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 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 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