* Fixes NB#64415, now the show_toolbar options are per window type specific
authorSergio Villar Senin <svillar@igalia.com>
Tue, 4 Sep 2007 13:54:21 +0000 (13:54 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Tue, 4 Sep 2007 13:54:21 +0000 (13:54 +0000)
* Deleted some unused methods

pmo-trunk-r3202

12 files changed:
src/maemo/modest-main-window.c
src/maemo/modest-msg-edit-window.c
src/maemo/modest-msg-view-window.c
src/maemo/ui/modest-msg-edit-window-ui.xml
src/modest-defs.h
src/modest-init.c
src/modest-ui-actions.c
src/widgets/modest-folder-view.c
src/widgets/modest-msg-edit-window.h
src/widgets/modest-msg-view-window.h
src/widgets/modest-window-mgr.c
src/widgets/modest-window-mgr.h

index 346975d..ef2519b 100644 (file)
@@ -1221,11 +1221,11 @@ modest_main_window_new (void)
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, 
                                            "/MenuBar/ViewMenu/ViewShowToolbarMainMenu/ViewShowToolbarNormalScreenMenu");
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, 
                                            "/MenuBar/ViewMenu/ViewShowToolbarMainMenu/ViewShowToolbarNormalScreenMenu");
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-                                     modest_conf_get_bool (conf, MODEST_CONF_SHOW_TOOLBAR, NULL));
+                                     modest_conf_get_bool (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR, NULL));
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, 
                                            "/MenuBar/ViewMenu/ViewShowToolbarMainMenu/ViewShowToolbarFullScreenMenu");
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, 
                                            "/MenuBar/ViewMenu/ViewShowToolbarMainMenu/ViewShowToolbarFullScreenMenu");
        gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-                                     modest_conf_get_bool (conf, MODEST_CONF_SHOW_TOOLBAR_FULLSCREEN, NULL));
+                                     modest_conf_get_bool (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL));
        hildon_window_set_menu (HILDON_WINDOW (self), GTK_MENU (parent_priv->menubar));
        gtk_widget_show (parent_priv->menubar);
 
        hildon_window_set_menu (HILDON_WINDOW (self), GTK_MENU (parent_priv->menubar));
        gtk_widget_show (parent_priv->menubar);
 
@@ -1446,6 +1446,8 @@ modest_main_window_show_toolbar (ModestWindow *self,
        GtkWidget *reply_button = NULL, *menu = NULL;
        GtkWidget *placeholder = NULL;
        gint insert_index;
        GtkWidget *reply_button = NULL, *menu = NULL;
        GtkWidget *placeholder = NULL;
        gint insert_index;
+       const gchar *action_name;
+       GtkAction *action;
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
 
        g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
@@ -1457,6 +1459,7 @@ modest_main_window_show_toolbar (ModestWindow *self,
        if (!parent_priv->toolbar) {
                parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, 
                                                                  "/ToolBar");
        if (!parent_priv->toolbar) {
                parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, 
                                                                  "/ToolBar");
+               gtk_widget_set_no_show_all (parent_priv->toolbar, TRUE);
 
                /* Set homogeneous toolbar */
                gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar), 
 
                /* Set homogeneous toolbar */
                gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar), 
@@ -1512,6 +1515,19 @@ modest_main_window_show_toolbar (ModestWindow *self,
        } else
                gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
 
        } else
                gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
 
+       /* Update also the actions (to update the toggles in the
+          menus), we have to do it manually because some other window
+          of the same time could have changed it (remember that the
+          toolbar fullscreen mode is shared by all the windows of the
+          same type */
+       if (modest_window_mgr_get_fullscreen_mode (modest_runtime_get_window_mgr ()))
+               action_name = "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarFullScreenMenu";
+       else
+               action_name = "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarNormalScreenMenu";
+
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, action_name);
+       modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action),
+                                                           show_toolbar);
 }
 
 static void
 }
 
 static void
index 4f0e79f..b9c7749 100644 (file)
@@ -966,10 +966,6 @@ modest_msg_edit_window_setup_toolbar (ModestMsgEditWindow *window)
        parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar");
        hildon_window_add_toolbar (HILDON_WINDOW (window), GTK_TOOLBAR (parent_priv->toolbar));
 
        parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar");
        hildon_window_add_toolbar (HILDON_WINDOW (window), GTK_TOOLBAR (parent_priv->toolbar));
 
-       /* should we hide the toolbar? */
-       if (!modest_conf_get_bool (modest_runtime_get_conf (), MODEST_CONF_SHOW_TOOLBAR, NULL))
-               gtk_widget_hide (parent_priv->toolbar);
-
        /* Font color placeholder */
        placeholder = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/FontColor");
        insert_index = gtk_toolbar_get_item_index(GTK_TOOLBAR (parent_priv->toolbar), GTK_TOOL_ITEM(placeholder));
        /* Font color placeholder */
        placeholder = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/FontColor");
        insert_index = gtk_toolbar_get_item_index(GTK_TOOLBAR (parent_priv->toolbar), GTK_TOOL_ITEM(placeholder));
