diff options
author | Ted Gould <ted@gould.cx> | 2011-03-10 15:04:33 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-10 15:04:33 -0600 |
commit | cb771e5da44cda7b8fc6ca07be44aa1d5048660b (patch) | |
tree | a4c0aa2be0efe7b4b11a5efc21a25167a723625c /src | |
parent | 80719b658bbd8f49c15b43e841370fc5ba509246 (diff) | |
download | ayatana-indicator-session-cb771e5da44cda7b8fc6ca07be44aa1d5048660b.tar.gz ayatana-indicator-session-cb771e5da44cda7b8fc6ca07be44aa1d5048660b.tar.bz2 ayatana-indicator-session-cb771e5da44cda7b8fc6ca07be44aa1d5048660b.zip |
Sort the launchers
Diffstat (limited to 'src')
-rw-r--r-- | src/session-service.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/session-service.c b/src/session-service.c index 28284ff..c76865d 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -517,6 +517,28 @@ desktop_activate_cb (DbusmenuMenuitem * mi, guint timestamp, gpointer data) return; } +/* Look at the GAppInfo structures and sort based on + the application names */ +static gint +sort_app_infos (gconstpointer a, gconstpointer b) +{ + GAppInfo * appa = G_APP_INFO(a); + GAppInfo * appb = G_APP_INFO(b); + + const gchar * namea = NULL; + const gchar * nameb = NULL; + + if (appa != NULL) { + namea = g_app_info_get_name(appa); + } + + if (appb != NULL) { + nameb = g_app_info_get_name(appb); + } + + return g_strcmp0(namea, nameb); +} + static void add_extra_separator_once (DbusmenuMenuitem *menu) { @@ -749,6 +771,8 @@ rebuild_items (DbusmenuMenuitem *root, } g_dir_close(extra_launchers_dir); + launchers = g_list_sort(launchers, sort_app_infos); + GList * launcher = NULL; for (launcher = launchers; launcher != NULL; launcher = g_list_next(launcher)) { GAppInfo * appinfo = G_APP_INFO(launcher->data); |