* Fixes NB#85574, show the folders help only when selecting it in the CSMs. The...
authorSergio Villar Senin <svillar@igalia.com>
Thu, 15 May 2008 16:06:32 +0000 (16:06 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 15 May 2008 16:06:32 +0000 (16:06 +0000)
pmo-trunk-r4537

src/gnome/modest-main-window.c
src/maemo/modest-main-window.c
src/modest-ui-actions.c
src/modest-ui-actions.h
src/widgets/modest-window-mgr.c

index e38e983..3255109 100644 (file)
@@ -132,7 +132,7 @@ static const GtkActionEntry modest_folder_view_action_entries [] = {
        { "FolderViewCSMPasteMsgs", NULL, N_("mcen_me_inbox_paste"), NULL, NULL,  G_CALLBACK (modest_ui_actions_on_paste)},
        { "FolderViewCSMDeleteFolder", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_folder) },
        { "FolderViewCSMSearchMessages", NULL, N_("mcen_me_inbox_search"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_search_messages) },
-       { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
+       { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_csm_help) },
 };
 
 static const GtkActionEntry modest_header_view_action_entries [] = {
index 816a280..0f1379a 100644 (file)
@@ -271,7 +271,7 @@ static const GtkActionEntry modest_folder_view_action_entries [] = {
        { "FolderViewCSMPasteMsgs", NULL, N_("mcen_me_inbox_paste"), NULL, NULL,  G_CALLBACK (modest_ui_actions_on_paste)},
        { "FolderViewCSMDeleteFolder", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_folder) },
        { "FolderViewCSMSearchMessages", NULL, N_("mcen_me_inbox_search"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_search_messages) },
-       { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
+       { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_csm_help) },
 };
 
 static const GtkActionEntry modest_header_view_action_entries [] = {
index 13eca36..bf822fb 100644 (file)
@@ -5506,15 +5506,40 @@ modest_ui_actions_on_help (GtkAction *action,
 {
        const gchar *help_id;
 
-       g_return_if_fail (action);
        g_return_if_fail (win && GTK_IS_WINDOW(win));
        
        help_id = modest_window_mgr_get_help_id (modest_runtime_get_window_mgr(), win);
-       
-       if (help_id)
-               modest_platform_show_help (GTK_WINDOW (win), help_id);
+
+        if (help_id)
+                modest_platform_show_help (GTK_WINDOW (win), help_id);
+}
+
+void 
+modest_ui_actions_on_csm_help (GtkAction *action, 
+                              GtkWindow *win)
+{
+       const gchar* help_id = NULL;
+       GtkWidget *folder_view;
+       TnyFolderStore *folder_store;
+
+       g_return_if_fail (win && MODEST_IS_MAIN_WINDOW (win));
+
+       /* Get selected folder */
+       folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
+                                                          MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
+       folder_store = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
+
+       /* Switch help_id */
+       if (folder_store && TNY_IS_FOLDER (folder_store))
+               help_id = modest_tny_folder_get_help_id (TNY_FOLDER (folder_store));
+
+       if (folder_store)
+               g_object_unref (folder_store);
+
+        if (help_id)
+                modest_platform_show_help (GTK_WINDOW (win), help_id);
        else
-               g_warning ("%s: no help for window %p", __FUNCTION__, win);
+               modest_ui_actions_on_help (action, win);
 }
 
 static void     
index dafb10d..4fe0146 100644 (file)
@@ -98,6 +98,17 @@ void     modest_ui_actions_on_settings      (GtkAction *action, ModestWindow *wi
  **/
 void     modest_ui_actions_on_help          (GtkAction *action, GtkWindow *win);
 
+
+/**
+ * modest_ui_actions_on_csm_elp:
+ * @action: a #GtkAction
+ * @win: a #ModestWindow
+ * 
+ * Shows the help dialog for folder view CSM. It shows the help ID
+ * which refers to the currently selected folder if any
+ **/
+void     modest_ui_actions_on_csm_help      (GtkAction *action, GtkWindow *win);
+
 /**
  * modest_ui_actions_toggle_folders_view:
  * @action: the #GtkAction
index 741b5c5..9e4cbb2 100644 (file)
@@ -425,37 +425,11 @@ modest_window_mgr_register_help_id (ModestWindowMgr *self, GtkWindow *win, const
 const gchar*
 modest_window_mgr_get_help_id (ModestWindowMgr *self, GtkWindow *win)
 {
-       const gchar* help_id = NULL;
-
        /* we don't need 'self', but for API consistency... */
-       g_return_val_if_fail (self && MODEST_IS_WINDOW_MGR(self), NULL);
-       
+       g_return_val_if_fail (self && MODEST_IS_WINDOW_MGR (self), NULL);
        g_return_val_if_fail (win, NULL);
-       g_return_val_if_fail (GTK_IS_WINDOW(win), NULL);
-       
-       if (MODEST_IS_MAIN_WINDOW (win)) {
-               GtkWidget *folder_view;
-               TnyFolderStore *folder_store;
-               
-               /* Get selected folder */
-               folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win),
-                                                                  MODEST_MAIN_WINDOW_WIDGET_TYPE_FOLDER_VIEW);
-               folder_store = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view));
-
-               /* Switch help_id */
-               if (folder_store && TNY_IS_FOLDER (folder_store)) {
-                       help_id = modest_tny_folder_get_help_id (TNY_FOLDER (folder_store));
-                       if (!help_id)
-                               g_warning ("%s: BUG: did not get a valid help_id", __FUNCTION__);
-               }
-               if (folder_store)
-                       g_object_unref (folder_store);
-       }
 
-       if (!help_id)
-               help_id = g_object_get_data (G_OBJECT(win), MODEST_WINDOW_HELP_ID_PARAM);
-               
-       return help_id;
+       return g_object_get_data (G_OBJECT(win), MODEST_WINDOW_HELP_ID_PARAM);
 }
 
 static gint