* modest/src/modest-mail-operation.c: the "last_updated" field off an account is updated also when there aren't new headers to get
* modest/src/modest-account-mgr.[ch]: added a new signal, "account_updated"
* modest/src/widgets/modest-account-view.c: connected to the former signal to refresh the "last updated" column
* modest/src/maemo/modest-main-window.c: connected to the former signal to refresh the details widget
pmo-trunk-r3833
static void on_refresh_account_action_activated (GtkAction *action,
gpointer user_data);
+static void on_account_updated (ModestAccountMgr* mgr, gchar* account_name,
+ gpointer user_data);
+
static void on_send_receive_csm_activated (GtkMenuItem *item,
gpointer user_data);
G_CALLBACK (on_default_account_changed),
self);
+ priv->sighandlers =
+ modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (modest_runtime_get_account_mgr ()),
+ "account_updated",
+ G_CALLBACK (on_account_updated),
+ self);
/* Account store */
priv->sighandlers =
modest_signal_mgr_connect (priv->sighandlers,
update_menus (MODEST_MAIN_WINDOW (user_data));
}
+static void
+on_account_updated (ModestAccountMgr* mgr,
+ gchar* account_name,
+ gpointer user_data)
+{
+ ModestMainWindow *win = MODEST_MAIN_WINDOW (user_data);
+
+ if (modest_main_window_get_contents_style(win) == MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS) {
+ modest_main_window_set_contents_style (win, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS);
+ }
+}
+
/*
* This function manages the key events used to navigate between
* header and folder views (when the window is in split view)
ACCOUNT_BUSY_SIGNAL,
DEFAULT_ACCOUNT_CHANGED_SIGNAL,
DISPLAY_NAME_CHANGED_SIGNAL,
+ ACCOUNT_UPDATED_SIGNAL,
LAST_SIGNAL
};
NULL, NULL,
g_cclosure_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
+
+ signals[ACCOUNT_UPDATED_SIGNAL] =
+ g_signal_new ("account_updated",
+ MODEST_TYPE_ACCOUNT_MGR,
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET(ModestAccountMgrClass, account_updated),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
+
modest_account_mgr_initialized = TRUE;
}
const gchar * key, int val, gboolean server_account)
{
ModestAccountMgrPrivate *priv;
-
const gchar *keyname;
gboolean retval;
GError *err = NULL;
g_printerr ("modest: error setting int '%s': %s\n", keyname, err->message);
g_error_free (err);
retval = FALSE;
+ } else {
+ /* check whether this field is one of those interesting for the
+ * "account-updated" signal */
+ if (strcmp(key, MODEST_ACCOUNT_LAST_UPDATED) == 0) {
+ g_signal_emit (G_OBJECT(self), signals[ACCOUNT_UPDATED_SIGNAL],
+ 0, name);
+ }
}
return retval;
}
void (* display_name_changed) (ModestAccountMgr *obj,
const gchar *account,
gpointer user_data);
+
+ void (* account_updated) (ModestAccountMgr *obj,
+ const gchar *account,
+ gpointer user_data);
};
/**
g_object_unref (info->inbox_observer);
info->inbox_observer = NULL;
+ /* Update the last updated key, even if we don't have to get new headers */
+ modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time (NULL));
+
if (new_headers_array->len == 0)
goto send_mail;
g_ptr_array_foreach (new_headers_array, (GFunc) g_object_unref, NULL);
g_ptr_array_free (new_headers_array, FALSE);
- /* Update the last updated key */
- modest_account_mgr_set_last_updated (mgr, tny_account_get_id (priv->account), time (NULL));
-
send_mail:
/* Send mails */
priv->done = 0;
/* Get all folders and continue in the callback */
folders = tny_simple_list_new ();
- tny_folder_store_get_folders_async (TNY_FOLDER_STORE (store_account),
- folders, recurse_folders_async_cb,
- NULL, NULL, info);
+ tny_folder_store_get_folders_async (TNY_FOLDER_STORE (store_account),
+ folders, recurse_folders_async_cb,
+ NULL, NULL, info);
}
/*
static void modest_account_view_select_first_account (ModestAccountView *account_view);
+static void on_account_updated (ModestAccountMgr* mgr, gchar* account_name,
+ gpointer user_data);
+
typedef enum {
MODEST_ACCOUNT_VIEW_NAME_COLUMN,
MODEST_ACCOUNT_VIEW_DISPLAY_NAME_COLUMN,
g_free (account_name);
}
+static void
+on_account_updated (ModestAccountMgr* mgr,
+ gchar* account_name,
+ gpointer user_data)
+{
+ update_account_view (mgr, MODEST_ACCOUNT_VIEW (user_data));
+}
+
void
bold_if_default_cell_data (GtkTreeViewColumn *column, GtkCellRenderer *renderer,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer user_data)
"display_name_changed",
G_CALLBACK(on_display_name_changed),
self);
+ priv->sig_handlers =
+ modest_signal_mgr_connect (priv->sig_handlers,
+ G_OBJECT (priv->account_mgr),
+ "account_updated",
+ G_CALLBACK (on_account_updated),
+ self);
}