aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-02-15 20:50:52 +0800
committerMilan Crha <mcrha@redhat.com>2012-02-15 20:50:52 +0800
commit99d4558915e709f770bfa142d6fec3f6ce32db10 (patch)
tree6ce78b9b532fa41fa06e8f10c587b4e1c497c603 /widgets/misc
parent0b8999bfe5e93cfbcbb6771105fd53231883f795 (diff)
downloadgsoc2013-evolution-99d4558915e709f770bfa142d6fec3f6ce32db10.tar
gsoc2013-evolution-99d4558915e709f770bfa142d6fec3f6ce32db10.tar.gz
gsoc2013-evolution-99d4558915e709f770bfa142d6fec3f6ce32db10.tar.bz2
gsoc2013-evolution-99d4558915e709f770bfa142d6fec3f6ce32db10.tar.lz
gsoc2013-evolution-99d4558915e709f770bfa142d6fec3f6ce32db10.tar.xz
gsoc2013-evolution-99d4558915e709f770bfa142d6fec3f6ce32db10.tar.zst
gsoc2013-evolution-99d4558915e709f770bfa142d6fec3f6ce32db10.zip
Be able to define help target for Preferences pages
A follow-up for bug #670073
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/e-preferences-window.c22
-rw-r--r--widgets/misc/e-preferences-window.h1
-rw-r--r--widgets/misc/test-preferences-window.c6
3 files changed, 18 insertions, 11 deletions
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);
}