aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCalum Lind <calumlind@gmail.com>2013-11-27 19:44:55 +0000
committerCalum Lind <calumlind@gmail.com>2013-11-27 19:44:55 +0000
commit54684163043cba634f473db5181fb54ed893270d (patch)
tree76486862dc8d366e0c22fe8021e4160a9f00bc37 /src
parent6c9f30f1e5ee6788369e484c6f995802e0da3915 (diff)
downloadayatana-indicator-power-54684163043cba634f473db5181fb54ed893270d.tar.gz
ayatana-indicator-power-54684163043cba634f473db5181fb54ed893270d.tar.bz2
ayatana-indicator-power-54684163043cba634f473db5181fb54ed893270d.zip
Focus to battery tab when opening in gnome-power-statistics
Diffstat (limited to 'src')
-rw-r--r--src/service.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/service.c b/src/service.c
index c70723a..85ac263 100644
--- a/src/service.c
+++ b/src/service.c
@@ -369,11 +369,15 @@ append_device_to_menu (GMenu * menu, const IndicatorPowerDevice * device)
{
GIcon * icon;
char * label;
+ char * action;
GMenuItem * menu_item;
icon = indicator_power_device_get_gicon (device);
label = indicator_power_device_get_label (device);
- menu_item = g_menu_item_new (label, "indicator.activate-statistics");
+ action = g_strconcat ("indicator.activate-statistics::",
+ indicator_power_device_get_object_path (device), NULL);
+ menu_item = g_menu_item_new (label, action);
+ g_free (action);
if (icon != NULL)
g_menu_item_set_attribute_value (menu_item,
@@ -687,10 +691,13 @@ on_settings_activated (GSimpleAction * a G_GNUC_UNUSED,
static void
on_statistics_activated (GSimpleAction * a G_GNUC_UNUSED,
- GVariant * param G_GNUC_UNUSED,
+ GVariant * param,
gpointer gself G_GNUC_UNUSED)
{
- execute_command ("gnome-power-statistics");
+ char *cmd = g_strconcat ("gnome-power-statistics", " --device ",
+ g_variant_get_string (param, NULL), NULL);
+ execute_command (cmd);
+ g_free (cmd);
}
static void
@@ -743,7 +750,7 @@ init_gactions (IndicatorPowerService * self)
GActionEntry entries[] = {
{ "activate-settings", on_settings_activated },
{ "activate-phone-settings", on_phone_settings_activated },
- { "activate-statistics", on_statistics_activated }
+ { "activate-statistics", on_statistics_activated, "s" }
};
p->actions = g_simple_action_group_new ();