aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2014-03-13 17:27:29 -0500
committerCharles Kerr <charles.kerr@canonical.com>2014-03-13 17:27:29 -0500
commitd6159805fc552643902321b3d41d1a0a53594f05 (patch)
treeeb183a767aea9b61c6a29891b11857cd99d8bab9
parentb1f0d4011ca8ff5658e5b8807350f583d41af21b (diff)
downloadayatana-indicator-power-d6159805fc552643902321b3d41d1a0a53594f05.tar.gz
ayatana-indicator-power-d6159805fc552643902321b3d41d1a0a53594f05.tar.bz2
ayatana-indicator-power-d6159805fc552643902321b3d41d1a0a53594f05.zip
add lp:~charlesk/indicator-power/lp-1256872
-rw-r--r--src/service.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/service.c b/src/service.c
index 405ad96..1d8ba3e 100644
--- a/src/service.c
+++ b/src/service.c
@@ -375,7 +375,7 @@ create_header_state (IndicatorPowerService * self)
***/
static void
-append_device_to_menu (GMenu * menu, const IndicatorPowerDevice * device)
+append_device_to_menu (GMenu * menu, const IndicatorPowerDevice * device, int profile)
{
const UpDeviceKind kind = indicator_power_device_get_kind (device);
@@ -386,7 +386,7 @@ append_device_to_menu (GMenu * menu, const IndicatorPowerDevice * device)
GIcon * icon;
label = indicator_power_device_get_readable_text (device);
- item = g_menu_item_new (label, "indicator.activate-statistics");
+ item = g_menu_item_new (label, NULL);
g_free (label);
if ((icon = indicator_power_device_get_gicon (device)))
@@ -404,8 +404,11 @@ append_device_to_menu (GMenu * menu, const IndicatorPowerDevice * device)
g_object_unref (icon);
}
- g_menu_item_set_action_and_target(item, "indicator.activate-statistics", "s",
- indicator_power_device_get_object_path (device));
+ if (profile == PROFILE_DESKTOP)
+ {
+ g_menu_item_set_action_and_target(item, "indicator.activate-statistics", "s",
+ indicator_power_device_get_object_path (device));
+ }
g_menu_append_item (menu, item);
g_object_unref (item);
@@ -414,13 +417,13 @@ append_device_to_menu (GMenu * menu, const IndicatorPowerDevice * device)
static GMenuModel *
-create_desktop_devices_section (IndicatorPowerService * self)
+create_desktop_devices_section (IndicatorPowerService * self, int profile)
{
GList * l;
GMenu * menu = g_menu_new ();
for (l=self->priv->devices; l!=NULL; l=l->next)
- append_device_to_menu (menu, l->data);
+ append_device_to_menu (menu, l->data, profile);
return G_MENU_MODEL (menu);
}
@@ -595,8 +598,8 @@ rebuild_now (IndicatorPowerService * self, guint sections)
if (sections & SECTION_DEVICES)
{
- rebuild_section (desktop->submenu, 0, create_desktop_devices_section (self));
- rebuild_section (greeter->submenu, 0, create_desktop_devices_section (self));
+ rebuild_section (desktop->submenu, 0, create_desktop_devices_section (self, PROFILE_DESKTOP));
+ rebuild_section (greeter->submenu, 0, create_desktop_devices_section (self, PROFILE_DESKTOP_GREETER));
}
if (sections & SECTION_SETTINGS)
@@ -647,12 +650,12 @@ create_menu (IndicatorPowerService * self, int profile)
break;
case PROFILE_DESKTOP:
- sections[n++] = create_desktop_devices_section (self);
+ sections[n++] = create_desktop_devices_section (self, PROFILE_DESKTOP);
sections[n++] = create_desktop_settings_section (self);
break;
case PROFILE_DESKTOP_GREETER:
- sections[n++] = create_desktop_devices_section (self);
+ sections[n++] = create_desktop_devices_section (self, PROFILE_DESKTOP_GREETER);
break;
}