]> spindle.queued.net Git - midori/commitdiff
Fix preferences, don't destroy child widgets
authorChristian Dywan <christian@twotoasts.de>
Mon, 26 Oct 2009 22:43:17 +0000 (23:43 +0100)
committerChristian Dywan <christian@twotoasts.de>
Mon, 26 Oct 2009 22:43:17 +0000 (23:43 +0100)
midori/midori-preferences.c

index c32a46f37489af6ef2c7e69239b5c1c02df52a62..bbeed4c93bf93e8b3a4e68e42fb84fc1a016d159 100644 (file)
@@ -25,6 +25,8 @@
 struct _MidoriPreferences
 {
     KatzePreferences parent_instance;
+
+    gpointer settings;
 };
 
 G_DEFINE_TYPE (MidoriPreferences, midori_preferences, KATZE_TYPE_PREFERENCES);
@@ -63,8 +65,6 @@ midori_preferences_class_init (MidoriPreferencesClass* class)
      * MidoriPreferences:settings:
      *
      * The settings to proxy properties from.
-     *
-     * Since 0.2.1 the property is only writable.
      */
     g_object_class_install_property (gobject_class,
                                      PROP_SETTINGS,
@@ -73,13 +73,13 @@ midori_preferences_class_init (MidoriPreferencesClass* class)
                                      "Settings",
                                      "Settings instance to provide properties",
                                      MIDORI_TYPE_WEB_SETTINGS,
-                                     G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS));
+                                     G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 }
 
 static void
 midori_preferences_init (MidoriPreferences* preferences)
 {
-    /* Nothing to do */
+    preferences->settings = NULL;
 }
 
 static void
@@ -114,8 +114,13 @@ midori_preferences_get_property (GObject*    object,
                                  GValue*     value,
                                  GParamSpec* pspec)
 {
+    MidoriPreferences* preferences = MIDORI_PREFERENCES (object);
+
     switch (prop_id)
     {
+    case PROP_SETTINGS:
+        g_value_set_object (value, preferences->settings);
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
         break;
@@ -244,8 +249,6 @@ midori_preferences_add_toolbutton (GtkWidget*   toolbar,
  * Note: This must not be called more than once.
  *
  * Since 0.1.2 this is equal to setting #MidoriPreferences:settings:.
- *
- * Since 0.2.1 this can be called multiple times.
  **/
 void
 midori_preferences_set_settings (MidoriPreferences* preferences,
@@ -265,7 +268,9 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
     g_return_if_fail (MIDORI_IS_PREFERENCES (preferences));
     g_return_if_fail (MIDORI_IS_WEB_SETTINGS (settings));
 
-    gtk_container_foreach (GTK_CONTAINER (GTK_DIALOG (preferences)->vbox), (GtkCallback)gtk_widget_destroy, NULL);
+    g_return_if_fail (!preferences->settings);
+
+    preferences->settings = settings;
 
     g_object_get (preferences, "transient-for", &parent, NULL);
     icon_name = parent ? gtk_window_get_icon_name (parent) : NULL;