From e6f4e517660c981eb453d0125460a1704c07461e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 27 Jan 2011 00:21:35 +0100 Subject: indicator-application: catch "scroll-entry" signal and send ApplicationScrollSignal to appstore This allows to catch every "scroll-entry" signal coming from the applet manager and to call the ApplicationScrollSignal method of indicator-application-service (to inform it about the scroll event) --- src/application-service.xml | 6 ++++++ src/indicator-application.c | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/src/application-service.xml b/src/application-service.xml index ae20900..bf1533f 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -28,6 +28,12 @@ with this program. If not, see . + + + + + + diff --git a/src/indicator-application.c b/src/indicator-application.c index 5754ac4..e72ee81 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -108,6 +108,7 @@ static void indicator_application_dispose (GObject *object); static void indicator_application_finalize (GObject *object); static GList * get_entries (IndicatorObject * io); static guint get_location (IndicatorObject * io, IndicatorObjectEntry * entry); +static void scroll_entry (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction); void connection_changed (IndicatorServiceManager * sm, gboolean connected, IndicatorApplication * application); static void connected (IndicatorApplication * application); static void disconnected (IndicatorApplication * application); @@ -142,6 +143,7 @@ indicator_application_class_init (IndicatorApplicationClass *klass) io_class->get_entries = get_entries; io_class->get_location = get_location; + io_class->scroll_entry = scroll_entry; return; } @@ -381,6 +383,29 @@ get_location (IndicatorObject * io, IndicatorObjectEntry * entry) return g_list_index(priv->applications, entry); } +/* Redirect the scroll event to the Application Item */ +static void scroll_entry (IndicatorObject * io, IndicatorObjectEntry * entry, gint delta, IndicatorScrollDirection direction) { + + g_return_if_fail(IS_INDICATOR_APPLICATION(io)); + + IndicatorApplicationPrivate * priv = INDICATOR_APPLICATION_GET_PRIVATE(io); + g_return_if_fail(priv->service_proxy); + + GList *l = g_list_find(priv->applications, entry); + if (l == NULL) + return; + + ApplicationEntry *app = l->data; + + if (app && app->dbusaddress && app->dbusobject && priv->service_proxy) { + g_dbus_proxy_call(priv->service_proxy, "ApplicationScrollSignal", + g_variant_new("(ssiu)", app->dbusaddress, + app->dbusobject, + delta, direction), + G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); + } +} + /* Does a quick meausre of how big the string is in pixels with a Pango layout */ static gint -- cgit v1.2.3 From 6adb897aad99b5ad100bcc1a1e7c12a8d3580ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Thu, 27 Jan 2011 00:23:32 +0100 Subject: application-appstore: support for ApplicationScrollSignal method When the ApplicationScrollSignal is called from indicator-application the XAyatanaScrollAction method provided by libappindicator is called with the scroll event data. So: indicator-application now is listening for that signal ("scroll-entry"), registering a call-back function. When it gets called, it finds the scrolled application and informs (via dbus) indicator-application-service that a scroll event has been registered for that application. Now the service (that is connected to every indicatorapp running) sends (via dbus, again) to the correct application the scroll-event informations. --- src/application-service-appstore.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 481d886..abe0089 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -260,6 +260,32 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, if (g_strcmp0(method, "GetApplications") == 0) { retval = get_applications(service); + } else if (g_strcmp0(method, "ApplicationScrollSignal") == 0) { + Application *app = NULL; + const gchar *dbusaddress; + const gchar *dbusobject; + gint delta; + guint direction; + + g_variant_get (params, "(&s&siu)", &dbusaddress, &dbusobject, + &delta, &direction); + + GList *l; + for (l = service->priv->applications; l != NULL; l = l->next) { + Application *a = l->data; + + if (g_strcmp0(a->dbus_name, dbusaddress) == 0 && + g_strcmp0(a->menu, dbusobject) == 0) { + app = a; + break; + } + } + + if (app != NULL && app->dbus_proxy != NULL) { + g_dbus_proxy_call(app->dbus_proxy, "XAyatanaScrollAction", + g_variant_new("(iu)", delta, direction), + G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); + } } else { g_warning("Calling method '%s' on the indicator service and it's unknown", method); } -- cgit v1.2.3 From 016feb948f488012ec87a2ac9036f041b1e81f94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 29 Jan 2011 03:25:32 +0100 Subject: indicator-application: rename the method ApplicationScrollSignal to ApplicationScrollEvent --- src/application-service.xml | 2 +- src/indicator-application.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/application-service.xml b/src/application-service.xml index bf1533f..1ad7030 100644 --- a/src/application-service.xml +++ b/src/application-service.xml @@ -28,7 +28,7 @@ with this program. If not, see . - + diff --git a/src/indicator-application.c b/src/indicator-application.c index e72ee81..cd83bdf 100644 --- a/src/indicator-application.c +++ b/src/indicator-application.c @@ -398,7 +398,7 @@ static void scroll_entry (IndicatorObject * io, IndicatorObjectEntry * entry, gi ApplicationEntry *app = l->data; if (app && app->dbusaddress && app->dbusobject && priv->service_proxy) { - g_dbus_proxy_call(priv->service_proxy, "ApplicationScrollSignal", + g_dbus_proxy_call(priv->service_proxy, "ApplicationScrollEvent", g_variant_new("(ssiu)", app->dbusaddress, app->dbusobject, delta, direction), -- cgit v1.2.3 From df3e14484ca574da270a2e7d38a82e25e6b86ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 29 Jan 2011 03:26:08 +0100 Subject: Using the SNI method "Scroll" instead of "XAyatanaScrollAction" --- src/application-service-appstore.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index abe0089..e6169a0 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -260,10 +260,11 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, if (g_strcmp0(method, "GetApplications") == 0) { retval = get_applications(service); - } else if (g_strcmp0(method, "ApplicationScrollSignal") == 0) { + } else if (g_strcmp0(method, "ApplicationScrollEvent") == 0) { Application *app = NULL; const gchar *dbusaddress; const gchar *dbusobject; + gchar *orientation = NULL; gint delta; guint direction; @@ -281,9 +282,22 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, } } - if (app != NULL && app->dbus_proxy != NULL) { - g_dbus_proxy_call(app->dbus_proxy, "XAyatanaScrollAction", - g_variant_new("(iu)", delta, direction), + switch (direction) { + case GDK_SCROLL_UP: + delta = -delta; + case GDK_SCROLL_DOWN: + orientation = "vertical"; + break; + + case GDK_SCROLL_LEFT: + delta = -delta; + case GDK_SCROLL_RIGHT: + orientation = "horizontal"; + } + + if (app != NULL && app->dbus_proxy != NULL && orientation != NULL) { + g_dbus_proxy_call(app->dbus_proxy, "Scroll", + g_variant_new("(is)", delta, orientation), G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL, NULL); } } else { -- cgit v1.2.3 From 70bc5ad4a4296583313a461642b908a8b6490069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Sat, 29 Jan 2011 03:33:18 +0100 Subject: Use INDICATOR_OBJECT_SCROLL instead of GDK_SCROLL enum value --- src/application-service-appstore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index e6169a0..7cadc13 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -283,15 +283,15 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, } switch (direction) { - case GDK_SCROLL_UP: + case INDICATOR_OBJECT_SCROLL_UP: delta = -delta; - case GDK_SCROLL_DOWN: + case INDICATOR_OBJECT_SCROLL_DOWN: orientation = "vertical"; break; - case GDK_SCROLL_LEFT: + case INDICATOR_OBJECT_SCROLL_LEFT: delta = -delta; - case GDK_SCROLL_RIGHT: + case INDICATOR_OBJECT_SCROLL_RIGHT: orientation = "horizontal"; } -- cgit v1.2.3 From 2a3698253f8ca0c280f917c483c39357a8f6b426 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Feb 2011 14:53:39 -0600 Subject: Adding in the indicator-object header --- src/application-service-appstore.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 52a510e..c9e803f 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -24,6 +24,7 @@ with this program. If not, see . #include "config.h" #endif +#include "libindicator/indicator-object.h" #include "libappindicator/app-indicator.h" #include "app-indicator-enum-types.h" #include "application-service-appstore.h" -- cgit v1.2.3 From f780ca4c2732d62a46c25a587aa85c02b5a88dd3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 3 Feb 2011 14:53:45 -0600 Subject: 0.2.93 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f76ec1f..fa8d252 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(indicator-application, 0.2.92, ted@canonical.com) +AC_INIT(indicator-application, 0.2.93, ted@canonical.com) AC_COPYRIGHT([Copyright 2009, 2010 Canonical]) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-application, 0.2.92) +AM_INIT_AUTOMAKE(indicator-application, 0.2.93) AM_MAINTAINER_MODE -- cgit v1.2.3