aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Terry <michael.terry@canonical.com>2011-08-11 17:10:29 +0100
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-08-11 17:10:29 +0100
commit7a2c59a355b603ac04c317f97d6bdb8f7988e2b4 (patch)
tree57a93d1c65eb34808d7ffcf045b0494090185af4 /src
parentb36ac875eec753d2368dad1cf45ab930bc7b52bc (diff)
parentb62772e76c7c5e2c400c100fb34e09a393e3ec78 (diff)
downloadayatana-indicator-power-7a2c59a355b603ac04c317f97d6bdb8f7988e2b4.tar.gz
ayatana-indicator-power-7a2c59a355b603ac04c317f97d6bdb8f7988e2b4.tar.bz2
ayatana-indicator-power-7a2c59a355b603ac04c317f97d6bdb8f7988e2b4.zip
Don't show settings links when used in a greeter
Diffstat (limited to 'src')
-rw-r--r--src/indicator-power.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index e0d8795..2179c3f 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -428,6 +428,14 @@ menu_add_devices (GtkMenu *menu,
return n_devices;
}
+static gboolean
+get_greeter_mode (void)
+{
+ const gchar *var;
+ var = g_getenv("INDICATOR_GREETER_MODE");
+ return (g_strcmp0(var, "1") == 0);
+}
+
static void
build_menu (IndicatorPower *self)
{
@@ -446,26 +454,28 @@ build_menu (IndicatorPower *self)
/* devices */
n_devices = menu_add_devices (priv->menu, priv->devices);
- /* only do the separator if we have at least one device */
- if (n_devices != 0)
- {
- item = gtk_separator_menu_item_new ();
- gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
- }
-
- /* 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);
- gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
-
- /* preferences */
- item = gtk_image_menu_item_new_with_mnemonic (_("Power Settings ..."));
- image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- g_signal_connect (G_OBJECT (item), "activate",
- G_CALLBACK (show_preferences_cb), NULL);
- gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
+ if (!get_greeter_mode ()) {
+ /* only do the separator if we have at least one device */
+ if (n_devices != 0)
+ {
+ item = gtk_separator_menu_item_new ();
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
+ }
+
+ /* 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);
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
+
+ /* preferences */
+ item = gtk_image_menu_item_new_with_mnemonic (_("Power Settings ..."));
+ image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
+ gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
+ g_signal_connect (G_OBJECT (item), "activate",
+ G_CALLBACK (show_preferences_cb), NULL);
+ gtk_menu_shell_append (GTK_MENU_SHELL (priv->menu), item);
+ }
/* show the menu */
gtk_widget_show_all (GTK_WIDGET (priv->menu));