* Removed the window management added to modest-main. Moved back to the window mgr
authorSergio Villar Senin <svillar@igalia.com>
Wed, 16 Apr 2008 19:12:54 +0000 (19:12 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Wed, 16 Apr 2008 19:12:54 +0000 (19:12 +0000)
pmo-trunk-r4423

src/modest-main.c
src/widgets/modest-window-mgr.c

index 2288c6f..269f06d 100644 (file)
@@ -80,16 +80,12 @@ static void
 on_queue_empty (ModestMailOperationQueue *queue,
                gpointer user_data)
 {
 on_queue_empty (ModestMailOperationQueue *queue,
                gpointer user_data)
 {
-       guint num_windows = 0;
        ModestWindowMgr *mgr = modest_runtime_get_window_mgr ();
        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 */
 
        /* 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);
 }
 
                g_idle_add_full (G_PRIORITY_LOW, on_idle_exit_modest, user_data, g_free);
 }
 
index cf69517..81b70b8 100644 (file)
@@ -808,7 +808,8 @@ on_window_destroy (ModestWindow *window,
                cancel_window_operations (window);
 
                /* Fake the window system, make it think that there is no window */
                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;
        }
 
                no_propagate = TRUE;
        }
@@ -933,7 +934,8 @@ modest_window_mgr_unregister_window (ModestWindowMgr *self,
        gtk_widget_destroy (win->data);
        
        /* If there are no more windows registered emit the signal */
        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);
 }
 
                g_signal_emit (self, signals[WINDOW_LIST_EMPTY_SIGNAL], 0);
 }
 
@@ -1306,6 +1308,10 @@ modest_window_mgr_num_windows (ModestWindowMgr *self)
        if (priv->window_list)
                num_windows = g_list_length (priv->window_list);
 
        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;
 }
 
        return num_windows + priv->banner_counter;
 }
 
@@ -1372,8 +1378,7 @@ modest_window_mgr_unregister_banner (ModestWindowMgr *self)
        priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
 
        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);
                g_signal_emit (self, signals[WINDOW_LIST_EMPTY_SIGNAL], 0);
-       }
-
 }
 }