Fix preferences, don't destroy child widgets

This commit is contained in:
Christian Dywan 2009-10-26 23:43:17 +01:00
parent 9c2c62d37c
commit aff65928b3

View 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;