diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/im-desktop-menu.c | 2 | ||||
-rw-r--r-- | src/im-menu.c | 15 | ||||
-rw-r--r-- | src/im-menu.h | 2 |
3 files changed, 13 insertions, 6 deletions
diff --git a/src/im-desktop-menu.c b/src/im-desktop-menu.c index 3309dad..834a8c9 100644 --- a/src/im-desktop-menu.c +++ b/src/im-desktop-menu.c @@ -97,7 +97,7 @@ im_desktop_menu_app_added (ImApplicationList *applist, g_menu_append_section (section, NULL, G_MENU_MODEL (source_section)); namespace = g_strconcat ("indicator.", app_id, NULL); - im_menu_insert_section (IM_MENU (menu), -1, namespace, G_MENU_MODEL (section)); + im_menu_insert_section (IM_MENU (menu), g_app_info_get_name(G_APP_INFO(app_info)), namespace, G_MENU_MODEL (section)); g_hash_table_insert (menu->source_sections, g_strdup (app_id), source_section); g_free (namespace); diff --git a/src/im-menu.c b/src/im-menu.c index ac23a29..1aaffe3 100644 --- a/src/im-menu.c +++ b/src/im-menu.c @@ -164,10 +164,11 @@ im_menu_append_section (ImMenu *menu, void im_menu_insert_section (ImMenu *menu, - gint position, + const gchar *sort_string, const gchar *namespace, GMenuModel *section) { + int position; ImMenuPrivate *priv; GMenuItem *item; @@ -176,11 +177,17 @@ im_menu_insert_section (ImMenu *menu, priv = im_menu_get_instance_private (menu); - /* count from the back if position is < 0 */ - if (position < 0) - position = g_menu_model_get_n_items (G_MENU_MODEL (priv->menu)) + position; + for (position = 1; position < g_menu_model_get_n_items(G_MENU_MODEL (priv->menu)) - 1; position++) + { + gchar * item_sort = NULL; + if (g_menu_model_get_item_attribute(G_MENU_MODEL(priv->menu), position, "x-messaging-menu-sort-string", "s", &item_sort)) + if (g_utf8_collate(sort_string, item_sort) < 0) + break; + g_free(item_sort); + } item = g_menu_item_new_section (NULL, section); + g_menu_item_set_attribute (item, "x-messaging-menu-sort-string", "s", sort_string); if (namespace) g_menu_item_set_attribute (item, "action-namespace", "s", namespace); diff --git a/src/im-menu.h b/src/im-menu.h index d3775ad..7c15eb7 100644 --- a/src/im-menu.h +++ b/src/im-menu.h @@ -57,7 +57,7 @@ void im_menu_append_section (ImMenu GMenuModel *section); void im_menu_insert_section (ImMenu *menu, - gint position, + const gchar *sort_string, const gchar *namespace, GMenuModel *section); |