From 1d51365ac7ecc5299f49c1c8a1985caa16a125c9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 10:27:53 -0500 Subject: XAyatana the register interface --- src/notification-watcher.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notification-watcher.xml b/src/notification-watcher.xml index cc7882d..5f19dd2 100644 --- a/src/notification-watcher.xml +++ b/src/notification-watcher.xml @@ -22,7 +22,7 @@ - + -- cgit v1.2.3 From a1e4f99efd90621eb9615ca761e65a37f941cbe8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 10:29:09 -0500 Subject: Changing function name as well. --- src/application-service-watcher.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c index 4fe3bc7..5b77620 100644 --- a/src/application-service-watcher.c +++ b/src/application-service-watcher.c @@ -34,7 +34,7 @@ static gboolean _notification_watcher_server_register_status_notifier_item (Appl 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_register_notification_approver (ApplicationServiceWatcher * appwatcher, const gchar * path, const GArray * categories, DBusGMethodInvocation * method); +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); @@ -252,7 +252,7 @@ get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer data) } static gboolean -_notification_watcher_server_register_notification_approver (ApplicationServiceWatcher * appwatcher, const gchar * path, const GArray * categories, DBusGMethodInvocation * method) +_notification_watcher_server_x_ayatana_register_notification_approver (ApplicationServiceWatcher * appwatcher, const gchar * path, const GArray * categories, DBusGMethodInvocation * method) { ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(appwatcher); -- cgit v1.2.3 From 12c8cd4a0caa402426b23adad343e83d05d27d3f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 10:31:20 -0500 Subject: Adding a signal to the approver interface --- src/notification-approver.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/notification-approver.xml b/src/notification-approver.xml index b1e69b9..4a8e39b 100644 --- a/src/notification-approver.xml +++ b/src/notification-approver.xml @@ -18,5 +18,12 @@ + + + + + + + -- cgit v1.2.3 From ca213633c7a98b7d9dd37a5a373f7ef825098eeb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 14:02:47 -0500 Subject: Connecting into the signal coming from the approver --- src/application-service-appstore.c | 29 +++++++++++++++++++++++++++++ src/application-service-marshal.list | 1 + 2 files changed, 30 insertions(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 30af2ea..789ca48 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -183,6 +183,12 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass) G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_object_register_marshaller(_application_service_marshal_VOID__BOOLEAN_STRING_OBJECT, + G_TYPE_NONE, + G_TYPE_BOOLEAN, + G_TYPE_STRING, + G_TYPE_OBJECT, + G_TYPE_INVALID); dbus_g_object_type_install_info(APPLICATION_SERVICE_APPSTORE_TYPE, &dbus_glib__application_service_server_object_info); @@ -1164,6 +1170,17 @@ approver_destroyed (gpointer pproxy, gpointer pappstore) return; } +/* A signal when an approver changes the why that it thinks about + a particular indicator. */ +void +approver_revise_judgement (DBusGProxy * proxy, gboolean new_status, gchar * address, DBusGProxy * get_path, gpointer user_data) +{ + ApplicationServiceAppstore * appstore = APPLICATION_SERVICE_APPSTORE(user_data); + appstore = NULL; + + return; +} + /* Adds a new approver to the app store */ void application_service_appstore_approver_add (ApplicationServiceAppstore * appstore, const gchar * dbus_name, const gchar * dbus_object) @@ -1191,6 +1208,18 @@ application_service_appstore_approver_add (ApplicationServiceAppstore * appstore g_signal_connect(G_OBJECT(approver->proxy), "destroy", G_CALLBACK(approver_destroyed), appstore); + dbus_g_proxy_add_signal(approver->proxy, + "ReviseJudgement", + G_TYPE_BOOLEAN, + G_TYPE_STRING, + DBUS_TYPE_G_OBJECT_PATH, + G_TYPE_INVALID); + dbus_g_proxy_connect_signal(approver->proxy, + "ReviseJudgement", + G_CALLBACK(approver_revise_judgement), + appstore, + NULL); + priv->approvers = g_list_prepend(priv->approvers, approver); g_list_foreach(priv->applications, check_with_new_approver, approver); diff --git a/src/application-service-marshal.list b/src/application-service-marshal.list index f432028..2b2efa5 100644 --- a/src/application-service-marshal.list +++ b/src/application-service-marshal.list @@ -20,3 +20,4 @@ VOID: STRING, INT, STRING, STRING, STRING, STRING, STRING VOID: INT, STRING, STRING VOID: INT, STRING VOID: STRING, STRING +VOID: BOOL, STRING, OBJECT -- cgit v1.2.3 From 1865cf3b4e415dcb8b9cf85208ab88596d00b043 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 14:26:10 -0500 Subject: Refactor so that there is a function to look for applications. --- src/application-service-appstore.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 789ca48..7040b2a 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -959,6 +959,24 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst return; } +/* Looks for an application in the list of applications */ +static Application * +find_application (ApplicationServiceAppstore * appstore, const gchar * address, const gchar * object) +{ + ApplicationServiceAppstorePrivate * priv = appstore->priv; + GList * listpntr; + + for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) { + Application * app = (Application *)listpntr->data; + + if (!g_strcmp0(app->dbus_name, address) && !g_strcmp0(app->dbus_object, object)) { + return app; + } + } + + return NULL; +} + /* Removes an application. Currently only works for the apps that are shown. */ void @@ -968,16 +986,11 @@ application_service_appstore_application_remove (ApplicationServiceAppstore * ap g_return_if_fail(dbus_name != NULL && dbus_name[0] != '\0'); g_return_if_fail(dbus_object != NULL && dbus_object[0] != '\0'); - ApplicationServiceAppstorePrivate * priv = appstore->priv; - GList * listpntr; - - for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) { - Application * app = (Application *)listpntr->data; - - if (!g_strcmp0(app->dbus_name, dbus_name) && !g_strcmp0(app->dbus_object, dbus_object)) { - application_removed_cb(NULL, app); - break; /* NOTE: Must break as the list will become inconsistent */ - } + Application * app = find_application(appstore, dbus_name, dbus_object); + if (app != NULL) { + application_removed_cb(NULL, app); + } else { + g_warning("Unable to find application %s:%s", dbus_name, dbus_object); } return; -- cgit v1.2.3 From 9fc60ae8675fe81a3c051e5f4de0378ecfd75069 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 14:26:38 -0500 Subject: Flesh out the revise judgement handler to update the list of approvers. --- src/application-service-appstore.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 7040b2a..2d77d28 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -1188,8 +1188,27 @@ approver_destroyed (gpointer pproxy, gpointer pappstore) void approver_revise_judgement (DBusGProxy * proxy, gboolean new_status, gchar * address, DBusGProxy * get_path, gpointer user_data) { + g_return_if_fail(IS_APPLICATION_SERVICE_APPSTORE(user_data)); + g_return_if_fail(address != NULL && address[0] != '\0'); + g_return_if_fail(get_path != NULL); + const gchar * path = dbus_g_proxy_get_path(get_path); + g_return_if_fail(path != NULL && path[0] != '\0'); + ApplicationServiceAppstore * appstore = APPLICATION_SERVICE_APPSTORE(user_data); - appstore = NULL; + + Application * app = find_application(appstore, address, path); + + if (app == NULL) { + g_warning("Unable to update approver status of application (%s:%s) as it was not found", address, path); + return; + } + + if (new_status) { + app->approved_by = g_list_prepend(app->approved_by, proxy); + } else { + app->approved_by = g_list_remove(app->approved_by, proxy); + } + apply_status(app); return; } -- cgit v1.2.3