@@ -983,7 +979,10 @@ modest_msg_edit_window_setup_toolbar (ModestMsgEditWindow *window)
        gtk_tool_item_set_expand (GTK_TOOL_ITEM (tool_item), TRUE);
        gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (tool_item), TRUE);
        gtk_toolbar_insert(GTK_TOOLBAR(parent_priv->toolbar), GTK_TOOL_ITEM (tool_item), insert_index);
        gtk_tool_item_set_expand (GTK_TOOL_ITEM (tool_item), TRUE);
        gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (tool_item), TRUE);
        gtk_toolbar_insert(GTK_TOOLBAR(parent_priv->toolbar), GTK_TOOL_ITEM (tool_item), insert_index);
-       g_signal_connect_swapped (G_OBJECT (priv->font_color_button), "notify::color", G_CALLBACK (modest_msg_edit_window_color_button_change), window);
+       g_signal_connect_swapped (G_OBJECT (priv->font_color_button), 
+                                 "notify::color", 
+                                 G_CALLBACK (modest_msg_edit_window_color_button_change), 
+                                 window);
 
        /* Font size and face placeholder */
        placeholder = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/FontAttributes");
 
        /* Font size and face placeholder */
        placeholder = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/ToolBar/FontAttributes");
@@ -1083,7 +1082,15 @@ modest_msg_edit_window_setup_toolbar (ModestMsgEditWindow *window)
        gtk_tool_item_set_expand (GTK_TOOL_ITEM (tool_item), TRUE);
        gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (tool_item), TRUE);
 
        gtk_tool_item_set_expand (GTK_TOOL_ITEM (tool_item), TRUE);
        gtk_tool_item_set_homogeneous (GTK_TOOL_ITEM (tool_item), TRUE);
 
+       /* Explicitelly show all the toolbar (a normal gtk_widget_show
+          will not show the tool items added to the placeholders) */
+       gtk_widget_show_all (parent_priv->toolbar);
 
 
+       /* Set the no show all *after* showing all items. We do not
+          want the toolbar to be shown with a show all because it
+          could go agains the gconf setting regarding showing or not
+          the toolbar of the editor window */
+       gtk_widget_set_no_show_all (parent_priv->toolbar, TRUE);
 }
 
 
 }
 
 
@@ -1163,8 +1170,18 @@ modest_msg_edit_window_new (TnyMsg *msg, const gchar *account_name, gboolean pre
        gtk_window_add_accel_group (GTK_WINDOW (obj), 
                                    gtk_ui_manager_get_accel_group (parent_priv->ui_manager));
 
        gtk_window_add_accel_group (GTK_WINDOW (obj), 
                                    gtk_ui_manager_get_accel_group (parent_priv->ui_manager));
 
-       /* Menubar */
+       /* Menubar. Update the state of some toggles */
        parent_priv->menubar = menubar_to_menu (parent_priv->ui_manager);
        parent_priv->menubar = menubar_to_menu (parent_priv->ui_manager);
+       conf = modest_runtime_get_conf ();
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, 
+                                           "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarNormalScreenMenu");
+       modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action),
+                                     modest_conf_get_bool (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR, NULL));
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, 
+                                           "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarFullScreenMenu");
+       modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action),
+                                     modest_conf_get_bool (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL));
+
        hildon_window_set_menu (HILDON_WINDOW (obj), GTK_MENU (parent_priv->menubar));
 
        /* Init window */
        hildon_window_set_menu (HILDON_WINDOW (obj), GTK_MENU (parent_priv->menubar));
 
        /* Init window */
@@ -1521,7 +1538,7 @@ text_buffer_refresh_attributes (WPTextBuffer *buffer, ModestMsgEditWindow *windo
        }
 
        wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), buffer_format, FALSE);
        }
 
        wp_text_buffer_get_attributes (WP_TEXT_BUFFER (priv->text_buffer), buffer_format, FALSE);
-       
+
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ActionsBold");
        modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), buffer_format->bold);
 
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ActionsBold");
        modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action), buffer_format->bold);
 
@@ -2174,20 +2191,6 @@ modest_msg_edit_window_window_state_event (GtkWidget *widget, GdkEventWindowStat
 }
 
 void
 }
 
 void
