aboutsummaryrefslogtreecommitdiff
path: root/src/application-service-appstore.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-03 11:03:53 -0600
committerTed Gould <ted@gould.cx>2011-02-03 11:03:53 -0600
commitdc47b4e17dae22058e3812e975c7fede2eb9273e (patch)
tree4448c63264796dcb458d268adbd08246200922b9 /src/application-service-appstore.c
parent82c80cd622d65cdce1c1eef15a71baf8a3530f7f (diff)
parent70bc5ad4a4296583313a461642b908a8b6490069 (diff)
downloadayatana-indicator-application-dc47b4e17dae22058e3812e975c7fede2eb9273e.tar.gz
ayatana-indicator-application-dc47b4e17dae22058e3812e975c7fede2eb9273e.tar.bz2
ayatana-indicator-application-dc47b4e17dae22058e3812e975c7fede2eb9273e.zip
Support scroll events from libindicator on down to sending them to the applications.
Diffstat (limited to 'src/application-service-appstore.c')
-rw-r--r--src/application-service-appstore.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index dd94561..52a510e 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -260,6 +260,46 @@ bus_method_call (GDBusConnection * connection, const gchar * sender,
if (g_strcmp0(method, "GetApplications") == 0) {
retval = get_applications(service);
+ } else if (g_strcmp0(method, "ApplicationScrollEvent") == 0) {
+ Application *app = NULL;
+ const gchar *dbusaddress;
+ const gchar *dbusobject;
+ gchar *orientation = NULL;
+ 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;
+ }
+ }
+
+ switch (direction) {
+ case INDICATOR_OBJECT_SCROLL_UP:
+ delta = -delta;
+ case INDICATOR_OBJECT_SCROLL_DOWN:
+ orientation = "vertical";
+ break;
+
+ case INDICATOR_OBJECT_SCROLL_LEFT:
+ delta = -delta;
+ case INDICATOR_OBJECT_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 {
g_warning("Calling method '%s' on the indicator service and it's unknown", method);
}