From: Christian Dywan Date: Mon, 26 Oct 2009 22:43:17 +0000 (+0100) Subject: Fix preferences, don't destroy child widgets X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aff65928b371c3794a78a2de6c2759076e29ef2f;p=midori Fix preferences, don't destroy child widgets --- diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index c32a46f3..bbeed4c9 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -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;