-modest_msg_edit_window_toggle_fullscreen (ModestMsgEditWindow *window)
-{
-       ModestWindowPrivate *parent_priv;
-       GtkAction *fs_toggle_action;
-       gboolean active;
-
-       parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
-
-       fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ViewToggleFullscreenMenu");
-       active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action));
-       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action), !active);
-}
-
-void
 modest_msg_edit_window_show_cc (ModestMsgEditWindow *window, 
                                gboolean show)
 {
 modest_msg_edit_window_show_cc (ModestMsgEditWindow *window, 
                                gboolean show)
 {
@@ -2280,18 +2283,34 @@ modest_msg_edit_window_show_toolbar (ModestWindow *self,
                                     gboolean show_toolbar)
 {
        ModestWindowPrivate *parent_priv;
                                     gboolean show_toolbar)
 {
        ModestWindowPrivate *parent_priv;
+       const gchar *action_name;
+       GtkAction *action;
        
        g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (self));
        parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
 
        
        g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (self));
        parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
 
-       /* FIXME: we can not just use the code of
+       /* We can not just use the code of
           modest_msg_edit_window_setup_toolbar because it has a
           mixture of both initialization and creation code. */
           modest_msg_edit_window_setup_toolbar because it has a
           mixture of both initialization and creation code. */
-
        if (show_toolbar)
                gtk_widget_show (GTK_WIDGET (parent_priv->toolbar));
        else
                gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
        if (show_toolbar)
                gtk_widget_show (GTK_WIDGET (parent_priv->toolbar));
        else
                gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
+
+       /* Update also the actions (to update the toggles in the
+          menus), we have to do it manually because some other window
+          of the same time could have changed it (remember that the
+          toolbar fullscreen mode is shared by all the windows of the
+          same type */
+       if (modest_window_mgr_get_fullscreen_mode (modest_runtime_get_window_mgr ()))
+               action_name = "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarFullScreenMenu";
+       else
+               action_name = "/MenuBar/ViewMenu/ShowToolbarMenu/ViewShowToolbarNormalScreenMenu";
+       
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, action_name);
+       modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action),
+                                                           show_toolbar);
+
 }
 
 void
 }
 
 void
index 9e580f3..3a59cc7 100644 (file)
@@ -483,7 +483,9 @@ init_window (ModestMsgViewWindow *obj, TnyMsg *msg)
        GtkWidget *main_vbox;
        ModestMsgViewWindowPrivate *priv;
        ModestWindowPrivate *parent_priv;
        GtkWidget *main_vbox;
        ModestMsgViewWindowPrivate *priv;
        ModestWindowPrivate *parent_priv;
-       
+       ModestConf *conf;
+       GtkAction *action = NULL;
+
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
        parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
 
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(obj);
        parent_priv = MODEST_WINDOW_GET_PRIVATE(obj);
 
@@ -493,8 +495,17 @@ init_window (ModestMsgViewWindow *obj, TnyMsg *msg)
 
        /* Menubar */
        parent_priv->menubar = menubar_to_menu (parent_priv->ui_manager);
 
        /* Menubar */
        parent_priv->menubar = menubar_to_menu (parent_priv->ui_manager);
-       gtk_widget_show_all (GTK_WIDGET(parent_priv->menubar));
+       conf = modest_runtime_get_conf ();
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, 
+                                           "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarNormalScreenMenu");
+       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+                                     modest_conf_get_bool (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR, NULL));
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, 
+                                           "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarFullScreenMenu");
+       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+                                     modest_conf_get_bool (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL));
        hildon_window_set_menu    (HILDON_WINDOW(obj), GTK_MENU(parent_priv->menubar));
        hildon_window_set_menu    (HILDON_WINDOW(obj), GTK_MENU(parent_priv->menubar));
+       gtk_widget_show (GTK_WIDGET(parent_priv->menubar));
 
        priv->main_scroll = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->main_scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
 
        priv->main_scroll = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->main_scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@@ -1840,18 +1851,6 @@ modest_msg_view_window_window_state_event (GtkWidget *widget, GdkEventWindowStat
 
 }
 
 
 }
 
-void
-modest_msg_view_window_toggle_fullscreen (ModestMsgViewWindow *window)
-{
-               ModestWindowPrivate *parent_priv;
-               GtkAction *fs_toggle_action;
-               parent_priv = MODEST_WINDOW_GET_PRIVATE (window);
-               
-               fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ViewToggleFullscreenMenu");
-               gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action),
-                                             !gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action)));
-}
-
 static void
 set_homogeneous (GtkWidget *widget,
                 gpointer data)
 static void
 set_homogeneous (GtkWidget *widget,
                 gpointer data)
@@ -1871,6 +1870,8 @@ modest_msg_view_window_show_toolbar (ModestWindow *self,
        GtkWidget *reply_button = NULL, *menu = NULL;
        GtkWidget *placeholder = NULL;
        gint insert_index;
        GtkWidget *reply_button = NULL, *menu = NULL;
        GtkWidget *placeholder = NULL;
        gint insert_index;
+       const gchar *action_name;
+       GtkAction *action;
        
        parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(self);
        
        parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
        priv = MODEST_MSG_VIEW_WINDOW_GET_PRIVATE(self);
@@ -1881,6 +1882,7 @@ modest_msg_view_window_show_toolbar (ModestWindow *self,
        if (!parent_priv->toolbar) {
                parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, 
                                                                  "/ToolBar");
        if (!parent_priv->toolbar) {
                parent_priv->toolbar = gtk_ui_manager_get_widget (parent_priv->ui_manager, 
                                                                  "/ToolBar");
+               gtk_widget_set_no_show_all (parent_priv->toolbar, TRUE);
 
                /* Set homogeneous toolbar */
                gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar), 
 
                /* Set homogeneous toolbar */
                gtk_container_foreach (GTK_CONTAINER (parent_priv->toolbar), 
@@ -1936,6 +1938,20 @@ modest_msg_view_window_show_toolbar (ModestWindow *self,
                gtk_widget_set_no_show_all (parent_priv->toolbar, TRUE);
                gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
        }
                gtk_widget_set_no_show_all (parent_priv->toolbar, TRUE);
                gtk_widget_hide (GTK_WIDGET (parent_priv->toolbar));
        }
+
+       /* Update also the actions (to update the toggles in the
+          menus), we have to do it manually because some other window
+          of the same time could have changed it (remember that the
+          toolbar fullscreen mode is shared by all the windows of the
+          same type */
+       if (modest_window_mgr_get_fullscreen_mode (modest_runtime_get_window_mgr ()))
+               action_name = "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarFullScreenMenu";
+       else
+               action_name = "/MenuBar/ViewMenu/ViewShowToolbarMenu/ViewShowToolbarNormalScreenMenu";
+
+       action = gtk_ui_manager_get_action (parent_priv->ui_manager, action_name);
+       modest_maemo_toggle_action_set_active_block_notify (GTK_TOGGLE_ACTION (action),
+                                                           show_toolbar);
 }
 
 static void 
 }
 
 static void 
