aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-07-09 16:16:48 -0500
committerTed Gould <ted@gould.cx>2010-07-09 16:16:48 -0500
commitb3a0f3e22a8ec154dd738019fbf3dff346188aee (patch)
treea2b9a893dc9d2ed2181379b0797d1d240c83bb0d
parenta281700349fbbcf9cc5df505c9d75b922da662a2 (diff)
downloadlibayatana-appindicator-b3a0f3e22a8ec154dd738019fbf3dff346188aee.tar.gz
libayatana-appindicator-b3a0f3e22a8ec154dd738019fbf3dff346188aee.tar.bz2
libayatana-appindicator-b3a0f3e22a8ec154dd738019fbf3dff346188aee.zip
Looking at all the applications when we get a new approver.
-rw-r--r--src/application-service-appstore.c34
1 files 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 <http://www.gnu.org/licenses/>.
#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;
}