aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog8
-rw-r--r--src/app-indicator.c38
-rw-r--r--src/application-service-appstore.c32
-rw-r--r--src/generate-id.c8
-rw-r--r--src/notification-item.xml2
5 files changed, 66 insertions, 22 deletions
diff --git a/debian/changelog b/debian/changelog
index 5b3a158..8871376 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+indicator-application (0.2.3-0ubuntu2~ppa5~order5) UNRELEASED; urgency=low
+
+ * Upstream Merge
+ * Various fixes to the ordering index calculation
+ * Putting ordering indexes in the X namespace
+
+ -- Ted Gould <ted@ubuntu.com> Wed, 11 Aug 2010 15:45:47 -0500
+
indicator-application (0.2.3-0ubuntu2~ppa5~order4) maverick; urgency=low
* Upstream Merge
diff --git a/src/app-indicator.c b/src/app-indicator.c
index e4138d4..7528da2 100644
--- a/src/app-indicator.c
+++ b/src/app-indicator.c
@@ -115,7 +115,8 @@ enum {
PROP_CONNECTED,
PROP_LABEL,
PROP_LABEL_GUIDE,
- PROP_ORDERING_INDEX
+ PROP_ORDERING_INDEX,
+ PROP_X_ORDERING_INDEX
};
/* The strings so that they can be slowly looked up. */
@@ -130,6 +131,7 @@ enum {
#define PROP_LABEL_S "label"
#define PROP_LABEL_GUIDE_S "label-guide"
#define PROP_ORDERING_INDEX_S "ordering-index"
+#define PROP_X_ORDERING_INDEX_S ("x-ayatana-" PROP_ORDERING_INDEX_S)
/* Private macro, shhhh! */
#define APP_INDICATOR_GET_PRIVATE(o) \
@@ -353,6 +355,20 @@ app_indicator_class_init (AppIndicatorClass *klass)
"A way to override the default ordering of the applications by providing a very specific idea of where this entry should be placed.",
0, G_MAXUINT32, 0,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ AppIndicator:x-ayatana-ordering-index:
+
+ A wrapper for #AppIndicator:ordering-index so that it can match the
+ dbus interface currently. It will hopefully be retired, please don't
+ use it anywhere.
+ */
+ g_object_class_install_property(object_class,
+ PROP_X_ORDERING_INDEX,
+ g_param_spec_uint (PROP_X_ORDERING_INDEX_S,
+ "A wrapper, please don't use.",
+ "A wrapper, please don't use.",
+ 0, G_MAXUINT32, 0,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/* Signals */
@@ -718,6 +734,7 @@ app_indicator_set_property (GObject * object, guint prop_id, const GValue * valu
}
break;
}
+ case PROP_X_ORDERING_INDEX:
case PROP_ORDERING_INDEX:
priv->ordering_index = g_value_get_uint(value);
break;
@@ -787,12 +804,9 @@ app_indicator_get_property (GObject * object, guint prop_id, GValue * value, GPa
g_value_set_string (value, priv->label_guide);
break;
+ case PROP_X_ORDERING_INDEX:
case PROP_ORDERING_INDEX:
- if (priv->ordering_index == 0) {
- g_value_set_uint(value, generate_id(priv->category, priv->id));
- } else {
- g_value_set_uint(value, priv->ordering_index);
- }
+ g_value_set_uint(value, priv->ordering_index);
break;
default:
@@ -2002,12 +2016,10 @@ app_indicator_get_ordering_index (AppIndicator *self)
{
g_return_val_if_fail (IS_APP_INDICATOR (self), 0);
- guint ordering_index = 0;
-
- g_object_get(G_OBJECT(self),
- PROP_ORDERING_INDEX_S, &ordering_index,
- NULL);
-
- return ordering_index;
+ if (self->priv->ordering_index == 0) {
+ return generate_id(self->priv->category, self->priv->id);
+ } else {
+ return self->priv->ordering_index;
+ }
}
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
diff --git a/src/generate-id.c b/src/generate-id.c
index a504e44..14d762e 100644
--- a/src/generate-id.c
+++ b/src/generate-id.c
@@ -26,10 +26,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
guint32
generate_id (const AppIndicatorCategory catenum, const gchar * id)
{
- gchar category = 0;
- gchar first = 0;
- gchar second = 0;
- gchar third = 0;
+ guchar category = 0;
+ guchar first = 0;
+ guchar second = 0;
+ guchar third = 0;
switch (catenum) {
case APP_INDICATOR_CATEGORY_OTHER:
diff --git a/src/notification-item.xml b/src/notification-item.xml
index ffd59d1..b66dfe3 100644
--- a/src/notification-item.xml
+++ b/src/notification-item.xml
@@ -14,7 +14,7 @@
<property name="Menu" type="o" access="read" />
<property name="Label" type="s" access="read" />
<property name="LabelGuide" type="s" access="read" />
- <property name="OrderingIndex" type="u" access="read" />
+ <property name="XAyatanaOrderingIndex" type="u" access="read" />
<!-- Methods -->
<!-- None currently -->