index 302da57..71d2ff5 100644 (file)
 
   <toolbar name="ToolBar">
     <toolitem action="ToolbarSend"/>
 
   <toolbar name="ToolBar">
     <toolitem action="ToolbarSend"/>
-    <!--<toolitem action="ActionFontFace"/>-->
-    <!--<toolitem action="ActionFontSize"/>-->
     <separator/>
     <placeholder name="FontAttributes" />
     <toolitem action="ActionsBold"/>
     <separator/>
     <placeholder name="FontAttributes" />
     <toolitem action="ActionsBold"/>
index adf668d..740d849 100644 (file)
@@ -76,8 +76,6 @@
 
 #define MODEST_CONF_SHOW_CC              MODEST_CONF_NAMESPACE "/show_cc"           
 #define MODEST_CONF_SHOW_BCC             MODEST_CONF_NAMESPACE "/show_bcc"           
 
 #define MODEST_CONF_SHOW_CC              MODEST_CONF_NAMESPACE "/show_cc"           
 #define MODEST_CONF_SHOW_BCC             MODEST_CONF_NAMESPACE "/show_bcc"           
-#define MODEST_CONF_SHOW_TOOLBAR         MODEST_CONF_NAMESPACE "/show_toolbar"
-#define MODEST_CONF_SHOW_TOOLBAR_FULLSCREEN         MODEST_CONF_NAMESPACE "/show_toolbar_fullscreen"
 
 /* This is the alarmd cookie, obtained from alarm_event_add(), 
  * which apparently remains valid between application instances.
 
 /* This is the alarmd cookie, obtained from alarm_event_add(), 
  * which apparently remains valid between application instances.
 
 #define MODEST_SERVER_ACCOUNT_NAMESPACE  MODEST_CONF_NAMESPACE "/" "server_accounts"
 
 
 #define MODEST_SERVER_ACCOUNT_NAMESPACE  MODEST_CONF_NAMESPACE "/" "server_accounts"
 
+/* show toolbar settings */
+#define MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR MODEST_CONF_WIDGET_NAMESPACE "/" MODEST_CONF_MAIN_WINDOW_KEY "/show_toolbar"
+#define MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR MODEST_CONF_WIDGET_NAMESPACE "/" MODEST_CONF_EDIT_WINDOW_KEY "/show_toolbar"
+#define MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR MODEST_CONF_WIDGET_NAMESPACE "/" MODEST_CONF_MSG_VIEW_WINDOW_KEY "/show_toolbar"
+#define MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR_FULLSCREEN MODEST_CONF_WIDGET_NAMESPACE "/" MODEST_CONF_MAIN_WINDOW_KEY "/show_toolbar_fullscreen"
+#define MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR_FULLSCREEN MODEST_CONF_WIDGET_NAMESPACE "/" MODEST_CONF_EDIT_WINDOW_KEY "/show_toolbar_fullscreen"
+#define MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR_FULLSCREEN MODEST_CONF_WIDGET_NAMESPACE "/" MODEST_CONF_MSG_VIEW_WINDOW_KEY "/show_toolbar_fullscreen"
 
 /* per-account data */
 #define MODEST_ACCOUNT_DISPLAY_NAME      "display_name"      /* string */
 
 /* per-account data */
 #define MODEST_ACCOUNT_DISPLAY_NAME      "display_name"      /* string */
