aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2011-02-25 06:47:48 +0800
committerDiego Escalante Urrelo <descalante@igalia.com>2011-02-25 06:55:26 +0800
commit0c799b8e9de67440b1c3bc976fa63685367f295e (patch)
tree7d281b63cf39e2fcf180328d0c258a64cce7977b
parent13eac99b2dcd76ad7bfaa13e4c8c4e0bbc5baa2c (diff)
downloadgsoc2013-epiphany-0c799b8e9de67440b1c3bc976fa63685367f295e.tar
gsoc2013-epiphany-0c799b8e9de67440b1c3bc976fa63685367f295e.tar.gz
gsoc2013-epiphany-0c799b8e9de67440b1c3bc976fa63685367f295e.tar.bz2
gsoc2013-epiphany-0c799b8e9de67440b1c3bc976fa63685367f295e.tar.lz
gsoc2013-epiphany-0c799b8e9de67440b1c3bc976fa63685367f295e.tar.xz
gsoc2013-epiphany-0c799b8e9de67440b1c3bc976fa63685367f295e.tar.zst
gsoc2013-epiphany-0c799b8e9de67440b1c3bc976fa63685367f295e.zip
prefs-dialog: use GtkBuildable id instead of name
Using the widget name is error prone because Glade removes the name property of objects. This makes cookie configuration work again.
-rw-r--r--data/glade/prefs-dialog.ui10
-rw-r--r--src/prefs-dialog.c19
2 files changed, 12 insertions, 17 deletions
diff --git a/data/glade/prefs-dialog.ui b/data/glade/prefs-dialog.ui
index 9a4455091..04b19e633 100644
--- a/data/glade/prefs-dialog.ui
+++ b/data/glade/prefs-dialog.ui
@@ -670,7 +670,7 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkRadioButton" id="cookies_always_radiobutton">
+ <object class="GtkRadioButton" id="always">
<property name="label" translatable="yes">_Always accept</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -685,14 +685,14 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="cookies_no_third_party_radiobutton">
+ <object class="GtkRadioButton" id="no-third-party">
<property name="label" translatable="yes">Only _from sites you visit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <property name="group">cookies_always_radiobutton</property>
+ <property name="group">always</property>
</object>
<packing>
<property name="expand">False</property>
@@ -720,14 +720,14 @@
</packing>
</child>
<child>
- <object class="GtkRadioButton" id="cookies_never_radiobutton">
+ <object class="GtkRadioButton" id="never">
<property name="label" translatable="yes">_Never accept</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
- <property name="group">cookies_always_radiobutton</property>
+ <property name="group">always</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 74637a365..7392450db 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -977,18 +977,15 @@ cookies_get_mapping (GValue *value,
gpointer user_data)
{
const char *setting;
- char *name;
+ const char *name;
setting = g_variant_get_string (variant, NULL);
-
- g_object_get (user_data, "name", &name, NULL);
+ name = gtk_buildable_get_name (GTK_BUILDABLE (user_data));
/* If the button name matches the setting, it should be active. */
if (g_strcmp0 (name, setting) == 0)
g_value_set_boolean (value, TRUE);
- g_free (name);
-
return TRUE;
}
@@ -998,17 +995,15 @@ cookies_set_mapping (const GValue *value,
gpointer user_data)
{
GVariant *variant = NULL;
- char *name;
+ const char *name;
/* Don't act unless the button has been activated (turned ON). */
if (!g_value_get_boolean (value))
return NULL;
- g_object_get (user_data, "name", &name, NULL);
+ name = gtk_buildable_get_name (GTK_BUILDABLE (user_data));
variant = g_variant_new_string (name);
- g_free (name);
-
return variant;
}
@@ -1076,13 +1071,13 @@ static const PrefsDialogPreference preferences[] =
G_SETTINGS_BIND_DEFAULT, NULL, NULL },
/* Has mapping */
- { "cookies_always_radiobutton", "active",
+ { "always", "active",
EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_COOKIES_POLICY,
G_SETTINGS_BIND_DEFAULT, cookies_get_mapping, cookies_set_mapping },
- { "cookies_no_third_party_radiobutton", "active",
+ { "no-third-party", "active",
EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_COOKIES_POLICY,
G_SETTINGS_BIND_DEFAULT, cookies_get_mapping, cookies_set_mapping },
- { "cookies_never_radiobutton", "active",
+ { "never", "active",
EPHY_PREFS_WEB_SCHEMA, EPHY_PREFS_WEB_COOKIES_POLICY,
G_SETTINGS_BIND_DEFAULT, cookies_get_mapping, cookies_set_mapping },
};