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:
committed by
mrovi9000@gmail.com
parent
ba40b0752f
commit
da7efb27a9
@@ -102,6 +102,7 @@ GtkWidget *tooltip_background;
|
||||
|
||||
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 @@ void load_desktop_files(const gchar *path)
|
||||
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)) {
|
||||
@@ -1762,6 +1763,16 @@ void create_launcher(GtkWidget *parent)
|
||||
|
||||
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);
|
||||
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
|
||||
|
||||
@@ -115,6 +115,7 @@ enum {
|
||||
|
||||
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;
|
||||
|
||||
@@ -415,6 +415,18 @@ void config_write_launcher(FILE *fp)
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -1086,6 +1098,16 @@ void add_entry(char *key, char *value)
|
||||
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) {
|
||||
set_current_icon_theme(value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user