aboutsummaryrefslogtreecommitdiff
path: root/libindicator
diff options
context:
space:
mode:
Diffstat (limited to 'libindicator')
-rw-r--r--libindicator/indicator-ng.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/libindicator/indicator-ng.c b/libindicator/indicator-ng.c
index 3e63dcd..3971129 100644
--- a/libindicator/indicator-ng.c
+++ b/libindicator/indicator-ng.c
@@ -34,6 +34,7 @@ struct _IndicatorNg
gchar *profile;
gchar *header_action;
gchar *scroll_action;
+ gchar *secondary_action;
gint position;
guint name_watch_id;
@@ -160,6 +161,7 @@ indicator_ng_finalize (GObject *object)
g_free (self->accessible_desc);
g_free (self->header_action);
g_free (self->scroll_action);
+ g_free (self->secondary_action);
G_OBJECT_CLASS (indicator_ng_parent_class)->finalize (object);
}
@@ -197,6 +199,22 @@ indicator_ng_entry_scrolled (IndicatorObject *io,
}
}
+void
+indicator_ng_secondary_activate (IndicatorObject *io,
+ IndicatorObjectEntry *entry,
+ guint timestamp,
+ gpointer user_data)
+{
+ IndicatorNg *self = INDICATOR_NG (io);
+
+ g_message ("secondary: %s", self->secondary_action);
+
+ if (self->actions && self->secondary_action)
+ {
+ g_action_group_activate_action (self->actions, self->secondary_action, NULL);
+ }
+}
+
static void
indicator_ng_set_accessible_desc (IndicatorNg *self,
const gchar *accessible_desc)
@@ -352,6 +370,7 @@ indicator_ng_menu_changed (GMenuModel *menu,
{
g_clear_pointer (&self->header_action, g_free);
g_clear_pointer (&self->scroll_action, g_free);
+ g_clear_pointer (&self->secondary_action, g_free);
if (indicator_ng_menu_item_is_of_type (self->menu, 0, "com.canonical.indicator.root"))
{
@@ -372,6 +391,13 @@ indicator_ng_menu_changed (GMenuModel *menu,
g_free (action);
}
+ if (g_menu_model_get_item_attribute (self->menu, 0, "x-canonical-secondary-action", "s", &action))
+ {
+ if (g_str_has_prefix (action, "indicator."))
+ self->secondary_action = g_strdup (action + strlen ("indicator."));
+ g_free (action);
+ }
+
popup = g_menu_model_get_item_link (self->menu, 0, G_MENU_LINK_SUBMENU);
if (popup)
{
@@ -597,6 +623,7 @@ indicator_ng_class_init (IndicatorNgClass *class)
io_class->get_entries = indicator_ng_get_entries;
io_class->get_position = indicator_ng_get_position;
io_class->entry_scrolled = indicator_ng_entry_scrolled;
+ io_class->secondary_activate = indicator_ng_secondary_activate;
properties[PROP_SERVICE_FILE] = g_param_spec_string ("service-file",
"Service file",