Support for launcher_apps_dir

git-svn-id: http://tint2.googlecode.com/svn/trunk@727 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
o9000
2015-03-01 11:06:48 +00:00
committed by mrovi9000@gmail.com
parent ba40b0752f
commit da7efb27a9
5 changed files with 60 additions and 2 deletions

View File

@@ -149,6 +149,25 @@ int config_get_monitor(char* monitor)
return -1;
}
void load_launcher_app_dir(const char *path)
{
GDir *d = g_dir_open(path, 0, NULL);
if (d) {
const gchar *name;
while ((name = g_dir_read_name(d))) {
gchar *file = g_build_filename(path, name, NULL);
if (!g_file_test(file, G_FILE_TEST_IS_DIR) &&
g_str_has_suffix(file, ".desktop")) {
panel_config.launcher.list_apps = g_slist_append(panel_config.launcher.list_apps, (char *)strdup(file));
} else if (g_file_test(file, G_FILE_TEST_IS_DIR)) {
load_launcher_app_dir(file);
}
g_free(file);
}
g_dir_close(d);
}
}
void add_entry (char *key, char *value)
{
char *value1=0, *value2=0, *value3=0;
@@ -606,6 +625,11 @@ void add_entry (char *key, char *value)
char *app = expand_tilde(value);
panel_config.launcher.list_apps = g_slist_append(panel_config.launcher.list_apps, app);
}
else if (strcmp(key, "launcher_apps_dir") == 0) {
char *path = expand_tilde(value);
load_launcher_app_dir(path);
free(path);
}
else if (strcmp(key, "launcher_icon_theme") == 0) {
// if XSETTINGS manager running, tint2 use it.
if (!icon_theme_name)