From 0e4c805aa984369a1aad72e1a6591d013edaf280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 18 Jul 2011 18:08:49 +0200 Subject: 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. --- src/app-indicator.c | 30 ++++++++++++++++++++++++++---- src/app-indicator.h | 23 +++++++++++++++-------- src/application-service-marshal.list | 1 + src/notification-item.xml | 4 ++++ 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 @@ + + + + -- cgit v1.2.3 From 4574948f9633981df5629a99679683972ab2adae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 18 Jul 2011 18:10:58 +0200 Subject: mono bindings: added SecondaryActivate support. Updated the example too. --- bindings/mono/examples/IndicatorExample.cs | 4 ++++ bindings/mono/libappindicator-api.metadata | 2 ++ 2 files changed, 6 insertions(+) diff --git a/bindings/mono/examples/IndicatorExample.cs b/bindings/mono/examples/IndicatorExample.cs index c18a665..397049b 100644 --- a/bindings/mono/examples/IndicatorExample.cs +++ b/bindings/mono/examples/IndicatorExample.cs @@ -47,6 +47,10 @@ public class IndicatorExample indicator.Menu = menu; indicator.Menu.ShowAll (); + indicator.SecondaryActivate += delegate { + System.Console.WriteLine ("Got secondary activate event"); + }; + win.ShowAll (); Application.Run (); diff --git a/bindings/mono/libappindicator-api.metadata b/bindings/mono/libappindicator-api.metadata index e610c88..c3c81cd 100644 --- a/bindings/mono/libappindicator-api.metadata +++ b/bindings/mono/libappindicator-api.metadata @@ -11,6 +11,8 @@ new-accessible-desc ConnectionChanged connection-changed + SecondaryActivate + secondary-activate ScrollEvent scroll-event NewIcon -- cgit v1.2.3 From d24b2f255e7135ceacd1ab7388e514f5f2b5edcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 18 Jul 2011 18:11:33 +0200 Subject: Vala bindings example: added secondary_activate --- bindings/vala/examples/indicator-example.vala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala index 621c962..b98498a 100644 --- a/bindings/vala/examples/indicator-example.vala +++ b/bindings/vala/examples/indicator-example.vala @@ -56,6 +56,14 @@ public class IndicatorExample { indicator.set_menu(menu); + indicator.secondary_activate.connect(() => { + print("Got secondary_activate event\n"); + if (indicator.get_status() != IndicatorStatus.ACTIVE) + indicator.set_status(IndicatorStatus.ACTIVE); + else + indicator.set_status(IndicatorStatus.ATTENTION); + }); + win.show_all(); Gtk.main(); -- cgit v1.2.3 From 383469d022e9b0c9a08321c7ec9c186fc09c1a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 18 Jul 2011 18:13:09 +0200 Subject: examples: add secondary-activate signal usage to Vala and C --- example/simple-client-vala.vala | 7 +++++++ example/simple-client.c | 14 +++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/example/simple-client-vala.vala b/example/simple-client-vala.vala index 61e0c2f..c0adf5b 100644 --- a/example/simple-client-vala.vala +++ b/example/simple-client-vala.vala @@ -92,6 +92,13 @@ class SimpleClient { print(@"Got scroll event! delta: $delta, direction: $direction\n"); }); + ci.secondary_activate.connect((x, y) => { + print(@"Got secondary activate event at $(x)x$(y)\n"); + + if (ci.get_status() == IndicatorStatus.ATTENTION) + ci.set_status(IndicatorStatus.ACTIVE); + }); + Timeout.add_seconds(1, () => { percentage = (percentage + 1) % 100; if (can_haz_label) { diff --git a/example/simple-client.c b/example/simple-client.c index 9e63e14..32e7240 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -98,11 +98,20 @@ image_clicked_cb (GtkWidget *widget, gpointer data) } static void -scroll_event_cb (AppIndicator * ci, gint delta, guint direction) +scroll_event_cb (AppIndicator * ci, gint delta, guint direction, gpointer data) { g_print("Got scroll event! delta: %d, direction: %d\n", delta, direction); } +static void +secondary_activate_cb (AppIndicator * ci, gint x, gint y, gpointer data) +{ + g_print("Got secondary activate event at %dx%d\n", x, y); + + if (app_indicator_get_status (ci) == APP_INDICATOR_STATUS_ATTENTION) + app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); +} + static void append_submenu (GtkWidget *item) { @@ -171,6 +180,9 @@ main (int argc, char ** argv) g_signal_connect (ci, "scroll-event", G_CALLBACK (scroll_event_cb), NULL); + g_signal_connect (ci, "secondary-activate", + G_CALLBACK (secondary_activate_cb), NULL); + g_timeout_add_seconds(1, percent_change, ci); menu = gtk_menu_new (); -- cgit v1.2.3 From a758223f67a87b382d1484c650cdc1ac499dbc93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 18 Jul 2011 18:43:03 +0200 Subject: app-indicator: added middle click support for wrapper tray When a trayicon is used, the middle click over the icon is considered as a secondary activation. --- src/app-indicator.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/app-indicator.c b/src/app-indicator.c index c745641..229221d 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -179,6 +179,7 @@ static gboolean fallback_timer_expire (gpointer data); static GtkStatusIcon * fallback (AppIndicator * self); static void status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer data); static gboolean scroll_event_wrapper(GtkWidget *status_icon, GdkEventScroll *event, gpointer user_data); +static gboolean middle_click_wrapper(GtkWidget *status_icon, GdkEventButton *event, gpointer user_data); static void status_icon_changes (AppIndicator * self, gpointer data); static void status_icon_activate (GtkStatusIcon * icon, gpointer data); static void status_icon_menu_activate (GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data); @@ -1464,6 +1465,7 @@ fallback (AppIndicator * self) g_signal_connect(G_OBJECT(icon), "activate", G_CALLBACK(status_icon_activate), self); g_signal_connect(G_OBJECT(icon), "popup-menu", G_CALLBACK(status_icon_menu_activate), self); g_signal_connect(G_OBJECT(icon), "scroll-event", G_CALLBACK(scroll_event_wrapper), self); + g_signal_connect(G_OBJECT(icon), "button-release-event", G_CALLBACK(middle_click_wrapper), self); return icon; } @@ -1479,12 +1481,37 @@ status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer /* A wrapper for redirecting the scroll events to the app-indicator from status icon widget. */ static gboolean -scroll_event_wrapper(GtkWidget *status_icon, GdkEventScroll *event, gpointer data) +scroll_event_wrapper (GtkWidget *status_icon, GdkEventScroll *event, gpointer data) { g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); AppIndicator * app = APP_INDICATOR(data); g_signal_emit(app, signals[SCROLL_EVENT], 0, 1, event->direction); + return TRUE; +} + +static gboolean +middle_click_wrapper (GtkWidget *status_icon, GdkEventButton *event, gpointer data) +{ + g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); + AppIndicator * app = APP_INDICATOR(data); + + if (event->button == 2 && event->type == GDK_BUTTON_RELEASE) { + GtkAllocation alloc; + gint px = event->x; + gint py = event->y; + gtk_widget_get_allocation (status_icon, &alloc); + + if (px >= 0 && px < alloc.width && py >= 0 && py < alloc.height) { + gint wx, wy; + gdk_window_get_origin(event->window, &wx, &wy); + + g_signal_emit(app, signals[SCROLL_EVENT], wx+px, wy+py); + + return TRUE; + } + } + return FALSE; } @@ -1557,6 +1584,7 @@ unfallback (AppIndicator * self, GtkStatusIcon * status_icon) g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_status_wrapper, status_icon); g_signal_handlers_disconnect_by_func(G_OBJECT(self), status_icon_changes, status_icon); g_signal_handlers_disconnect_by_func(G_OBJECT(self), scroll_event_wrapper, status_icon); + g_signal_handlers_disconnect_by_func(G_OBJECT(self), middle_click_wrapper, status_icon); gtk_status_icon_set_visible(status_icon, FALSE); g_object_unref(G_OBJECT(status_icon)); return; -- cgit v1.2.3 From d54d1e78545ee8cbeb7d3b0d276665290de7f296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 19 Jul 2011 20:25:58 +0200 Subject: Call the right signal on middle-click over the tray icon! --- src/app-indicator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app-indicator.c b/src/app-indicator.c index 229221d..30e2e0a 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1506,7 +1506,7 @@ middle_click_wrapper (GtkWidget *status_icon, GdkEventButton *event, gpointer da gint wx, wy; gdk_window_get_origin(event->window, &wx, &wy); - g_signal_emit(app, signals[SCROLL_EVENT], wx+px, wy+py); + g_signal_emit(app, signals[SECONDARY_ACTIVATE], wx+px, wy+py); return TRUE; } -- cgit v1.2.3 From 8f71358509ec3e2a6e2fe633c4dfc07c58f450ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 20 Jul 2011 02:57:51 +0200 Subject: app-indicator: Move from "secondary-activate" signal to secondary_activate target To avoid appindicators writers to use the "secondary-activate" event to perform actions that can't be done via a menu item we added a new API: - app_indicator_set_secondary_activate_target - app_indicator_get_secondary_activate_target With it, an appindicator writer can simply define a new GtkWidget that will be activated when a secondary activation will occur. The GtkWidget must be a sensitive and visible inner child of the appindicator MenuItem. --- src/app-indicator.c | 150 +++++++++++++++++++++++++++++++++++++++++----------- src/app-indicator.h | 26 ++++----- 2 files changed, 131 insertions(+), 45 deletions(-) diff --git a/src/app-indicator.c b/src/app-indicator.c index 30e2e0a..1dc91d8 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -77,6 +77,8 @@ struct _AppIndicatorPrivate { gchar *icon_theme_path; DbusmenuServer *menuservice; GtkWidget *menu; + GtkWidget *sec_activate_target; + gboolean sec_activate_enabled; guint32 ordering_index; gchar * label; gchar * label_guide; @@ -106,7 +108,6 @@ enum { CONNECTION_CHANGED, NEW_ICON_THEME_PATH, SCROLL_EVENT, - SECONDARY_ACTIVATE, LAST_SIGNAL }; @@ -187,6 +188,7 @@ static void unfallback (AppIndicator * self, GtkStatusIcon * status_icon); static gchar * append_panel_icon_suffix (const gchar * icon_name); static void watcher_owner_changed (GObject * obj, GParamSpec * pspec, gpointer user_data); static void theme_changed_cb (GtkIconTheme * theme, gpointer user_data); +static void sec_activate_target_parent_changed(GtkWidget *menuitem, GtkWidget *old_parent, gpointer user_data); static GVariant * bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * property, GError ** error, gpointer user_data); static void bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data); static void bus_creation (GObject * obj, GAsyncResult * res, gpointer user_data); @@ -520,23 +522,6 @@ 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; @@ -606,6 +591,9 @@ app_indicator_init (AppIndicator *self) priv->shorties = NULL; + priv->sec_activate_target = NULL; + priv->sec_activate_enabled = FALSE; + /* Start getting the session bus */ g_object_ref(self); /* ref for the bus creation callback */ g_bus_get(G_BUS_TYPE_SESSION, NULL, bus_creation, self); @@ -681,6 +669,12 @@ app_indicator_dispose (GObject *object) priv->connection = NULL; } + if (priv->sec_activate_target != NULL) { + g_signal_handlers_disconnect_by_func (priv->sec_activate_target, sec_activate_target_parent_changed, self); + g_object_unref(G_OBJECT(priv->sec_activate_target)); + priv->sec_activate_target = NULL; + } + g_signal_handlers_disconnect_by_func(gtk_icon_theme_get_default(), G_CALLBACK(theme_changed_cb), self); G_OBJECT_CLASS (app_indicator_parent_class)->dispose (object); @@ -1008,6 +1002,7 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, g_return_if_fail(IS_APP_INDICATOR(user_data)); AppIndicator * app = APP_INDICATOR(user_data); + AppIndicatorPrivate * priv = app->priv; GVariant * retval = NULL; if (g_strcmp0(method, "Scroll") == 0) { @@ -1030,10 +1025,14 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, 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); + GtkWidget *menuitem = priv->sec_activate_target; + + if (priv->sec_activate_enabled && menuitem && + gtk_widget_get_visible (menuitem) && + gtk_widget_get_sensitive (menuitem)) + { + gtk_widget_activate (menuitem); + } } else { g_warning("Calling method '%s' on the app-indicator and it's unknown", method); } @@ -1495,19 +1494,21 @@ middle_click_wrapper (GtkWidget *status_icon, GdkEventButton *event, gpointer da { g_return_val_if_fail(IS_APP_INDICATOR(data), FALSE); AppIndicator * app = APP_INDICATOR(data); + AppIndicatorPrivate *priv = app->priv; if (event->button == 2 && event->type == GDK_BUTTON_RELEASE) { GtkAllocation alloc; gint px = event->x; gint py = event->y; gtk_widget_get_allocation (status_icon, &alloc); - - if (px >= 0 && px < alloc.width && py >= 0 && py < alloc.height) { - gint wx, wy; - gdk_window_get_origin(event->window, &wx, &wy); - - g_signal_emit(app, signals[SECONDARY_ACTIVATE], wx+px, wy+py); - + GtkWidget *menuitem = priv->sec_activate_target; + + if (px >= 0 && px < alloc.width && py >= 0 && py < alloc.height && + priv->sec_activate_enabled && menuitem && + gtk_widget_get_visible (menuitem) && + gtk_widget_get_sensitive (menuitem)) + { + gtk_widget_activate (menuitem); return TRUE; } } @@ -1607,6 +1608,38 @@ append_panel_icon_suffix (const gchar *icon_name) return long_name; } +static gboolean +widget_is_menu_child(AppIndicator * self, GtkWidget *child) +{ + g_return_val_if_fail(IS_APP_INDICATOR(self), FALSE); + + if (!self->priv->menu) return FALSE; + if (!child) return FALSE; + + GtkWidget *parent; + + while ((parent = gtk_widget_get_parent(child))) { + if (parent == self->priv->menu) + return TRUE; + + if (GTK_IS_MENU(parent)) + child = gtk_menu_get_attach_widget(GTK_MENU(parent)); + else + child = parent; + } + + return FALSE; +} + +static void +sec_activate_target_parent_changed(GtkWidget *menuitem, GtkWidget *old_parent, + gpointer data) +{ + g_return_if_fail(IS_APP_INDICATOR(data)); + AppIndicator *self = data; + self->priv->sec_activate_enabled = widget_is_menu_child(self, menuitem); +} + /* ************************* */ /* Public Functions */ @@ -1996,6 +2029,8 @@ app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) setup_dbusmenu (self); + priv->sec_activate_enabled = widget_is_menu_child (self, priv->sec_activate_target); + check_connect (self); return; @@ -2022,6 +2057,45 @@ app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index) return; } +/** + app_indicator_set_secondary_activate_target: + @self: The #AppIndicator + @menuitem: A #GtkWidget to be activated on secondary activation + + Set the @menuitem to be activated when a secondary activation event (i.e. a + middle-click) is emitted over the #AppIndicator icon/label. + + The @menuitem can be also a complex #GtkWidget, but to get activated when + a secondary activation occurs in the #Appindicator, it must be a visible and + active child (or inner-child) of the #AppIndicator:menu. + + Setting @menuitem to %NULL causes to disable this feature. +**/ +void +app_indicator_set_secondary_activate_target (AppIndicator *self, GtkWidget *menuitem) +{ + g_return_if_fail (IS_APP_INDICATOR (self)); + AppIndicatorPrivate *priv = self->priv; + + if (menuitem == NULL) { + if (priv->sec_activate_target) { + g_object_unref(G_OBJECT(priv->sec_activate_target)); + g_signal_handlers_disconnect_by_func (priv->sec_activate_target, + sec_activate_target_parent_changed, + self); + priv->sec_activate_target = NULL; + } + + return; + } + + g_return_if_fail (GTK_IS_WIDGET (menuitem)); + + priv->sec_activate_target = g_object_ref(G_OBJECT(menuitem)); + priv->sec_activate_enabled = widget_is_menu_child(self, menuitem); + g_signal_connect(menuitem, "parent-set", G_CALLBACK(sec_activate_target_parent_changed), self); +} + /** app_indicator_get_id: @self: The #AppIndicator object to use @@ -2157,7 +2231,7 @@ app_indicator_get_attention_icon_desc (AppIndicator *self) Gets the menu being used for this application indicator. Wrapper function for property #AppIndicator:menu. - Return value: (transfer none): A #GtkMenu object or %NULL if one hasn't been set. + Return value: (transfer full): A #GtkMenu object or %NULL if one hasn't been set. */ GtkMenu * app_indicator_get_menu (AppIndicator *self) @@ -2223,6 +2297,22 @@ app_indicator_get_ordering_index (AppIndicator *self) } } +/** + app_indicator_get_secondary_activate_target: + @self: The #AppIndicator object to use + + Gets the menuitem being called on secondary-activate event. + + Return value: (transfer full): A #GtkWidget object or %NULL if none has been set. +*/ +GtkWidget * +app_indicator_get_secondary_activate_target (AppIndicator *self) +{ + g_return_val_if_fail (IS_APP_INDICATOR (self), NULL); + + return GTK_WIDGET(self->priv->sec_activate_target); +} + #define APP_INDICATOR_SHORTY_NICK "app-indicator-shorty-nick" /* Callback when an item from the desktop shortcuts gets diff --git a/src/app-indicator.h b/src/app-indicator.h index 32aa2dd..09b7520 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -118,7 +118,6 @@ 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" /** @@ -171,10 +170,7 @@ 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 - @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. + @app_indicator_reserved_ats: Reserved for future use. @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 @@ -210,19 +206,16 @@ 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 (* secondary_activate) (AppIndicator *indicator, - gint x, - gint y, - gpointer user_data); + void (*app_indicator_reserved_ats)(void); /* Overridable Functions */ GtkStatusIcon * (*fallback) (AppIndicator * indicator); @@ -291,6 +284,8 @@ void app_indicator_set_icon_theme_path(AppIndicator const gchar *icon_theme_path); void app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index); +void app_indicator_set_secondary_activate_target (AppIndicator *self, + GtkWidget *menuitem); /* Get properties */ const gchar * app_indicator_get_id (AppIndicator *self); @@ -305,6 +300,7 @@ GtkMenu * app_indicator_get_menu (AppIndic const gchar * app_indicator_get_label (AppIndicator *self); const gchar * app_indicator_get_label_guide (AppIndicator *self); guint32 app_indicator_get_ordering_index (AppIndicator *self); +GtkWidget * app_indicator_get_secondary_activate_target (AppIndicator *self); /* Helpers */ void app_indicator_build_menu_from_desktop (AppIndicator * self, -- cgit v1.2.3 From 6a52781539b7ff689620fdb07043664ed457a10b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 20 Jul 2011 03:16:53 +0200 Subject: mono bindings: updated API and example --- bindings/mono/examples/IndicatorExample.cs | 11 +++++++---- bindings/mono/libappindicator-api.metadata | 2 -- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bindings/mono/examples/IndicatorExample.cs b/bindings/mono/examples/IndicatorExample.cs index 397049b..7413c54 100644 --- a/bindings/mono/examples/IndicatorExample.cs +++ b/bindings/mono/examples/IndicatorExample.cs @@ -41,15 +41,18 @@ public class IndicatorExample indicator.Status = Status.Attention; Menu menu = new Menu (); - menu.Append (new MenuItem ("Foo")); + var foo = new MenuItem ("Foo"); + menu.Append (foo); + foo.Activated += delegate { + System.Console.WriteLine ("Foo item has been activated"); + }; + menu.Append (new MenuItem ("Bar")); indicator.Menu = menu; indicator.Menu.ShowAll (); - indicator.SecondaryActivate += delegate { - System.Console.WriteLine ("Got secondary activate event"); - }; + indicator.SecondaryActivateTarget = foo; win.ShowAll (); diff --git a/bindings/mono/libappindicator-api.metadata b/bindings/mono/libappindicator-api.metadata index c3c81cd..e610c88 100644 --- a/bindings/mono/libappindicator-api.metadata +++ b/bindings/mono/libappindicator-api.metadata @@ -11,8 +11,6 @@ new-accessible-desc ConnectionChanged connection-changed - SecondaryActivate - secondary-activate ScrollEvent scroll-event NewIcon -- cgit v1.2.3 From a3812f9b8bfe467873bfe261a161b868c2b42118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 20 Jul 2011 03:20:54 +0200 Subject: vala: updated example to use the new API --- bindings/vala/examples/indicator-example.vala | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/bindings/vala/examples/indicator-example.vala b/bindings/vala/examples/indicator-example.vala index b98498a..7bb1d7d 100644 --- a/bindings/vala/examples/indicator-example.vala +++ b/bindings/vala/examples/indicator-example.vala @@ -47,22 +47,15 @@ public class IndicatorExample { item.show(); menu.append(item); - item = new MenuItem.with_label("Bar"); + var bar = item = new MenuItem.with_label("Bar"); item.show(); item.activate.connect(() => { - indicator.set_status(IndicatorStatus.ATTENTION); + indicator.set_status(IndicatorStatus.ACTIVE); }); menu.append(item); indicator.set_menu(menu); - - indicator.secondary_activate.connect(() => { - print("Got secondary_activate event\n"); - if (indicator.get_status() != IndicatorStatus.ACTIVE) - indicator.set_status(IndicatorStatus.ACTIVE); - else - indicator.set_status(IndicatorStatus.ATTENTION); - }); + indicator.set_secondary_activate_target(bar); win.show_all(); -- cgit v1.2.3 From beb4f164b808f2dbb3fffa6ed85c931c2710a924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 20 Jul 2011 03:32:35 +0200 Subject: examples: use the set_secondary_activate_target API --- example/simple-client-vala.vala | 20 ++++--- example/simple-client.c | 113 ++++++++++++++++++---------------------- 2 files changed, 63 insertions(+), 70 deletions(-) diff --git a/example/simple-client-vala.vala b/example/simple-client-vala.vala index c0adf5b..8d661ce 100644 --- a/example/simple-client-vala.vala +++ b/example/simple-client-vala.vala @@ -72,6 +72,17 @@ class SimpleClient { menu.append(mi); mi.activate.connect(() => { print("Sub3\n"); }); + mi = new MenuItem.with_label("Toggle Attention"); + menu.append(mi); + mi.activate.connect(() => { + if (ci.get_status() == IndicatorStatus.ATTENTION) + ci.set_status(IndicatorStatus.ACTIVE); + else + ci.set_status(IndicatorStatus.ATTENTION); + }); + + ci.set_secondary_activate_target(mi); + menu.show_all(); item.set_submenu(menu); } @@ -92,13 +103,6 @@ class SimpleClient { print(@"Got scroll event! delta: $delta, direction: $direction\n"); }); - ci.secondary_activate.connect((x, y) => { - print(@"Got secondary activate event at $(x)x$(y)\n"); - - if (ci.get_status() == IndicatorStatus.ATTENTION) - ci.set_status(IndicatorStatus.ACTIVE); - }); - Timeout.add_seconds(1, () => { percentage = (percentage + 1) % 100; if (can_haz_label) { @@ -116,7 +120,7 @@ class SimpleClient { chk.show(); var radio = new RadioMenuItem.with_label(new SList(), "2"); - radio.activate.connect(() => { print("2\n"); }); + radio.activate.connect(() => { print("2\n"); }); menu.append(radio); radio.show(); diff --git a/example/simple-client.c b/example/simple-client.c index 32e7240..dcee81b 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -31,46 +31,46 @@ static gboolean can_haz_label = TRUE; static void label_toggle_cb (GtkWidget * widget, gpointer data) { - can_haz_label = !can_haz_label; + can_haz_label = !can_haz_label; - if (can_haz_label) { - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Hide label"); - } else { - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Show label"); - } + if (can_haz_label) { + gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Hide label"); + } else { + gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Show label"); + } - return; + return; } static void activate_clicked_cb (GtkWidget *widget, gpointer data) { - AppIndicator * ci = APP_INDICATOR(data); - - if (active) { - app_indicator_set_status (ci, APP_INDICATOR_STATUS_ATTENTION); - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "I'm okay now"); - active = FALSE; - } else { - app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); - gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Get Attention"); - active = TRUE; - } + AppIndicator * ci = APP_INDICATOR(data); + + if (active) { + app_indicator_set_status (ci, APP_INDICATOR_STATUS_ATTENTION); + gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "I'm okay now"); + active = FALSE; + } else { + app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); + gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Get Attention"); + active = TRUE; + } } static void local_icon_toggle_cb (GtkWidget *widget, gpointer data) { - AppIndicator * ci = APP_INDICATOR(data); + AppIndicator * ci = APP_INDICATOR(data); - if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { - app_indicator_set_icon_full(ci, LOCAL_ICON, "Local Icon"); - } else { - app_indicator_set_icon_full(ci, "indicator-messages", "System Icon"); - } + if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) { + app_indicator_set_icon_full(ci, LOCAL_ICON, "Local Icon"); + } else { + app_indicator_set_icon_full(ci, "indicator-messages", "System Icon"); + } - return; + return; } static void @@ -100,16 +100,7 @@ image_clicked_cb (GtkWidget *widget, gpointer data) static void scroll_event_cb (AppIndicator * ci, gint delta, guint direction, gpointer data) { - g_print("Got scroll event! delta: %d, direction: %d\n", delta, direction); -} - -static void -secondary_activate_cb (AppIndicator * ci, gint x, gint y, gpointer data) -{ - g_print("Got secondary activate event at %dx%d\n", x, y); - - if (app_indicator_get_status (ci) == APP_INDICATOR_STATUS_ATTENTION) - app_indicator_set_status(ci, APP_INDICATOR_STATUS_ACTIVE); + g_print("Got scroll event! delta: %d, direction: %d\n", delta, direction); } static void @@ -147,15 +138,15 @@ guint percentage = 0; static gboolean percent_change (gpointer user_data) { - percentage = (percentage + 1) % 100; - if (can_haz_label) { - gchar * percentstr = g_strdup_printf("%d%%", percentage + 1); - app_indicator_set_label (APP_INDICATOR(user_data), percentstr, "100%"); - g_free(percentstr); - } else { - app_indicator_set_label (APP_INDICATOR(user_data), NULL, NULL); - } - return TRUE; + percentage = (percentage + 1) % 100; + if (can_haz_label) { + gchar * percentstr = g_strdup_printf("%d%%", percentage + 1); + app_indicator_set_label (APP_INDICATOR(user_data), percentstr, "100%"); + g_free(percentstr); + } else { + app_indicator_set_label (APP_INDICATOR(user_data), NULL, NULL); + } + return TRUE; } int @@ -170,20 +161,17 @@ main (int argc, char ** argv) "indicator-messages", APP_INDICATOR_CATEGORY_APPLICATION_STATUS); - g_assert (IS_APP_INDICATOR (ci)); + g_assert (IS_APP_INDICATOR (ci)); g_assert (G_IS_OBJECT (ci)); - app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); - app_indicator_set_attention_icon_full(ci, "indicator-messages-new", "System Messages Icon Highlighted"); - app_indicator_set_label (ci, "1%", "100%"); + app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); + app_indicator_set_attention_icon_full(ci, "indicator-messages-new", "System Messages Icon Highlighted"); + app_indicator_set_label (ci, "1%", "100%"); - g_signal_connect (ci, "scroll-event", + g_signal_connect (ci, "scroll-event", G_CALLBACK (scroll_event_cb), NULL); - g_signal_connect (ci, "secondary-activate", - G_CALLBACK (secondary_activate_cb), NULL); - - g_timeout_add_seconds(1, percent_change, ci); + g_timeout_add_seconds(1, percent_change, ci); menu = gtk_menu_new (); GtkWidget *item = gtk_check_menu_item_new_with_label ("1"); @@ -207,37 +195,38 @@ main (int argc, char ** argv) g_signal_connect (toggle_item, "activate", G_CALLBACK (toggle_sensitivity_cb), item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), toggle_item); - gtk_widget_show(toggle_item); + gtk_widget_show(toggle_item); item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); g_signal_connect (item, "activate", G_CALLBACK (image_clicked_cb), NULL); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show(item); + gtk_widget_show(item); item = gtk_menu_item_new_with_label ("Get Attention"); g_signal_connect (item, "activate", G_CALLBACK (activate_clicked_cb), ci); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show(item); + gtk_widget_show(item); + app_indicator_set_secondary_activate_target(ci, item); item = gtk_menu_item_new_with_label ("Show label"); - label_toggle_cb(item, ci); + label_toggle_cb(item, ci); g_signal_connect (item, "activate", G_CALLBACK (label_toggle_cb), ci); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show(item); + gtk_widget_show(item); item = gtk_check_menu_item_new_with_label ("Set Local Icon"); g_signal_connect (item, "activate", G_CALLBACK (local_icon_toggle_cb), ci); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); - gtk_widget_show(item); + gtk_widget_show(item); app_indicator_set_menu (ci, GTK_MENU (menu)); - mainloop = g_main_loop_new(NULL, FALSE); - g_main_loop_run(mainloop); + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); - return 0; + return 0; } -- cgit v1.2.3 From 940f4ac6af7c3ef9e8adf92d7821d2104a2b27ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 20 Jul 2011 17:16:35 +0200 Subject: Fixed comments to correctly work with g-ir-scanner No more missing transfer warning (and relative missing bindings for some getting functions). --- src/Makefile.am | 1 + src/app-indicator.c | 703 ++++++++++++++++++++++++++-------------------------- src/app-indicator.h | 256 +++++++++---------- 3 files changed, 479 insertions(+), 481 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 8a74d66..a4bd27a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -148,6 +148,7 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) if HAVE_INTROSPECTION introspection_sources = \ + $(addprefix $(srcdir)/,app-indicator.c) \ $(addprefix $(srcdir)/,$(libappindicator_headers)) AppIndicator$(VER)-0.1.gir: libappindicator$(VER).la diff --git a/src/app-indicator.c b/src/app-indicator.c index 1dc91d8..aae8434 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -51,20 +51,18 @@ License version 3 and version 2.1 along with this program. If not, see #define PANEL_ICON_SUFFIX "panel" /** - AppIndicatorPrivate: - - All of the private data in an instance of a - application indicator. -*/ -/* Private Fields - @id: The ID of the indicator. Maps to AppIndicator:id. - @category: Which category the indicator is. Maps to AppIndicator:category. - @status: The status of the indicator. Maps to AppIndicator:status. - @icon_name: The name of the icon to use. Maps to AppIndicator:icon-name. - @attention_icon_name: The name of the attention icon to use. Maps to AppIndicator:attention-icon-name. - @menu: The menu for this indicator. Maps to AppIndicator:menu - @watcher_proxy: The proxy connection to the watcher we're connected to. If we're not connected to one this will be %NULL. -*/ + * AppIndicatorPrivate: + * All of the private data in an instance of an application indicator. + * + * Private Fields + * @id: The ID of the indicator. Maps to AppIndicator:id. + * @category: Which category the indicator is. Maps to AppIndicator:category. + * @status: The status of the indicator. Maps to AppIndicator:status. + * @icon_name: The name of the icon to use. Maps to AppIndicator:icon-name. + * @attention_icon_name: The name of the attention icon to use. Maps to AppIndicator:attention-icon-name. + * @menu: The menu for this indicator. Maps to AppIndicator:menu + * @watcher_proxy: The proxy connection to the watcher we're connected to. If we're not connected to one this will be %NULL. + */ struct _AppIndicatorPrivate { /*< Private >*/ /* Properties */ @@ -225,11 +223,11 @@ app_indicator_class_init (AppIndicatorClass *klass) /* Properties */ /** - AppIndicator:id: - - The ID for this indicator, which should be unique, but used consistently - by this program and its indicator. - */ + * AppIndicator:id: + * + * The ID for this indicator, which should be unique, but used consistently + * by this program and its indicator. + */ g_object_class_install_property (object_class, PROP_ID, g_param_spec_string(PROP_ID_S, @@ -239,11 +237,11 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); /** - AppIndicator:category: - - The type of indicator that this represents. Please don't use 'Other'. - Defaults to 'ApplicationStatus'. - */ + * AppIndicator:category: + * + * The type of indicator that this represents. Please don't use 'Other'. + * Defaults to 'ApplicationStatus'. + */ g_object_class_install_property (object_class, PROP_CATEGORY, g_param_spec_string (PROP_CATEGORY_S, @@ -253,11 +251,11 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY)); /** - AppIndicator:status: - - Whether the indicator is shown or requests attention. Defaults to - 'Passive'. - */ + * AppIndicator: + * + * Whether the indicator is shown or requests attention. Defaults to + * 'Passive'. + */ g_object_class_install_property (object_class, PROP_STATUS, g_param_spec_string (PROP_STATUS_S, @@ -267,10 +265,10 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:icon-name: - - The name of the regular icon that is shown for the indicator. - */ + * AppIndicator:icon-name: + * + * The name of the regular icon that is shown for the indicator. + */ g_object_class_install_property(object_class, PROP_ICON_NAME, g_param_spec_string (PROP_ICON_NAME_S, @@ -279,10 +277,10 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:icon-desc: - - The description of the regular icon that is shown for the indicator. - */ + * AppIndicator:icon-desc: + * + * The description of the regular icon that is shown for the indicator. + */ g_object_class_install_property(object_class, PROP_ICON_DESC, g_param_spec_string (PROP_ICON_DESC_S, @@ -292,11 +290,11 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:attention-icon-name: - - If the indicator sets it's status to %APP_INDICATOR_STATUS_ATTENTION - then this icon is shown. - */ + * AppIndicator:attention-icon-name: + * + * If the indicator sets it's status to %APP_INDICATOR_STATUS_ATTENTION + * then this icon is shown. + */ g_object_class_install_property (object_class, PROP_ATTENTION_ICON_NAME, g_param_spec_string (PROP_ATTENTION_ICON_NAME_S, @@ -305,11 +303,11 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:attention-icon-desc: - - If the indicator sets it's status to %APP_INDICATOR_STATUS_ATTENTION - then this textual description of the icon shown. - */ + * AppIndicator:attention-icon-desc: + * + * If the indicator sets it's status to %APP_INDICATOR_STATUS_ATTENTION + * then this textual description of the icon shown. + */ g_object_class_install_property (object_class, PROP_ATTENTION_ICON_DESC, g_param_spec_string (PROP_ATTENTION_ICON_DESC_S, @@ -318,11 +316,11 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:icon-theme-path: - - An additional place to look for icon names that may be installed by the - application. - */ + * AppIndicator:icon-theme-path: + * + * An additional place to look for icon names that may be installed by the + * application. + */ g_object_class_install_property(object_class, PROP_ICON_THEME_PATH, g_param_spec_string (PROP_ICON_THEME_PATH_S, @@ -332,11 +330,11 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT)); /** - AppIndicator:connected: - - Pretty simple, %TRUE if we have a reasonable expectation of being - displayed through this object. You should hide your TrayIcon if so. - */ + * AppIndicator:connected: + * + * Pretty simple, %TRUE if we have a reasonable expectation of being + * displayed through this object. You should hide your TrayIcon if so. + */ g_object_class_install_property (object_class, PROP_CONNECTED, g_param_spec_boolean (PROP_CONNECTED_S, @@ -345,15 +343,15 @@ app_indicator_class_init (AppIndicatorClass *klass) FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:label: - - A label that can be shown next to the string in the application - indicator. The label will not be shown unless there is an icon - as well. The label is useful for numerical and other frequently - updated information. In general, it shouldn't be shown unless a - user requests it as it can take up a significant amount of space - on the user's panel. This may not be shown in all visualizations. - */ + * AppIndicator:label: + * + * A label that can be shown next to the string in the application + * indicator. The label will not be shown unless there is an icon + * as well. The label is useful for numerical and other frequently + * updated information. In general, it shouldn't be shown unless a + * user requests it as it can take up a significant amount of space + * on the user's panel. This may not be shown in all visualizations. + */ g_object_class_install_property(object_class, PROP_LABEL, g_param_spec_string (PROP_LABEL_S, @@ -362,16 +360,16 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:label-guide: - - An optional string to provide guidance to the panel on how big - the #AppIndicator:label string could get. If this is set correctly - then the panel should never 'jiggle' as the string adjusts through - out the range of options. For instance, if you were providing a - percentage like "54% thrust" in #AppIndicator:label you'd want to - set this string to "100% thrust" to ensure space when Scotty can - get you enough power. - */ + * AppIndicator:label-guide: + * + * An optional string to provide guidance to the panel on how big + * the #AppIndicator:label string could get. If this is set correctly + * then the panel should never 'jiggle' as the string adjusts through + * out the range of options. For instance, if you were providing a + * percentage like "54% thrust" in #AppIndicator:label you'd want to + * set this string to "100% thrust" to ensure space when Scotty can + * get you enough power. + */ g_object_class_install_property(object_class, PROP_LABEL_GUIDE, g_param_spec_string (PROP_LABEL_GUIDE_S, @@ -380,17 +378,17 @@ app_indicator_class_init (AppIndicatorClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:ordering-index: - - The ordering index is an odd parameter, and if you think you don't need - it you're probably right. In general, the application indicator try - to place the applications in a recreatable place taking into account - which category they're in to try and group them. But, there are some - cases where you'd want to ensure indicators are next to each other. - To do that you can override the generated ordering index and replace it - with a new one. Again, you probably don't want to be doing this, but - in case you do, this is the way. - */ + * AppIndicator:ordering-index: + * + * The ordering index is an odd parameter, and if you think you don't need + * it you're probably right. In general, the application indicator try + * to place the applications in a recreatable place taking into account + * which category they're in to try and group them. But, there are some + * cases where you'd want to ensure indicators are next to each other. + * To do that you can override the generated ordering index and replace it + * with a new one. Again, you probably don't want to be doing this, but + * in case you do, this is the way. + */ g_object_class_install_property(object_class, PROP_ORDERING_INDEX, g_param_spec_uint (PROP_ORDERING_INDEX_S, @@ -400,11 +398,11 @@ app_indicator_class_init (AppIndicatorClass *klass) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** - AppIndicator:dbus-menu-server: - - A way to get the internal dbusmenu server if it is available. - This should only be used for testing. - */ + * AppIndicator:dbus-menu-server: + * + * A way to get the internal dbusmenu server if it is available. + * This should only be used for testing. + */ g_object_class_install_property(object_class, PROP_DBUS_MENU_SERVER, g_param_spec_object (PROP_DBUS_MENU_SERVER_S, @@ -416,11 +414,11 @@ app_indicator_class_init (AppIndicatorClass *klass) /* Signals */ /** - AppIndicator::new-icon: - @arg0: The #AppIndicator object - - Emitted when #AppIndicator:icon-name is changed - */ + * AppIndicator::new-icon: + * @arg0: The #AppIndicator object + * + * when #AppIndicator:icon-name is changed + */ signals[NEW_ICON] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -430,11 +428,11 @@ app_indicator_class_init (AppIndicatorClass *klass) G_TYPE_NONE, 0, G_TYPE_NONE); /** - AppIndicator::new-attention-icon: - @arg0: The #AppIndicator object - - Emitted when #AppIndicator:attention-icon-name is changed - */ + * AppIndicator::new-attention-icon: + * @arg0: The #AppIndicator object + * + * Emitted when #AppIndicator:attention-icon-name is changed + */ signals[NEW_ATTENTION_ICON] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -444,12 +442,12 @@ app_indicator_class_init (AppIndicatorClass *klass) G_TYPE_NONE, 0, G_TYPE_NONE); /** - AppIndicator::new-status: - @arg0: The #AppIndicator object - @arg1: The string value of the #AppIndicatorStatus enum. - - Emitted when #AppIndicator:status is changed - */ + * AppIndicator::new-status: + * @arg0: The #AppIndicator object + * @arg1: The string value of the #AppIndicatorStatus enum. + * + * Emitted when #AppIndicator:status is changed + */ signals[NEW_STATUS] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_STATUS, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -460,13 +458,13 @@ app_indicator_class_init (AppIndicatorClass *klass) G_TYPE_STRING); /** - AppIndicator::new-label: - @arg0: The #AppIndicator object - @arg1: The string for the label - @arg1: The string for the guide - - Emitted when either #AppIndicator:label or #AppIndicator:label-guide are - changed. + * AppIndicator::new-label: + * @arg0: The #AppIndicator object + * @arg1: The string for the label + * @arg1: The string for the guide + * + * Emitted when either #AppIndicator:label or #AppIndicator:label-guide are + * changed. */ signals[NEW_LABEL] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_LABEL, G_TYPE_FROM_CLASS(klass), @@ -477,12 +475,12 @@ app_indicator_class_init (AppIndicatorClass *klass) G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); /** - AppIndicator::connection-changed: - @arg0: The #AppIndicator object - @arg1: Whether we're connected or not - - Signaled when we connect to a watcher, or when it drops away. - */ + * AppIndicator::connection-changed: + * @arg0: The #AppIndicator object + * @arg1: Whether we're connected or not + * + * Signaled when we connect to a watcher, or when it drops away. + */ signals[CONNECTION_CHANGED] = g_signal_new (APP_INDICATOR_SIGNAL_CONNECTION_CHANGED, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -492,12 +490,12 @@ app_indicator_class_init (AppIndicatorClass *klass) G_TYPE_NONE, 1, G_TYPE_BOOLEAN, G_TYPE_NONE); /** - AppIndicator::new-icon-theme-path: - @arg0: The #AppIndicator object - - Signaled when there is a new icon set for the - object. - */ + * AppIndicator::new-icon-theme-path: + * @arg0: The #AppIndicator object + * + * Signaled when there is a new icon set for the + * object. + */ signals[NEW_ICON_THEME_PATH] = g_signal_new (APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -507,13 +505,13 @@ app_indicator_class_init (AppIndicatorClass *klass) G_TYPE_NONE, 1, G_TYPE_STRING); /** - AppIndicator::scroll-event: - @arg0: The #AppIndicator object - @arg1: How many steps the scroll wheel has taken - @arg2: (type Gdk.ScrollDirection) Which direction the wheel went in - - Signaled when the #AppIndicator receives a scroll event. - */ + * AppIndicator::scroll-event: + * @arg0: The #AppIndicator object + * @arg1: How many steps the scroll wheel has taken + * @arg2: (type Gdk.ScrollDirection) Which direction the wheel went in + * + * Signaled when the #AppIndicator receives a scroll event. + */ signals[SCROLL_EVENT] = g_signal_new (APP_INDICATOR_SIGNAL_SCROLL_EVENT, G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -1646,17 +1644,16 @@ sec_activate_target_parent_changed(GtkWidget *menuitem, GtkWidget *old_parent, /* ************************* */ /** - app_indicator_new: - @id: The unique id of the indicator to create. - @icon_name: The icon name for this indicator - @category: The category of indicator. - - Creates a new #AppIndicator setting the properties: - #AppIndicator:id with @id, #AppIndicator:category - with @category and #AppIndicator:icon-name with - @icon_name. - - Return value: A pointer to a new #AppIndicator object. + * app_indicator_new: + * @id: The unique id of the indicator to create. + * @icon_name: The icon name for this indicator + * @category: The category of indicator. + * + * Creates a new #AppIndicator setting the properties: + * #AppIndicator:id with @id, #AppIndicator:category with @category + * and #AppIndicator:icon-name with @icon_name. + * + * Return value: A pointer to a new #AppIndicator object. */ AppIndicator * app_indicator_new (const gchar *id, @@ -1673,18 +1670,18 @@ app_indicator_new (const gchar *id, } /** - app_indicator_new_with_path: - @id: The unique id of the indicator to create. - @icon_name: The icon name for this indicator - @category: The category of indicator. - @icon_theme_path: A custom path for finding icons. - - Creates a new #AppIndicator setting the properties: - #AppIndicator:id with @id, #AppIndicator:category - with @category, #AppIndicator:icon-name with - @icon_name and #AppIndicator:icon-theme-path with @icon_theme_path. - - Return value: A pointer to a new #AppIndicator object. + * app_indicator_new_with_path: + * @id: The unique id of the indicator to create. + * @icon_name: The icon name for this indicator + * @category: The category of indicator. + * @icon_theme_path: A custom path for finding icons. + + * Creates a new #AppIndicator setting the properties: + * #AppIndicator:id with @id, #AppIndicator:category with @category, + * #AppIndicator:icon-name with @icon_name and #AppIndicator:icon-theme-path + * with @icon_theme_path. + * + * Return value: A pointer to a new #AppIndicator object. */ AppIndicator * app_indicator_new_with_path (const gchar *id, @@ -1703,20 +1700,20 @@ app_indicator_new_with_path (const gchar *id, } /** - app_indicator_get_type: - - Generates or returns the unique #GType for #AppIndicator. - - Return value: A unique #GType for #AppIndicator objects. -*/ + * app_indicator_get_type: + * + * Generates or returns the unique #GType for #AppIndicator. + * + * Return value: A unique #GType for #AppIndicator objects. + */ /** - app_indicator_set_status: - @self: The #AppIndicator object to use - @status: The status to set for this indicator - - Wrapper function for property #AppIndicator:status. -*/ + * app_indicator_set_status: + * @self: The #AppIndicator object to use + * @status: The status to set for this indicator + * + * Wrapper function for property #AppIndicator:status. + */ void app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status) { @@ -1750,15 +1747,15 @@ app_indicator_set_status (AppIndicator *self, AppIndicatorStatus status) } /** - app_indicator_set_attention_icon: - @self: The #AppIndicator object to use - @icon_name: The name of the attention icon to set for this indicator - - Wrapper for app_indicator_set_attention_icon_full() with a NULL - description. - - Deprecated: Use app_indicator_set_attention_icon_full() instead. -*/ + * app_indicator_set_attention_icon: + * @self: The #AppIndicator object to use + * @icon_name: The name of the attention icon to set for this indicator + * + * Wrapper for app_indicator_set_attention_icon_full() with a NULL + * description. + * + * Deprecated: Use app_indicator_set_attention_icon_full() instead. + */ void app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) { @@ -1766,13 +1763,13 @@ app_indicator_set_attention_icon (AppIndicator *self, const gchar *icon_name) } /** - app_indicator_set_attention_icon_full: - @self: The #AppIndicator object to use - @icon_name: The name of the attention icon to set for this indicator - @icon_desc: A textual description of the icon - - Wrapper function for property #AppIndicator:attention-icon-name. -*/ + * app_indicator_set_attention_icon_full: + * @self: The #AppIndicator object to use + * @icon_name: The name of the attention icon to set for this indicator + * @icon_desc: A textual description of the icon + * + * Wrapper function for property #AppIndicator:attention-icon-name. + */ void app_indicator_set_attention_icon_full (AppIndicator *self, const gchar *icon_name, const gchar * icon_desc) { @@ -1823,15 +1820,15 @@ app_indicator_set_attention_icon_full (AppIndicator *self, const gchar *icon_nam } /** - app_indicator_set_icon: - @self: The #AppIndicator object to use - @icon_name: The icon name to set. - - Wrapper function for app_indicator_set_icon_full() with a NULL - description. - - Deprecated: Use app_indicator_set_icon_full() -**/ + * app_indicator_set_icon: + * @self: The #AppIndicator object to use + * @icon_name: The icon name to set. + * + * Wrapper function for app_indicator_set_icon_full() with a NULL + * description. + * + * Deprecated: Use app_indicator_set_icon_full() + */ void app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) { @@ -1839,18 +1836,18 @@ app_indicator_set_icon (AppIndicator *self, const gchar *icon_name) } /** - app_indicator_set_icon_full: - @self: The #AppIndicator object to use - @icon_name: The icon name to set. - @icon_desc: A textual description of the icon for accessibility - - Sets the default icon to use when the status is active but - not set to attention. In most cases, this should be the - application icon for the program. - - Wrapper function for property #AppIndicator:icon-name and - #AppIndicator::icon-desc. -**/ + * app_indicator_set_icon_full: + * @self: The #AppIndicator object to use + * @icon_name: The icon name to set. + * @icon_desc: A textual description of the icon for accessibility + * + * Sets the default icon to use when the status is active but + * not set to attention. In most cases, this should be the + * application icon for the program. + * + * Wrapper function for property #AppIndicator:icon-name and + * #AppIndicator::icon-desc. + */ void app_indicator_set_icon_full (AppIndicator *self, const gchar *icon_name, const gchar * icon_desc) { @@ -1901,14 +1898,14 @@ app_indicator_set_icon_full (AppIndicator *self, const gchar *icon_name, const g } /** - app_indicator_set_label: - @self: The #AppIndicator object to use - @label: The label to show next to the icon. - @guide: A guide to size the label correctly. - - This is a wrapper function for the #AppIndicator:label and - #AppIndicator:guide properties. This function can take #NULL - as either @label or @guide and will clear the entries. + * app_indicator_set_label: + * @self: The #AppIndicator object to use + * @label: The label to show next to the icon. + * @guide: A guide to size the label correctly. + * + * This is a wrapper function for the #AppIndicator:label and + * #AppIndicator:guide properties. This function can take #NULL + * as either @label or @guide and will clear the entries. */ void app_indicator_set_label (AppIndicator *self, const gchar * label, const gchar * guide) @@ -1926,12 +1923,12 @@ app_indicator_set_label (AppIndicator *self, const gchar * label, const gchar * } /** - app_indicator_set_icon_theme_path: - @self: The #AppIndicator object to use - @icon_theme_path: The icon theme path to set. - - Sets the path to use when searching for icons. -**/ + * app_indicator_set_icon_theme_path: + * @self: The #AppIndicator object to use + * @icon_theme_path: The icon theme path to set. + * + * Sets the path to use when searching for icons. + */ void app_indicator_set_icon_theme_path (AppIndicator *self, const gchar *icon_theme_path) { @@ -1997,17 +1994,17 @@ setup_dbusmenu (AppIndicator *self) return; } -/** - app_indicator_set_menu: - @self: The #AppIndicator - @menu: A #GtkMenu to set - - Sets the menu that should be shown when the Application Indicator - is clicked on in the panel. An application indicator will not - be rendered unless it has a menu. - - Wrapper function for property #AppIndicator:menu. -**/ +/* + * app_indicator_set_menu: + * @self: The #AppIndicator + * @menu: (allow-none): A #GtkMenu to set + * + * Sets the menu that should be shown when the Application Indicator + * is clicked on in the panel. An application indicator will not + * be rendered unless it has a menu. + * + * Wrapper function for property #AppIndicator:menu. + */ void app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) { @@ -2037,16 +2034,16 @@ app_indicator_set_menu (AppIndicator *self, GtkMenu *menu) } /** - app_indicator_set_ordering_index: - @self: The #AppIndicator - @ordering_index: A value for the ordering of this app indicator - - Sets the ordering index for the app indicator which effects the - placement of it on the panel. For almost all app indicator - this is not the function you're looking for. - - Wrapper function for property #AppIndicator:ordering-index. -**/ + * app_indicator_set_ordering_index: + * @self: The #AppIndicator + * @ordering_index: A value for the ordering of this app indicator + * + * Sets the ordering index for the app indicator which effects the + * placement of it on the panel. For almost all app indicator + * this is not the function you're looking for. + * + * Wrapper function for property #AppIndicator:ordering-index. + */ void app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index) { @@ -2058,19 +2055,19 @@ app_indicator_set_ordering_index (AppIndicator *self, guint32 ordering_index) } /** - app_indicator_set_secondary_activate_target: - @self: The #AppIndicator - @menuitem: A #GtkWidget to be activated on secondary activation - - Set the @menuitem to be activated when a secondary activation event (i.e. a - middle-click) is emitted over the #AppIndicator icon/label. - - The @menuitem can be also a complex #GtkWidget, but to get activated when - a secondary activation occurs in the #Appindicator, it must be a visible and - active child (or inner-child) of the #AppIndicator:menu. - - Setting @menuitem to %NULL causes to disable this feature. -**/ + * app_indicator_set_secondary_activate_target: + * @self: The #AppIndicator + * @menuitem: (allow-none): A #GtkWidget to be activated on secondary activation + * + * Set the @menuitem to be activated when a secondary activation event (i.e. a + * middle-click) is emitted over the #AppIndicator icon/label. + * + * The @menuitem can be also a complex #GtkWidget, but to get activated when + * a secondary activation occurs in the #Appindicator, it must be a visible and + * active child (or inner-child) of the #AppIndicator:menu. + * + * Setting @menuitem to %NULL causes to disable this feature. + */ void app_indicator_set_secondary_activate_target (AppIndicator *self, GtkWidget *menuitem) { @@ -2097,13 +2094,13 @@ app_indicator_set_secondary_activate_target (AppIndicator *self, GtkWidget *menu } /** - app_indicator_get_id: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:id. - - Return value: The current ID -*/ + * app_indicator_get_id: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:id. + * + * Return value: The current ID + */ const gchar * app_indicator_get_id (AppIndicator *self) { @@ -2113,13 +2110,13 @@ app_indicator_get_id (AppIndicator *self) } /** - app_indicator_get_category: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:category. - - Return value: The current category. -*/ + * app_indicator_get_category: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:category. + * + * Return value: The current category. + */ AppIndicatorCategory app_indicator_get_category (AppIndicator *self) { @@ -2129,13 +2126,13 @@ app_indicator_get_category (AppIndicator *self) } /** - app_indicator_get_status: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:status. - - Return value: The current status. -*/ + * app_indicator_get_status: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:status. + * + * Return value: The current status. + */ AppIndicatorStatus app_indicator_get_status (AppIndicator *self) { @@ -2145,13 +2142,13 @@ app_indicator_get_status (AppIndicator *self) } /** - app_indicator_get_icon: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:icon-name. - - Return value: The current icon name. -*/ + * app_indicator_get_icon: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:icon-name. + * + * Return value: The current icon name. + */ const gchar * app_indicator_get_icon (AppIndicator *self) { @@ -2161,12 +2158,12 @@ app_indicator_get_icon (AppIndicator *self) } /** - app_indicator_get_icon_desc: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:icon-desc. - - Return value: The current icon description. + * app_indicator_get_icon_desc: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:icon-desc. + * + * Return value: The current icon description. */ const gchar * app_indicator_get_icon_desc (AppIndicator *self) @@ -2177,13 +2174,13 @@ app_indicator_get_icon_desc (AppIndicator *self) } /** - app_indicator_get_icon_theme_path: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:icon-theme-path. - - Return value: The current icon theme path. -*/ + * app_indicator_get_icon_theme_path: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:icon-theme-path. + * + * Return value: The current icon theme path. + */ const gchar * app_indicator_get_icon_theme_path (AppIndicator *self) { @@ -2193,13 +2190,13 @@ app_indicator_get_icon_theme_path (AppIndicator *self) } /** - app_indicator_get_attention_icon: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:attention-icon-name. - - Return value: The current attention icon name. -*/ + * app_indicator_get_attention_icon: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:attention-icon-name. + * + * Return value: The current attention icon name. + */ const gchar * app_indicator_get_attention_icon (AppIndicator *self) { @@ -2209,13 +2206,13 @@ app_indicator_get_attention_icon (AppIndicator *self) } /** - app_indicator_get_attention_icon_desc: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:attention-icon-desc. - - Return value: The current attention icon description. -*/ + * app_indicator_get_attention_icon_desc: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:attention-icon-desc. + * + * Return value: The current attention icon description. + */ const gchar * app_indicator_get_attention_icon_desc (AppIndicator *self) { @@ -2225,14 +2222,14 @@ app_indicator_get_attention_icon_desc (AppIndicator *self) } /** - app_indicator_get_menu: - @self: The #AppIndicator object to use - - Gets the menu being used for this application indicator. - Wrapper function for property #AppIndicator:menu. - - Return value: (transfer full): A #GtkMenu object or %NULL if one hasn't been set. -*/ + * app_indicator_get_menu: + * @self: The #AppIndicator object to use + * + * Gets the menu being used for this application indicator. + * Wrapper function for property #AppIndicator:menu. + * + * Returns: (transfer full): A #GtkMenu object or %NULL if one hasn't been set. + */ GtkMenu * app_indicator_get_menu (AppIndicator *self) { @@ -2246,13 +2243,13 @@ app_indicator_get_menu (AppIndicator *self) } /** - app_indicator_get_label: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:label. - - Return value: The current label. -*/ + * app_indicator_get_label: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:label. + * + * Return value: The current label. + */ const gchar * app_indicator_get_label (AppIndicator *self) { @@ -2262,13 +2259,13 @@ app_indicator_get_label (AppIndicator *self) } /** - app_indicator_get_label_guide: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:label-guide. - - Return value: The current label guide. -*/ + * app_indicator_get_label_guide: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:label-guide. + * + * Return value: The current label guide. + */ const gchar * app_indicator_get_label_guide (AppIndicator *self) { @@ -2278,13 +2275,13 @@ app_indicator_get_label_guide (AppIndicator *self) } /** - app_indicator_get_ordering_index: - @self: The #AppIndicator object to use - - Wrapper function for property #AppIndicator:ordering-index. - - Return value: The current ordering index. -*/ + * app_indicator_get_ordering_index: + * @self: The #AppIndicator object to use + * + * Wrapper function for property #AppIndicator:ordering-index. + * + * Return value: The current ordering index. + */ guint32 app_indicator_get_ordering_index (AppIndicator *self) { @@ -2298,13 +2295,13 @@ app_indicator_get_ordering_index (AppIndicator *self) } /** - app_indicator_get_secondary_activate_target: - @self: The #AppIndicator object to use - - Gets the menuitem being called on secondary-activate event. - - Return value: (transfer full): A #GtkWidget object or %NULL if none has been set. -*/ + * app_indicator_get_secondary_activate_target: + * @self: The #AppIndicator object to use + * + * Gets the menuitem being called on secondary-activate event. + * + * Returns: (transfer full): A #GtkWidget object or %NULL if none has been set. + */ GtkWidget * app_indicator_get_secondary_activate_target (AppIndicator *self) { @@ -2335,14 +2332,14 @@ shorty_activated_cb (DbusmenuMenuitem * mi, guint timestamp, gpointer user_data) } /** - app_indicator_build_menu_from_desktop: - @self: The #AppIndicator object to use - @desktop_file: A path to the desktop file to build the menu from - @desktop_profile: Which entries should be used from the desktop file - - This function allows for building the Application Indicator menu - from a static desktop file. -*/ + * app_indicator_build_menu_from_desktop: + * @self: The #AppIndicator object to use + * @desktop_file: A path to the desktop file to build the menu from + * @desktop_profile: Which entries should be used from the desktop file + * + * This function allows for building the Application Indicator menu + * from a static desktop file. + */ void app_indicator_build_menu_from_desktop (AppIndicator * self, const gchar * desktop_file, const gchar * desktop_profile) { diff --git a/src/app-indicator.h b/src/app-indicator.h index 09b7520..6922248 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -35,40 +35,40 @@ License version 3 and version 2.1 along with this program. If not, see G_BEGIN_DECLS /** - APP_INDICATOR_TYPE: - - Get the #GType for a #AppIndicator. -*/ + * APP_INDICATOR_TYPE: + * + * Get the #GType for a #AppIndicator. + */ /** - APP_INDICATOR: - @obj: The object to convert - - Safely convert a #GObject into an #AppIndicator. -*/ + * APP_INDICATOR: + * @obj: The object to convert + * + * Safely convert a #GObject into an #AppIndicator. + */ /** - APP_INDICATOR_CLASS: - @klass: #GObjectClass based class to convert. - - Safely convert a #GObjectClass into a #AppIndicatorClass. -*/ + * APP_INDICATOR_CLASS: + * @klass: #GObjectClass based class to convert. + * + * Safely convert a #GObjectClass into a #AppIndicatorClass. + */ /** - IS_APP_INDICATOR: - @obj: An #GObject to check - - Checks to see if @obj is in the object hierarchy of #AppIndicator. -*/ + * IS_APP_INDICATOR: + * @obj: An #GObject to check + * + * Checks to see if @obj is in the object hierarchy of #AppIndicator. + */ /** - IS_APP_INDICATOR_CLASS: - @klass: An #GObjectClass to check - - Checks to see if @klass is in the object class hierarchy of #AppIndicatorClass. -*/ + * IS_APP_INDICATOR_CLASS: + * @klass: An #GObjectClass to check + * + * Checks to see if @klass is in the object class hierarchy of #AppIndicatorClass. + */ /** - APP_INDICATOR_GET_CLASS: - @obj: A #GObject in the class hierarchy of #AppIndicator. - - Gets a pointer to the #AppIndicatorClass for the object @obj. -*/ + * APP_INDICATOR_GET_CLASS: + * @obj: A #GObject in the class hierarchy of #AppIndicator. + * + * Gets a pointer to the #AppIndicatorClass for the object @obj. + */ #define APP_INDICATOR_TYPE (app_indicator_get_type ()) #define APP_INDICATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), APP_INDICATOR_TYPE, AppIndicator)) @@ -78,40 +78,40 @@ G_BEGIN_DECLS #define APP_INDICATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), APP_INDICATOR_TYPE, AppIndicatorClass)) /** - APP_INDICATOR_SIGNAL_NEW_ICON: - - String identifier for the #AppIndicator::new-icon signal. -*/ + * APP_INDICATOR_SIGNAL_NEW_ICON: + * + * String identifier for the #AppIndicator::new-icon signal. + */ /** - APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON: - - String identifier for the #AppIndicator::new-attention-icon signal. -*/ + * APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON: + * + * String identifier for the #AppIndicator::new-attention-icon signal. + */ /** - APP_INDICATOR_SIGNAL_NEW_STATUS: - - String identifier for the #AppIndicator::new-status signal. -*/ + * APP_INDICATOR_SIGNAL_NEW_STATUS: + * + * String identifier for the #AppIndicator::new-status signal. + */ /** - APP_INDICATOR_SIGNAL_NEW_LABEL: - - String identifier for the #AppIndicator::new-label signal. -*/ + * APP_INDICATOR_SIGNAL_NEW_LABEL: + * + * String identifier for the #AppIndicator::new-label signal. + */ /** - APP_INDICATOR_SIGNAL_CONNECTION_CHANGED: - - String identifier for the #AppIndicator::connection-changed signal. -*/ + * APP_INDICATOR_SIGNAL_CONNECTION_CHANGED: + * + * String identifier for the #AppIndicator::connection-changed signal. + */ /** - APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH: - - String identifier for the #AppIndicator::new-icon-theme-path signal. -*/ + * APP_INDICATOR_SIGNAL_NEW_ICON_THEME_PATH: + * + * String identifier for the #AppIndicator::new-icon-theme-path signal. + */ /** - APP_INDICATOR_SIGNAL_SCROLL_EVENT: - - String identifier for the #AppIndicator::scroll-event signal. -*/ + * APP_INDICATOR_SIGNAL_SCROLL_EVENT: + * + * String identifier for the #AppIndicator::scroll-event signal. + */ #define APP_INDICATOR_SIGNAL_NEW_ICON "new-icon" #define APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON "new-attention-icon" #define APP_INDICATOR_SIGNAL_NEW_STATUS "new-status" @@ -121,16 +121,16 @@ G_BEGIN_DECLS #define APP_INDICATOR_SIGNAL_SCROLL_EVENT "scroll-event" /** - AppIndicatorCategory: - @APP_INDICATOR_CATEGORY_APPLICATION_STATUS: The indicator is used to display the status of the application. - @APP_INDICATOR_CATEGORY_COMMUNICATIONS: The application is used for communication with other people. - @APP_INDICATOR_CATEGORY_SYSTEM_SERVICES: A system indicator relating to something in the user's system. - @APP_INDICATOR_CATEGORY_HARDWARE: An indicator relating to the user's hardware. - @APP_INDICATOR_CATEGORY_OTHER: Something not defined in this enum, please don't use unless you really need it. - - The category provides grouping for the indicators so that - users can find indicators that are similar together. -*/ + * AppIndicatorCategory: + * @APP_INDICATOR_CATEGORY_APPLICATION_STATUS: The indicator is used to display the status of the application. + * @APP_INDICATOR_CATEGORY_COMMUNICATIONS: The application is used for communication with other people. + * @APP_INDICATOR_CATEGORY_SYSTEM_SERVICES: A system indicator relating to something in the user's system. + * @APP_INDICATOR_CATEGORY_HARDWARE: An indicator relating to the user's hardware. + * @APP_INDICATOR_CATEGORY_OTHER: Something not defined in this enum, please don't use unless you really need it. + * + * The category provides grouping for the indicators so that + * users can find indicators that are similar together. + */ typedef enum { /*< prefix=APP_INDICATOR_CATEGORY >*/ APP_INDICATOR_CATEGORY_APPLICATION_STATUS, /*< nick=ApplicationStatus >*/ APP_INDICATOR_CATEGORY_COMMUNICATIONS, /*< nick=Communications >*/ @@ -140,16 +140,16 @@ typedef enum { /*< prefix=APP_INDICATOR_CATEGORY >*/ } AppIndicatorCategory; /** - AppIndicatorStatus: - @APP_INDICATOR_STATUS_PASSIVE: The indicator should not be shown to the user. - @APP_INDICATOR_STATUS_ACTIVE: The indicator should be shown in it's default state. - @APP_INDICATOR_STATUS_ATTENTION: The indicator should show it's attention icon. - - These are the states that the indicator can be on in - the user's panel. The indicator by default starts - in the state @APP_INDICATOR_STATUS_PASSIVE and can be - shown by setting it to @APP_INDICATOR_STATUS_ACTIVE. -*/ + * AppIndicatorStatus: + * @APP_INDICATOR_STATUS_PASSIVE: The indicator should not be shown to the user. + * @APP_INDICATOR_STATUS_ACTIVE: The indicator should be shown in it's default state. + * @APP_INDICATOR_STATUS_ATTENTION: The indicator should show it's attention icon. + * + * These are the states that the indicator can be on in + * the user's panel. The indicator by default starts + * in the state @APP_INDICATOR_STATUS_PASSIVE and can be + * shown by setting it to @APP_INDICATOR_STATUS_ACTIVE. + */ typedef enum { /*< prefix=APP_INDICATOR_STATUS >*/ APP_INDICATOR_STATUS_PASSIVE, /*< nick=Passive >*/ APP_INDICATOR_STATUS_ACTIVE, /*< nick=Active >*/ @@ -161,30 +161,30 @@ typedef struct _AppIndicatorClass AppIndicatorClass; typedef struct _AppIndicatorPrivate AppIndicatorPrivate; /** - AppIndicatorClass: - @parent_class: Mia familia - @new_icon: Slot for #AppIndicator::new-icon. - @new_attention_icon: Slot for #AppIndicator::new-attention-icon. - @new_status: Slot for #AppIndicator::new-status. - @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path - @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. - @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 - Indicator area appears after the fallback has been created. - @app_indicator_reserved_1: Reserved for future use. - @app_indicator_reserved_2: Reserved for future use. - @app_indicator_reserved_3: Reserved for future use. - @app_indicator_reserved_4: Reserved for future use. - @app_indicator_reserved_5: Reserved for future use. - @app_indicator_reserved_6: Reserved for future use. - - The signals and external functions that make up the #AppIndicator - class object. -*/ + * AppIndicatorClass: + * @parent_class: Mia familia + * @new_icon: Slot for #AppIndicator::new-icon. + * @new_attention_icon: Slot for #AppIndicator::new-attention-icon. + * @new_status: Slot for #AppIndicator::new-status. + * @new_icon_theme_path: Slot for #AppIndicator::new-icon-theme-path + * @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. + * @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 + * Indicator area appears after the fallback has been created. + * @app_indicator_reserved_1: Reserved for future use. + * @app_indicator_reserved_2: Reserved for future use. + * @app_indicator_reserved_3: Reserved for future use. + * @app_indicator_reserved_4: Reserved for future use. + * @app_indicator_reserved_5: Reserved for future use. + * @app_indicator_reserved_6: Reserved for future use. + * + * The signals and external functions that make up the #AppIndicator + * class object. + */ struct _AppIndicatorClass { /* Parent */ GObjectClass parent_class; @@ -232,19 +232,18 @@ struct _AppIndicatorClass { }; /** - AppIndicator: - - A application indicator represents the values that are needed to show a - unique status in the panel for an application. In general, applications - should try to fit in the other indicators that are available on the - panel before using this. But, sometimes it is necissary. -*/ -/* Private fields - @parent: Parent object. - @priv: Internal data. -*/ + * AppIndicator: + * + * A application indicator represents the values that are needed to show a + * unique status in the panel for an application. In general, applications + * should try to fit in the other indicators that are available on the + * panel before using this. But, sometimes it is necissary. + * + * Private fields + * @parent: Parent object. + * @priv: Internal data. + */ struct _AppIndicator { - /*< Private >*/ GObject parent; /*< Private >*/ @@ -296,6 +295,7 @@ const gchar * app_indicator_get_icon_desc (AppIndic const gchar * app_indicator_get_icon_theme_path (AppIndicator *self); const gchar * app_indicator_get_attention_icon (AppIndicator *self); const gchar * app_indicator_get_attention_icon_desc (AppIndicator *self); + GtkMenu * app_indicator_get_menu (AppIndicator *self); const gchar * app_indicator_get_label (AppIndicator *self); const gchar * app_indicator_get_label_guide (AppIndicator *self); @@ -310,20 +310,20 @@ void app_indicator_build_menu_from_desktop (AppIndica G_END_DECLS /** - SECTION:app-indicator - @short_description: An object to put application information - into the panel. - @stability: Unstable - @include: libappindicator/app-indicator.h - - An application indicator is a way for an application to put - a menu into the panel on the user's screen. This allows the - user to interact with the application even though it might - not be visible to the user at the time. In most cases this - is not a good solution as there are other ways to inform the - user. It should only be use if persistence is a desired - feature for the user (not for your marketing purpose of - having your logo in the panel). -*/ + * SECTION:app-indicator + * @short_description: An object to put application information + * into the panel. + * @stability: Unstable + * @include: libappindicator/app-indicator.h + * + * An application indicator is a way for an application to put + * a menu into the panel on the user's screen. This allows the + * user to interact with the application even though it might + * not be visible to the user at the time. In most cases this + * is not a good solution as there are other ways to inform the + * user. It should only be use if persistence is a desired + * feature for the user (not for your marketing purpose of + * having your logo in the panel). + */ #endif -- cgit v1.2.3 From 195a64f16c356b1b75c81ec374699c94c636fbe2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 22 Jul 2011 13:50:27 -0500 Subject: Always clear the sec_activate_target --- src/app-indicator.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app-indicator.c b/src/app-indicator.c index 1dc91d8..98aec7a 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -2077,15 +2077,15 @@ app_indicator_set_secondary_activate_target (AppIndicator *self, GtkWidget *menu g_return_if_fail (IS_APP_INDICATOR (self)); AppIndicatorPrivate *priv = self->priv; - if (menuitem == NULL) { - if (priv->sec_activate_target) { - g_object_unref(G_OBJECT(priv->sec_activate_target)); - g_signal_handlers_disconnect_by_func (priv->sec_activate_target, - sec_activate_target_parent_changed, - self); - priv->sec_activate_target = NULL; - } + if (priv->sec_activate_target) { + g_signal_handlers_disconnect_by_func (priv->sec_activate_target, + sec_activate_target_parent_changed, + self); + g_object_unref(G_OBJECT(priv->sec_activate_target)); + priv->sec_activate_target = NULL; + } + if (menuitem == NULL) { return; } -- cgit v1.2.3 From d59df9bc7c25cd9983174b3a917a743ee4dcff1b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 22 Jul 2011 13:56:05 -0500 Subject: Watching for the 'XAyatanaSecondaryActivate' method as well --- src/app-indicator.c | 3 ++- src/notification-item.xml | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app-indicator.c b/src/app-indicator.c index 98aec7a..bdc4ea9 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -1024,7 +1024,8 @@ 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) { + } else if (g_strcmp0(method, "SecondaryActivate") == 0 || + g_strcmp0(method, "XAyatanaSecondaryActivate") == 0) { GtkWidget *menuitem = priv->sec_activate_target; if (priv->sec_activate_enabled && menuitem && diff --git a/src/notification-item.xml b/src/notification-item.xml index 0cf043e..589a438 100644 --- a/src/notification-item.xml +++ b/src/notification-item.xml @@ -27,6 +27,9 @@ + + + -- cgit v1.2.3 From f551fdbd371ee30b8be507f9471b252ab84504c9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 22 Jul 2011 13:58:14 -0500 Subject: Adding the secondary target functions to the documentation --- docs/reference/libappindicator-sections.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/reference/libappindicator-sections.txt b/docs/reference/libappindicator-sections.txt index da05f40..6f09364 100644 --- a/docs/reference/libappindicator-sections.txt +++ b/docs/reference/libappindicator-sections.txt @@ -31,6 +31,7 @@ app_indicator_set_icon_full app_indicator_set_icon_theme_path app_indicator_set_label app_indicator_set_ordering_index +app_indicator_set_secondary_activate_target app_indicator_get_id app_indicator_get_category app_indicator_get_status @@ -43,6 +44,7 @@ app_indicator_get_menu app_indicator_get_label app_indicator_get_label_guide app_indicator_get_ordering_index +app_indicator_get_secondary_activate_target app_indicator_build_menu_from_desktop -- cgit v1.2.3 From 1bfe91a779b5d71cf3e6bf066182af38995fa4bf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Aug 2011 11:58:08 -0500 Subject: 0.3.91 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 75c5200..72bb7f6 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([libappindicator], - [0.3.90], + [0.3.91], [http://bugs.launchpad.net/libappindicator], [libappindicator], [http://launchpad.net/libappindicator]) -- cgit v1.2.3 From 7a5688c166f39166a98f8a660269834c57ca8980 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 11 Aug 2011 12:10:20 -0500 Subject: releasing version 0.3.91-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 18b3f36..d4cce6d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -libappindicator (0.3.91-0ubuntu1~ppa1) UNRELEASED; urgency=low +libappindicator (0.3.91-0ubuntu1~ppa1) oneiric; urgency=low * New upstream release. * Secondary activate support * Better GIR file annotations - -- Ted Gould Thu, 11 Aug 2011 12:03:31 -0500 + -- Ted Gould Thu, 11 Aug 2011 12:10:17 -0500 libappindicator (0.3.90-0ubuntu1) oneiric; urgency=low -- cgit v1.2.3