all repos — tint2 @ e8eae2702925f2359ceafcf53787aab711430c32

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

tint2conf: Prevent some icon theme duplicates due to symlinks
o9000 mrovi9000@gmail.com
commit

e8eae2702925f2359ceafcf53787aab711430c32

parent

c4d1614cc3708046c26d7451b7696ad052b22da0

1 files changed, 18 insertions(+), 2 deletions(-)

jump to
M src/tint2conf/properties.csrc/tint2conf/properties.c

@@ -17,6 +17,9 @@ * along with this program; if not, write to the Free Software

* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **************************************************************************/ +#include <limits.h> +#include <stdlib.h> + #include "main.h" #include "properties.h" #include "properties_rw.h"

@@ -2407,7 +2410,6 @@ if (strcmp(key, "Name") == 0) {

IconTheme *theme = calloc(1, sizeof(IconTheme)); theme->name = strdup(theme_name); theme->description = strdup(value); - fprintf(stderr, "THEME %s %s %s\n", theme_name, value, file_name); *themes = g_list_append(*themes, theme); break; }

@@ -2434,7 +2436,21 @@ g_file_test(file, G_FILE_TEST_IS_REGULAR) &&

g_str_equal(name, "index.theme")) { load_theme_file(file, parent, themes); } else if (g_file_test(file, G_FILE_TEST_IS_DIR)) { - load_icon_themes(file, name, themes); + gboolean duplicate = FALSE; + if (g_file_test(file, G_FILE_TEST_IS_SYMLINK)) { +#ifdef PATH_MAX + char real_path[PATH_MAX]; +#else + char real_path[65536]; +#endif + if (realpath(file, real_path)) { + fprintf(stderr, "SYMLINK %s -> %s in %s\n", file, real_path, path); + if (strstr(real_path, path) == real_path) + duplicate = TRUE; + } + } + if (!duplicate) + load_icon_themes(file, name, themes); } g_free(file); }