diff options
author | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-11-19 11:37:14 +0100 |
---|---|---|
committer | Lars Uebernickel <lars.uebernickel@canonical.com> | 2013-11-19 11:37:14 +0100 |
commit | 6fbc5160dff89422e1fe4aef1dc60b8d09ffb579 (patch) | |
tree | 576882f71f532353a9cb0e8cc575ae0d14dce71a | |
parent | 3b4ecb626f803cd1ba5778149e5de27b39bcb78a (diff) | |
download | ayatana-indicator-messages-6fbc5160dff89422e1fe4aef1dc60b8d09ffb579.tar.gz ayatana-indicator-messages-6fbc5160dff89422e1fe4aef1dc60b8d09ffb579.tar.bz2 ayatana-indicator-messages-6fbc5160dff89422e1fe4aef1dc60b8d09ffb579.zip |
im_menu_insert: make sorting logic more readable
-rw-r--r-- | src/im-menu.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/im-menu.c b/src/im-menu.c index 0aa042c..55ea99c 100644 --- a/src/im-menu.c +++ b/src/im-menu.c @@ -179,18 +179,17 @@ im_menu_insert_section (ImMenu *menu, for (position = 1; position < g_menu_model_get_n_items(G_MENU_MODEL (priv->menu)) - 1; position++) { - gchar * item_sort = NULL; + gchar *item_sort; 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) - { - g_free (item_sort); - break; - } - } + gint cmp; - g_free(item_sort); + cmp = g_utf8_collate(sort_string, item_sort); + g_free (item_sort); + if (cmp < 0) + break; + } } item = g_menu_item_new_section (NULL, section); |