diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2011-07-18 18:08:49 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2011-07-18 18:08:49 +0200 |
commit | 0e4c805aa984369a1aad72e1a6591d013edaf280 (patch) | |
tree | 96af21b24beba2a32d2cf8d7765a6cf9aed7dbb6 /src/app-indicator.c | |
parent | 414645578b18e3e7aa0aa2ea7509e9e3509bb836 (diff) | |
download | libayatana-appindicator-0e4c805aa984369a1aad72e1a6591d013edaf280.tar.gz libayatana-appindicator-0e4c805aa984369a1aad72e1a6591d013edaf280.tar.bz2 libayatana-appindicator-0e4c805aa984369a1aad72e1a6591d013edaf280.zip |
Add signal "secondary-activate" and emit it when needed
When a libappindicator app get the "SecondaryActivate" dbus
method call, the library redirects it to the app emitting
the "secondary-activate" signal.
This should be conform to the StatusNotifierItem specifications.
Diffstat (limited to 'src/app-indicator.c')
-rw-r--r-- | src/app-indicator.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/app-indicator.c b/src/app-indicator.c index bc08eea..c745641 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -104,8 +104,9 @@ enum { NEW_STATUS, NEW_LABEL, CONNECTION_CHANGED, - NEW_ICON_THEME_PATH, - SCROLL_EVENT, + NEW_ICON_THEME_PATH, + SCROLL_EVENT, + SECONDARY_ACTIVATE, LAST_SIGNAL }; @@ -508,8 +509,7 @@ app_indicator_class_init (AppIndicatorClass *klass) @arg1: How many steps the scroll wheel has taken @arg2: (type Gdk.ScrollDirection) Which direction the wheel went in - Signaled when there is a new icon set for the - object. + Signaled when the #AppIndicator receives a scroll event. */ signals[SCROLL_EVENT] = g_signal_new (APP_INDICATOR_SIGNAL_SCROLL_EVENT, G_TYPE_FROM_CLASS(klass), @@ -519,6 +519,23 @@ app_indicator_class_init (AppIndicatorClass *klass) _application_service_marshal_VOID__INT_UINT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT); + /** + AppIndicator::secondary-activate: + @arg0: The #AppIndicator object + @arg1: The x pointer position of the secondary activation + @arg2: The y pointer position of the secondary activation + + Signaled when the #AppIndicator receives a secondary activate event + (i.e. a middle-click over the #AppIndicator icon/label). + */ + signals[SECONDARY_ACTIVATE] = g_signal_new (APP_INDICATOR_SIGNAL_SECONDARY_ACTIVATE, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AppIndicatorClass, secondary_activate), + NULL, NULL, + _application_service_marshal_VOID__INT_INT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); + /* DBus interfaces */ if (item_node_info == NULL) { GError * error = NULL; @@ -1011,6 +1028,11 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, delta = ABS(delta); g_signal_emit(app, signals[SCROLL_EVENT], 0, delta, direction); + } else if (g_strcmp0(method, "SecondaryActivate") == 0) { + gint x, y; + + g_variant_get(params, "(ii)", &x, &y); + g_signal_emit(app, signals[SECONDARY_ACTIVATE], 0, x, y); } else { g_warning("Calling method '%s' on the app-indicator and it's unknown", method); } |