diff options
author | Ted Gould <ted@canonical.com> | 2009-08-19 16:47:04 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-08-19 16:47:04 -0500 |
commit | 24cd5919a5de12b2309ba6f9fa48f402e3d2ae11 (patch) | |
tree | d9579ffa95889a1cf373e2243883bd0f7deb9d7e /src | |
parent | d44ae676f2d89a286a8298927bdda89725d91603 (diff) | |
download | ayatana-indicator-messages-24cd5919a5de12b2309ba6f9fa48f402e3d2ae11.tar.gz ayatana-indicator-messages-24cd5919a5de12b2309ba6f9fa48f402e3d2ae11.tar.bz2 ayatana-indicator-messages-24cd5919a5de12b2309ba6f9fa48f402e3d2ae11.zip |
Go through the launchers and start building items
Diffstat (limited to 'src')
-rw-r--r-- | src/messages-service.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/messages-service.c b/src/messages-service.c index 93c926b..ce3fcdb 100644 --- a/src/messages-service.c +++ b/src/messages-service.c @@ -30,9 +30,11 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "app-menu-item.h" #include "launcher-menu-item.h" #include "dbus-data.h" +#include "dirs.h" static IndicateListener * listener; -static GList * serverList; +static GList * serverList = NULL; +static GList * launcherList = NULL; static DbusmenuMenuitem * root_menuitem = NULL; static GMainLoop * mainloop = NULL; @@ -489,9 +491,29 @@ indicator_removed (IndicateListener * listener, IndicateListenerServer * server, gboolean build_launchers (gpointer data) { + if (!g_file_test(SYSTEM_APPS_DIR, G_FILE_TEST_IS_DIR)) { + return FALSE; + } + GError * error = NULL; + GDir * dir = g_dir_open(SYSTEM_APPS_DIR, 0, &error); + if (dir == NULL) { + g_warning("Unable to open system apps directory: %s", error->message); + g_error_free(error); + return FALSE; + } + const gchar * filename = NULL; + while ((filename = g_dir_read_name(dir)) != NULL) { + gchar * path = g_build_filename(SYSTEM_APPS_DIR, filename, NULL); + launcherList_t * ll = g_new0(launcherList_t, 1); + ll->menuitem = launcher_menu_item_new(path); + g_free(path); + launcherList = g_list_append(launcherList, ll); + } + g_dir_close(dir); + launcherList = g_list_sort(launcherList, launcherList_sort); return FALSE; } |