diff options
author | Ted Gould <ted@gould.cx> | 2011-03-10 15:09:45 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-03-10 15:09:45 -0600 |
commit | 81022fc8b072cb04d3f2ebe8841c2f0b865870b7 (patch) | |
tree | 203c7969dfa99ea277135882527113d60e4f4e84 | |
parent | cb771e5da44cda7b8fc6ca07be44aa1d5048660b (diff) | |
download | ayatana-indicator-session-81022fc8b072cb04d3f2ebe8841c2f0b865870b7.tar.gz ayatana-indicator-session-81022fc8b072cb04d3f2ebe8841c2f0b865870b7.tar.bz2 ayatana-indicator-session-81022fc8b072cb04d3f2ebe8841c2f0b865870b7.zip |
Add some cleanup and some comments
-rw-r--r-- | src/session-service.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/session-service.c b/src/session-service.c index c76865d..123a12b 100644 --- a/src/session-service.c +++ b/src/session-service.c @@ -754,6 +754,7 @@ rebuild_items (DbusmenuMenuitem *root, if (extra_launchers_dir != NULL) { GList * launchers = NULL; + /* Find all the desktop files we want to use */ for (;;) { const gchar *extra_launcher_file; @@ -771,16 +772,24 @@ rebuild_items (DbusmenuMenuitem *root, } g_dir_close(extra_launchers_dir); + /* Sort the desktop files based on their names */ launchers = g_list_sort(launchers, sort_app_infos); + /* Turn each one into a separate menu item */ GList * launcher = NULL; for (launcher = launchers; launcher != NULL; launcher = g_list_next(launcher)) { GAppInfo * appinfo = G_APP_INFO(launcher->data); + /* Make sure we have a separator */ add_extra_separator_once (root); + + /* Build the item */ DbusmenuMenuitem * desktop_mi = dbusmenu_menuitem_new(); dbusmenu_menuitem_property_set(desktop_mi, DBUSMENU_MENUITEM_PROP_LABEL, g_app_info_get_name(appinfo)); g_signal_connect(G_OBJECT(desktop_mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(desktop_activate_cb), appinfo); + g_object_weak_ref(G_OBJECT(desktop_mi), (GWeakNotify)g_object_unref, appinfo); + + /* Put into the menu */ dbusmenu_menuitem_child_append(root, desktop_mi); } |