]> spindle.queued.net Git - midori/commitdiff
Connect Help in Preferences to HelpContents
authorChristian Dywan <christian@twotoasts.de>
Fri, 3 Oct 2008 22:46:54 +0000 (00:46 +0200)
committerChristian Dywan <christian@twotoasts.de>
Fri, 3 Oct 2008 22:46:54 +0000 (00:46 +0200)
midori/midori-browser.c
midori/midori-preferences.c

index 8ae8e23026d307e388f244aa02490ad6b63c58cb..2e89252e4354bc5b08a67798b2bd6994bf599af2 100644 (file)
@@ -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);
     }
 }
index 47fa3c4b321a8b5afb642ba67a10a6fb263a1387..23caa8801c00774e13a83a4542c5581e2af6370f 100644 (file)
@@ -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);