all repos — tint2 @ 64ec2ce7ec5654b6fbc9fb3f6f8337d560b2c02f

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

Launcher: add icon lookup in ~/.local and /usr/local



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

64ec2ce7ec5654b6fbc9fb3f6f8337d560b2c02f

parent

123c8bef7d1c5a796da5e81d9f39cb2526737a73

1 files changed, 20 insertions(+), 4 deletions(-)

jump to
M src/launcher/launcher.csrc/launcher/launcher.c

@@ -823,6 +823,7 @@ }

} } +#define DEBUG_ICON_SEARCH 0 // Returns the full path to an icon file (or NULL) given the icon name char *icon_path(Launcher *launcher, const char *icon_name, int size) {

@@ -840,6 +841,10 @@

GSList *basenames = NULL; char *home_icons = g_build_filename(g_get_home_dir(), ".icons", NULL); basenames = g_slist_append(basenames, home_icons); + char *home_local_icons = g_build_filename(g_get_home_dir(), ".local/share/icons", NULL); + basenames = g_slist_append(basenames, home_local_icons); + basenames = g_slist_append(basenames, "/usr/local/share/icons"); + basenames = g_slist_append(basenames, "/usr/local/share/pixmaps"); basenames = g_slist_append(basenames, "/usr/share/icons"); basenames = g_slist_append(basenames, "/usr/share/pixmaps");

@@ -884,6 +889,7 @@ if (g_file_test(file_name, G_FILE_TEST_EXISTS)) {

g_slist_free(basenames); g_slist_free(extensions); g_free(home_icons); + g_free(home_local_icons); return file_name; } else { free(file_name);

@@ -927,8 +933,11 @@ char *file_name = malloc(strlen(base_name) + strlen(theme_name) +

strlen(dir_name) + strlen(icon_name) + strlen(extension) + 100); // filename = directory/$(themename)/subdirectory/iconname.extension sprintf(file_name, "%s/%s/%s/%s%s", base_name, theme_name, dir_name, icon_name, extension); + if (DEBUG_ICON_SEARCH) + printf("checking %s\n", file_name); if (g_file_test(file_name, G_FILE_TEST_EXISTS)) { - //printf("found: %s\n", file_name); + if (DEBUG_ICON_SEARCH) + printf("found: %s\n", file_name); // Closest match if (directory_size_distance((IconThemeDir*)dir->data, size) < minimal_size && (!best_file_theme ? 1 : theme == best_file_theme)) { if (best_file_name) {

@@ -938,7 +947,8 @@ }

best_file_name = strdup(file_name); minimal_size = directory_size_distance((IconThemeDir*)dir->data, size); best_file_theme = theme; - //printf("best_file_name = %s; minimal_size = %d\n", best_file_name, minimal_size); + if (DEBUG_ICON_SEARCH) + printf("best_file_name = %s; minimal_size = %d\n", best_file_name, minimal_size); } // Next larger match if (((IconThemeDir*)dir->data)->size >= size &&

@@ -951,7 +961,8 @@ }

next_larger = strdup(file_name); next_larger_size = ((IconThemeDir*)dir->data)->size; next_larger_theme = theme; - //printf("next_larger = %s; next_larger_size = %d\n", next_larger, next_larger_size); + if (DEBUG_ICON_SEARCH) + printf("next_larger = %s; next_larger_size = %d\n", next_larger, next_larger_size); } } free(file_name);

@@ -964,12 +975,14 @@ g_slist_free(basenames);

g_slist_free(extensions); free(best_file_name); g_free(home_icons); + g_free(home_local_icons); return next_larger; } if (best_file_name) { g_slist_free(basenames); g_slist_free(extensions); g_free(home_icons); + g_free(home_local_icons); return best_file_name; }

@@ -985,11 +998,13 @@ char *file_name = malloc(strlen(base_name) + strlen(icon_name) +

strlen(extension) + 100); // filename = directory/iconname.extension sprintf(file_name, "%s/%s%s", base_name, icon_name, extension); - //printf("checking %s\n", file_name); + if (DEBUG_ICON_SEARCH) + printf("checking %s\n", file_name); if (g_file_test(file_name, G_FILE_TEST_EXISTS)) { g_slist_free(basenames); g_slist_free(extensions); g_free(home_icons); + g_free(home_local_icons); return file_name; } else { free(file_name);

@@ -1004,6 +1019,7 @@

g_slist_free(basenames); g_slist_free(extensions); g_free(home_icons); + g_free(home_local_icons); return NULL; }