[gnac/gnac-gsettings] Used g_settings bind instead of listening to GtkCheckButton's signals
- From: Benoît Dupasquier <bdupasqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnac/gnac-gsettings] Used g_settings bind instead of listening to GtkCheckButton's signals
- Date: Sat, 16 Oct 2010 17:34:11 +0000 (UTC)
commit 02adc14bb58bdbfb11b23552e47cd07f4e4ebe67
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date: Sat Oct 16 18:34:04 2010 +0100
Used g_settings bind instead of listening to GtkCheckButton's signals
data/ui/gnac-pref-window.xml | 2 -
src/gnac-prefs.c | 53 ++++++++++++-----------------------------
src/gnac-prefs.h | 8 ------
3 files changed, 16 insertions(+), 47 deletions(-)
---
diff --git a/data/ui/gnac-pref-window.xml b/data/ui/gnac-pref-window.xml
index c68b27e..3fc6481 100644
--- a/data/ui/gnac-pref-window.xml
+++ b/data/ui/gnac-pref-window.xml
@@ -113,7 +113,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="gnac_prefs_tray_icon_toggled"/>
</object>
<packing>
<property name="y_options">GTK_FILL</property>
@@ -335,7 +334,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="gnac_prefs_erase_source_toggled"/>
</object>
<packing>
<property name="position">2</property>
diff --git a/src/gnac-prefs.c b/src/gnac-prefs.c
index 5ba5080..462b802 100644
--- a/src/gnac-prefs.c
+++ b/src/gnac-prefs.c
@@ -203,21 +203,6 @@ gnac_prefs_retrieve_settings(void)
GtkWidget *temp;
gint folder_type;
- /* notification icon */
- check_button = GTK_TOGGLE_BUTTON(gtk_builder_get_object(gnac_prefs_builder,
- "check_notification_icon"));
- gtk_toggle_button_set_active(check_button,
- g_settings_get_boolean(settings_ui, GNAC_KEY_TRAY_ICON));
- /* delete original files */
- check_button = GTK_TOGGLE_BUTTON(gtk_builder_get_object(gnac_prefs_builder,
- "erase_originals_checkbutton"));
- gtk_toggle_button_set_active(check_button,
- g_settings_get_boolean(settings, GNAC_KEY_CLEAR_SOURCE));
- /* strip special characters */
- check_button = GTK_TOGGLE_BUTTON(gtk_builder_get_object(gnac_prefs_builder,
- "strip_special_checkbutton"));
- gtk_toggle_button_set_active(check_button,
- g_settings_get_boolean(settings, GNAC_KEY_STRIP_SPECIAL));
/* output folder */
folder_type = g_settings_get_int(settings, GNAC_KEY_FOLDER_TYPE);
/* output filename combo */
@@ -287,6 +272,7 @@ gnac_prefs_window_new(void)
{
GError *err = NULL;
GtkWidget *prefs_window;
+ GtkWidget *check_button;
gnac_prefs_builder = gtk_builder_new();
@@ -305,6 +291,21 @@ gnac_prefs_window_new(void)
/* Set the parent */
gtk_window_set_transient_for(GTK_WINDOW(prefs_window),
GTK_WINDOW(gnac_ui_get_widget("main_window")));
+
+ /* GSettings binding */
+ check_button = GTK_WIDGET(gtk_builder_get_object(gnac_prefs_builder,
+ "check_notification_icon"));
+ g_settings_bind(settings_ui, GNAC_KEY_TRAY_ICON, check_button,
+ "active", G_SETTINGS_BIND_DEFAULT);
+ check_button = GTK_WIDGET(gtk_builder_get_object(gnac_prefs_builder,
+ "erase_originals_checkbutton"));
+ g_settings_bind(settings, GNAC_KEY_CLEAR_SOURCE, check_button,
+ "active", G_SETTINGS_BIND_DEFAULT);
+ check_button = GTK_WIDGET(gtk_builder_get_object(gnac_prefs_builder,
+ "strip_special_checkbutton"));
+ g_settings_bind(settings, GNAC_KEY_STRIP_SPECIAL, check_button,
+ "active", G_SETTINGS_BIND_DEFAULT);
+
return prefs_window;
}
@@ -373,17 +374,6 @@ gnac_prefs_get_folder_hierarchy_as_str(void)
void
-gnac_prefs_tray_icon_toggled(GtkWidget *widget,
- gpointer data)
-{
- if (!g_settings_set_boolean(settings_ui, GNAC_KEY_TRAY_ICON,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))) {
- g_printerr("failed to set key\n");
- }
-}
-
-
-void
gnac_prefs_same_radio_toggled(GtkWidget *widget,
gpointer data)
{
@@ -394,20 +384,9 @@ gnac_prefs_same_radio_toggled(GtkWidget *widget,
void
-gnac_prefs_erase_source_toggled(GtkWidget *widget,
- gpointer data)
-{
- g_settings_set_boolean(settings, GNAC_KEY_CLEAR_SOURCE,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
-}
-
-
-void
gnac_prefs_strip_special_toggled(GtkWidget *widget,
gpointer data)
{
- g_settings_set_boolean(settings, GNAC_KEY_STRIP_SPECIAL,
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
gnac_prefs_update_example_label(widget, data);
}
diff --git a/src/gnac-prefs.h b/src/gnac-prefs.h
index ae55e72..31fc5d6 100644
--- a/src/gnac-prefs.h
+++ b/src/gnac-prefs.h
@@ -40,14 +40,6 @@ void
gnac_prefs_window_hide(void);
void
-gnac_prefs_tray_icon_toggled(GtkWidget *widget,
- gpointer data);
-
-void
-gnac_prefs_erase_source_toggled(GtkWidget *widget,
- gpointer data);
-
-void
gnac_prefs_strip_special_toggled(GtkWidget *widget,
gpointer data);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]