on_queue_empty (ModestMailOperationQueue *queue,
gpointer user_data)
{
- guint num_windows = 0;
ModestWindowMgr *mgr = modest_runtime_get_window_mgr ();
- ModestWindow *main_win = modest_window_mgr_get_main_window (mgr, FALSE);
/* Exit if the queue is empty and there are no more
windows. We can exit as well if the main window is hidden
and it's the only one */
- num_windows = modest_window_mgr_num_windows (mgr);
- if ((num_windows == 0) ||
- (num_windows == 1 && main_win && !GTK_WIDGET_VISIBLE (main_win)))
+ if (modest_window_mgr_num_windows (mgr) == 0)
g_idle_add_full (G_PRIORITY_LOW, on_idle_exit_modest, user_data, g_free);
}
cancel_window_operations (window);
/* Fake the window system, make it think that there is no window */
- g_signal_emit (self, signals[WINDOW_LIST_EMPTY_SIGNAL], 0);
+ if (modest_window_mgr_num_windows (self) == 0)
+ g_signal_emit (self, signals[WINDOW_LIST_EMPTY_SIGNAL], 0);
no_propagate = TRUE;
}
gtk_widget_destroy (win->data);
/* If there are no more windows registered emit the signal */
- if (priv->window_list == NULL && priv->banner_counter == 0)
+ if (modest_window_mgr_num_windows (self) == 0)
+/* if (priv->window_list == NULL && priv->banner_counter == 0) */
g_signal_emit (self, signals[WINDOW_LIST_EMPTY_SIGNAL], 0);
}
if (priv->window_list)
num_windows = g_list_length (priv->window_list);
+ /* Do not take into account the main window if it was hidden */
+ if (priv->main_window && !GTK_WIDGET_VISIBLE (priv->main_window))
+ num_windows--;
+
return num_windows + priv->banner_counter;
}
priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
priv->banner_counter--;
- if (priv->window_list == NULL && priv->banner_counter == 0) {
+/* if (priv->window_list == NULL && priv->banner_counter == 0) */
+ if (modest_window_mgr_num_windows (self) == 0)
g_signal_emit (self, signals[WINDOW_LIST_EMPTY_SIGNAL], 0);
- }
-
}