* src/maemo/modest-main-window.c:
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 20 Jun 2007 17:26:29 +0000 (17:26 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 20 Jun 2007 17:26:29 +0000 (17:26 +0000)
        * Now "send & receive/all" is hidden when there's only one
          account available (fixes NB#59238).

pmo-trunk-r2345

src/maemo/modest-main-window.c

index 8fd643c..67e9c04 100644 (file)
@@ -745,7 +745,18 @@ modest_main_window_on_show (GtkWidget *self, gpointer user_data)
                It's an ugly hack... jschmid */
                gtk_widget_show_all(GTK_WIDGET(self));
                modest_ui_actions_on_accounts (NULL, MODEST_WINDOW(self));
+       } else {
+               GSList *accounts;
+               GtkAction *send_receive_all;
+               ModestWindowPrivate *parent_priv = MODEST_WINDOW_GET_PRIVATE (self);
+               accounts = modest_account_mgr_account_names (modest_runtime_get_account_mgr (), TRUE);
+               send_receive_all = gtk_ui_manager_get_action (parent_priv->ui_manager, 
+                                                             "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveAllMenu");
+               gtk_action_set_visible (send_receive_all, g_slist_length (accounts));
+               modest_account_mgr_free_account_names (accounts);
        }
+
+
 }
 
 ModestWindow *
@@ -1137,6 +1148,7 @@ on_account_update (TnyAccountStore *account_store,
        GList *groups;
        gchar *default_account;
        GtkWidget *send_receive_button, *item;
+       GtkAction *send_receive_all = NULL;
                
        self = MODEST_MAIN_WINDOW (user_data);
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
@@ -1162,6 +1174,10 @@ on_account_update (TnyAccountStore *account_store,
        accounts = g_slist_sort (accounts, (GCompareFunc) compare_display_names);
        num_accounts = g_slist_length (accounts);
 
+       send_receive_all = gtk_ui_manager_get_action (parent_priv->ui_manager, 
+                                                     "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveAllMenu");
+       gtk_action_set_visible (send_receive_all, num_accounts > 1);
+
        /* Delete old send&receive popup items. We can not just do a
           menu_detach because it does not work well with
           tap_and_hold */