aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-02-03 14:54:42 -0600
committerTed Gould <ted@gould.cx>2011-02-03 14:54:42 -0600
commitcd55d421ca00a32f8ee1f0a4339eec23160284c7 (patch)
tree54f1c95e35b916bd493b77f6d5aa0097926eaaa3 /src
parent2c6ef4e38e32386cc19bb8e1eb094378ef1c58f1 (diff)
parentf780ca4c2732d62a46c25a587aa85c02b5a88dd3 (diff)
downloadayatana-indicator-application-cd55d421ca00a32f8ee1f0a4339eec23160284c7.tar.gz
ayatana-indicator-application-cd55d421ca00a32f8ee1f0a4339eec23160284c7.tar.bz2
ayatana-indicator-application-cd55d421ca00a32f8ee1f0a4339eec23160284c7.zip
Import upstream version 0.2.93
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in6
-rw-r--r--src/application-service-appstore.c41
-rw-r--r--src/application-service.xml6
-rw-r--r--src/gen-application-service.xml.c6
-rw-r--r--src/indicator-application.c25
5 files changed, 80 insertions, 4 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index c24eb09..ae28f65 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -74,10 +74,8 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
libexec_PROGRAMS = indicator-application-service$(EXEEXT)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index dd94561..c9e803f 100644
--- a/src/application-service-appstore.c
+++ b/src/application-service-appstore.c
@@ -24,6 +24,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#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"
@@ -260,6 +261,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);
}
diff --git a/src/application-service.xml b/src/application-service.xml
index ae20900..1ad7030 100644
--- a/src/application-service.xml
+++ b/src/application-service.xml
@@ -28,6 +28,12 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
<method name="GetApplications">
<arg type="a(sisosss)" name="applications" direction="out" />
</method>
+ <method name="ApplicationScrollEvent">
+ <arg type="s" name="dbusaddress" direction="in" />
+ <arg type="s" name="dbusobject" direction="in" />
+ <arg type="i" name="delta" direction="in" />
+ <arg type="u" name="direction" direction="in" />
+ </method>
<!-- Signals -->
<signal name="ApplicationAdded">
diff --git a/src/gen-application-service.xml.c b/src/gen-application-service.xml.c
index 2a0277a..292cb62 100644
--- a/src/gen-application-service.xml.c
+++ b/src/gen-application-service.xml.c
@@ -29,6 +29,12 @@ const char * _application_service =
" <method name=\"GetApplications\">\n"
" <arg type=\"a(sisosss)\" name=\"applications\" direction=\"out\" />\n"
" </method>\n"
+" <method name=\"ApplicationScrollEvent\">\n"
+" <arg type=\"s\" name=\"dbusaddress\" direction=\"in\" />\n"
+" <arg type=\"s\" name=\"dbusobject\" direction=\"in\" />\n"
+" <arg type=\"i\" name=\"delta\" direction=\"in\" />\n"
+" <arg type=\"u\" name=\"direction\" direction=\"in\" />\n"
+" </method>\n"
"\n"
"<!-- Signals -->\n"
" <signal name=\"ApplicationAdded\">\n"
diff --git a/src/indicator-application.c b/src/indicator-application.c
index 5754ac4..cd83bdf 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, "ApplicationScrollEvent",
+ 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