+ g_debug ("%s: showing accounts view", __FUNCTION__);
+ }
+ gtk_container_child_set (GTK_CONTAINER(priv->box), priv->pannable,
+ "expand", count > 0,
+ "fill", count > 0,
+ NULL);
+}
+
+static void
+on_mail_operation_started (ModestMailOperation *mail_op,
+ gpointer user_data)
+{
+ ModestAccountsWindow *self;
+ ModestMailOperationTypeOperation op_type;
+ GObject *source = NULL;
+
+ self = MODEST_ACCOUNTS_WINDOW (user_data);
+ op_type = modest_mail_operation_get_type_operation (mail_op);
+ source = modest_mail_operation_get_source(mail_op);
+ if (G_OBJECT (self) == source) {
+ update_progress_hint (self);
+ }
+ g_object_unref (source);
+}
+
+static void
+on_mail_operation_finished (ModestMailOperation *mail_op,
+ gpointer user_data)
+{
+ ModestAccountsWindow *self;
+
+ self = MODEST_ACCOUNTS_WINDOW (user_data);
+
+ /* Don't disable the progress hint if there are more pending
+ operations from this window */
+ update_progress_hint (self);
+
+ modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self));
+}
+
+static void
+on_queue_changed (ModestMailOperationQueue *queue,
+ ModestMailOperation *mail_op,
+ ModestMailOperationQueueNotification type,
+ ModestAccountsWindow *self)
+{
+ ModestAccountsWindowPrivate *priv;
+
+ priv = MODEST_ACCOUNTS_WINDOW_GET_PRIVATE (self);
+
+ /* If this operations was created by another window, do nothing */
+ if (!modest_mail_operation_is_mine (mail_op, G_OBJECT(self)))
+ return;
+
+ if (type == MODEST_MAIL_OPERATION_QUEUE_OPERATION_ADDED) {
+ priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-started",
+ G_CALLBACK (on_mail_operation_started),
+ self);
+ priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-finished",
+ G_CALLBACK (on_mail_operation_finished),
+ self);
+ } else if (type == MODEST_MAIL_OPERATION_QUEUE_OPERATION_REMOVED) {
+ priv->sighandlers = modest_signal_mgr_disconnect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-started");
+ priv->sighandlers = modest_signal_mgr_disconnect (priv->sighandlers,
+ G_OBJECT (mail_op),
+ "operation-finished");
+ }
+}
+
+void
+modest_accounts_window_pre_create (void)
+{
+ static gboolean pre_created = FALSE;
+ if (!pre_created) {
+ pre_created = TRUE;
+ pre_created_accounts_window = GTK_WIDGET (modest_accounts_window_new_real ());