diff options
author | Ted Gould <ted@gould.cx> | 2010-01-14 23:22:46 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-01-14 23:22:46 -0600 |
commit | 7a001c72db8fcbd518c132862ddc215bc215aac4 (patch) | |
tree | 36c8372118260dd069c7c093f9fdd7e474fdebd4 /src/application-service-appstore.c | |
parent | f0104e11357b5804aea2ecead13f99231b671a75 (diff) | |
download | libayatana-appindicator-7a001c72db8fcbd518c132862ddc215bc215aac4.tar.gz libayatana-appindicator-7a001c72db8fcbd518c132862ddc215bc215aac4.tar.bz2 libayatana-appindicator-7a001c72db8fcbd518c132862ddc215bc215aac4.zip |
Fleshing out returning the list of apps already there.
Diffstat (limited to 'src/application-service-appstore.c')
-rw-r--r-- | src/application-service-appstore.c | 47 |
1 files changed, 45 insertions, 2 deletions
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 <http://www.gnu.org/licenses/>. #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; } |