all repos — tint2 @ da7efb27a9a7ceef7b6b3a09f2e104dad4d6bd26

fork of the tint2 desktop panel for my custom setup - only minimized windows across all desktops for the taskbar

Support for launcher_apps_dir

git-svn-id: http://tint2.googlecode.com/svn/trunk@727 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
o9000 o9000
commit

da7efb27a9a7ceef7b6b3a09f2e104dad4d6bd26

parent

ba40b0752f7a5dd5eb48ed84b4cbe72ef533acdb

M src/config.csrc/config.c

@@ -149,6 +149,25 @@ // monitor == "all" or monitor not found or xrandr can't identify monitors

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;

@@ -605,6 +624,11 @@ }

else if (strcmp(key, "launcher_item_app") == 0) { 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.
M src/launcher/icon-theme-common.csrc/launcher/icon-theme-common.c

@@ -428,7 +428,7 @@ const gchar *name;

while ((name = g_dir_read_name(d))) { gchar *file_name = g_build_filename(path, name, "index.theme", NULL); if (g_file_test(file_name, G_FILE_TEST_EXISTS) && - g_file_test(file_name, G_FILE_TEST_IS_REGULAR)) { + !g_file_test(file_name, G_FILE_TEST_IS_DIR)) { load_themes_helper(name, &wrapper->themes_fallback, &queued); } g_free(file_name);
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -102,6 +102,7 @@ // launcher

GtkListStore *launcher_apps, *all_apps; GtkWidget *launcher_apps_view, *all_apps_view; +GtkWidget *launcher_apps_dirs; GtkWidget *launcher_icon_size, *launcher_icon_theme, *launcher_padding_x, *launcher_padding_y, *launcher_spacing; GtkWidget *margin_x, *margin_y;

@@ -1538,7 +1539,7 @@ return;

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_REGULAR) && + if (!g_file_test(file, G_FILE_TEST_IS_DIR) && g_str_has_suffix(file, ".desktop")) { load_desktop_file(file, FALSE); } else if (g_file_test(file, G_FILE_TEST_IS_DIR)) {

@@ -1761,6 +1762,16 @@ gtk_widget_show(all_apps_view);

gtk_table_attach(GTK_TABLE(table), addScrollBarToWidget(all_apps_view), 2, 3, 1, 2, GTK_FILL | GTK_EXPAND, GTK_FILL, 0, 0); change_paragraph(parent); + + label = gtk_label_new(_("<b>Additional application directories</b>")); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + gtk_label_set_use_markup(GTK_LABEL(label), TRUE); + gtk_widget_show(label); + gtk_box_pack_start(GTK_BOX(parent), label, FALSE, FALSE, 0); + + launcher_apps_dirs = gtk_entry_new(); + gtk_widget_show(launcher_apps_dirs); + gtk_box_pack_start(GTK_BOX(parent), launcher_apps_dirs, FALSE, FALSE, 0); label = gtk_label_new(_("<b>Appearance</b>")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
M src/tint2conf/properties.hsrc/tint2conf/properties.h

@@ -115,6 +115,7 @@ };

extern GtkListStore *launcher_apps, *all_apps; extern GtkWidget *launcher_apps_view, *all_apps_view; +extern GtkWidget *launcher_apps_dirs; extern GtkWidget *launcher_icon_size, *launcher_icon_theme, *launcher_padding_x, *launcher_padding_y, *launcher_spacing; extern GtkWidget *margin_x, *margin_y;
M src/tint2conf/properties_rw.csrc/tint2conf/properties_rw.c

@@ -415,6 +415,18 @@ free(contracted);

g_free(app_path); } + gchar **app_dirs = g_strsplit(gtk_entry_get_text(GTK_ENTRY(launcher_apps_dirs)), ",", 0); + for (index = 0; app_dirs[index]; index++) { + gchar *dir = app_dirs[index]; + g_strstrip(dir); + if (strlen(dir) > 0) { + char *contracted = contract_tilde(dir); + fprintf(fp, "launcher_item_app = %s\n", contracted); + free(contracted); + } + } + g_strfreev(app_dirs); + fprintf(fp, "\n"); }

@@ -1084,6 +1096,16 @@ else if (strcmp(key, "launcher_item_app") == 0) {

char *path = expand_tilde(value); load_desktop_file(path, TRUE); load_desktop_file(path, FALSE); + free(path); + } + else if (strcmp(key, "launcher_apps_dir") == 0) { + char *path = expand_tilde(value); + + if (gtk_entry_get_text_length(GTK_ENTRY(launcher_apps_dirs)) > 0) { + gtk_entry_append_text(GTK_ENTRY(launcher_apps_dirs), ","); + } + gtk_entry_append_text(GTK_ENTRY(launcher_apps_dirs), path); + free(path); } else if (strcmp(key, "launcher_icon_theme") == 0) {