[gnome-bluetooth] Fix initial checkbox state in geoclue plugin
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-bluetooth] Fix initial checkbox state in geoclue plugin
- Date: Mon, 22 Jun 2009 12:16:45 -0400 (EDT)
commit 8fffec86540b5020101b8caecceba5aebf7a6db1
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jun 22 17:12:30 2009 +0100
Fix initial checkbox state in geoclue plugin
lib/plugins/geoclue.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/lib/plugins/geoclue.c b/lib/plugins/geoclue.c
index 6df686c..7ae83d5 100644
--- a/lib/plugins/geoclue.c
+++ b/lib/plugins/geoclue.c
@@ -153,17 +153,29 @@ get_config_widgets (const char *bdaddr, const char **uuids)
{
GtkWidget *button;
GConfClient *client;
+ char *old_bdaddr;
client = gconf_client_get_default ();
if (client == NULL)
return NULL;
button = gtk_check_button_new_with_label (_("Use this GPS device for Geolocation services"));
- g_signal_connect (G_OBJECT (button), "toggled",
- G_CALLBACK (toggle_button), NULL);
g_object_set_data_full (G_OBJECT (button), "bdaddr", g_strdup (bdaddr), g_free);
g_object_set_data_full (G_OBJECT (button), "client", client, g_object_unref);
+ /* Is it already setup? */
+ old_bdaddr = gconf_client_get_string (client, GPS_KEY, NULL);
+ if (g_strcmp0 (old_bdaddr, bdaddr) == 0) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
+ g_object_set_data (G_OBJECT (button), "bdaddr", old_bdaddr);
+ } else {
+ g_free (old_bdaddr);
+ }
+
+ /* And set the signal */
+ g_signal_connect (G_OBJECT (button), "toggled",
+ G_CALLBACK (toggle_button), NULL);
+
return button;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]