aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2011-07-18 18:08:49 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2011-07-18 18:08:49 +0200
commit0e4c805aa984369a1aad72e1a6591d013edaf280 (patch)
tree96af21b24beba2a32d2cf8d7765a6cf9aed7dbb6
parent414645578b18e3e7aa0aa2ea7509e9e3509bb836 (diff)
downloadlibayatana-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.
-rw-r--r--src/app-indicator.c30
-rw-r--r--src/app-indicator.h23
-rw-r--r--src/application-service-marshal.list1
-rw-r--r--src/notification-item.xml4
4 files changed, 46 insertions, 12 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);
}
diff --git a/src/app-indicator.h b/src/app-indicator.h
index f96212d..32aa2dd 100644
--- a/src/app-indicator.h
+++ b/src/app-indicator.h
@@ -118,6 +118,7 @@ G_BEGIN_DECLS
#define APP_INDICATOR_SIGNAL_NEW_LABEL "new-label"
#define APP_INDICATOR_SIGNAL_CONNECTION_CHANGED "connection-changed"
#define APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH "new-icon-theme-path"
+#define APP_INDICATOR_SIGNAL_SECONDARY_ACTIVATE "secondary-activate"
#define APP_INDICATOR_SIGNAL_SCROLL_EVENT "scroll-event"
/**
@@ -170,7 +171,10 @@ typedef struct _AppIndicatorPrivate AppIndicatorPrivate;
@new_label: Slot for #AppIndicator::new-label.
@connection_changed: Slot for #AppIndicator::connection-changed.
@scroll_event: Slot for #AppIndicator::scroll-event
- @app_indicator_reserved_ats: Reserved for future use.
+ @secondary_activate: Slot for #AppIndicator::secondary-activate.
+ This signal is generally called on middle-click over the #AppIndicator,
+ it's meant to be used only for advanced actions, which must be
+ accessible also via menu items or any other platform-independent controls.
@fallback: Function that gets called to make a #GtkStatusIcon when
there is no Application Indicator area available.
@unfallback: The function that gets called if an Application
@@ -206,16 +210,19 @@ struct _AppIndicatorClass {
gpointer user_data);
/* Local Signals */
- void (* connection_changed) (AppIndicator * indicator,
- gboolean connected,
- gpointer user_data);
+ void (* connection_changed) (AppIndicator *indicator,
+ gboolean connected,
+ gpointer user_data);
- void (* scroll_event) (AppIndicator * indicator,
- gint delta,
+ void (* scroll_event) (AppIndicator *indicator,
+ gint delta,
GdkScrollDirection direction,
- gpointer user_data);
+ gpointer user_data);
- void (*app_indicator_reserved_ats)(void);
+ void (* secondary_activate) (AppIndicator *indicator,
+ gint x,
+ gint y,
+ gpointer user_data);
/* Overridable Functions */
GtkStatusIcon * (*fallback) (AppIndicator * indicator);
diff --git a/src/application-service-marshal.list b/src/application-service-marshal.list
index 39a55fe..ae3aa6f 100644
--- a/src/application-service-marshal.list
+++ b/src/application-service-marshal.list
@@ -22,3 +22,4 @@ VOID: INT, STRING
VOID: STRING, STRING
VOID: BOOL, STRING, OBJECT
VOID: INT, UINT
+VOID: INT, INT
diff --git a/src/notification-item.xml b/src/notification-item.xml
index bbf77c5..0cf043e 100644
--- a/src/notification-item.xml
+++ b/src/notification-item.xml
@@ -23,6 +23,10 @@
<arg type="i" name="delta" direction="in" />
<arg type="s" name="orientation" direction="in" />
</method>
+ <method name="SecondaryActivate">
+ <arg type="i" name="x" direction="in" />
+ <arg type="i" name="y" direction="in" />
+ </method>
<!-- Signals -->
<signal name="NewIcon">