From 08fef8dc585407e88d27da07a7c6fd726303a0dd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 19 Jan 2010 17:20:21 -0600 Subject: Adding a _new function for the appstore and using it. It now takes the lru file. --- src/application-service-appstore.c | 13 +++++++++++++ src/application-service-appstore.h | 2 ++ src/application-service.c | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index d0b5570..2121a0d 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -52,6 +52,7 @@ typedef struct _ApplicationServiceAppstorePrivate ApplicationServiceAppstorePriv struct _ApplicationServiceAppstorePrivate { DBusGConnection * bus; GList * applications; + AppLruFile * lrufile; }; #define APP_STATUS_PASSIVE_STR "passive" @@ -148,6 +149,7 @@ application_service_appstore_init (ApplicationServiceAppstore *self) ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(self); priv->applications = NULL; + priv->lrufile = NULL; GError * error = NULL; priv->bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); @@ -645,6 +647,17 @@ application_service_appstore_application_remove (ApplicationServiceAppstore * ap return; } +/* Creates a basic appstore object and attaches the + LRU file object to it. */ +ApplicationServiceAppstore * +application_service_appstore_new (AppLruFile * lrufile) +{ + ApplicationServiceAppstore * appstore = APPLICATION_SERVICE_APPSTORE(g_object_new(APPLICATION_SERVICE_APPSTORE_TYPE, NULL)); + ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + priv->lrufile = lrufile; + return appstore; +} + /* DBus Interface */ static gboolean _application_service_server_get_applications (ApplicationServiceAppstore * appstore, GArray ** apps) diff --git a/src/application-service-appstore.h b/src/application-service-appstore.h index 6bd7a01..d2e0013 100644 --- a/src/application-service-appstore.h +++ b/src/application-service-appstore.h @@ -25,6 +25,7 @@ with this program. If not, see . #include #include +#include "application-service-lru-file.h" G_BEGIN_DECLS @@ -50,6 +51,7 @@ struct _ApplicationServiceAppstore { GObject parent; }; +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, diff --git a/src/application-service.c b/src/application-service.c index abb86ee..ffd042e 100644 --- a/src/application-service.c +++ b/src/application-service.c @@ -66,7 +66,7 @@ main (int argc, char ** argv) lrufile = app_lru_file_new(); /* Building our app store */ - appstore = APPLICATION_SERVICE_APPSTORE(g_object_new(APPLICATION_SERVICE_APPSTORE_TYPE, NULL)); + appstore = application_service_appstore_new(lrufile); /* Adding a watcher for the Apps coming up */ watcher = application_service_watcher_new(appstore); @@ -79,6 +79,7 @@ main (int argc, char ** argv) g_object_unref(G_OBJECT(watcher)); g_object_unref(G_OBJECT(appstore)); g_object_unref(G_OBJECT(service)); + g_object_unref(G_OBJECT(lrufile)); return 0; } -- cgit v1.2.3