From 99d4558915e709f770bfa142d6fec3f6ce32db10 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 15 Feb 2012 13:50:52 +0100 Subject: Be able to define help target for Preferences pages A follow-up for bug #670073 --- modules/addressbook/e-book-shell-backend.c | 2 ++ modules/calendar/e-cal-shell-backend.c | 1 + modules/mail/e-mail-shell-backend.c | 4 ++++ widgets/misc/e-preferences-window.c | 22 ++++++++++++++-------- widgets/misc/e-preferences-window.h | 1 + widgets/misc/test-preferences-window.c | 6 +++--- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/modules/addressbook/e-book-shell-backend.c b/modules/addressbook/e-book-shell-backend.c index b717b090d3..5a564e8fa4 100644 --- a/modules/addressbook/e-book-shell-backend.c +++ b/modules/addressbook/e-book-shell-backend.c @@ -343,6 +343,7 @@ book_shell_backend_init_preferences (EShell *shell) "contacts", "preferences-autocompletion", _("Contacts"), + "index#contacts", autocompletion_config_new, 200); @@ -353,6 +354,7 @@ book_shell_backend_init_preferences (EShell *shell) "certificates", "preferences-certificates", _("Certificates"), + "mail-encryption-s-mime-manage", e_cert_manager_config_new, 700); #endif diff --git a/modules/calendar/e-cal-shell-backend.c b/modules/calendar/e-cal-shell-backend.c index 399a5ea80c..f13cc2d715 100644 --- a/modules/calendar/e-cal-shell-backend.c +++ b/modules/calendar/e-cal-shell-backend.c @@ -792,6 +792,7 @@ cal_shell_backend_constructed (GObject *object) "calendar-and-tasks", "preferences-calendar-and-tasks", _("Calendar and Tasks"), + "index#calendar", e_calendar_preferences_new, 600); diff --git a/modules/mail/e-mail-shell-backend.c b/modules/mail/e-mail-shell-backend.c index 4e28d8c629..48cde2c502 100644 --- a/modules/mail/e-mail-shell-backend.c +++ b/modules/mail/e-mail-shell-backend.c @@ -429,6 +429,7 @@ mail_shell_backend_constructed (GObject *object) "mail-accounts", "preferences-mail-accounts", _("Mail Accounts"), + "mail-account-management", em_account_prefs_new, 100); @@ -437,6 +438,7 @@ mail_shell_backend_constructed (GObject *object) "mail", "preferences-mail", _("Mail Preferences"), + "index#mail-basic", em_mailer_prefs_new, 300); @@ -445,6 +447,7 @@ mail_shell_backend_constructed (GObject *object) "composer", "preferences-composer", _("Composer Preferences"), + "index#mail-composing", em_composer_prefs_new, 400); @@ -453,6 +456,7 @@ mail_shell_backend_constructed (GObject *object) "system-network-proxy", "preferences-system-network-proxy", _("Network Preferences"), + NULL, em_network_prefs_new, 500); } diff --git a/widgets/misc/e-preferences-window.c b/widgets/misc/e-preferences-window.c index c246abba13..4d90640796 100644 --- a/widgets/misc/e-preferences-window.c +++ b/widgets/misc/e-preferences-window.c @@ -48,6 +48,7 @@ struct _EPreferencesWindowPrivate { enum { COLUMN_ID, /* G_TYPE_STRING */ COLUMN_TEXT, /* G_TYPE_STRING */ + COLUMN_HELP, /* G_TYPE_STRING */ COLUMN_PIXBUF, /* GDK_TYPE_PIXBUF */ COLUMN_PAGE, /* G_TYPE_INT */ COLUMN_SORT /* G_TYPE_INT */ @@ -132,7 +133,7 @@ preferences_window_help_clicked_cb (EPreferencesWindow *window) GtkTreeModel *model; GtkTreeIter iter; GList *list; - gchar *page = NULL; + gchar *help = NULL; g_return_if_fail (window != NULL); @@ -140,7 +141,7 @@ preferences_window_help_clicked_cb (EPreferencesWindow *window) list = gtk_icon_view_get_selected_items (GTK_ICON_VIEW (window->priv->icon_view)); if (list != NULL) { gtk_tree_model_get_iter (model, &iter, list->data); - gtk_tree_model_get (model, &iter, COLUMN_ID, &page, -1); + gtk_tree_model_get (model, &iter, COLUMN_HELP, &help, -1); } else if (gtk_tree_model_get_iter_first (model, &iter)) { gint page_index, current_index; @@ -149,15 +150,15 @@ preferences_window_help_clicked_cb (EPreferencesWindow *window) gtk_tree_model_get (model, &iter, COLUMN_PAGE, &page_index, -1); if (page_index == current_index) { - gtk_tree_model_get (model, &iter, COLUMN_ID, &page, -1); + gtk_tree_model_get (model, &iter, COLUMN_HELP, &help, -1); break; } } while (gtk_tree_model_iter_next (model, &iter)); } - e_display_help (GTK_WINDOW (window), page ? page : "index"); + e_display_help (GTK_WINDOW (window), help ? help : "index"); - g_free (page); + g_free (help); } static void @@ -292,7 +293,7 @@ e_preferences_window_init (EPreferencesWindow *window) window->priv->filter_view = NULL; store = gtk_list_store_new ( - 5, G_TYPE_STRING, G_TYPE_STRING, + 6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, GDK_TYPE_PIXBUF, G_TYPE_INT, G_TYPE_INT); gtk_tree_sortable_set_sort_column_id ( GTK_TREE_SORTABLE (store), COLUMN_SORT, GTK_SORT_ASCENDING); @@ -418,6 +419,7 @@ e_preferences_window_add_page (EPreferencesWindow *window, const gchar *page_name, const gchar *icon_name, const gchar *caption, + const gchar *help_target, EPreferencesWindowCreatePageFn create_fn, gint sort_order) { @@ -450,8 +452,12 @@ e_preferences_window_add_page (EPreferencesWindow *window, gtk_list_store_set ( GTK_LIST_STORE (model), &iter, COLUMN_ID, page_name, - COLUMN_TEXT, caption, COLUMN_PIXBUF, pixbuf, - COLUMN_PAGE, page, COLUMN_SORT, sort_order, -1); + COLUMN_TEXT, caption, + COLUMN_HELP, help_target, + COLUMN_PIXBUF, pixbuf, + COLUMN_PAGE, page, + COLUMN_SORT, sort_order, + -1); index = window->priv->index; path = gtk_tree_model_get_path (model, &iter); diff --git a/widgets/misc/e-preferences-window.h b/widgets/misc/e-preferences-window.h index f7789b3af6..72ae63eb7e 100644 --- a/widgets/misc/e-preferences-window.h +++ b/widgets/misc/e-preferences-window.h @@ -70,6 +70,7 @@ void e_preferences_window_add_page (EPreferencesWindow *window, const gchar *page_name, const gchar *icon_name, const gchar *caption, + const gchar *help_target, EPreferencesWindowCreatePageFn create_fn, gint sort_order); void e_preferences_window_show_page (EPreferencesWindow *window, diff --git a/widgets/misc/test-preferences-window.c b/widgets/misc/test-preferences-window.c index 738d7ff403..ae0a570c6d 100644 --- a/widgets/misc/test-preferences-window.c +++ b/widgets/misc/test-preferences-window.c @@ -59,13 +59,13 @@ static void add_pages (EPreferencesWindow *preferences_window) { e_preferences_window_add_page (preferences_window, "page-0", - "gtk-properties", "title 0", + "gtk-properties", "title 0", NULL, create_page_zero, 0); e_preferences_window_add_page (preferences_window, "page-1", - "gtk-properties", "title 1", + "gtk-properties", "title 1", NULL, create_page_one, 1); e_preferences_window_add_page (preferences_window, "page-2", - "gtk-properties", "title 2", + "gtk-properties", "title 2", NULL, create_page_two, 2); } -- cgit v1.2.3