From 5eb74b6bf350813a441679a91e364363f9ec87b0 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 4 Oct 2008 00:46:54 +0200 Subject: [PATCH] Connect Help in Preferences to HelpContents --- midori/midori-browser.c | 11 +++++++++++ midori/midori-preferences.c | 19 +++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 8ae8e230..2e89252e 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1428,6 +1428,15 @@ midori_browser_menu_trash_activate_cb (GtkWidget* widget, SOKOKE_MENU_POSITION_RIGHT); } +static void +midori_preferences_response_help_cb (GtkWidget* preferences, + gint response, + MidoriBrowser* browser) +{ + if (response == GTK_RESPONSE_HELP) + gtk_action_activate (_action_by_name (browser, "HelpContents")); +} + static void _action_preferences_activate (GtkAction* action, MidoriBrowser* browser) @@ -1440,6 +1449,8 @@ _action_preferences_activate (GtkAction* action, { dialog = midori_preferences_new (GTK_WINDOW (browser), browser->settings); + g_signal_connect (dialog, "response", + G_CALLBACK (midori_preferences_response_help_cb), browser); gtk_widget_show (dialog); } } diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index 47fa3c4b..23caa880 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -64,13 +64,23 @@ midori_preferences_class_init (MidoriPreferencesClass* class) G_PARAM_WRITABLE)); } +static void +midori_preferences_response_cb (MidoriPreferences* preferences, + gint response) +{ + if (response == GTK_RESPONSE_CLOSE) + gtk_widget_destroy (GTK_WIDGET (preferences)); +} + static void midori_preferences_init (MidoriPreferences* preferences) { + gchar* dialog_title; + preferences->notebook = NULL; - gchar* dialog_title = g_strdup_printf (_("%s Preferences"), - g_get_application_name ()); + dialog_title = g_strdup_printf (_("%s Preferences"), + g_get_application_name ()); g_object_set (preferences, "icon-name", GTK_STOCK_PREFERENCES, "title", dialog_title, @@ -80,11 +90,8 @@ midori_preferences_init (MidoriPreferences* preferences) GTK_STOCK_HELP, GTK_RESPONSE_HELP, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); - /* TODO: Implement some kind of help function */ - gtk_dialog_set_response_sensitive (GTK_DIALOG (preferences), - GTK_RESPONSE_HELP, FALSE); g_signal_connect (preferences, "response", - G_CALLBACK (gtk_widget_destroy), preferences); + G_CALLBACK (midori_preferences_response_cb), NULL); /* TODO: Do we want tooltips for explainations or can we omit that? */ g_free (dialog_title);