From 1cac2ea0d1e60053a733a99ebc77b5ef46d52850 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 14:13:44 -0500 Subject: Adding 'OrderingIndex' and realigning. --- src/application-service-appstore.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index f18a89e..0d9396b 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -38,17 +38,18 @@ static gboolean _application_service_server_get_applications (ApplicationService #include "application-service-server.h" -#define NOTIFICATION_ITEM_PROP_ID "Id" -#define NOTIFICATION_ITEM_PROP_CATEGORY "Category" -#define NOTIFICATION_ITEM_PROP_STATUS "Status" -#define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName" -#define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName" -#define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath" -#define NOTIFICATION_ITEM_PROP_MENU "Menu" - -#define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon" -#define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon" -#define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus" +#define NOTIFICATION_ITEM_PROP_ID "Id" +#define NOTIFICATION_ITEM_PROP_CATEGORY "Category" +#define NOTIFICATION_ITEM_PROP_STATUS "Status" +#define NOTIFICATION_ITEM_PROP_ICON_NAME "IconName" +#define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName" +#define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath" +#define NOTIFICATION_ITEM_PROP_MENU "Menu" +#define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "OrderingIndex" + +#define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon" +#define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon" +#define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus" #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" /* Private Stuff */ -- cgit v1.2.3 From 09e6c21971ee0c93b72ed8386911875c3f630a1c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 14:37:44 -0500 Subject: Adding in an ordering index for application structures --- src/application-service-appstore.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 0d9396b..cd827d3 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -81,6 +81,7 @@ struct _Application { gchar * menu; gchar * icon_theme_path; gboolean currently_free; + guint ordering_index; }; #define APPLICATION_SERVICE_APPSTORE_GET_PRIVATE(o) \ @@ -650,6 +651,7 @@ application_service_appstore_application_add (ApplicationServiceAppstore * appst app->menu = NULL; app->icon_theme_path = NULL; app->currently_free = FALSE; + app->ordering_index = 0; /* Get the DBus proxy for the NotificationItem interface */ GError * error = NULL; -- cgit v1.2.3 From c27a7a980337e5216abe0ba0e77c94cf83d2fe43 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 14:41:53 -0500 Subject: Setting the ordering ID. --- src/application-service-appstore.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index cd827d3..4ae316c 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -32,6 +32,7 @@ with this program. If not, see . #include "dbus-properties-client.h" #include "dbus-shared.h" #include "notification-approver-client.h" +#include "generate-id.h" /* DBus Prototypes */ static gboolean _application_service_server_get_applications (ApplicationServiceAppstore * appstore, GPtrArray ** apps, GError ** error); @@ -264,6 +265,13 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err app->icon_theme_path = g_strdup(""); } + gpointer ordering_index_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ORDERING_INDEX); + if (ordering_index_data == NULL || g_value_get_uint(ordering_index_data) == 0) { + app->ordering_index = generate_id(string_to_status(app->category), app->id); + } else { + app->ordering_index = g_value_get_uint(ordering_index_data); + } + /* TODO: Calling approvers, but we're ignoring the results. So, eh. */ g_list_foreach(priv->approvers, check_with_old_approver, app); -- cgit v1.2.3 From bf3f4c6eb3affcf8e66b67ed61666c93a97ca47b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 14:47:23 -0500 Subject: Removing the LRU file --- src/application-service-appstore.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 4ae316c..2aa418a 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -58,7 +58,6 @@ struct _ApplicationServiceAppstorePrivate { DBusGConnection * bus; GList * applications; GList * approvers; - AppLruFile * lrufile; }; typedef struct _Approver Approver; @@ -165,7 +164,6 @@ application_service_appstore_init (ApplicationServiceAppstore *self) priv->applications = NULL; priv->approvers = NULL; - priv->lrufile = NULL; GError * error = NULL; priv->bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); @@ -241,7 +239,6 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err app->id = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ID)); app->category = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_CATEGORY)); ApplicationServiceAppstorePrivate * priv = app->appstore->priv; - app_lru_file_touch(priv->lrufile, app->id, app->category); app->icon = g_value_dup_string(g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ICON_NAME)); @@ -411,15 +408,13 @@ can_add_application (GList *applications, Application *app) } /* This function takes two Application structure - pointers and uses the lrufile to compare them. */ + pointers and uses their ordering index to compare them. */ static gint app_sort_func (gconstpointer a, gconstpointer b, gpointer userdata) { Application * appa = (Application *)a; Application * appb = (Application *)b; - AppLruFile * lrufile = (AppLruFile *)userdata; - - return app_lru_file_sort(lrufile, appa->id, appb->id); + return appa->ordering_index - appb->ordering_index; } /* Change the status of the application. If we're going passive @@ -456,7 +451,7 @@ apply_status (Application * app, AppIndicatorStatus status) if (app->status == APP_INDICATOR_STATUS_PASSIVE) { if (can_add_application (priv->applications, app)) { /* Put on panel */ - priv->applications = g_list_insert_sorted_with_data (priv->applications, app, app_sort_func, priv->lrufile); + priv->applications = g_list_insert_sorted_with_data (priv->applications, app, app_sort_func, NULL); g_signal_emit(G_OBJECT(app->appstore), signals[APPLICATION_ADDED], 0, @@ -769,12 +764,9 @@ application_service_appstore_application_remove (ApplicationServiceAppstore * ap /* Creates a basic appstore object and attaches the LRU file object to it. */ ApplicationServiceAppstore * -application_service_appstore_new (AppLruFile * lrufile) +application_service_appstore_new (void) { - g_return_val_if_fail(IS_APP_LRU_FILE(lrufile), NULL); ApplicationServiceAppstore * appstore = APPLICATION_SERVICE_APPSTORE(g_object_new(APPLICATION_SERVICE_APPSTORE_TYPE, NULL)); - ApplicationServiceAppstorePrivate * priv = appstore->priv; - priv->lrufile = lrufile; return appstore; } -- cgit v1.2.3 From dad491a83573507401805d9782a02dec2bad743a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 16:50:54 -0500 Subject: Adding an override hash table --- src/application-service-appstore.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 5fc4f9b..47396bb 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -56,11 +56,14 @@ static gboolean _application_service_server_get_applications (ApplicationService #define NOTIFICATION_ITEM_SIG_NEW_LABEL "NewLabel" #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" +#define OVERRIDE_GROUP_NAME "Ordering Index Overrides" + /* Private Stuff */ struct _ApplicationServiceAppstorePrivate { DBusGConnection * bus; GList * applications; GList * approvers; + GHashTable * ordering_overrides; }; typedef struct _Approver Approver; @@ -183,6 +186,8 @@ application_service_appstore_init (ApplicationServiceAppstore *self) priv->applications = NULL; priv->approvers = NULL; + + priv->ordering_overrides = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); GError * error = NULL; priv->bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); @@ -225,6 +230,12 @@ application_service_appstore_dispose (GObject *object) static void application_service_appstore_finalize (GObject *object) { + ApplicationServiceAppstorePrivate * priv = APPLICATION_SERVICE_APPSTORE(object)->priv; + + if (priv->ordering_overrides != NULL) { + g_hash_table_destroy(priv->ordering_overrides); + priv->ordering_overrides = NULL; + } G_OBJECT_CLASS (application_service_appstore_parent_class)->finalize (object); return; -- cgit v1.2.3 From f4b22a7fa52695acc7e1e5abd20859f320e3895f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 16:59:25 -0500 Subject: Putting together the pieces to look for override files --- src/application-service-appstore.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 47396bb..0df4dd5 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -57,6 +57,7 @@ static gboolean _application_service_server_get_applications (ApplicationService #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" #define OVERRIDE_GROUP_NAME "Ordering Index Overrides" +#define OVERRIDE_FILE_NAME "ordering-override.keyfile" /* Private Stuff */ struct _ApplicationServiceAppstorePrivate { @@ -112,6 +113,7 @@ static void application_service_appstore_class_init (ApplicationServiceAppstoreC static void application_service_appstore_init (ApplicationServiceAppstore *self); static void application_service_appstore_dispose (GObject *object); static void application_service_appstore_finalize (GObject *object); +static void load_override_file (GHashTable * hash, const gchar * filename); static AppIndicatorStatus string_to_status(const gchar * status_string); static void apply_status (Application * app, AppIndicatorStatus status); static void approver_free (gpointer papprover, gpointer user_data); @@ -188,6 +190,11 @@ application_service_appstore_init (ApplicationServiceAppstore *self) priv->approvers = NULL; priv->ordering_overrides = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + + load_override_file(priv->ordering_overrides, DATADIR "/" OVERRIDE_FILE_NAME); + gchar * userfile = g_build_filename(g_get_user_data_dir(), "indicators", "application", OVERRIDE_FILE_NAME, NULL); + load_override_file(priv->ordering_overrides, userfile); + g_free(userfile); GError * error = NULL; priv->bus = dbus_g_bus_get(DBUS_BUS_STARTER, &error); @@ -241,6 +248,15 @@ application_service_appstore_finalize (GObject *object) return; } +/* Loads the file and adds the override entries to the table + of overrides */ +static void +load_override_file (GHashTable * hash, const gchar * filename) +{ + + +} + /* Return from getting the properties from the item. We're looking at those and making sure we have everythign that we need. If we do, then we'll move on up to sending this onto the indicator. */ -- cgit v1.2.3 From de6c40d873a317a98d025cb094e7d89a646b4000 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 17:13:22 -0500 Subject: Fleshing out the loading overrides function. --- src/application-service-appstore.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 0df4dd5..4d21291 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -253,8 +253,46 @@ application_service_appstore_finalize (GObject *object) static void load_override_file (GHashTable * hash, const gchar * filename) { + g_return_if_fail(hash != NULL); + g_return_if_fail(filename != NULL); + if (!g_file_test(filename, G_FILE_TEST_EXISTS)) { + return; + } + + g_debug("Loading overrides from: '%s'", filename); + + GError * error = NULL; + GKeyFile * keyfile = g_key_file_new(); + g_key_file_load_from_file(keyfile, filename, G_KEY_FILE_NONE, &error); + if (error != NULL) { + g_warning("Unable to load keyfile '%s' because: %s", filename, error->message); + g_error_free(error); + g_key_file_free(keyfile); + return; + } + + gchar ** keys = g_key_file_get_keys(keyfile, OVERRIDE_GROUP_NAME, NULL, NULL); + gchar * key = keys[0]; + gint i; + + for (i = 0; (key = keys[i]) != NULL; i++) { + GError * valerror = NULL; + gint val = g_key_file_get_integer(keyfile, OVERRIDE_GROUP_NAME, key, &valerror); + + if (valerror != NULL) { + g_warning("Unable to get key '%s' out of file '%s' because: %s", key, filename, valerror->message); + g_error_free(valerror); + continue; + } + g_debug("%s: override '%s' with value '%d'", filename, key, val); + + g_hash_table_insert(hash, g_strdup(key), GINT_TO_POINTER(val)); + } + g_key_file_free(keyfile); + + return; } /* Return from getting the properties from the item. We're looking at those -- cgit v1.2.3 From 51de4ced42e132fa3a66a2739e8a3ba861842467 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 10 Aug 2010 21:19:31 -0500 Subject: Checking for an override and applying it. --- src/application-service-appstore.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index 4d21291..d632456 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -346,11 +346,16 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err app->icon_theme_path = g_strdup(""); } - gpointer ordering_index_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ORDERING_INDEX); - if (ordering_index_data == NULL || g_value_get_uint(ordering_index_data) == 0) { - app->ordering_index = generate_id(string_to_status(app->category), app->id); + gpointer ordering_index_over = g_hash_table_lookup(priv->ordering_overrides, app->id); + if (ordering_index_over == NULL) { + gpointer ordering_index_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ORDERING_INDEX); + if (ordering_index_data == NULL || g_value_get_uint(ordering_index_data) == 0) { + app->ordering_index = generate_id(string_to_status(app->category), app->id); + } else { + app->ordering_index = g_value_get_uint(ordering_index_data); + } } else { - app->ordering_index = g_value_get_uint(ordering_index_data); + app->ordering_index = GPOINTER_TO_UINT(ordering_index_over); } gpointer label_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL); -- cgit v1.2.3 From bdd9c8541f5df134ad5460ef192c7dc019e893eb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 09:05:07 -0500 Subject: Ensuring that we got a list of keys so we don't crash --- src/application-service-appstore.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index d632456..2306230 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -273,7 +273,14 @@ load_override_file (GHashTable * hash, const gchar * filename) return; } - gchar ** keys = g_key_file_get_keys(keyfile, OVERRIDE_GROUP_NAME, NULL, NULL); + gchar ** keys = g_key_file_get_keys(keyfile, OVERRIDE_GROUP_NAME, NULL, &error); + if (error != NULL) { + g_warning("Unable to get keys from keyfile '%s' because: %s", filename, error->message); + g_error_free(error); + g_key_file_free(keyfile); + return; + } + gchar * key = keys[0]; gint i; -- cgit v1.2.3 From fd956d9ac1489d8dc12827df67e9a201da43bc9d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 09:50:14 -0500 Subject: Flipping the order --- 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 2306230..57f8871 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -530,7 +530,7 @@ app_sort_func (gconstpointer a, gconstpointer b, gpointer userdata) { Application * appa = (Application *)a; Application * appb = (Application *)b; - return appa->ordering_index - appb->ordering_index; + return appb->ordering_index - appa->ordering_index; } /* Change the status of the application. If we're going passive -- cgit v1.2.3 From 818f7c466b1a06cea9a70e11abcfc0fba13a37c7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 13:02:20 -0500 Subject: Putting the ordering index into the 'x' domain. --- 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 57f8871..e067b90 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -47,8 +47,8 @@ static gboolean _application_service_server_get_applications (ApplicationService #define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath" #define NOTIFICATION_ITEM_PROP_MENU "Menu" #define NOTIFICATION_ITEM_PROP_LABEL "Label" -#define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "LabelGuide" -#define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "OrderingIndex" +#define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "LabelGuide" +#define NOTIFICATION_ITEM_PROP_ORDERING_INDEX "XAyatanaOrderingIndex" #define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon" #define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon" -- cgit v1.2.3 From 2a0f0b9f099c2714556099fc7ddf1ceca5378fa2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 13:04:52 -0500 Subject: Changing the app store --- 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 55906ff..cf74efc 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -45,13 +45,13 @@ static gboolean _application_service_server_get_applications (ApplicationService #define NOTIFICATION_ITEM_PROP_AICON_NAME "AttentionIconName" #define NOTIFICATION_ITEM_PROP_ICON_THEME_PATH "IconThemePath" #define NOTIFICATION_ITEM_PROP_MENU "Menu" -#define NOTIFICATION_ITEM_PROP_LABEL "Label" -#define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "LabelGuide" +#define NOTIFICATION_ITEM_PROP_LABEL "XAyatanaLabel" +#define NOTIFICATION_ITEM_PROP_LABEL_GUIDE "XAyatanaLabelGuide" #define NOTIFICATION_ITEM_SIG_NEW_ICON "NewIcon" #define NOTIFICATION_ITEM_SIG_NEW_AICON "NewAttentionIcon" #define NOTIFICATION_ITEM_SIG_NEW_STATUS "NewStatus" -#define NOTIFICATION_ITEM_SIG_NEW_LABEL "NewLabel" +#define NOTIFICATION_ITEM_SIG_NEW_LABEL "XAyatanaNewLabel" #define NOTIFICATION_ITEM_SIG_NEW_ICON_THEME_PATH "NewIconThemePath" /* Private Stuff */ -- cgit v1.2.3 From a0c8fb032b4eb3fb534367832d43207cfdf31309 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 15:28:26 -0500 Subject: We were using the wrong function, we want categories not statuses! --- src/application-service-appstore.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/application-service-appstore.c') diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c index e067b90..e7231fe 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -115,6 +115,7 @@ static void application_service_appstore_dispose (GObject *object); static void application_service_appstore_finalize (GObject *object); static void load_override_file (GHashTable * hash, const gchar * filename); static AppIndicatorStatus string_to_status(const gchar * status_string); +static AppIndicatorCategory string_to_cat(const gchar * cat_string); static void apply_status (Application * app, AppIndicatorStatus status); static void approver_free (gpointer papprover, gpointer user_data); static void check_with_new_approver (gpointer papp, gpointer papprove); @@ -357,13 +358,14 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err if (ordering_index_over == NULL) { gpointer ordering_index_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_ORDERING_INDEX); if (ordering_index_data == NULL || g_value_get_uint(ordering_index_data) == 0) { - app->ordering_index = generate_id(string_to_status(app->category), app->id); + app->ordering_index = generate_id(string_to_cat(app->category), app->id); } else { app->ordering_index = g_value_get_uint(ordering_index_data); } } else { app->ordering_index = GPOINTER_TO_UINT(ordering_index_over); } + g_debug("'%s' ordering index is '%d'", app->id, app->ordering_index); gpointer label_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL); if (label_data != NULL) { @@ -417,6 +419,28 @@ string_to_status(const gchar * status_string) return retval; } +/* Simple translation function -- could be optimized */ +static AppIndicatorCategory +string_to_cat(const gchar * cat_string) +{ + GEnumClass * klass = G_ENUM_CLASS(g_type_class_ref(APP_INDICATOR_TYPE_INDICATOR_CATEGORY)); + g_return_val_if_fail(klass != NULL, APP_INDICATOR_CATEGORY_OTHER); + + AppIndicatorCategory retval = APP_INDICATOR_CATEGORY_OTHER; + + GEnumValue * val = g_enum_get_value_by_nick(klass, cat_string); + if (val == NULL) { + g_warning("Unrecognized status '%s' assuming other.", cat_string); + } else { + retval = (AppIndicatorCategory)val->value; + } + + g_type_class_unref(klass); + + return retval; +} + + /* A small helper function to get the position of an application in the app list. */ static gint -- cgit v1.2.3 From d678c3504b773d726573d50f2456ae83fc2b0bb0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 15:42:56 -0500 Subject: Better debug printing. --- 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 e7231fe..f28c2af 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -365,7 +365,7 @@ get_all_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * err } else { app->ordering_index = GPOINTER_TO_UINT(ordering_index_over); } - g_debug("'%s' ordering index is '%d'", app->id, app->ordering_index); + g_debug("'%s' ordering index is '%X'", app->id, app->ordering_index); gpointer label_data = g_hash_table_lookup(properties, NOTIFICATION_ITEM_PROP_LABEL); if (label_data != NULL) { -- cgit v1.2.3 From f34b5e562004795cfb4e09a7daa1d3cbb21f89f0 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 11 Aug 2010 15:45:09 -0500 Subject: Fighting wrap around --- 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 f28c2af..d3dc4a9 100644 --- a/src/application-service-appstore.c +++ b/src/application-service-appstore.c @@ -554,7 +554,7 @@ app_sort_func (gconstpointer a, gconstpointer b, gpointer userdata) { Application * appa = (Application *)a; Application * appb = (Application *)b; - return appb->ordering_index - appa->ordering_index; + return (appb->ordering_index/2) - (appa->ordering_index/2); } /* Change the status of the application. If we're going passive -- cgit v1.2.3