index 52c6220..690f7c8 100644 (file)
@@ -660,23 +660,32 @@ init_stock_icons (void)
 static void
 init_default_settings (ModestConf *conf)
 {
 static void
 init_default_settings (ModestConf *conf)
 {
-       if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_TOOLBAR, NULL))
-               modest_conf_set_bool (conf, MODEST_CONF_SHOW_TOOLBAR, TRUE, NULL);
+       /* Show toolbar keys */
+       if (!modest_conf_key_exists (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR, NULL))
+               modest_conf_set_bool (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR, TRUE, NULL);
 
 
-       if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_TOOLBAR_FULLSCREEN, NULL))
-               modest_conf_set_bool (conf, MODEST_CONF_SHOW_TOOLBAR_FULLSCREEN, TRUE, NULL);
+       if (!modest_conf_key_exists (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL))
+               modest_conf_set_bool (conf, MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR_FULLSCREEN, TRUE, NULL);
+
+       if (!modest_conf_key_exists (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR, NULL))
+               modest_conf_set_bool (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR, TRUE, NULL);
+
+       if (!modest_conf_key_exists (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL))
+               modest_conf_set_bool (conf, MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR_FULLSCREEN, TRUE, NULL);
+
+       if (!modest_conf_key_exists (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR, NULL))
+               modest_conf_set_bool (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR, TRUE, NULL);
        
        
+       if (!modest_conf_key_exists (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR_FULLSCREEN, NULL))
+               modest_conf_set_bool (conf, MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR_FULLSCREEN, TRUE, NULL);
+
+       /* Editor keys */
        if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_CC, NULL))
                modest_conf_set_bool (conf, MODEST_CONF_SHOW_CC, TRUE, NULL);
 
        if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_BCC, NULL))
                modest_conf_set_bool (conf, MODEST_CONF_SHOW_BCC, FALSE, NULL);
 
        if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_CC, NULL))
                modest_conf_set_bool (conf, MODEST_CONF_SHOW_CC, TRUE, NULL);
 
        if (!modest_conf_key_exists (conf, MODEST_CONF_SHOW_BCC, NULL))
                modest_conf_set_bool (conf, MODEST_CONF_SHOW_BCC, FALSE, NULL);
 
-/* Not used:
-       if (!modest_conf_key_exists (conf, MODEST_CONF_CONNECT_AT_STARTUP, NULL))
-               modest_conf_set_bool (conf, MODEST_CONF_CONNECT_AT_STARTUP, TRUE, NULL);
-*/
-
        /* Global settings */
        if (!modest_conf_key_exists (conf, MODEST_CONF_AUTO_UPDATE, NULL))
                modest_conf_set_bool (conf, MODEST_CONF_AUTO_UPDATE, TRUE, NULL);
        /* Global settings */
        if (!modest_conf_key_exists (conf, MODEST_CONF_AUTO_UPDATE, NULL))
                modest_conf_set_bool (conf, MODEST_CONF_AUTO_UPDATE, TRUE, NULL);
index af25fa3..fbd7088 100644 (file)
@@ -769,7 +769,7 @@ modest_ui_actions_on_new_msg (GtkAction *action, ModestWindow *win)
 
        if (win)
                gtk_window_set_transient_for (GTK_WINDOW (msg_win),
 
        if (win)
                gtk_window_set_transient_for (GTK_WINDOW (msg_win),
-                                             GTK_WINDOW (win));        
+                                             GTK_WINDOW (win));
        gtk_widget_show_all (GTK_WIDGET (msg_win));
 
 cleanup:
        gtk_widget_show_all (GTK_WIDGET (msg_win));
 
 cleanup:
@@ -3202,9 +3202,10 @@ modest_ui_actions_on_change_zoom (GtkRadioAction *action,
        }
 }
 
        }
 }
 
