From 7a001c72db8fcbd518c132862ddc215bc215aac4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Jan 2010 23:22:46 -0600 Subject: Fleshing out returning the list of apps already there. --- src/application-service-appstore.c | 47 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index fa1b9d2..282eb51 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -31,7 +31,7 @@ with this program. If not, see . #include "dbus-shared.h" /* DBus Prototypes */ -static gboolean _application_service_server_get_applications (ApplicationServiceAppstore * appstore, GArray ** apps); +static gboolean _application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps); #include "application-service-server.h" @@ -624,8 +624,51 @@ application_service_appstore_application_remove (ApplicationServiceAppstore * ap /* DBus Interface */ static gboolean -_application_service_server_get_applications (ApplicationServiceAppstore * appstore, GArray ** apps) +_application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps) { + ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); + + *apps = g_ptr_array_new(); + GList * listpntr; + gint position = 0; + + for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) { + GValueArray * values = g_value_array_new(0); + + GValue value = {0}; + + /* Icon name */ + g_value_init(&value, G_TYPE_STRING); + g_value_set_string(&value, ((Application *)listpntr->data)->icon); + g_value_array_append(values, &value); + g_value_unset(&value); + + /* Position */ + g_value_init(&value, G_TYPE_INT); + g_value_set_int(&value, position++); + g_value_array_append(values, &value); + g_value_unset(&value); + + /* DBus Address */ + g_value_init(&value, G_TYPE_STRING); + g_value_set_string(&value, ((Application *)listpntr->data)->dbus_name); + g_value_array_append(values, &value); + g_value_unset(&value); + + /* DBus Object */ + g_value_init(&value, G_TYPE_STRING); + g_value_set_string(&value, ((Application *)listpntr->data)->dbus_object); + g_value_array_append(values, &value); + g_value_unset(&value); + + /* Icon path */ + g_value_init(&value, G_TYPE_STRING); + g_value_set_string(&value, ((Application *)listpntr->data)->icon_path); + g_value_array_append(values, &value); + g_value_unset(&value); + + g_ptr_array_add(*apps, values); + } return FALSE; } -- cgit v1.2.3 From eddc0d0e435a16acacafe086475ef79cc3f599ae Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Jan 2010 23:30:11 -0600 Subject: Returning truth. --- src/application-service-appstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 282eb51..d70e2f8 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -670,6 +670,6 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst g_ptr_array_add(*apps, values); } - return FALSE; + return TRUE; } -- cgit v1.2.3 From 00cad2ec8d5a143b3970dd63825cbd4b6265092a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 00:48:09 -0600 Subject: Better init value and adding error to prototype. --- src/application-service-appstore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index d70e2f8..95f8dde 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -31,7 +31,7 @@ with this program. If not, see . #include "dbus-shared.h" /* DBus Prototypes */ -static gboolean _application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps); +static gboolean _application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps, GError ** error); #include "application-service-server.h" @@ -624,7 +624,7 @@ application_service_appstore_application_remove (ApplicationServiceAppstore * ap /* DBus Interface */ static gboolean -_application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps) +_application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps, GError ** error) { ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(appstore); @@ -633,7 +633,7 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst gint position = 0; for (listpntr = priv->applications; listpntr != NULL; listpntr = g_list_next(listpntr)) { - GValueArray * values = g_value_array_new(0); + GValueArray * values = g_value_array_new(5); GValue value = {0}; -- cgit v1.2.3 From 8045abdf6b0390572dbeb1a224431ec4c3e3355e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 01:01:11 -0600 Subject: Setting the proper type for the GValue of an 'o' --- src/application-service-appstore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 95f8dde..df4213a 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -656,8 +656,8 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst g_value_unset(&value); /* DBus Object */ - g_value_init(&value, G_TYPE_STRING); - g_value_set_string(&value, ((Application *)listpntr->data)->dbus_object); + g_value_init(&value, DBUS_TYPE_G_OBJECT_PATH); + g_value_set_static_boxed(&value, ((Application *)listpntr->data)->dbus_object); g_value_array_append(values, &value); g_value_unset(&value); -- cgit v1.2.3 From 93f32fd90d78997bf9661ddeaa8bfbb2f3020ced Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Jan 2010 10:05:21 -0600 Subject: Using the menu path instead of the item path. --- src/application-service-appstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index df4213a..bc99855 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -657,7 +657,7 @@ _application_service_server_get_applications (ApplicationServiceAppstore * appst /* DBus Object */ g_value_init(&value, DBUS_TYPE_G_OBJECT_PATH); - g_value_set_static_boxed(&value, ((Application *)listpntr->data)->dbus_object); + g_value_set_static_boxed(&value, ((Application *)listpntr->data)->menu); g_value_array_append(values, &value); g_value_unset(&value); -- cgit v1.2.3