aboutsummaryrefslogtreecommitdiff
path: root/src/application-service-appstore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/application-service-appstore.c')
-rw-r--r--src/application-service-appstore.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/application-service-appstore.c b/src/application-service-appstore.c
index 57f8871..d3dc4a9 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"
@@ -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 '%X'", 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
@@ -530,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