From a46a27a598890cd49f67b076866fc6b4b6042485 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 25 Jun 2010 14:34:03 -0500 Subject: Adding an approver interface. --- .bzrignore | 2 ++ src/Makefile.am | 1 + src/notification-approver.xml | 22 ++++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/notification-approver.xml diff --git a/.bzrignore b/.bzrignore index c044203..0d82d3e 100644 --- a/.bzrignore +++ b/.bzrignore @@ -107,3 +107,5 @@ docs/reference/libappindicator-decl.txt.bak docs/reference/libappindicator-decl-list.txt.bak src/AppIndicator-0.1.vapi bindings/mono/policy.appindicator-sharp.dll +src/notification-approver-client.h +src/notification-approver-server.h diff --git a/src/Makefile.am b/src/Makefile.am index 787ba2f..68be1c0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -116,6 +116,7 @@ libappindicator_la_LIBADD = \ DBUS_SPECS = \ dbus-properties.xml \ application-service.xml \ + notification-approver.xml \ notification-item.xml \ notification-watcher.xml diff --git a/src/notification-approver.xml b/src/notification-approver.xml new file mode 100644 index 0000000..e7ba780 --- /dev/null +++ b/src/notification-approver.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 4c9f4340d8ba171ed3c6edf2cbaf8de498e4493d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 25 Jun 2010 14:38:21 -0500 Subject: Adding a function to register an approver. --- src/notification-watcher.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/notification-watcher.xml b/src/notification-watcher.xml index c2324f1..06a7785 100644 --- a/src/notification-watcher.xml +++ b/src/notification-watcher.xml @@ -22,6 +22,12 @@ + + + + + + -- cgit v1.2.3 From 6cf35d78ab649d06cc3d74710e8d06b22871ebb1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 25 Jun 2010 14:43:16 -0500 Subject: Adding in a template function to register approvers. --- src/application-service-watcher.c | 8 ++++++++ src/notification-watcher.xml | 1 + 2 files changed, 9 insertions(+) diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c index eff249d..844585d 100644 --- a/src/application-service-watcher.c +++ b/src/application-service-watcher.c @@ -34,6 +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 GValue * 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); @@ -249,3 +250,10 @@ get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer data) return; } + +static gboolean +_notification_watcher_server_register_notification_approver (ApplicationServiceWatcher * appwatcher, const GValue * path, const GArray * categories, DBusGMethodInvocation * method) +{ + + return FALSE; +} diff --git a/src/notification-watcher.xml b/src/notification-watcher.xml index 06a7785..cc7882d 100644 --- a/src/notification-watcher.xml +++ b/src/notification-watcher.xml @@ -23,6 +23,7 @@ + -- cgit v1.2.3 From a8aac3aa0fd375c258579df7bc9db031900966dd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 1 Jul 2010 14:29:30 -0500 Subject: Return a boolean --- src/notification-approver.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/notification-approver.xml b/src/notification-approver.xml index e7ba780..b1e69b9 100644 --- a/src/notification-approver.xml +++ b/src/notification-approver.xml @@ -15,7 +15,7 @@ - + -- cgit v1.2.3 From 925e3d8fea64fecdb16ce4a83750abb414f8687b Mon Sep 17 00:00:00 2001 From: Sense Hofstede Date: Thu, 8 Jul 2010 20:45:51 +0200 Subject: Removed all but one calls to the APPLICATION_SERVICE_APPSTORE_GET_PRIVATE() macro All references to the APPLICATION_SERVICE_APPSTORE_GET_PRIVATE() macro were removed from src/application-service-appstore.c. This makes this file comply with the recommended practise, which should reduce overhead. --- src/application-service-appstore.c | 22 ++++++++++++---------- src/application-service-appstore.h | 3 +++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 15abea3..886fe92 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -50,7 +50,6 @@ static gboolean _application_service_server_get_applications (ApplicationService #define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus" /* Private Stuff */ -typedef struct _ApplicationServiceAppstorePrivate ApplicationServiceAppstorePrivate; struct _ApplicationServiceAppstorePrivate { DBusGConnection * bus; GList * applications; @@ -139,7 +138,8 @@ application_service_appstore_class_init (ApplicationServiceAppstoreClass *klass) static void application_service_appstore_init (ApplicationServiceAppstore *self) { - ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(self); + + ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE (self); priv->applications = NULL; priv->lrufile = NULL; @@ -155,6 +155,8 @@ application_service_appstore_init (ApplicationServiceAppstore *self) dbus_g_connection_register_g_object(priv->bus, INDICATOR_APPLICATION_DBUS_OBJ, G_OBJECT(self)); + + self->priv = priv; return; } @@ -162,7 +164,7 @@ application_service_appstore_init (ApplicationServiceAppstore *self) static void application_service_appstore_dispose (GObject *object) { - ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(object); + ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE(object)->priv; while (priv->applications != NULL) { application_service_appstore_application_remove(APPLICATION_SERVICE_APPSTORE(object), @@ -209,7 +211,7 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err app->id = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ID)); app->category = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_CATEGORY)); - ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(app->appstore); + ApplicationServiceAppstorePrivate * priv = app->appstore->priv; app_lru_file_touch(priv->lrufile, app->id, app->category); app->icon = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_NAME)); @@ -265,7 +267,7 @@ string_to_status(const gchar * status_string) static gint get_position (Application * app) { ApplicationServiceAppstore * appstore = app->appstore; - ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + ApplicationServiceAppstorePrivate * priv = appstore->priv; GList * applistitem = g_list_find(priv->applications, app); if (applistitem == NULL) { @@ -384,7 +386,7 @@ apply_status (Application * app, AppIndicatorStatus status) g_debug("Changing app status to: %d", status); ApplicationServiceAppstore * appstore = app->appstore; - ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + ApplicationServiceAppstorePrivate * priv = appstore->priv; /* This means we're going off line */ if (status == APP_INDICATOR_STATUS_PASSIVE) { @@ -567,7 +569,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst g_return_if_fail(IS_APPLICATION_SERVICE_APPSTORE(appstore)); g_return_if_fail(dbus_name != NULL && dbus_name[0] != '\0'); g_return_if_fail(dbus_object != NULL && dbus_object[0] != '\0'); - ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + ApplicationServiceAppstorePrivate * priv = appstore->priv; /* Build the application entry. This will be carried along until we're sure we've got everything. */ @@ -665,7 +667,7 @@ 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 = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + ApplicationServiceAppstorePrivate * priv = appstore->priv; GList * listpntr; for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) { @@ -687,7 +689,7 @@ application_service_appstore_new (AppLruFile * lrufile) { g_return_val_if_fail(IS_APP_LRU_FILE(lrufile), NULL); ApplicationServiceAppstore * appstore = APPLICATION_SERVICE_APPSTORE(g_object_new(APPLICATION_SERVICE_APPSTORE_TYPE, NULL)); - ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + ApplicationServiceAppstorePrivate * priv = appstore->priv; priv->lrufile = lrufile; return appstore; } @@ -696,7 +698,7 @@ application_service_appstore_new (AppLruFile * lrufile) static gboolean _application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps, GError ** error) { - ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + ApplicationServiceAppstorePrivate * priv = appstore->priv; *apps = g_ptr_array_new(); GList * listpntr; diff --git a/src/application-service-appstore.h b/src/application-service-appstore.h index d2e0013..86d989b 100644 --- a/src/application-service-appstore.h +++ b/src/application-service-appstore.h @@ -38,6 +38,7 @@ G_BEGIN_DECLS typedef struct _ApplicationServiceAppstore ApplicationServiceAppstore; typedef struct _ApplicationServiceAppstoreClass ApplicationServiceAppstoreClass; +typedef struct _ApplicationServiceAppstorePrivate ApplicationServiceAppstorePrivate; struct _ApplicationServiceAppstoreClass { GObjectClass parent_class; @@ -49,6 +50,8 @@ struct _ApplicationServiceAppstoreClass { struct _ApplicationServiceAppstore { GObject parent; + + ApplicationServiceAppstorePrivate * priv; }; ApplicationServiceAppstore * application_service_appstore_new (AppLruFile * lrufile); -- cgit v1.2.3 From d7c73248a5dccdb3929ed959f027366028ed757e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 15:13:48 -0500 Subject: Adding a function to bring in approvers --- src/application-service-appstore.c | 7 +++++++ src/application-service-appstore.h | 11 +++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 886fe92..340548f 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -745,3 +745,10 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst return TRUE; } +void +application_service_appstore_approver_add (ApplicationServiceAppstore * appstore, const gchar * dbus_name, const gchar * dbus_object) +{ + + return; +} + diff --git a/src/application-service-appstore.h b/src/application-service-appstore.h index 86d989b..e8ba8c1 100644 --- a/src/application-service-appstore.h +++ b/src/application-service-appstore.h @@ -57,11 +57,14 @@ struct _ApplicationServiceAppstore { ApplicationServiceAppstore * application_service_appstore_new (AppLruFile * lrufile); GType application_service_appstore_get_type (void); void application_service_appstore_application_add (ApplicationServiceAppstore * appstore, - const gchar * dbus_name, - const gchar * dbus_object); + const gchar * dbus_name, + const gchar * dbus_object); void application_service_appstore_application_remove (ApplicationServiceAppstore * appstore, - const gchar * dbus_name, - const gchar * dbus_object); + const gchar * dbus_name, + const gchar * dbus_object); +void application_service_appstore_approver_add (ApplicationServiceAppstore * appstore, + const gchar * dbus_name, + const gchar * dbus_object); G_END_DECLS -- cgit v1.2.3 From 298644534b236239d0c30d63456bae07a31c8d5e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 15:20:13 -0500 Subject: For DBus to real objects, the signal shall travel. --- src/application-service-watcher.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/application-service-watcher.c b/src/application-service-watcher.c index 844585d..4fe3bc7 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 GValue * path, const GArray * categories, DBusGMethodInvocation * method); +static gboolean _notification_watcher_server_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,8 +252,14 @@ get_name_cb (DBusGProxy * proxy, guint status, GError * error, gpointer data) } static gboolean -_notification_watcher_server_register_notification_approver (ApplicationServiceWatcher * appwatcher, const GValue * path, const GArray * categories, DBusGMethodInvocation * method) +_notification_watcher_server_register_notification_approver (ApplicationServiceWatcher * appwatcher, const gchar * path, const GArray * categories, DBusGMethodInvocation * method) { + ApplicationServiceWatcherPrivate * priv = APPLICATION_SERVICE_WATCHER_GET_PRIVATE(appwatcher); - return FALSE; + application_service_appstore_approver_add(priv->appstore, + dbus_g_method_get_sender(method), + path); + + dbus_g_method_return(method, G_TYPE_NONE); + return TRUE; } -- cgit v1.2.3 From 93572f1975170710345344512204e45e6eb3b145 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 15:58:34 -0500 Subject: Adding some structures for approvers and making them real. --- src/application-service-appstore.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 340548f..335cd63 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -53,9 +53,15 @@ static gboolean _application_service_server_get_applications (ApplicationService struct _ApplicationServiceAppstorePrivate { DBusGConnection * bus; GList * applications; + GList * approvers; AppLruFile * lrufile; }; +typedef struct _Approver Approver; +struct _Approver { + DBusGProxy * proxy; +}; + typedef struct _Application Application; struct _Application { gchar * id; @@ -94,6 +100,7 @@ static void application_service_appstore_dispose (GObject *object); static void application_service_appstore_finalize (GObject *object); static AppIndicatorStatus string_to_status(const gchar * status_string); static void apply_status (Application * app, AppIndicatorStatus status); +void approver_free (gpointer papprover, gpointer user_data); G_DEFINE_TYPE (ApplicationServiceAppstore, application_service_appstore, G_TYPE_OBJECT); @@ -142,6 +149,7 @@ application_service_appstore_init (ApplicationServiceAppstore *self) ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE (self); priv->applications = NULL; + priv->approvers = NULL; priv->lrufile = NULL; GError * error = NULL; @@ -172,6 +180,12 @@ application_service_appstore_dispose (GObject *object) ((Application *)priv->applications->data)->dbus_object); } + if (priv->approvers != NULL) { + g_list_foreach(priv->approvers, approver_free, NULL); + g_list_free(priv->approvers); + priv->approvers = NULL; + } + G_OBJECT_CLASS (application_service_appstore_parent_class)->dispose (object); return; } @@ -745,6 +759,21 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst return TRUE; } +void +approver_free (gpointer papprover, gpointer user_data) +{ + Approver * approver = (Approver *)papprover; + g_return_if_fail(approver != NULL); + + if (approver->proxy != NULL) { + g_object_unref(approver->proxy); + approver->proxy = NULL; + } + + g_free(approver); + return; +} + void application_service_appstore_approver_add (ApplicationServiceAppstore * appstore, const gchar * dbus_name, const gchar * dbus_object) { -- cgit v1.2.3 From 4f7e748e6fc9a5b190b527b3089aa7bcffad092b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 15:59:35 -0500 Subject: Comments --- src/application-service-appstore.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 335cd63..4b5004c 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -759,6 +759,7 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst return TRUE; } +/* Frees the data associated with an approver */ void approver_free (gpointer papprover, gpointer user_data) { @@ -774,6 +775,7 @@ approver_free (gpointer papprover, gpointer user_data) 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) { -- cgit v1.2.3 From a281700349fbbcf9cc5df505c9d75b922da662a2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 16:06:37 -0500 Subject: Building the approver structure and putting it in the list. --- src/application-service-appstore.c | 21 +++++++++++++++++++++ src/dbus-shared.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 4b5004c..e4c2d4c 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -779,6 +779,27 @@ approver_free (gpointer papprover, gpointer user_data) void application_service_appstore_approver_add (ApplicationServiceAppstore * appstore, const gchar * dbus_name, const gchar * dbus_object) { + g_return_if_fail(IS_APPLICATION_SERVICE_APPSTORE(appstore)); + g_return_if_fail(dbus_name != NULL); + g_return_if_fail(dbus_object != NULL); + ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE (appstore); + + Approver * approver = g_new0(Approver, 1); + + GError * error = NULL; + approver->proxy = dbus_g_proxy_new_for_name_owner(priv->bus, + dbus_name, + dbus_object, + NOTIFICATION_APPROVER_DBUS_IFACE, + &error); + if (error != NULL) { + g_warning("Unable to get approver interface on '%s:%s' : %s", dbus_name, dbus_object, error->message); + g_error_free(error); + g_free(approver); + return; + } + + priv->approvers = g_list_prepend(priv->approvers, approver); return; } diff --git a/src/dbus-shared.h b/src/dbus-shared.h index f158b1c..1d8d89c 100644 --- a/src/dbus-shared.h +++ b/src/dbus-shared.h @@ -31,3 +31,5 @@ with this program. If not, see . #define NOTIFICATION_ITEM_DBUS_IFACE "org.kde.StatusNotifierItem" #define NOTIFICATION_ITEM_DEFAULT_OBJ "/StatusNotifierItem" +#define NOTIFICATION_APPROVER_DBUS_IFACE "org.ayatana.StatusNotifierApprover" + -- cgit v1.2.3 From b3a0f3e22a8ec154dd738019fbf3dff346188aee Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 16:16:48 -0500 Subject: Looking at all the applications when we get a new approver. --- src/application-service-appstore.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index e4c2d4c..3e4fd15 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -31,6 +31,7 @@ with this program. If not, see . #include "application-service-marshal.h" #include "dbus-properties-client.h" #include "dbus-shared.h" +#include "notification-approver-client.h" /* DBus Prototypes */ static gboolean _application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps, GError ** error); @@ -100,7 +101,7 @@ static void application_service_appstore_dispose (GObject *object); static void application_service_appstore_finalize (GObject *object); static AppIndicatorStatus string_to_status(const gchar * status_string); static void apply_status (Application * app, AppIndicatorStatus status); -void approver_free (gpointer papprover, gpointer user_data); +static void approver_free (gpointer papprover, gpointer user_data); G_DEFINE_TYPE (ApplicationServiceAppstore, application_service_appstore, G_TYPE_OBJECT); @@ -760,7 +761,7 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst } /* Frees the data associated with an approver */ -void +static void approver_free (gpointer papprover, gpointer user_data) { Approver * approver = (Approver *)papprover; @@ -775,6 +776,33 @@ approver_free (gpointer papprover, gpointer user_data) return; } +/* What did the approver tell us? */ +static void +approver_request_cb (DBusGProxy *proxy, gboolean OUT_approved, GError *error, gpointer userdata) +{ + g_debug("Approver responded: %s", OUT_approved ? "approve" : "rejected"); + return; +} + +/* Run the applications through the new approver */ +static void +check_with_new_approver (gpointer papp, gpointer papprove) +{ + Application * app = (Application *)papp; + Approver * approver = (Approver *)papprove; + + org_ayatana_StatusNotifierApprover_approve_item_async(approver->proxy, + app->id, + app->category, + 0, + app->dbus_name, + app->dbus_object, + approver_request_cb, + app); + + 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) @@ -801,6 +829,8 @@ application_service_appstore_approver_add (ApplicationServiceAppstore * appstore priv->approvers = g_list_prepend(priv->approvers, approver); + g_list_foreach(priv->applications, check_with_new_approver, approver); + return; } -- cgit v1.2.3 From 306a78b6a438f0702d7f8475e726de53a7a7b66c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 16:29:22 -0500 Subject: When we have new apps we can ask the approver about them. --- src/application-service-appstore.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 3e4fd15..311fcb1 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -102,6 +102,8 @@ static void application_service_appstore_finalize (GObject *object); static AppIndicatorStatus string_to_status(const gchar * status_string); static void apply_status (Application * app, AppIndicatorStatus status); static void approver_free (gpointer papprover, gpointer user_data); +static void check_with_new_approver (gpointer papp, gpointer papprove); +static void check_with_old_approver (gpointer papprove, gpointer papp); G_DEFINE_TYPE (ApplicationServiceAppstore, application_service_appstore, G_TYPE_OBJECT); @@ -251,11 +253,23 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err app->icon_path = g_strdup(""); } + /* TODO: Calling approvers, but we're ignoring the results. So, eh. */ + g_list_foreach(priv->approvers, check_with_old_approver, app); + apply_status(app, string_to_status(g_value_get_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_STATUS)))); return; } +/* Check the application against an approver */ +static void +check_with_old_approver (gpointer papprove, gpointer papp) +{ + /* Funny the parallels, eh? */ + check_with_new_approver(papp, papprove); + return; +} + /* Simple translation function -- could be optimized */ static AppIndicatorStatus string_to_status(const gchar * status_string) -- cgit v1.2.3 From 8072a97d30c0e3aaa9f02b89f53ae9af247e473b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 16:47:45 -0500 Subject: Adding a new sample approver --- .bzrignore | 1 + tests/Makefile.am | 16 +++++++++++ tests/test-approver.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 tests/test-approver.c diff --git a/.bzrignore b/.bzrignore index 0d82d3e..ad46d0c 100644 --- a/.bzrignore +++ b/.bzrignore @@ -109,3 +109,4 @@ src/AppIndicator-0.1.vapi bindings/mono/policy.appindicator-sharp.dll src/notification-approver-client.h src/notification-approver-server.h +tests/test-approver diff --git a/tests/Makefile.am b/tests/Makefile.am index 8d356bc..a920a20 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ check_PROGRAMS = \ + test-approver \ test-libappindicator \ test-libappindicator-dbus-client \ test-libappindicator-dbus-server \ @@ -98,6 +99,21 @@ test_libappindicator_status_server_LDADD = \ $(INDICATOR_LIBS) \ $(top_builddir)/src/libappindicator.la +######################################### +## test-approver +######################################### + +test_approver_SOURCES = \ + test-approver.c + +test_approver_CFLAGS = \ + $(INDICATOR_CFLAGS) \ + -Wall -Werror \ + -I$(top_srcdir)/src + +test_approver_LDADD = \ + $(INDICATOR_LIBS) + ######################################### ## test-libappindicator-fallback ######################################### diff --git a/tests/test-approver.c b/tests/test-approver.c new file mode 100644 index 0000000..f411b0d --- /dev/null +++ b/tests/test-approver.c @@ -0,0 +1,74 @@ +#include +#include + +#define APPROVER_PATH "/my/approver" + +#define TEST_APPROVER_TYPE (test_approver_get_type ()) +#define TEST_APPROVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_APPROVER_TYPE, TestApprover)) +#define TEST_APPROVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_APPROVER_TYPE, TestApproverClass)) +#define IS_TEST_APPROVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_APPROVER_TYPE)) +#define IS_TEST_APPROVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_APPROVER_TYPE)) +#define TEST_APPROVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_APPROVER_TYPE, TestApproverClass)) + +typedef struct _TestApprover TestApprover; +typedef struct _TestApproverClass TestApproverClass; + +struct _TestApproverClass { + GObjectClass parent_class; +}; + +struct _TestApprover { + GObject parent; +}; + +GType test_approver_get_type (void); + +static void test_approver_class_init (TestApproverClass *klass); +static void test_approver_init (TestApprover *self); +static void _notification_approver_server_approve_item (void); + +#include "../src/notification-approver-server.h" + +G_DEFINE_TYPE (TestApprover, test_approver, G_TYPE_OBJECT); + +static void +test_approver_class_init (TestApproverClass *klass) +{ + dbus_g_object_type_install_info(TEST_APPROVER_TYPE, + &dbus_glib__notification_approver_server_object_info); + + return; +} + +static void +test_approver_init (TestApprover *self) +{ + DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + + dbus_g_connection_register_g_object(session_bus, + APPROVER_PATH, + G_OBJECT(self)); + + return; +} + +static void +_notification_approver_server_approve_item (void) +{ + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + TestApprover * approver = g_object_new(TEST_APPROVER_TYPE, NULL); + + GMainLoop * main_loop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(main_loop); + + g_object_unref(approver); + + return 0; +} -- cgit v1.2.3 From fd3e18e471823583a29e673a639b9b14295b4a4c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 20:44:07 -0500 Subject: Okay, so now we're detecing when the watcher comes up, and registering ourselves as the approver. --- tests/test-approver.c | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/tests/test-approver.c b/tests/test-approver.c index f411b0d..c51e1cb 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -1,6 +1,11 @@ #include #include +#include + +#include "notification-watcher-client.h" +#include "dbus-shared.h" + #define APPROVER_PATH "/my/approver" #define TEST_APPROVER_TYPE (test_approver_get_type ()) @@ -29,6 +34,10 @@ static void _notification_approver_server_approve_item (void); #include "../src/notification-approver-server.h" +GMainLoop * main_loop = NULL; +DBusGConnection * session_bus = NULL; +DBusGProxy * bus_proxy = NULL; + G_DEFINE_TYPE (TestApprover, test_approver, G_TYPE_OBJECT); static void @@ -43,8 +52,6 @@ test_approver_class_init (TestApproverClass *klass) static void test_approver_init (TestApprover *self) { - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - dbus_g_connection_register_g_object(session_bus, APPROVER_PATH, G_OBJECT(self)); @@ -58,14 +65,48 @@ _notification_approver_server_approve_item (void) return; } +gint owner_count = 0; +gboolean +check_for_service (gpointer user_data) +{ + if (owner_count > 100) { + g_main_loop_quit(main_loop); + return FALSE; + } + + owner_count++; + + gboolean has_owner = FALSE; + org_freedesktop_DBus_name_has_owner(bus_proxy, "org.test", &has_owner, NULL); + + if (has_owner) { + const char * cats = NULL; + DBusGProxy * proxy = dbus_g_proxy_new_for_name(session_bus, + NOTIFICATION_WATCHER_DBUS_ADDR, + NOTIFICATION_WATCHER_DBUS_OBJ, + NOTIFICATION_WATCHER_DBUS_IFACE); + + org_kde_StatusNotifierWatcher_register_notification_approver (proxy, APPROVER_PATH, &cats, NULL); + return FALSE; + } + + return TRUE; +} + int main (int argc, char ** argv) { g_type_init(); + session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + TestApprover * approver = g_object_new(TEST_APPROVER_TYPE, NULL); - GMainLoop * main_loop = g_main_loop_new(NULL, FALSE); + bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + + g_timeout_add(100, check_for_service, NULL); + + main_loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(main_loop); g_object_unref(approver); -- cgit v1.2.3 From 018bf0e6f77b80643712712cf814b1fadbff288d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 20:45:32 -0500 Subject: Helpful debug info --- tests/test-approver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test-approver.c b/tests/test-approver.c index c51e1cb..127dc67 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -69,6 +69,8 @@ gint owner_count = 0; gboolean check_for_service (gpointer user_data) { + g_debug("Checking for Watcher"); + if (owner_count > 100) { g_main_loop_quit(main_loop); return FALSE; @@ -86,6 +88,7 @@ check_for_service (gpointer user_data) NOTIFICATION_WATCHER_DBUS_OBJ, NOTIFICATION_WATCHER_DBUS_IFACE); + g_debug("Registering Approver"); org_kde_StatusNotifierWatcher_register_notification_approver (proxy, APPROVER_PATH, &cats, NULL); return FALSE; } @@ -97,12 +100,13 @@ int main (int argc, char ** argv) { g_type_init(); + g_debug("Initing"); session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); TestApprover * approver = g_object_new(TEST_APPROVER_TYPE, NULL); - bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); g_timeout_add(100, check_for_service, NULL); -- cgit v1.2.3 From 5b41b1e87608bab6bacb62ea95dd1c0964ba8706 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 20:49:26 -0500 Subject: Some more error handling and better debug messages. --- tests/test-approver.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/tests/test-approver.c b/tests/test-approver.c index 127dc67..df06df2 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -37,6 +37,7 @@ static void _notification_approver_server_approve_item (void); GMainLoop * main_loop = NULL; DBusGConnection * session_bus = NULL; DBusGProxy * bus_proxy = NULL; +gboolean passed = FALSE; G_DEFINE_TYPE (TestApprover, test_approver, G_TYPE_OBJECT); @@ -72,6 +73,7 @@ check_for_service (gpointer user_data) g_debug("Checking for Watcher"); if (owner_count > 100) { + g_warning("Couldn't find watcher after 100 tries."); g_main_loop_quit(main_loop); return FALSE; } @@ -79,7 +81,7 @@ check_for_service (gpointer user_data) owner_count++; gboolean has_owner = FALSE; - org_freedesktop_DBus_name_has_owner(bus_proxy, "org.test", &has_owner, NULL); + org_freedesktop_DBus_name_has_owner(bus_proxy, NOTIFICATION_WATCHER_DBUS_ADDR, &has_owner, NULL); if (has_owner) { const char * cats = NULL; @@ -89,7 +91,15 @@ check_for_service (gpointer user_data) NOTIFICATION_WATCHER_DBUS_IFACE); g_debug("Registering Approver"); - org_kde_StatusNotifierWatcher_register_notification_approver (proxy, APPROVER_PATH, &cats, NULL); + GError * error = NULL; + org_kde_StatusNotifierWatcher_register_notification_approver (proxy, APPROVER_PATH, &cats, &error); + + if (error != NULL) { + g_warning("Unable to register approver: %s", error->message); + g_error_free(error); + g_main_loop_quit(main_loop); + } + return FALSE; } @@ -99,10 +109,17 @@ check_for_service (gpointer user_data) int main (int argc, char ** argv) { + GError * error = NULL; + g_type_init(); g_debug("Initing"); - session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + if (error != NULL) { + g_warning("Unable to get session bus: %s", error->message); + g_error_free(error); + return -1; + } TestApprover * approver = g_object_new(TEST_APPROVER_TYPE, NULL); @@ -115,5 +132,9 @@ main (int argc, char ** argv) g_object_unref(approver); + if (!passed) { + return -1; + } + return 0; } -- cgit v1.2.3 From ed8163b9de3adf9883b2cf0c47c35bad2fe221ff Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 20:58:38 -0500 Subject: Making the registration async to clean things up, and async is better anyway. --- tests/test-approver.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/tests/test-approver.c b/tests/test-approver.c index df06df2..fd90bf7 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -66,6 +66,21 @@ _notification_approver_server_approve_item (void) return; } +static void +register_cb (DBusGProxy * proxy, GError * error, gpointer user_data) +{ + if (error != NULL) { + g_warning("Unable to register approver: %s", error->message); + g_error_free(error); + g_main_loop_quit(main_loop); + return; + } + + g_debug("Building App Indicator"); + + return; +} + gint owner_count = 0; gboolean check_for_service (gpointer user_data) @@ -91,14 +106,7 @@ check_for_service (gpointer user_data) NOTIFICATION_WATCHER_DBUS_IFACE); g_debug("Registering Approver"); - GError * error = NULL; - org_kde_StatusNotifierWatcher_register_notification_approver (proxy, APPROVER_PATH, &cats, &error); - - if (error != NULL) { - g_warning("Unable to register approver: %s", error->message); - g_error_free(error); - g_main_loop_quit(main_loop); - } + org_kde_StatusNotifierWatcher_register_notification_approver_async (proxy, APPROVER_PATH, &cats, register_cb, NULL); return FALSE; } -- cgit v1.2.3 From d7c39d7b2654985016f533217e300b5dd5573020 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 21:10:00 -0500 Subject: Building an application indicator too! --- tests/Makefile.am | 3 ++- tests/test-approver.c | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index a920a20..6ee3a02 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -112,7 +112,8 @@ test_approver_CFLAGS = \ -I$(top_srcdir)/src test_approver_LDADD = \ - $(INDICATOR_LIBS) + $(INDICATOR_LIBS) \ + $(top_builddir)/src/libappindicator.la ######################################### ## test-libappindicator-fallback diff --git a/tests/test-approver.c b/tests/test-approver.c index fd90bf7..609036c 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -5,9 +5,14 @@ #include "notification-watcher-client.h" #include "dbus-shared.h" +#include "app-indicator.h" #define APPROVER_PATH "/my/approver" +#define INDICATOR_ID "test-indicator-id" +#define INDICATOR_ICON "test-indicator-icon-name" +#define INDICATOR_CATEGORY APP_INDICATOR_CATEGORY_APPLICATION_STATUS + #define TEST_APPROVER_TYPE (test_approver_get_type ()) #define TEST_APPROVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_APPROVER_TYPE, TestApprover)) #define TEST_APPROVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_APPROVER_TYPE, TestApproverClass)) @@ -37,6 +42,7 @@ static void _notification_approver_server_approve_item (void); GMainLoop * main_loop = NULL; DBusGConnection * session_bus = NULL; DBusGProxy * bus_proxy = NULL; +AppIndicator * app_indicator = NULL; gboolean passed = FALSE; G_DEFINE_TYPE (TestApprover, test_approver, G_TYPE_OBJECT); @@ -77,6 +83,13 @@ register_cb (DBusGProxy * proxy, GError * error, gpointer user_data) } g_debug("Building App Indicator"); + app_indicator = app_indicator_new(INDICATOR_ID, INDICATOR_ICON, INDICATOR_CATEGORY); + + GtkWidget * menu = gtk_menu_new(); + GtkWidget * mi = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT, NULL); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi); + + app_indicator_set_menu(app_indicator, GTK_MENU(menu)); return; } -- cgit v1.2.3 From 0bf54f57b3212c020be3dd493829fa67516a7143 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 21:14:25 -0500 Subject: Filling out the approver prototype --- tests/test-approver.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test-approver.c b/tests/test-approver.c index 609036c..44cd5b4 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -35,7 +35,7 @@ GType test_approver_get_type (void); static void test_approver_class_init (TestApproverClass *klass); static void test_approver_init (TestApprover *self); -static void _notification_approver_server_approve_item (void); +static gboolean _notification_approver_server_approve_item (TestApprover * ta, const gchar * id, const gchar * category, guint pid, const gchar * address, const gchar * path, gboolean * approved, GError ** error); #include "../src/notification-approver-server.h" @@ -66,10 +66,13 @@ test_approver_init (TestApprover *self) return; } -static void -_notification_approver_server_approve_item (void) +static gboolean +_notification_approver_server_approve_item (TestApprover * ta, const gchar * id, const gchar * category, guint pid, const gchar * address, const gchar * path, gboolean * approved, GError ** error) { - return; + *approved = TRUE; + + + return TRUE; } static void -- cgit v1.2.3 From 12c8596edf111ec4b087ce52f736e32f06638815 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 21:15:49 -0500 Subject: Filling out the approve function. --- tests/test-approver.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test-approver.c b/tests/test-approver.c index 44cd5b4..d52a13f 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -70,7 +70,13 @@ static gboolean _notification_approver_server_approve_item (TestApprover * ta, const gchar * id, const gchar * category, guint pid, const gchar * address, const gchar * path, gboolean * approved, GError ** error) { *approved = TRUE; + g_debug("Asked to approve indicator"); + if (g_strcmp0(id, INDICATOR_ID) == 0) { + passed = TRUE; + } + + g_main_loop_quit(main_loop); return TRUE; } -- cgit v1.2.3 From 3c43fed297b0804d6f2fd60dbcab68c3ed492047 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 21:21:22 -0500 Subject: Building up to a formal test --- tests/Makefile.am | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index 6ee3a02..35d557e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -115,6 +115,15 @@ test_approver_LDADD = \ $(INDICATOR_LIBS) \ $(top_builddir)/src/libappindicator.la +test-approver-tester: test-approver Makefile.am + @echo "#!/bin/bash" > $@ + @echo . $(srcdir)/run-xvfb.sh >> $@ + @echo $(DBUS_RUNNER) --task $(builddir)/test-approver --task-name Approver --task $(top_builddir)/src/indicator-application-service --task-name Service --ignore-return >> $@ + @chmod +x $@ + +TESTS += test-approver-tester + + ######################################### ## test-libappindicator-fallback ######################################### -- cgit v1.2.3 From 1b89529258a612d2df0e1114b708ad4ea61c59aa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 21:23:59 -0500 Subject: Oops, with a menu we're all GTK now. --- tests/test-approver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-approver.c b/tests/test-approver.c index d52a13f..30beb30 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -141,7 +141,7 @@ main (int argc, char ** argv) { GError * error = NULL; - g_type_init(); + gtk_init(&argc, &argv); g_debug("Initing"); session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); -- cgit v1.2.3 From 25b69bb08e3e5a3df7037f8ac786422ff53f6425 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 9 Jul 2010 21:35:45 -0500 Subject: Need the built headers too --- tests/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 35d557e..867d4de 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -109,7 +109,8 @@ test_approver_SOURCES = \ test_approver_CFLAGS = \ $(INDICATOR_CFLAGS) \ -Wall -Werror \ - -I$(top_srcdir)/src + -I$(top_srcdir)/src \ + -I$(top_builddir)/src test_approver_LDADD = \ $(INDICATOR_LIBS) \ -- cgit v1.2.3 From 791daf2fb1ed8583b89bed0709011ee55e42c9c9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 09:43:11 -0500 Subject: Autogen update --- debian/changelog | 3 ++- src/Makefile.in | 1 + tests/Makefile.in | 69 +++++++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 63 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index e159389..a9e13d6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ indicator-application (0.2.2-0ubuntu2~ppa1) UNRELEASED; urgency=low * Merge upstream * Adding an Approver API to remove things from the AppIndicators. + * Autogen update - -- Ted Gould Mon, 12 Jul 2010 09:27:41 -0500 + -- Ted Gould Mon, 12 Jul 2010 09:43:02 -0500 indicator-application (0.2.2-0ubuntu1) maverick; urgency=low diff --git a/src/Makefile.in b/src/Makefile.in index 2d50887..598f335 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -462,6 +462,7 @@ libappindicator_la_LIBADD = \ DBUS_SPECS = \ dbus-properties.xml \ application-service.xml \ + notification-approver.xml \ notification-item.xml \ notification-watcher.xml diff --git a/tests/Makefile.in b/tests/Makefile.in index edc828f..0630ac0 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -33,7 +33,7 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ -check_PROGRAMS = test-libappindicator$(EXEEXT) \ +check_PROGRAMS = test-approver$(EXEEXT) test-libappindicator$(EXEEXT) \ test-libappindicator-dbus-client$(EXEEXT) \ test-libappindicator-dbus-server$(EXEEXT) \ test-libappindicator-status-client$(EXEEXT) \ @@ -52,15 +52,22 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am_test_libappindicator_OBJECTS = \ - test_libappindicator-test-libappindicator.$(OBJEXT) -test_libappindicator_OBJECTS = $(am_test_libappindicator_OBJECTS) +am_test_approver_OBJECTS = test_approver-test-approver.$(OBJEXT) +test_approver_OBJECTS = $(am_test_approver_OBJECTS) am__DEPENDENCIES_1 = -test_libappindicator_DEPENDENCIES = $(am__DEPENDENCIES_1) \ +test_approver_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(top_builddir)/src/libappindicator.la AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent +test_approver_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_approver_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +am_test_libappindicator_OBJECTS = \ + test_libappindicator-test-libappindicator.$(OBJEXT) +test_libappindicator_OBJECTS = $(am_test_libappindicator_OBJECTS) +test_libappindicator_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(top_builddir)/src/libappindicator.la test_libappindicator_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_libappindicator_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ @@ -154,7 +161,7 @@ am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(test_libappindicator_SOURCES) \ +SOURCES = $(test_approver_SOURCES) $(test_libappindicator_SOURCES) \ $(test_libappindicator_dbus_client_SOURCES) \ $(test_libappindicator_dbus_server_SOURCES) \ $(test_libappindicator_fallback_item_SOURCES) \ @@ -162,7 +169,8 @@ SOURCES = $(test_libappindicator_SOURCES) \ $(test_libappindicator_status_client_SOURCES) \ $(test_libappindicator_status_server_SOURCES) \ $(test_simple_app_SOURCES) -DIST_SOURCES = $(test_libappindicator_SOURCES) \ +DIST_SOURCES = $(test_approver_SOURCES) \ + $(test_libappindicator_SOURCES) \ $(test_libappindicator_dbus_client_SOURCES) \ $(test_libappindicator_dbus_server_SOURCES) \ $(test_libappindicator_fallback_item_SOURCES) \ @@ -341,8 +349,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -TESTS = test-libappindicator-fallback libappindicator-tests \ - test-libappindicator-dbus test-libappindicator-status +TESTS = test-approver-tester test-libappindicator-fallback \ + libappindicator-tests test-libappindicator-dbus \ + test-libappindicator-status DISTCLEANFILES = $(TESTS) $(XML_REPORT) $(HTML_REPORT) \ libappindicator-tests-gtester EXTRA_DIST = run-xvfb.sh @@ -426,6 +435,22 @@ test_libappindicator_status_server_LDADD = \ $(top_builddir)/src/libappindicator.la +######################################### +######################################### +test_approver_SOURCES = \ + test-approver.c + +test_approver_CFLAGS = \ + $(INDICATOR_CFLAGS) \ + -Wall -Werror \ + -I$(top_srcdir)/src \ + -I$(top_builddir)/src + +test_approver_LDADD = \ + $(INDICATOR_LIBS) \ + $(top_builddir)/src/libappindicator.la + + ######################################### ######################################### test_libappindicator_fallback_watcher_SOURCES = \ @@ -516,6 +541,9 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list +test-approver$(EXEEXT): $(test_approver_OBJECTS) $(test_approver_DEPENDENCIES) + @rm -f test-approver$(EXEEXT) + $(AM_V_CCLD)$(test_approver_LINK) $(test_approver_OBJECTS) $(test_approver_LDADD) $(LIBS) test-libappindicator$(EXEEXT): $(test_libappindicator_OBJECTS) $(test_libappindicator_DEPENDENCIES) @rm -f test-libappindicator$(EXEEXT) $(AM_V_CCLD)$(test_libappindicator_LINK) $(test_libappindicator_OBJECTS) $(test_libappindicator_LDADD) $(LIBS) @@ -547,6 +575,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_approver-test-approver.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_libappindicator-test-libappindicator.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_libappindicator_dbus_client-test-libappindicator-dbus-client.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_libappindicator_dbus_server-test-libappindicator-dbus-server.Po@am__quote@ @@ -580,6 +609,22 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +test_approver-test-approver.o: test-approver.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_approver_CFLAGS) $(CFLAGS) -MT test_approver-test-approver.o -MD -MP -MF $(DEPDIR)/test_approver-test-approver.Tpo -c -o test_approver-test-approver.o `test -f 'test-approver.c' || echo '$(srcdir)/'`test-approver.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_approver-test-approver.Tpo $(DEPDIR)/test_approver-test-approver.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-approver.c' object='test_approver-test-approver.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_approver_CFLAGS) $(CFLAGS) -c -o test_approver-test-approver.o `test -f 'test-approver.c' || echo '$(srcdir)/'`test-approver.c + +test_approver-test-approver.obj: test-approver.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_approver_CFLAGS) $(CFLAGS) -MT test_approver-test-approver.obj -MD -MP -MF $(DEPDIR)/test_approver-test-approver.Tpo -c -o test_approver-test-approver.obj `if test -f 'test-approver.c'; then $(CYGPATH_W) 'test-approver.c'; else $(CYGPATH_W) '$(srcdir)/test-approver.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_approver-test-approver.Tpo $(DEPDIR)/test_approver-test-approver.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='test-approver.c' object='test_approver-test-approver.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_approver_CFLAGS) $(CFLAGS) -c -o test_approver-test-approver.obj `if test -f 'test-approver.c'; then $(CYGPATH_W) 'test-approver.c'; else $(CYGPATH_W) '$(srcdir)/test-approver.c'; fi` + test_libappindicator-test-libappindicator.o: test-libappindicator.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_libappindicator_CFLAGS) $(CFLAGS) -MT test_libappindicator-test-libappindicator.o -MD -MP -MF $(DEPDIR)/test_libappindicator-test-libappindicator.Tpo -c -o test_libappindicator-test-libappindicator.o `test -f 'test-libappindicator.c' || echo '$(srcdir)/'`test-libappindicator.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_libappindicator-test-libappindicator.Tpo $(DEPDIR)/test_libappindicator-test-libappindicator.Po @@ -1008,6 +1053,12 @@ uninstall-am: tags uninstall uninstall-am +test-approver-tester: test-approver Makefile.am + @echo "#!/bin/bash" > $@ + @echo . $(srcdir)/run-xvfb.sh >> $@ + @echo $(DBUS_RUNNER) --task $(builddir)/test-approver --task-name Approver --task $(top_builddir)/src/indicator-application-service --task-name Service --ignore-return >> $@ + @chmod +x $@ + test-libappindicator-fallback: test-libappindicator-fallback-watcher test-libappindicator-fallback-item Makefile.am @echo "#!/bin/bash" > $@ @echo . $(srcdir)/run-xvfb.sh >> $@ -- cgit v1.2.3 From 0de45ad20a3024bd46c93928cf10e6ccf9ff487b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 09:44:40 -0500 Subject: releasing version 0.2.2-0ubuntu2~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index a9e13d6..a0a4d05 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-application (0.2.2-0ubuntu2~ppa1) UNRELEASED; urgency=low +indicator-application (0.2.2-0ubuntu2~ppa1) lucid; urgency=low * Merge upstream * Adding an Approver API to remove things from the AppIndicators. * Autogen update - -- Ted Gould Mon, 12 Jul 2010 09:43:02 -0500 + -- Ted Gould Mon, 12 Jul 2010 09:44:37 -0500 indicator-application (0.2.2-0ubuntu1) maverick; urgency=low -- cgit v1.2.3 From 8a0649a9f1fe4914149a86f42f5e503be8edd87f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 13:55:08 -0500 Subject: Adding in setting the environment variable to adjust the timeout to be twice as long for slow systems. --- tests/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index 867d4de..f2bdbb2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -118,6 +118,7 @@ test_approver_LDADD = \ test-approver-tester: test-approver Makefile.am @echo "#!/bin/bash" > $@ + @echo export INDICATOR_SERVICE_SHUTDOWN_TIMEOUT=1000 >> $@ @echo . $(srcdir)/run-xvfb.sh >> $@ @echo $(DBUS_RUNNER) --task $(builddir)/test-approver --task-name Approver --task $(top_builddir)/src/indicator-application-service --task-name Service --ignore-return >> $@ @chmod +x $@ -- cgit v1.2.3 From 930a79ae19c29e718b9fb49246baba58f9c32875 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 13:57:47 -0500 Subject: Add a fail timeout so this test can't block. --- tests/test-approver.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test-approver.c b/tests/test-approver.c index 30beb30..bc25761 100644 --- a/tests/test-approver.c +++ b/tests/test-approver.c @@ -136,6 +136,14 @@ check_for_service (gpointer user_data) return TRUE; } +gboolean +fail_timeout (gpointer user_data) +{ + g_debug("Failure timeout initiated."); + g_main_loop_quit(main_loop); + return FALSE; +} + int main (int argc, char ** argv) { @@ -156,6 +164,7 @@ main (int argc, char ** argv) bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); g_timeout_add(100, check_for_service, NULL); + g_timeout_add_seconds(2, fail_timeout, NULL); main_loop = g_main_loop_new(NULL, FALSE); g_main_loop_run(main_loop); -- cgit v1.2.3 From e1dc7c00dd8f0d94f84dbd4fe626ea365a2543db Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 12 Jul 2010 13:58:37 -0500 Subject: Ignoring the tester script --- .bzrignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.bzrignore b/.bzrignore index ad46d0c..cbf5964 100644 --- a/.bzrignore +++ b/.bzrignore @@ -110,3 +110,4 @@ bindings/mono/policy.appindicator-sharp.dll src/notification-approver-client.h src/notification-approver-server.h tests/test-approver +tests/test-approver-tester -- cgit v1.2.3 From c95f5174418c33c4c3756d42f365844f46f34368 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 13 Jul 2010 10:55:44 -0500 Subject: Autogen update --- debian/changelog | 3 ++- tests/Makefile.in | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 8f23d32..ecd0b80 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ indicator-application (0.2.2-0ubuntu2~ppa2) UNRELEASED; urgency=low * Merge upstream * Fixing test for slower machines + * Autogen update - -- Ted Gould Tue, 13 Jul 2010 10:55:02 -0500 + -- Ted Gould Tue, 13 Jul 2010 10:55:35 -0500 indicator-application (0.2.2-0ubuntu2~ppa1) lucid; urgency=low diff --git a/tests/Makefile.in b/tests/Makefile.in index 0630ac0..dc4be9b 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1055,6 +1055,7 @@ uninstall-am: test-approver-tester: test-approver Makefile.am @echo "#!/bin/bash" > $@ + @echo export INDICATOR_SERVICE_SHUTDOWN_TIMEOUT=1000 >> $@ @echo . $(srcdir)/run-xvfb.sh >> $@ @echo $(DBUS_RUNNER) --task $(builddir)/test-approver --task-name Approver --task $(top_builddir)/src/indicator-application-service --task-name Service --ignore-return >> $@ @chmod +x $@ -- cgit v1.2.3 From 76c177b8aa9e0a7432543333e987dd389b032b7b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 13 Jul 2010 11:02:08 -0500 Subject: releasing version 0.2.2-0ubuntu2~ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index ecd0b80..5d8db67 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-application (0.2.2-0ubuntu2~ppa2) UNRELEASED; urgency=low +indicator-application (0.2.2-0ubuntu2~ppa2) lucid; urgency=low * Merge upstream * Fixing test for slower machines * Autogen update - -- Ted Gould Tue, 13 Jul 2010 10:55:35 -0500 + -- Ted Gould Tue, 13 Jul 2010 11:02:07 -0500 indicator-application (0.2.2-0ubuntu2~ppa1) lucid; urgency=low -- cgit v1.2.3 From 17dea0907c51dfb39686f6840a9404467d79db82 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 15 Jul 2010 10:18:23 -0500 Subject: 0.2.3 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 86c60e7..9ac78ec 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(indicator-application, 0.2.2, ted@canonical.com) +AC_INIT(indicator-application, 0.2.3, ted@canonical.com) AC_COPYRIGHT([Copyright 2009, 2010 Canonical]) AC_PREREQ(2.53) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(indicator-application, 0.2.2) +AM_INIT_AUTOMAKE(indicator-application, 0.2.3) AM_MAINTAINER_MODE -- cgit v1.2.3 From 8faa8b6fc99b117bd0799aabc90dc3d271a5fe96 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 15 Jul 2010 10:22:37 -0500 Subject: releasing version 0.2.3-0ubuntu1~ppa1 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index b3215cf..a0b88cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -indicator-application (0.2.3-0ubuntu1~ppa1) UNRELEASED; urgency=low +indicator-application (0.2.3-0ubuntu1~ppa1) lucid; urgency=low * New upstream release. * Fixing test for slower machines * Adding an Approver API to remove things from the AppIndicators. - -- Ted Gould Thu, 15 Jul 2010 10:20:35 -0500 + -- Ted Gould Thu, 15 Jul 2010 10:22:33 -0500 indicator-application (0.2.2-0ubuntu1) maverick; urgency=low -- cgit v1.2.3