← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~3v1n0/indicator-application/scroll-event-support into lp:indicator-application

 

Treviño (Marco Trevisan) has proposed merging lp:~3v1n0/indicator-application/scroll-event-support into lp:indicator-application.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)
Related bugs:
  #708180 Indicators "scroll-event" support
  https://bugs.launchpad.net/bugs/708180

For more details, see:
https://code.launchpad.net/~3v1n0/indicator-application/scroll-event-support/+merge/47610

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.

This depends on:
lp:~3v1n0/libindicator/scroll-event-support

This is part of the Indicators "scroll-event" support patch, see bug #708180
-- 
https://code.launchpad.net/~3v1n0/indicator-application/scroll-event-support/+merge/47610
Your team ayatana-commits is subscribed to branch lp:indicator-application.
=== modified file 'src/application-service-appstore.c'
--- src/application-service-appstore.c	2011-01-14 02:25:13 +0000
+++ src/application-service-appstore.c	2011-01-26 23:58:57 +0000
@@ -260,6 +260,32 @@
 
 	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);
 	}

=== modified file 'src/application-service.xml'
--- src/application-service.xml	2011-01-14 02:10:12 +0000
+++ src/application-service.xml	2011-01-26 23:58:57 +0000
@@ -28,6 +28,12 @@
 		<method name="GetApplications">
 			<arg type="a(sisosss)" name="applications" direction="out" />
 		</method>
+		<method name="ApplicationScrollSignal">
+			<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">

=== modified file 'src/indicator-application.c'
--- src/indicator-application.c	2011-01-13 17:03:04 +0000
+++ src/indicator-application.c	2011-01-26 23:58:57 +0000
@@ -108,6 +108,7 @@
 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 @@
 
 	io_class->get_entries = get_entries;
 	io_class->get_location = get_location;
+	io_class->scroll_entry = scroll_entry;
 
 	return;
 }
@@ -381,6 +383,29 @@
 	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


Follow ups