diff options
author | Ted Gould <ted@gould.cx> | 2011-02-10 14:47:52 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-02-10 14:47:52 -0600 |
commit | 18d89929cb035b798916e10a6aa253fd5bcf4e7d (patch) | |
tree | 953e74c6b5755b722efcaa63b70c23890d11418b /src | |
parent | 41981b1b0cc723c58e515702fc34cfd6bf500ae9 (diff) | |
parent | 23a4650671cb87a0e440b5c4284e437905f768b6 (diff) | |
download | libayatana-appindicator-18d89929cb035b798916e10a6aa253fd5bcf4e7d.tar.gz libayatana-appindicator-18d89929cb035b798916e10a6aa253fd5bcf4e7d.tar.bz2 libayatana-appindicator-18d89929cb035b798916e10a6aa253fd5bcf4e7d.zip |
Import upstream version 0.2.93
Diffstat (limited to 'src')
-rw-r--r-- | src/AppIndicator-0.1.metadata | 1 | ||||
-rw-r--r-- | src/AppIndicator-0.1.metadata.in | 3 | ||||
-rw-r--r-- | src/Makefile.am | 37 | ||||
-rw-r--r-- | src/Makefile.in | 81 | ||||
-rw-r--r-- | src/app-indicator.c | 86 | ||||
-rw-r--r-- | src/app-indicator.h | 15 | ||||
-rw-r--r-- | src/application-service-marshal.c | 37 | ||||
-rw-r--r-- | src/application-service-marshal.list | 1 | ||||
-rw-r--r-- | src/gen-notification-item.xml.c | 6 | ||||
-rw-r--r-- | src/notification-item.xml | 6 |
10 files changed, 182 insertions, 91 deletions
diff --git a/src/AppIndicator-0.1.metadata b/src/AppIndicator-0.1.metadata deleted file mode 100644 index e4d068e..0000000 --- a/src/AppIndicator-0.1.metadata +++ /dev/null @@ -1 +0,0 @@ -AppIndicator name="AppIndicator" diff --git a/src/AppIndicator-0.1.metadata.in b/src/AppIndicator-0.1.metadata.in new file mode 100644 index 0000000..5790ddb --- /dev/null +++ b/src/AppIndicator-0.1.metadata.in @@ -0,0 +1,3 @@ +AppIndicator name="AppIndicator" +Indicator.priv hidden="1" +IndicatorPrivate hidden="1" diff --git a/src/Makefile.am b/src/Makefile.am index b9ee3e1..f83a6c4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,12 +2,10 @@ if USE_GTK3 VER=3 lib_LTLIBRARIES = libappindicator3.la GTKGIR = Gtk-3.0 -GTKVAPI = gtk+-3.0 else VER= lib_LTLIBRARIES = libappindicator.la GTKGIR = Gtk-2.0 -GTKVAPI = gtk+-2.0 endif CLEANFILES = @@ -16,7 +14,7 @@ BUILT_SOURCES = EXTRA_DIST = \ appindicator-0.1.pc.in \ appindicator3-0.1.pc.in \ - AppIndicator-0.1.metadata + AppIndicator$(VER)-0.1.metadata.in include $(top_srcdir)/Makefile.am.enum include $(top_srcdir)/Makefile.am.marshal @@ -45,7 +43,8 @@ glib_enum_headers = $(addprefix $(srcdir)/, $(libappindicator_headers)) DISTCLEANFILES += app-indicator-enum-types.c -libappindicatorincludedir=$(includedir)/libappindicator-0.1/libappindicator +libappindicatorincludefolder=libappindicator +libappindicatorincludedir=$(includedir)/libappindicator-0.1/$(libappindicatorincludefolder) libappindicator_headers = \ app-indicator.h @@ -133,13 +132,13 @@ INTROSPECTION_GIRS = if INTROSPECTION_TEN INTROSPECTION_SCANNER_ARGS = \ --add-include-path=$(srcdir) \ - $(addprefix --c-include=src/, $(introspection_sources)) \ + $(addprefix --c-include=$(libappindicatorincludefolder)/, $(libappindicator_headers)) \ --symbol-prefix=app \ --identifier-prefix=App else INTROSPECTION_SCANNER_ARGS = \ --add-include-path=$(srcdir) \ - $(addprefix --c-include=src/, $(introspection_sources)) + $(addprefix --c-include=$(libappindicatorincludefolder)/, $(libappindicator_headers)) endif INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) @@ -165,6 +164,12 @@ AppIndicator3_0_1_gir_FILES = $(AppIndicator_0_1_gir_FILES) INTROSPECTION_GIRS += AppIndicator$(VER)-0.1.gir +AppIndicator$(VER)-0.1.metadata: AppIndicator$(VER)-0.1.gir + cp -f $(srcdir)/$@.in $@ + +BUILT_SOURCES += AppIndicator$(VER)-0.1.metadata +CLEANFILES += AppIndicator$(VER)-0.1.metadata + girdir = $(datadir)/gir-1.0 gir_DATA = $(INTROSPECTION_GIRS) @@ -174,23 +179,3 @@ typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES += $(gir_DATA) $(typelib_DATA) endif - -######################### -# VAPI Files -######################### - -if HAVE_INTROSPECTION - -vapidir = $(datadir)/vala/vapi -vapi_DATA = AppIndicator$(VER)-0.1.vapi - -AppIndicator$(VER)-0.1.vapi: AppIndicator$(VER)-0.1.gir Makefile.am - $(VALA_API_GEN) --library=AppIndicator$(VER)-0.1 \ - --pkg $(GTKVAPI) \ - --vapidir=$(top_builddir)/src \ - $< - -CLEANFILES += $(vapi_DATA) - -endif - diff --git a/src/Makefile.in b/src/Makefile.in index 2e2cd6b..20885b0 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -76,8 +76,10 @@ DIST_COMMON = $(libappindicator3include_HEADERS) \ $(top_srcdir)/Makefile.am.enum \ $(top_srcdir)/Makefile.am.marshal @HAVE_INTROSPECTION_TRUE@am__append_1 = AppIndicator$(VER)-0.1.gir -@HAVE_INTROSPECTION_TRUE@am__append_2 = $(gir_DATA) $(typelib_DATA) \ -@HAVE_INTROSPECTION_TRUE@ $(vapi_DATA) +@HAVE_INTROSPECTION_TRUE@am__append_2 = AppIndicator$(VER)-0.1.metadata +@HAVE_INTROSPECTION_TRUE@am__append_3 = \ +@HAVE_INTROSPECTION_TRUE@ AppIndicator$(VER)-0.1.metadata \ +@HAVE_INTROSPECTION_TRUE@ $(gir_DATA) $(typelib_DATA) subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ @@ -111,7 +113,6 @@ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \ "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" \ - "$(DESTDIR)$(vapidir)" \ "$(DESTDIR)$(libappindicator3includedir)" \ "$(DESTDIR)$(libappindicatorincludedir)" LTLIBRARIES = $(lib_LTLIBRARIES) @@ -179,7 +180,7 @@ am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libappindicator_la_SOURCES) $(libappindicator3_la_SOURCES) DIST_SOURCES = $(libappindicator_la_SOURCES) \ $(libappindicator3_la_SOURCES) -DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelib_DATA) $(vapi_DATA) +DATA = $(gir_DATA) $(pkgconfig_DATA) $(typelib_DATA) HEADERS = $(libappindicator3include_HEADERS) \ $(libappindicatorinclude_HEADERS) ETAGS = etags @@ -294,6 +295,7 @@ SHELL = @SHELL@ STRIP = @STRIP@ TESTDEPS_CFLAGS = @TESTDEPS_CFLAGS@ TESTDEPS_LIBS = @TESTDEPS_LIBS@ +VALAC = @VALAC@ VALA_API_GEN = @VALA_API_GEN@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ @@ -358,12 +360,10 @@ top_srcdir = @top_srcdir@ @USE_GTK3_TRUE@lib_LTLIBRARIES = libappindicator3.la @USE_GTK3_FALSE@GTKGIR = Gtk-2.0 @USE_GTK3_TRUE@GTKGIR = Gtk-3.0 -@USE_GTK3_FALSE@GTKVAPI = gtk+-2.0 -@USE_GTK3_TRUE@GTKVAPI = gtk+-3.0 CLEANFILES = stamp-enum-types stamp-marshal \ gen-notification-item.xml.c gen-notification-item.xml.h \ gen-notification-watcher.xml.c gen-notification-watcher.xml.h \ - $(am__append_2) + $(am__append_3) DISTCLEANFILES = $(glib_enum_h) $(glib_enum_c) $(marshal_h) \ $(marshal_c) app-indicator-enum-types.c @@ -374,10 +374,10 @@ BUILT_SOURCES = $(glib_enum_h) $(glib_enum_c) $(marshal_h) \ $(marshal_c) application-service-marshal.h \ application-service-marshal.c gen-notification-item.xml.c \ gen-notification-item.xml.h gen-notification-watcher.xml.c \ - gen-notification-watcher.xml.h + gen-notification-watcher.xml.h $(am__append_2) EXTRA_DIST = appindicator-0.1.pc.in appindicator3-0.1.pc.in \ - AppIndicator-0.1.metadata $(enum_tmpl_h) $(enum_tmpl_c) \ - $(glib_marshal_list) $(DBUS_SPECS) + AppIndicator$(VER)-0.1.metadata.in $(enum_tmpl_h) \ + $(enum_tmpl_c) $(glib_marshal_list) $(DBUS_SPECS) enum_tmpl_h = $(glib_enum_h:.h=.h.in) enum_tmpl_c = $(glib_enum_c:.c=.c.in) marshal_h = $(glib_marshal_list:.list=.h) @@ -393,7 +393,8 @@ pkgconfigdir = $(libdir)/pkgconfig glib_enum_h = app-indicator-enum-types.h glib_enum_c = app-indicator-enum-types.c glib_enum_headers = $(addprefix $(srcdir)/, $(libappindicator_headers)) -libappindicatorincludedir = $(includedir)/libappindicator-0.1/libappindicator +libappindicatorincludefolder = libappindicator +libappindicatorincludedir = $(includedir)/libappindicator-0.1/$(libappindicatorincludefolder) libappindicator_headers = \ app-indicator.h @@ -449,11 +450,11 @@ DBUS_SPECS = \ INTROSPECTION_GIRS = $(am__append_1) @INTROSPECTION_TEN_FALSE@INTROSPECTION_SCANNER_ARGS = \ @INTROSPECTION_TEN_FALSE@ --add-include-path=$(srcdir) \ -@INTROSPECTION_TEN_FALSE@ $(addprefix --c-include=src/, $(introspection_sources)) +@INTROSPECTION_TEN_FALSE@ $(addprefix --c-include=$(libappindicatorincludefolder)/, $(libappindicator_headers)) @INTROSPECTION_TEN_TRUE@INTROSPECTION_SCANNER_ARGS = \ @INTROSPECTION_TEN_TRUE@ --add-include-path=$(srcdir) \ -@INTROSPECTION_TEN_TRUE@ $(addprefix --c-include=src/, $(introspection_sources)) \ +@INTROSPECTION_TEN_TRUE@ $(addprefix --c-include=$(libappindicatorincludefolder)/, $(libappindicator_headers)) \ @INTROSPECTION_TEN_TRUE@ --symbol-prefix=app \ @INTROSPECTION_TEN_TRUE@ --identifier-prefix=App @@ -476,12 +477,6 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) @HAVE_INTROSPECTION_TRUE@gir_DATA = $(INTROSPECTION_GIRS) @HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0 @HAVE_INTROSPECTION_TRUE@typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) - -######################### -# VAPI Files -######################### -@HAVE_INTROSPECTION_TRUE@vapidir = $(datadir)/vala/vapi -@HAVE_INTROSPECTION_TRUE@vapi_DATA = AppIndicator$(VER)-0.1.vapi all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -761,26 +756,6 @@ uninstall-typelibDATA: test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(typelibdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(typelibdir)" && rm -f $$files -install-vapiDATA: $(vapi_DATA) - @$(NORMAL_INSTALL) - test -z "$(vapidir)" || $(MKDIR_P) "$(DESTDIR)$(vapidir)" - @list='$(vapi_DATA)'; test -n "$(vapidir)" || list=; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(vapidir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(vapidir)" || exit $$?; \ - done - -uninstall-vapiDATA: - @$(NORMAL_UNINSTALL) - @list='$(vapi_DATA)'; test -n "$(vapidir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - test -n "$$files" || exit 0; \ - echo " ( cd '$(DESTDIR)$(vapidir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(vapidir)" && rm -f $$files install-libappindicator3includeHEADERS: $(libappindicator3include_HEADERS) @$(NORMAL_INSTALL) test -z "$(libappindicator3includedir)" || $(MKDIR_P) "$(DESTDIR)$(libappindicator3includedir)" @@ -909,7 +884,7 @@ check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(vapidir)" "$(DESTDIR)$(libappindicator3includedir)" "$(DESTDIR)$(libappindicatorincludedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(libappindicator3includedir)" "$(DESTDIR)$(libappindicatorincludedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) @@ -967,7 +942,7 @@ info-am: install-data-am: install-girDATA \ install-libappindicator3includeHEADERS \ install-libappindicatorincludeHEADERS install-pkgconfigDATA \ - install-typelibDATA install-vapiDATA + install-typelibDATA install-dvi: install-dvi-am @@ -1016,8 +991,7 @@ ps-am: uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \ uninstall-libappindicator3includeHEADERS \ uninstall-libappindicatorincludeHEADERS \ - uninstall-pkgconfigDATA uninstall-typelibDATA \ - uninstall-vapiDATA + uninstall-pkgconfigDATA uninstall-typelibDATA .MAKE: all check install install-am install-strip @@ -1031,16 +1005,14 @@ uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \ install-libLTLIBRARIES install-libappindicator3includeHEADERS \ install-libappindicatorincludeHEADERS install-man install-pdf \ install-pdf-am install-pkgconfigDATA install-ps install-ps-am \ - install-strip install-typelibDATA install-vapiDATA \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-girDATA \ - uninstall-libLTLIBRARIES \ + install-strip install-typelibDATA installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-girDATA uninstall-libLTLIBRARIES \ uninstall-libappindicator3includeHEADERS \ uninstall-libappindicatorincludeHEADERS \ - uninstall-pkgconfigDATA uninstall-typelibDATA \ - uninstall-vapiDATA + uninstall-pkgconfigDATA uninstall-typelibDATA stamp-enum-types: $(glib_enum_headers) @@ -1102,11 +1074,8 @@ gen-%.xml.c: %.xml @HAVE_INTROSPECTION_TRUE@AppIndicator$(VER)-0.1.gir: libappindicator$(VER).la -@HAVE_INTROSPECTION_TRUE@AppIndicator$(VER)-0.1.vapi: AppIndicator$(VER)-0.1.gir Makefile.am -@HAVE_INTROSPECTION_TRUE@ $(VALA_API_GEN) --library=AppIndicator$(VER)-0.1 \ -@HAVE_INTROSPECTION_TRUE@ --pkg $(GTKVAPI) \ -@HAVE_INTROSPECTION_TRUE@ --vapidir=$(top_builddir)/src \ -@HAVE_INTROSPECTION_TRUE@ $< +@HAVE_INTROSPECTION_TRUE@AppIndicator$(VER)-0.1.metadata: AppIndicator$(VER)-0.1.gir +@HAVE_INTROSPECTION_TRUE@ cp -f $(srcdir)/$@.in $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/src/app-indicator.c b/src/app-indicator.c index 039b980..f4e9173 100644 --- a/src/app-indicator.c +++ b/src/app-indicator.c @@ -103,6 +103,7 @@ enum { NEW_LABEL, CONNECTION_CHANGED, NEW_ICON_THEME_PATH, + SCROLL_EVENT, LAST_SIGNAL }; @@ -170,19 +171,22 @@ static void start_fallback_timer (AppIndicator * self, gboolean disable_timeout) 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 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); 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 client_menu_changed (GtkWidget *widget, GtkWidget *child, AppIndicator *indicator); static void theme_changed_cb (GtkIconTheme * theme, 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); static void bus_watcher_ready (GObject * obj, GAsyncResult * res, gpointer user_data); static const GDBusInterfaceVTable item_interface_table = { - method_call: NULL, /* No methods on this object */ + method_call: bus_method_call, get_property: bus_get_prop, set_property: NULL /* No properties that can be set */ }; @@ -469,6 +473,23 @@ app_indicator_class_init (AppIndicatorClass *klass) g_cclosure_marshal_VOID__STRING, 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 there is a new icon set for the + object. + */ + signals[SCROLL_EVENT] = g_signal_new (APP_INDICATOR_SIGNAL_SCROLL_EVENT, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (AppIndicatorClass, scroll_event), + NULL, NULL, + _application_service_marshal_VOID__INT_UINT, + G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT); + /* DBus interfaces */ if (item_node_info == NULL) { GError * error = NULL; @@ -899,6 +920,43 @@ bus_creation (GObject * obj, GAsyncResult * res, gpointer user_data) return; } +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) +{ + g_return_if_fail(IS_APP_INDICATOR(user_data)); + + AppIndicator * app = APP_INDICATOR(user_data); + GVariant * retval = NULL; + + if (g_strcmp0(method, "Scroll") == 0) { + guint direction; + gint delta; + const gchar *orientation; + + g_variant_get(params, "(i&s)", &delta, &orientation); + + if (g_strcmp0(orientation, "horizontal") == 0) { + direction = (delta >= 0) ? GDK_SCROLL_RIGHT : GDK_SCROLL_LEFT; + } else if (g_strcmp0(orientation, "vertical") == 0) { + direction = (delta >= 0) ? GDK_SCROLL_DOWN : GDK_SCROLL_UP; + } else { + g_dbus_method_invocation_return_value(invocation, retval); + return; + } + + delta = ABS(delta); + g_signal_emit(app, signals[SCROLL_EVENT], 0, delta, direction); + + } else { + g_warning("Calling method '%s' on the app-indicator and it's unknown", method); + } + + g_dbus_method_invocation_return_value(invocation, retval); +} + /* DBus is asking for a property so we should figure out what it wants and try and deliver. */ static GVariant * @@ -1053,7 +1111,8 @@ check_connect (AppIndicator *self) if (priv->watcher_proxy == NULL) { /* Build Watcher Proxy */ g_dbus_proxy_new(priv->connection, - G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, /* We don't use these, don't bother with them */ + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES| + G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, /* We don't use these, don't bother with them */ watcher_interface_info, NOTIFICATION_WATCHER_DBUS_ADDR, NOTIFICATION_WATCHER_DBUS_OBJ, @@ -1315,6 +1374,8 @@ fallback (AppIndicator * self) status_icon_changes(self, icon); 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); return icon; } @@ -1327,6 +1388,18 @@ status_icon_status_wrapper (AppIndicator * self, const gchar * status, gpointer return status_icon_changes(self, data); } +/* 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) +{ + 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 FALSE; +} + /* This tracks changes to either the status or the icons that are associated with the app indicator */ static void @@ -1388,6 +1461,14 @@ status_icon_activate (GtkStatusIcon * icon, gpointer data) return; } +/* Handles the right-click action by the status icon by showing + the menu in a popup. */ +static void +status_icon_menu_activate (GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) +{ + status_icon_activate(status_icon, user_data); +} + /* Removes the status icon as the application indicator area is now up and running again. */ static void @@ -1395,6 +1476,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); gtk_status_icon_set_visible(status_icon, FALSE); g_object_unref(G_OBJECT(status_icon)); return; diff --git a/src/app-indicator.h b/src/app-indicator.h index 3e159db..2a30b22 100644 --- a/src/app-indicator.h +++ b/src/app-indicator.h @@ -107,12 +107,18 @@ G_BEGIN_DECLS String identifier for the #AppIndicator::new-icon-theme-path 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" #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_SCROLL_EVENT "scroll-event" /** AppIndicatorCategory: @@ -163,7 +169,7 @@ typedef struct _AppIndicatorPrivate AppIndicatorPrivate; @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. - @app_indicator_reserved_sw: Reserved for future use. + @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. @@ -203,7 +209,12 @@ struct _AppIndicatorClass { void (* connection_changed) (AppIndicator * indicator, gboolean connected, gpointer user_data); - void (*app_indicator_reserved_sw)(void); + + void (* scroll_event) (AppIndicator * indicator, + gint delta, + GdkScrollDirection direction, + gpointer user_data); + void (*app_indicator_reserved_ats)(void); /* Overridable Functions */ diff --git a/src/application-service-marshal.c b/src/application-service-marshal.c index e109d7c..fb940b7 100644 --- a/src/application-service-marshal.c +++ b/src/application-service-marshal.c @@ -249,3 +249,40 @@ _application_service_marshal_VOID__BOOLEAN_STRING_OBJECT (GClosure *closure, data2); } +/* VOID:INT,UINT (./application-service-marshal.list:24) */ +void +_application_service_marshal_VOID__INT_UINT (GClosure *closure, + GValue *return_value G_GNUC_UNUSED, + guint n_param_values, + const GValue *param_values, + gpointer invocation_hint G_GNUC_UNUSED, + gpointer marshal_data) +{ + typedef void (*GMarshalFunc_VOID__INT_UINT) (gpointer data1, + gint arg_1, + guint arg_2, + gpointer data2); + register GMarshalFunc_VOID__INT_UINT callback; + register GCClosure *cc = (GCClosure*) closure; + register gpointer data1, data2; + + g_return_if_fail (n_param_values == 3); + + if (G_CCLOSURE_SWAP_DATA (closure)) + { + data1 = closure->data; + data2 = g_value_peek_pointer (param_values + 0); + } + else + { + data1 = g_value_peek_pointer (param_values + 0); + data2 = closure->data; + } + callback = (GMarshalFunc_VOID__INT_UINT) (marshal_data ? marshal_data : cc->callback); + + callback (data1, + g_marshal_value_peek_int (param_values + 1), + g_marshal_value_peek_uint (param_values + 2), + data2); +} + diff --git a/src/application-service-marshal.list b/src/application-service-marshal.list index 2b2efa5..39a55fe 100644 --- a/src/application-service-marshal.list +++ b/src/application-service-marshal.list @@ -21,3 +21,4 @@ VOID: INT, STRING, STRING VOID: INT, STRING VOID: STRING, STRING VOID: BOOL, STRING, OBJECT +VOID: INT, UINT diff --git a/src/gen-notification-item.xml.c b/src/gen-notification-item.xml.c index 5243f9e..b80567e 100644 --- a/src/gen-notification-item.xml.c +++ b/src/gen-notification-item.xml.c @@ -18,7 +18,10 @@ const char * _notification_item = " <property name=\"XAyatanaOrderingIndex\" type=\"u\" access=\"read\" />\n" "\n" "<!-- Methods -->\n" -" <!-- None currently -->\n" +" <method name=\"Scroll\">\n" +" <arg type=\"i\" name=\"delta\" direction=\"in\" />\n" +" <arg type=\"s\" name=\"orientation\" direction=\"in\" />\n" +" </method>\n" "\n" "<!-- Signals -->\n" " <signal name=\"NewIcon\">\n" @@ -35,7 +38,6 @@ const char * _notification_item = " <arg type=\"s\" name=\"label\" direction=\"out\" />\n" " <arg type=\"s\" name=\"guide\" direction=\"out\" />\n" " </signal>\n" -"\n" " </interface>\n" "</node>\n" ; diff --git a/src/notification-item.xml b/src/notification-item.xml index 05afd83..127eb3a 100644 --- a/src/notification-item.xml +++ b/src/notification-item.xml @@ -17,7 +17,10 @@ <property name="XAyatanaOrderingIndex" type="u" access="read" /> <!-- Methods --> - <!-- None currently --> + <method name="Scroll"> + <arg type="i" name="delta" direction="in" /> + <arg type="s" name="orientation" direction="in" /> + </method> <!-- Signals --> <signal name="NewIcon"> @@ -34,6 +37,5 @@ <arg type="s" name="label" direction="out" /> <arg type="s" name="guide" direction="out" /> </signal> - </interface> </node> |