#include <modest-account-mgr.h>
#include <modest-account-mgr-helpers.h>
#include <modest-text-utils.h>
+#include <modest-runtime.h>
#include <gtk/gtkcellrenderertoggle.h>
#include <gtk/gtkcellrenderertext.h>
ModestAccountMgr *account_mgr;
gulong sig1, sig2;
+ /* When this is TRUE, we ignore configuration key changes.
+ * This is useful when making many changes. */
+ gboolean block_conf_updates;
+
};
#define MODEST_ACCOUNT_VIEW_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \
MODEST_TYPE_ACCOUNT_VIEW, \
const gchar* account, const gchar* key,
gboolean server_account, ModestAccountView *self)
{
- update_account_view (account_mgr, self);
+ /* Never update the view in response to gconf changes.
+ * Always do it explicitly instead.
+ * This is because we have no way to avoid 10 updates when changing
+ * 10 items, and this blocks the UI.
+ *
+ * But this block/unblock API might be useful on platforms where the
+ * notification does not happen so long after the key was set.
+ * (We have no way to know when the last key was set, to do a final update)..
+ */
+ return;
+
+ ModestAccountViewPrivate* priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE(self);
+
+ if (!priv->block_conf_updates)
+ update_account_view (account_mgr, self);
}
const gchar* account, gboolean server_account,
ModestAccountView *self)
{
- on_account_changed (account_mgr, account, NULL, server_account, self);
+ ModestAccountViewPrivate* priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE(self);
+ if (!priv->block_conf_updates)
+ on_account_changed (account_mgr, account, NULL, server_account, self);
}
G_TYPE_STRING, /* account proto (pop, imap,...) */
G_TYPE_STRING /* last updated (time_t) */
);
+
+ gtk_tree_sortable_set_sort_column_id (
+ GTK_TREE_SORTABLE (model), MODEST_ACCOUNT_VIEW_DISPLAY_NAME_COLUMN,
+ GTK_SORT_ASCENDING);
gtk_tree_view_set_model (GTK_TREE_VIEW(self), GTK_TREE_MODEL(model));
g_object_unref (G_OBJECT (model));
* which causes the model column to be updated automatically when the row is clicked.
* Making this the default in Maemo's GTK+ is obviously a bug:
* https://maemo.org/bugzilla/show_bug.cgi?id=146
- */
+ *
+ * djcb: indeed, they have been removed for post-bora, i added the ifdefs...
+ */
+#ifdef MODEST_HILDON_VERSION_0
g_object_set(G_OBJECT(self), "allow-checkbox-mode", FALSE, NULL);
g_object_set(G_OBJECT(toggle_renderer), "checkbox-mode", FALSE, NULL);
+#endif /*MODEST_HILDON_VERSION_0 */
g_signal_connect (G_OBJECT(toggle_renderer), "toggled", G_CALLBACK(on_account_default_toggled),
self);
return account_name;
}
+
+
+void modest_account_view_block_conf_updates (ModestAccountView *account_view)
+{
+ ModestAccountViewPrivate* priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE(account_view);
+ priv->block_conf_updates = TRUE;
+}
+
+void modest_account_view_unblock_conf_updates (ModestAccountView *account_view)
+{
+ ModestAccountViewPrivate* priv = MODEST_ACCOUNT_VIEW_GET_PRIVATE(account_view);
+ priv->block_conf_updates = FALSE;
+
+ update_account_view (modest_runtime_get_account_mgr(), account_view);
+}