aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2011-01-27 00:21:35 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2011-01-27 00:21:35 +0100
commite6f4e517660c981eb453d0125460a1704c07461e (patch)
treed0280f187ade93f3df82690e2a1206f533ee1ffa
parent85761bcb811b75dc0470369581f452e17ebd95f1 (diff)
downloadayatana-indicator-application-e6f4e517660c981eb453d0125460a1704c07461e.tar.gz
ayatana-indicator-application-e6f4e517660c981eb453d0125460a1704c07461e.tar.bz2
ayatana-indicator-application-e6f4e517660c981eb453d0125460a1704c07461e.zip
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)
-rw-r--r--src/application-service.xml6
-rw-r--r--src/indicator-application.c25
2 files changed, 31 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
<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">
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