aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-power.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-02-01 22:51:26 -0600
committerCharles Kerr <charles.kerr@canonical.com>2012-02-01 22:51:26 -0600
commit33beea08d1a833a3517b1a7a858d14ecc438017c (patch)
tree016c5ad3c9ff15af234f21b00c67089fd7be1c17 /src/indicator-power.c
parentda453ec039c78d60ebad64226367780037621197 (diff)
downloadayatana-indicator-power-33beea08d1a833a3517b1a7a858d14ecc438017c.tar.gz
ayatana-indicator-power-33beea08d1a833a3517b1a7a858d14ecc438017c.tar.bz2
ayatana-indicator-power-33beea08d1a833a3517b1a7a858d14ecc438017c.zip
use g_settings_bind() for the show-time checkbox
Diffstat (limited to 'src/indicator-power.c')
-rw-r--r--src/indicator-power.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index dc1007d..f91119d 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -178,19 +178,10 @@ show_info_cb (GtkMenuItem *item,
}
static void
-option_toggled_cb (GtkCheckMenuItem *item,
- gpointer user_data)
+option_toggled_cb (GtkCheckMenuItem *item, IndicatorPower * self)
{
- IndicatorPower *self = INDICATOR_POWER (user_data);
- gboolean visible;
-
- visible = gtk_check_menu_item_get_active (item);
-
gtk_widget_set_visible (GTK_WIDGET (self->label),
- visible);
-
- g_settings_set_boolean (self->settings, "show-time",
- visible);
+ gtk_check_menu_item_get_active(item));
}
static void
@@ -597,7 +588,6 @@ build_menu (IndicatorPower *self)
GtkWidget *image;
GList *children;
gsize n_devices = 0;
- gboolean visible;
if (self->menu == NULL)
self->menu = GTK_MENU (gtk_menu_new ());
@@ -619,10 +609,8 @@ build_menu (IndicatorPower *self)
/* options */
item = gtk_check_menu_item_new_with_label (_("Show Time in Menu Bar"));
- g_signal_connect (G_OBJECT (item), "toggled",
- G_CALLBACK (option_toggled_cb), self);
- visible = g_settings_get_boolean (self->settings, "show-time");
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), visible);
+ g_signal_connect (item, "toggled", G_CALLBACK(option_toggled_cb), self);
+ g_settings_bind (self->settings, "show-time", item, "active", G_SETTINGS_BIND_DEFAULT);
gtk_menu_shell_append (GTK_MENU_SHELL (self->menu), item);
/* preferences */