ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #02513
[Merge] lp:~agateau/indicator-application/watcher-impl-fixes into lp:indicator-application
Aurélien Gâteau has proposed merging lp:~agateau/indicator-application/watcher-impl-fixes into lp:indicator-application.
Requested reviews:
Indicator Applet Developers (indicator-applet-developers)
Fix implementation of org.kde.StatusNotifierWatcher interface:
ProtocolVersion, IsStatusNotifierHostRegistered and RegisteredStatusNotifierItems are properties, not methods.
--
https://code.launchpad.net/~agateau/indicator-application/watcher-impl-fixes/+merge/37983
Your team ayatana-commits is subscribed to branch lp:indicator-application.
=== modified file 'src/application-service-appstore.c'
--- src/application-service-appstore.c 2010-09-15 16:12:42 +0000
+++ src/application-service-appstore.c 2010-10-08 15:08:47 +0000
@@ -1022,6 +1022,24 @@
return;
}
+gchar**
+application_service_appstore_application_get_list (ApplicationServiceAppstore * appstore)
+{
+ ApplicationServiceAppstorePrivate * priv = appstore->priv;
+ gchar ** out;
+ gchar ** outpntr;
+ GList * listpntr;
+
+ out = g_new(gchar*, g_list_length(priv->applications) + 1);
+
+ for (listpntr = priv->applications, outpntr = out; listpntr != NULL; listpntr = g_list_next(listpntr), ++outpntr) {
+ Application * app = (Application *)listpntr->data;
+ *outpntr = g_strdup_printf("%s%s", app->dbus_name, app->dbus_object);
+ }
+ *outpntr = 0;
+ return out;
+}
+
/* Creates a basic appstore object and attaches the
LRU file object to it. */
ApplicationServiceAppstore *
=== modified file 'src/application-service-appstore.h'
--- src/application-service-appstore.h 2010-08-10 20:22:29 +0000
+++ src/application-service-appstore.h 2010-10-08 15:08:47 +0000
@@ -66,6 +66,7 @@
void application_service_appstore_approver_add (ApplicationServiceAppstore * appstore,
const gchar * dbus_name,
const gchar * dbus_object);
+gchar** application_service_appstore_application_get_list (ApplicationServiceAppstore * appstore);
G_END_DECLS
=== modified file 'src/application-service-watcher.c'
--- src/application-service-watcher.c 2010-08-18 15:29:09 +0000
+++ src/application-service-watcher.c 2010-10-08 15:08:47 +0000
@@ -30,12 +30,25 @@
#include "application-service-watcher.h"
#include "dbus-shared.h"
+/* Enum for the properties so that they can be quickly
+ found and looked up. */
+enum {
+ PROP_0,
+ PROP_PROTOCOL_VERSION,
+ PROP_IS_STATUS_NOTIFIER_HOST_REGISTERED,
+ PROP_REGISTERED_STATUS_NOTIFIER_ITEMS
+};
+
+/* The strings so that they can be slowly looked up. */
+#define PROP_PROTOCOL_VERSION_S "protocol-version"
+#define PROP_IS_STATUS_NOTIFIER_HOST_REGISTERED_S "is-status-notifier-host-registered"
+#define PROP_REGISTERED_STATUS_NOTIFIER_ITEMS_S "registered-status-notifier-items"
+
+#define CURRENT_PROTOCOL_VERSION 0
+
static gboolean _notification_watcher_server_register_status_notifier_item (ApplicationServiceWatcher * appwatcher, const gchar * service, DBusGMethodInvocation * method);
-static gboolean _notification_watcher_server_registered_status_notifier_items (ApplicationServiceWatcher * appwatcher, GArray ** apps);
-static gboolean _notification_watcher_server_protocol_version (ApplicationServiceWatcher * appwatcher, char ** version);
static gboolean _notification_watcher_server_register_notification_host (ApplicationServiceWatcher * appwatcher, const gchar * host);
static gboolean _notification_watcher_server_x_ayatana_register_notification_approver (ApplicationServiceWatcher * appwatcher, const gchar * path, const GArray * categories, DBusGMethodInvocation * method);
-static gboolean _notification_watcher_server_is_notification_host_registered (ApplicationServiceWatcher * appwatcher, gboolean * haveHost);
static void get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer data);
#include "notification-watcher-server.h"
@@ -66,6 +79,8 @@
static void application_service_watcher_init (ApplicationServiceWatcher *self);
static void application_service_watcher_dispose (GObject *object);
static void application_service_watcher_finalize (GObject *object);
+static void application_service_watcher_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
+static void application_service_watcher_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
G_DEFINE_TYPE (ApplicationServiceWatcher, application_service_watcher, G_TYPE_OBJECT);
@@ -79,6 +94,34 @@
object_class->dispose = application_service_watcher_dispose;
object_class->finalize = application_service_watcher_finalize;
+ /* Property funcs */
+ object_class->set_property = application_service_watcher_set_property;
+ object_class->get_property = application_service_watcher_get_property;
+
+ /* Properties */
+ g_object_class_install_property (object_class,
+ PROP_PROTOCOL_VERSION,
+ g_param_spec_int(PROP_PROTOCOL_VERSION_S,
+ "Protocol Version",
+ "Which version of the StatusNotifierProtocol this watcher implements",
+ 0, G_MAXINT,
+ CURRENT_PROTOCOL_VERSION,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_IS_STATUS_NOTIFIER_HOST_REGISTERED,
+ g_param_spec_boolean(PROP_IS_STATUS_NOTIFIER_HOST_REGISTERED_S,
+ "Is StatusNotifierHost Registered",
+ "True if there is at least one StatusNotifierHost registered",
+ FALSE,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_REGISTERED_STATUS_NOTIFIER_ITEMS,
+ g_param_spec_boxed(PROP_REGISTERED_STATUS_NOTIFIER_ITEMS_S,
+ "Registered StatusNotifierItems",
+ "The list of StatusNotifierItems registered to this watcher",
+ G_TYPE_STRV,
+ G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ /* Signals */
signals[SERVICE_REGISTERED] = g_signal_new ("service-registered",
G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
@@ -175,6 +218,29 @@
return;
}
+static void
+application_service_watcher_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+ /* There are no writable properties for now */
+}
+
+static void
+application_service_watcher_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec)
+{
+ ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(object);
+ switch (prop_id) {
+ case PROP_PROTOCOL_VERSION:
+ g_value_set_int (value, CURRENT_PROTOCOL_VERSION);
+ break;
+ case PROP_IS_STATUS_NOTIFIER_HOST_REGISTERED:
+ g_value_set_boolean (value, TRUE);
+ break;
+ case PROP_REGISTERED_STATUS_NOTIFIER_ITEMS:
+ g_value_set_boxed (value, application_service_appstore_application_get_list(priv->appstore));
+ break;
+ }
+}
+
ApplicationServiceWatcher *
application_service_watcher_new (ApplicationServiceAppstore * appstore)
{
@@ -205,33 +271,12 @@
}
static gboolean
-_notification_watcher_server_registered_status_notifier_items (ApplicationServiceWatcher * appwatcher, GArray ** apps)
-{
-
- return FALSE;
-}
-
-static gboolean
-_notification_watcher_server_protocol_version (ApplicationServiceWatcher * appwatcher, char ** version)
-{
- *version = g_strdup("Ayatana Version 1");
- return TRUE;
-}
-
-static gboolean
_notification_watcher_server_register_notification_host (ApplicationServiceWatcher * appwatcher, const gchar * host)
{
return FALSE;
}
-static gboolean
-_notification_watcher_server_is_notification_host_registered (ApplicationServiceWatcher * appwatcher, gboolean * haveHost)
-{
- *haveHost = TRUE;
- return TRUE;
-}
-
/* Function to handle the return of the get name. There isn't a whole
lot that can be done, but we're atleast going to tell people. */
static void
=== modified file 'src/notification-watcher.xml'
--- src/notification-watcher.xml 2010-08-18 15:27:53 +0000
+++ src/notification-watcher.xml 2010-10-08 15:08:47 +0000
@@ -3,25 +3,18 @@
<interface name="org.kde.StatusNotifierWatcher">
<!-- Properties -->
- <!-- None currently -->
+ <property name="ProtocolVersion" type="i" access="read" />
+ <property name="IsStatusNotifierHostRegistered" type="b" access="read" />
+ <property name="RegisteredStatusNotifierItems" type="as" access="read" />
<!-- Methods -->
<method name="RegisterStatusNotifierItem">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true" />
<arg type="s" name="service" direction="in" />
</method>
- <method name="RegisteredStatusNotifierItems">
- <arg type="as" name="services" direction="out" />
- </method>
- <method name="ProtocolVersion">
- <arg type="s" name="version" direction="out" />
- </method>
<method name="RegisterNotificationHost">
<arg type="s" name="service" direction="in" />
</method>
- <method name="IsNotificationHostRegistered">
- <arg type="b" name="hasHost" direction="out" />
- </method>
<method name="XAyatanaRegisterNotificationApprover">
<annotation name="org.freedesktop.DBus.GLib.Async" value="true" />
<!-- The path where to find the approver interface -->
Follow ups