Make Preferences property readable

This commit is contained in:
Christian Dywan 2009-02-19 22:57:51 +01:00
parent 33e5bb7134
commit ad13d2e8a2

View file

@ -28,6 +28,7 @@ struct _MidoriPreferences
{ {
GtkDialog parent_instance; GtkDialog parent_instance;
MidoriWebSettings* settings;
GtkWidget* notebook; GtkWidget* notebook;
}; };
@ -70,7 +71,7 @@ midori_preferences_class_init (MidoriPreferencesClass* class)
"Settings", "Settings",
"Settings instance to provide properties", "Settings instance to provide properties",
MIDORI_TYPE_WEB_SETTINGS, MIDORI_TYPE_WEB_SETTINGS,
G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
} }
static void static void
@ -86,6 +87,7 @@ midori_preferences_init (MidoriPreferences* preferences)
{ {
gchar* dialog_title; gchar* dialog_title;
preferences->settings = NULL;
preferences->notebook = NULL; preferences->notebook = NULL;
dialog_title = g_strdup_printf (_("Preferences for %s"), dialog_title = g_strdup_printf (_("Preferences for %s"),
@ -123,11 +125,9 @@ midori_preferences_set_property (GObject* object,
switch (prop_id) switch (prop_id)
{ {
case PROP_SETTINGS: case PROP_SETTINGS:
{
midori_preferences_set_settings (preferences, midori_preferences_set_settings (preferences,
g_value_get_object (value)); g_value_get_object (value));
break; break;
}
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -140,8 +140,13 @@ midori_preferences_get_property (GObject* object,
GValue* value, GValue* value,
GParamSpec* pspec) GParamSpec* pspec)
{ {
MidoriPreferences* preferences = MIDORI_PREFERENCES (object);
switch (prop_id) switch (prop_id)
{ {
case PROP_SETTINGS:
g_value_set_object (value, preferences->settings);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -320,6 +325,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
g_return_if_fail (!preferences->notebook); g_return_if_fail (!preferences->notebook);
katze_assign (preferences->settings, g_object_ref (settings));
g_object_get (preferences, "transient-for", &parent, NULL); g_object_get (preferences, "transient-for", &parent, NULL);
icon_name = parent ? gtk_window_get_icon_name (parent) : NULL; icon_name = parent ? gtk_window_get_icon_name (parent) : NULL;
if ((header = sokoke_xfce_header_new (icon_name, if ((header = sokoke_xfce_header_new (icon_name,