From 215c9ad8c58cc98af7ab1db98d9107ddbf9c3b66 Mon Sep 17 00:00:00 2001 From: Sergio Villar Senin Date: Thu, 31 May 2007 12:03:42 +0000 Subject: [PATCH] * Fixes NB#57592 * Adds Help support to the windows, and folder and header CSMs pmo-trunk-r2008 --- src/maemo/modest-main-window-ui.h | 2 +- src/maemo/modest-main-window.c | 2 +- src/maemo/modest-platform.c | 24 +++++++++--- src/maemo/ui/modest-msg-edit-window-ui.xml | 7 ++++ src/maemo/ui/modest-msg-view-window-ui.xml | 6 +++ src/modest-platform.h | 11 ++++++ src/modest-ui-actions.c | 55 ++++++++++++++++++++++++++++ src/modest-ui-actions.h | 9 +++++ src/widgets/modest-msg-edit-window-ui.h | 2 + 9 files changed, 110 insertions(+), 8 deletions(-) diff --git a/src/maemo/modest-main-window-ui.h b/src/maemo/modest-main-window-ui.h index fb506b2..a63b12a 100644 --- a/src/maemo/modest-main-window-ui.h +++ b/src/maemo/modest-main-window-ui.h @@ -99,7 +99,7 @@ static const GtkActionEntry modest_action_entries [] = { { "ToolsContacts", NULL, N_("mcen_me_inbox_open_addressbook"), NULL, NULL, NULL }, { "ToolsAddToContacts", NULL, N_("mcen_me_viewer_addtocontacts"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_add_to_contacts) }, { "ToolsSearchMessages", NULL, N_("mcen_me_inbox_search"), NULL, NULL, NULL }, - { "ToolsHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, NULL }, + { "ToolsHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) }, /* Close */ { "CloseWindow", NULL, N_("mcen_me_inbox_close_window"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_close_window) }, diff --git a/src/maemo/modest-main-window.c b/src/maemo/modest-main-window.c index e20d361..042d76b 100644 --- a/src/maemo/modest-main-window.c +++ b/src/maemo/modest-main-window.c @@ -190,7 +190,7 @@ static const GtkActionEntry modest_folder_view_action_entries [] = { { "FolderViewCSMPasteMsgs", NULL, N_("mcen_me_inbox_paste"), NULL, NULL, NULL }, { "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, NULL }, - { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, NULL }, + { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) }, }; diff --git a/src/maemo/modest-platform.c b/src/maemo/modest-platform.c index 5161310..f3a66bb 100644 --- a/src/maemo/modest-platform.c +++ b/src/maemo/modest-platform.c @@ -781,12 +781,24 @@ modest_platform_on_new_msg (void) } - -gboolean -modest_platform_show_help (GtkWidget *widget, const gchar *help_id) +void +modest_platform_show_help (GtkWindow *parent_window, + const gchar *help_id) { - g_return_val_if_fail (help_id, FALSE); - g_return_val_if_fail (osso_context, FALSE); + osso_return_t result; + + g_return_if_fail (help_id); + g_return_if_fail (osso_context); - return ossohelp_show (osso_context, help_id, OSSO_HELP_SHOW_DIALOG); + /* Show help */ + result = ossohelp_show (osso_context, help_id, OSSO_HELP_SHOW_DIALOG); + + if (result != OSSO_OK) { + gchar *error_msg; + error_msg = g_strdup_printf ("FIXME The help topic %s could not be found", help_id); + hildon_banner_show_information (GTK_WIDGET (parent_window), + NULL, + error_msg); + g_free (error_msg); + } } diff --git a/src/maemo/ui/modest-msg-edit-window-ui.xml b/src/maemo/ui/modest-msg-edit-window-ui.xml index c7bb67f..df432c5 100644 --- a/src/maemo/ui/modest-msg-edit-window-ui.xml +++ b/src/maemo/ui/modest-msg-edit-window-ui.xml @@ -100,6 +100,13 @@ + + + diff --git a/src/maemo/ui/modest-msg-view-window-ui.xml b/src/maemo/ui/modest-msg-view-window-ui.xml index 95ad57c..39d1c5d 100644 --- a/src/maemo/ui/modest-msg-view-window-ui.xml +++ b/src/maemo/ui/modest-msg-view-window-ui.xml @@ -79,6 +79,12 @@ + + diff --git a/src/modest-platform.h b/src/modest-platform.h index b2024eb..8eb4adc 100644 --- a/src/modest-platform.h +++ b/src/modest-platform.h @@ -213,6 +213,17 @@ GtkWidget* modest_platform_get_global_settings_dialog (void); void modest_platform_on_new_msg (void); + +/** + * modest_platform_show_help: + * @parent_window: + * @help_id: the help topic id to be shown in the help dialog + * + * shows the application help dialog + **/ +void modest_platform_show_help (GtkWindow *parent_window, + const gchar *help_id); + G_END_DECLS #endif /* __MODEST_PLATFORM_UTILS_H__ */ diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index d5bd712..f974ffe 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -2772,6 +2772,61 @@ modest_ui_actions_on_settings (GtkAction *action, } void +modest_ui_actions_on_help (GtkAction *action, + ModestWindow *win) +{ + const gchar *help_id; + + if (MODEST_IS_MAIN_WINDOW (win)) { + const gchar *action_name; + action_name = gtk_action_get_name (action); + + if (!strcmp (action_name, "FolderViewCSMHelp") || + !strcmp (action_name, "HeaderViewCSMHelp")) { + GtkWidget *folder_view; + TnyFolderStore *folder_store; + /* Get selected folder */ + folder_view = modest_main_window_get_child_widget (MODEST_MAIN_WINDOW (win), + MODEST_WIDGET_TYPE_FOLDER_VIEW); + folder_store = modest_folder_view_get_selected (MODEST_FOLDER_VIEW (folder_view)); + + /* Switch help_id */ + if (TNY_IS_FOLDER (folder_store)) { + switch (tny_folder_get_folder_type (TNY_FOLDER (folder_store))) { + case TNY_FOLDER_TYPE_NORMAL: + help_id = "applications_email_userfolder"; + break; + case TNY_FOLDER_TYPE_INBOX: + help_id = "applications_email_inbox"; + break; + case TNY_FOLDER_TYPE_OUTBOX: + help_id = "applications_email_outbox"; + break; + case TNY_FOLDER_TYPE_SENT: + help_id = "applications_email_sent"; + break; + case TNY_FOLDER_TYPE_DRAFTS: + help_id = "applications_email_drafts"; + break; + case TNY_FOLDER_TYPE_ARCHIVE: + help_id = "applications_email_archive"; + break; + default: + help_id = NULL; + } + } + } else { + help_id = "applications_email_mainview"; + } + } else if (MODEST_IS_MSG_VIEW_WINDOW (win)) { + help_id = "applications_email_viewer"; + } else if (MODEST_IS_MSG_EDIT_WINDOW (win)) + help_id = "applications_email_editor"; + + modest_platform_show_help (GTK_WINDOW (win), help_id); +} + +void modest_ui_actions_on_retrieve_msg_contents (GtkAction *action, ModestWindow *window) { diff --git a/src/modest-ui-actions.h b/src/modest-ui-actions.h index cbc46a5..46eb9dd 100644 --- a/src/modest-ui-actions.h +++ b/src/modest-ui-actions.h @@ -81,6 +81,15 @@ void modest_ui_actions_on_move_to (GtkAction *action, ModestWindow *wi void modest_ui_actions_on_settings (GtkAction *action, ModestWindow *win); /** + * modest_ui_actions_on_help: + * @action: a #GtkAction + * @win: a #ModestWindow + * + * Shows the help dialog + **/ +void modest_ui_actions_on_help (GtkAction *action, ModestWindow *win); + +/** * modest_ui_actions_toggle_folders_view: * @action: the #GtkAction * @main_window: the #ModestMainWindow diff --git a/src/widgets/modest-msg-edit-window-ui.h b/src/widgets/modest-msg-edit-window-ui.h index 2556236..419a819 100644 --- a/src/widgets/modest-msg-edit-window-ui.h +++ b/src/widgets/modest-msg-edit-window-ui.h @@ -73,6 +73,8 @@ static const GtkActionEntry modest_msg_edit_action_entries [] = { { "CheckNames", NULL, N_("mcen_me_editor_checknames"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_check_names)}, { "CloseWindow", NULL, N_("mcen_me_inbox_close_window"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_close_window)}, { "CloseAllWindows", NULL, N_("mcen_me_inbox_close_windows"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_quit) }, + { "Help", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) }, + /* KEY ACCELERATOR ACTIONS */ { "ZoomPlus", NULL, N_("Zoom +"), "F7", NULL, G_CALLBACK (modest_ui_actions_on_zoom_plus) }, -- 1.7.9.5