-void     modest_ui_actions_msg_edit_on_change_priority (GtkRadioAction *action,
-                                                       GtkRadioAction *selected,
-                                                       ModestWindow *window)
+void     
+modest_ui_actions_msg_edit_on_change_priority (GtkRadioAction *action,
+                                              GtkRadioAction *selected,
+                                              ModestWindow *window)
 {
        TnyHeaderFlags flags;
        g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
 {
        TnyHeaderFlags flags;
        g_return_if_fail (MODEST_IS_MSG_EDIT_WINDOW (window));
@@ -3213,9 +3214,10 @@ void     modest_ui_actions_msg_edit_on_change_priority (GtkRadioAction *action,
        modest_msg_edit_window_set_priority_flags (MODEST_MSG_EDIT_WINDOW (window), flags);
 }
 
        modest_msg_edit_window_set_priority_flags (MODEST_MSG_EDIT_WINDOW (window), flags);
 }
 
-void     modest_ui_actions_msg_edit_on_change_file_format (GtkRadioAction *action,
-                                                          GtkRadioAction *selected,
-                                                          ModestWindow *window)
+void     
+modest_ui_actions_msg_edit_on_change_file_format (GtkRadioAction *action,
+                                                 GtkRadioAction *selected,
+                                                 ModestWindow *window)
 {
        gint file_format;
 
 {
        gint file_format;
 
@@ -3434,7 +3436,7 @@ modest_ui_actions_on_toggle_toolbar (GtkToggleAction *toggle,
 
        /* Toggle toolbar */
        mgr = modest_runtime_get_window_mgr ();
 
        /* Toggle toolbar */
        mgr = modest_runtime_get_window_mgr ();
-       modest_window_mgr_show_toolbars (mgr, active, fullscreen);
+       modest_window_mgr_show_toolbars (mgr, G_TYPE_FROM_INSTANCE (window), active, fullscreen);
 }
 
 void     
 }
 
 void     
index 4d4a2ab..e28c3e2 100644 (file)
@@ -124,7 +124,7 @@ static gboolean     on_drag_motion         (GtkWidget      *widget,
                                            guint           time,
                                            gpointer        user_data);
 
                                            guint           time,
                                            gpointer        user_data);
 
-static void expand_root_items (ModestFolderView *self);
+static void         expand_root_items (ModestFolderView *self);
 
 static gint         expand_row_timeout     (gpointer data);
 
 
 static gint         expand_row_timeout     (gpointer data);
 
@@ -480,7 +480,7 @@ icon_cell_data  (GtkTreeViewColumn *column,  GtkCellRenderer *renderer,
        TnyFolderType type = TNY_FOLDER_TYPE_UNKNOWN;
        const gchar *account_id = NULL;
        gboolean has_children;
        TnyFolderType type = TNY_FOLDER_TYPE_UNKNOWN;
        const gchar *account_id = NULL;
        gboolean has_children;
-       
+
        rendobj = G_OBJECT(renderer);
        gtk_tree_model_get (tree_model, iter,
                            TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
        rendobj = G_OBJECT(renderer);
        gtk_tree_model_get (tree_model, iter,
                            TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
index 132d87d..76cba35 100644 (file)
@@ -262,14 +262,6 @@ void                    modest_msg_edit_window_show_cc               (ModestMsgE
 void                    modest_msg_edit_window_show_bcc               (ModestMsgEditWindow *window, gboolean show);
 
 /**
 void                    modest_msg_edit_window_show_bcc               (ModestMsgEditWindow *window, gboolean show);
 
 /**
- * modest_msg_edit_window_toggle_fullscreen:
- * @window: a #ModestMsgEditWindow
- *
- * toggles the current fullscreen status
- */
-void            modest_msg_edit_window_toggle_fullscreen (ModestMsgEditWindow *window);
-
-/**
  * modest_msg_edit_window_set_priority_flags:
  * @window: a #ModestMsgEditWindow
  * @priority_flags: a #TnyHeaderFlags with priority information
  * modest_msg_edit_window_set_priority_flags:
  * @window: a #ModestMsgEditWindow
  * @priority_flags: a #TnyHeaderFlags with priority information
index e2c7eb7..6cad5e0 100644 (file)
@@ -190,14 +190,6 @@ gboolean        modest_msg_view_window_select_next_message (ModestMsgViewWindow
 gboolean        modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window);
 
 /**
 gboolean        modest_msg_view_window_select_previous_message (ModestMsgViewWindow *window);
 
 /**
- * modest_msg_view_window_toggle_fullscreen:
- * @window: a #ModestMsgViewWindow
- *
- * toggles the current fullscreen status
- */
-void            modest_msg_view_window_toggle_fullscreen (ModestMsgViewWindow *window);
-
-/**
  * modest_msg_view_window_view_attachment:
  * @window: a #ModestMsgViewWindow
  * @mime_part: a #TnyMimePart
  * modest_msg_view_window_view_attachment:
  * @window: a #ModestMsgViewWindow
  * @mime_part: a #TnyMimePart
index 5cdd6d9..4e380f1 100644 (file)
@@ -43,9 +43,12 @@ static void modest_window_mgr_class_init (ModestWindowMgrClass *klass);
 static void modest_window_mgr_init       (ModestWindowMgr *obj);
 static void modest_window_mgr_finalize   (GObject *obj);
 
 static void modest_window_mgr_init       (ModestWindowMgr *obj);
 static void modest_window_mgr_finalize   (GObject *obj);
 
-static gboolean on_window_destroy            (ModestWindow *window,
-                                             GdkEvent *event,
-                                             ModestWindowMgr *self);
+static gboolean on_window_destroy        (ModestWindow *window,
+                                         GdkEvent *event,
+                                         ModestWindowMgr *self);
+
+static const gchar* get_show_toolbar_key (GType window_type,
+                                         gboolean fullscreen);
 
 /* list my signals  */
 enum {
 
 /* list my signals  */
 enum {
@@ -62,8 +65,6 @@ struct _ModestWindowMgrPrivate {
        GtkDialog    *easysetup_dialog;
        
        gboolean     fullscreen_mode;
        GtkDialog    *easysetup_dialog;
        
        gboolean     fullscreen_mode;
-       gboolean     show_toolbars;
-       gboolean     show_toolbars_fullscreen;
        
        GSList       *windows_that_prevent_hibernation;
        GSList       *preregistered_uids;
        
        GSList       *windows_that_prevent_hibernation;
        GSList       *preregistered_uids;
@@ -132,8 +133,6 @@ modest_window_mgr_init (ModestWindowMgr *obj)
 
        /* Could not initialize it from gconf, singletons are not
           ready yet */
 
        /* Could not initialize it from gconf, singletons are not
           ready yet */
-       priv->show_toolbars = FALSE;
-       priv->show_toolbars_fullscreen = FALSE;
        priv->destroy_handlers = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);   
        priv->viewer_handlers = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
 
        priv->destroy_handlers = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);   
        priv->viewer_handlers = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
 
@@ -357,17 +356,38 @@ modest_window_mgr_find_registered_header (ModestWindowMgr *self, TnyHeader *head
        return has_header || has_window;
 }
 
        return has_header || has_window;
 }
 
+static const gchar *
+get_show_toolbar_key (GType window_type,
+                     gboolean fullscreen)
+{
+       const gchar *key = NULL;
+
+       if (window_type == MODEST_TYPE_MAIN_WINDOW)
+               key = (fullscreen) ? 
+                       MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR_FULLSCREEN :
+                       MODEST_CONF_MAIN_WINDOW_SHOW_TOOLBAR;
+       else if (window_type == MODEST_TYPE_MSG_VIEW_WINDOW)
+               key = (fullscreen) ? 
+                       MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR_FULLSCREEN :
+                       MODEST_CONF_MSG_VIEW_WINDOW_SHOW_TOOLBAR;
+       else if (window_type ==  MODEST_TYPE_MSG_EDIT_WINDOW)
+               key = (fullscreen) ? 
+                       MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR_FULLSCREEN :
+                       MODEST_CONF_EDIT_WINDOW_SHOW_TOOLBAR;
+       else
+               g_return_val_if_reached (NULL);
 
 
+       return key;
+}
 
 void 
 modest_window_mgr_register_window (ModestWindowMgr *self, 
                                   ModestWindow *window)
 {
 
 void 
 modest_window_mgr_register_window (ModestWindowMgr *self, 
                                   ModestWindow *window)
 {
-       static gboolean first_time = TRUE;
        GList *win;
        GList *win;
-       gboolean show;
        ModestWindowMgrPrivate *priv;
        gint *handler_id;
        ModestWindowMgrPrivate *priv;
        gint *handler_id;
+       const gchar *key;
 
        g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
        g_return_if_fail (GTK_IS_WINDOW (window));
 
        g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
        g_return_if_fail (GTK_IS_WINDOW (window));
@@ -442,22 +462,9 @@ modest_window_mgr_register_window (ModestWindowMgr *self,
        if (priv->fullscreen_mode)
                gtk_window_fullscreen (GTK_WINDOW (window));
 
        if (priv->fullscreen_mode)
                gtk_window_fullscreen (GTK_WINDOW (window));
 
-       /* Fill caches */
-       if (first_time) {
-               ModestConf *conf = modest_runtime_get_conf ();
-               priv->show_toolbars = 
-                       modest_conf_get_bool (conf, MODEST_CONF_SHOW_TOOLBAR, NULL);
-               priv->show_toolbars_fullscreen = 
-                       modest_conf_get_bool (conf, MODEST_CONF_SHOW_TOOLBAR_FULLSCREEN, NULL);
-               first_time = FALSE;
-       }
-
-       /* Show/hide toolbar */
-       if (priv->fullscreen_mode)
-               show = priv->show_toolbars_fullscreen;
-       else
-               show = priv->show_toolbars;
-       modest_window_show_toolbar (window, show);
+       /* Show/hide toolbar & fullscreen */    
+       key = get_show_toolbar_key (G_TYPE_FROM_INSTANCE (window), priv->fullscreen_mode);
+       modest_window_show_toolbar (window, modest_conf_get_bool (modest_runtime_get_conf (), key, NULL));
 }
 
 static gboolean
 }
 
 static gboolean
@@ -648,18 +655,9 @@ modest_window_mgr_unregister_window (ModestWindowMgr *self,
        gtk_widget_destroy (win->data);
        
        /* If there are no more windows registered then exit program */
        gtk_widget_destroy (win->data);
        
        /* If there are no more windows registered then exit program */
-       if (priv->window_list == NULL) {
-               
-               ModestConf *conf = modest_runtime_get_conf ();
-               /* Save show toolbar status */
-               modest_conf_set_bool (conf, MODEST_CONF_SHOW_TOOLBAR_FULLSCREEN, 
-                                     priv->show_toolbars_fullscreen, NULL);
-               modest_conf_set_bool (conf, MODEST_CONF_SHOW_TOOLBAR, 
-                                     priv->show_toolbars, NULL);
-
+       if (priv->window_list == NULL)
                g_timeout_add (CLOSING_RETRY_INTERVAL,
                               (GSourceFunc)on_quit_maybe, self);
                g_timeout_add (CLOSING_RETRY_INTERVAL,
                               (GSourceFunc)on_quit_maybe, self);
-       }
 }
 
 
 }
 
 
@@ -670,6 +668,7 @@ modest_window_mgr_set_fullscreen_mode (ModestWindowMgr *self,
 {
        ModestWindowMgrPrivate *priv;
        GList *win = NULL;
 {
        ModestWindowMgrPrivate *priv;
        GList *win = NULL;
+       ModestConf *conf;
 
        g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
 
 
        g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
 
@@ -681,18 +680,28 @@ modest_window_mgr_set_fullscreen_mode (ModestWindowMgr *self,
 
        priv->fullscreen_mode = on;
 
 
        priv->fullscreen_mode = on;
 
+       conf = modest_runtime_get_conf ();
+
        /* Update windows */
        win = priv->window_list;
        while (win) {
        /* Update windows */
        win = priv->window_list;
        while (win) {
-               if (on) {
+               gboolean show;
+               const gchar *key = NULL;
+
+               /* Getting this from gconf everytime is not that
+                  expensive, we'll do it just a few times */
+               key = get_show_toolbar_key (G_TYPE_FROM_INSTANCE (win->data), on);
+               show = modest_conf_get_bool (conf, key, NULL);
+
+               /* Set fullscreen/unfullscreen */
+               if (on)
                        gtk_window_fullscreen (GTK_WINDOW (win->data));
                        gtk_window_fullscreen (GTK_WINDOW (win->data));
-                       modest_window_show_toolbar (MODEST_WINDOW (win->data), 
-                                                   priv->show_toolbars_fullscreen);
-               } else {
+               else
                        gtk_window_unfullscreen (GTK_WINDOW (win->data));
                        gtk_window_unfullscreen (GTK_WINDOW (win->data));
-                       modest_window_show_toolbar (MODEST_WINDOW (win->data), 
-                                                   priv->show_toolbars);
-               }
+
+               /* Show/Hide toolbar */
+               modest_window_show_toolbar (MODEST_WINDOW (win->data), show);
+
                win = g_list_next (win);
        }
 }
                win = g_list_next (win);
        }
 }
@@ -711,30 +720,27 @@ modest_window_mgr_get_fullscreen_mode (ModestWindowMgr *self)
 
 void 
 modest_window_mgr_show_toolbars (ModestWindowMgr *self,
 
 void 
 modest_window_mgr_show_toolbars (ModestWindowMgr *self,
+                                GType window_type,
                                 gboolean show_toolbars,
                                 gboolean fullscreen)
 {
        ModestWindowMgrPrivate *priv;
                                 gboolean show_toolbars,
                                 gboolean fullscreen)
 {
        ModestWindowMgrPrivate *priv;
+       ModestConf *conf;
+       const gchar *key = NULL;
 
        g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
 
        priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
 
        g_return_if_fail (MODEST_IS_WINDOW_MGR (self));
 
        priv = MODEST_WINDOW_MGR_GET_PRIVATE (self);
+       conf = modest_runtime_get_conf ();
 
 
-       /* If nothing changes then return. Otherwise cache it, do not
-          save to GConf for the moment, it will be done when all
-          windows become unregistered in order to avoid unnecessary
-          ModestConf calls */
-       if (fullscreen) {
-               if (priv->show_toolbars_fullscreen == show_toolbars)
-                       return;
-               else
-                       priv->show_toolbars_fullscreen = show_toolbars;
-       } else {
-               if (priv->show_toolbars == show_toolbars)
-                       return;
-               else
-                       priv->show_toolbars = show_toolbars;
-       }
+       /* If nothing changes then return */
+       key = get_show_toolbar_key (window_type, fullscreen);
+       conf = modest_runtime_get_conf ();
+       if (modest_conf_get_bool (conf, key, NULL) == show_toolbars)
+               return;
+
+       /* Save in conf */
+       modest_conf_set_bool (conf, key, show_toolbars, NULL);
 
        /* Apply now if the view mode is the right one */
        if ((fullscreen && priv->fullscreen_mode) ||
 
        /* Apply now if the view mode is the right one */
        if ((fullscreen && priv->fullscreen_mode) ||
@@ -743,8 +749,9 @@ modest_window_mgr_show_toolbars (ModestWindowMgr *self,
                GList *win = priv->window_list;
 
                while (win) {
                GList *win = priv->window_list;
 
                while (win) {
-                       modest_window_show_toolbar (MODEST_WINDOW (win->data),
-                                                   show_toolbars);
+                       if (G_TYPE_FROM_INSTANCE (win->data) == window_type)
+                               modest_window_show_toolbar (MODEST_WINDOW (win->data),
+                                                           show_toolbars);
                        win = g_list_next (win);
                }
        }
                        win = g_list_next (win);
                }
        }
index 6baf711..2518f5f 100644 (file)
@@ -111,6 +111,7 @@ gboolean       modest_window_mgr_get_fullscreen_mode   (ModestWindowMgr *self);
 /**
  * modest_window_mgr_show_toolbars:
  * @self: a #ModestWindowMgr
 /**
  * modest_window_mgr_show_toolbars:
  * @self: a #ModestWindowMgr
+ * @window_type: apply the show toolbars command only to the windows of this type
  * @show_toolbar: whether or not the toolbars should be shown
  * @fullscreen: TRUE/FALSE for show/hide in fullscreen mode, otherwise
  * it applies to normal mode
  * @show_toolbar: whether or not the toolbars should be shown
  * @fullscreen: TRUE/FALSE for show/hide in fullscreen mode, otherwise
  * it applies to normal mode
@@ -121,6 +122,7 @@ gboolean       modest_window_mgr_get_fullscreen_mode   (ModestWindowMgr *self);
  * to fullscreen mode and viceversa
  **/
 void           modest_window_mgr_show_toolbars         (ModestWindowMgr *self,
  * to fullscreen mode and viceversa
  **/
 void           modest_window_mgr_show_toolbars         (ModestWindowMgr *self,
+                                                       GType window_type,
                                                        gboolean show_toolbars,
                                                        gboolean fullscreen);
 /**
                                                        gboolean show_toolbars,
                                                        gboolean fullscreen);
 /**