aboutsummaryrefslogtreecommitdiff
path: root/src/indicator-power.c
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2011-08-22 20:38:36 +0100
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-08-22 20:38:36 +0100
commit84735ec5056e864684245f90a0116ce09cc42b8f (patch)
tree92495137fcc0ff51b7ed79a79f7bddd95c03512e /src/indicator-power.c
parent94b05b3ac5e37146e6e049df4daf011e0b5689ae (diff)
downloadayatana-indicator-power-84735ec5056e864684245f90a0116ce09cc42b8f.tar.gz
ayatana-indicator-power-84735ec5056e864684245f90a0116ce09cc42b8f.tar.bz2
ayatana-indicator-power-84735ec5056e864684245f90a0116ce09cc42b8f.zip
Use gsettings to store the status of "Show time in Menu Bar" option
Fixes https://bugs.launchpad.net/indicator-power/+bug/829853
Diffstat (limited to 'src/indicator-power.c')
-rw-r--r--src/indicator-power.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 24b2b72..7f9e479 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -82,6 +82,8 @@ struct _IndicatorPowerPrivate
GVariant *devices;
GVariant *device;
+
+ GSettings *settings;
};
/* Prototypes */
@@ -138,9 +140,15 @@ option_toggled_cb (GtkCheckMenuItem *item,
{
IndicatorPower *self = INDICATOR_POWER (user_data);
IndicatorPowerPrivate *priv = self->priv;
+ gboolean visible;
+
+ visible = gtk_check_menu_item_get_active (item);
gtk_widget_set_visible (GTK_WIDGET (priv->label),
- gtk_check_menu_item_get_active (item));
+ visible);
+
+ g_settings_set_boolean (priv->settings, "show-time",
+ visible);
}
static void
@@ -459,6 +467,7 @@ build_menu (IndicatorPower *self)
GtkWidget *image;
GList *children;
gsize n_devices = 0;
+ gboolean visible;
if (priv->menu == NULL)
priv->menu = GTK_MENU (gtk_menu_new ());
@@ -482,6 +491,8 @@ build_menu (IndicatorPower *self)
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 (priv->settings, "show-time");
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), visible);
gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
/* preferences */
@@ -755,6 +766,9 @@ indicator_power_init (IndicatorPower *self)
priv->proxy_cancel,
service_proxy_cb,
self);
+
+ /* GSettings */
+ priv->settings = g_settings_new ("org.ubuntu.indicator-power");
}
static void