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