preprent "tint2:" to all logging messages

This commit is contained in:
o9000
2017-09-01 18:23:46 +02:00
parent b7691afb8d
commit eb93af3622
30 changed files with 231 additions and 232 deletions

View File

@@ -92,7 +92,7 @@ IconTheme *load_theme_from_index(const char *file_name, const char *name)
size_t line_size;
if ((f = fopen(file_name, "rt")) == NULL) {
fprintf(stderr, "Could not open theme '%s'\n", file_name);
fprintf(stderr, "tint2: Could not open theme '%s'\n", file_name);
return NULL;
}
@@ -327,22 +327,22 @@ void free_themes(IconThemeWrapper *wrapper)
void test_launcher_read_theme_file()
{
fprintf(stdout, "\033[1;33m");
fprintf(stdout, YELLOW);
IconTheme *theme = load_theme("oxygen");
if (!theme) {
fprintf(stderr, "Could not load theme\n");
fprintf(stderr, "tint2: Could not load theme\n");
return;
}
fprintf(stderr, "Loaded theme: %s\n", theme->name);
fprintf(stderr, "tint2: Loaded theme: %s\n", theme->name);
GSList *item = theme->list_inherits;
while (item != NULL) {
fprintf(stderr, "Inherits:%s\n", (char *)item->data);
fprintf(stderr, "tint2: Inherits:%s\n", (char *)item->data);
item = g_slist_next(item);
}
item = theme->list_directories;
while (item != NULL) {
IconThemeDir *dir = item->data;
fprintf(stderr, "Dir:%s Size=%d MinSize=%d MaxSize=%d Threshold=%d Type=%s\n",
fprintf(stderr, "tint2: Dir:%s Size=%d MinSize=%d MaxSize=%d Threshold=%d Type=%s\n",
dir->name,
dir->size,
dir->min_size,
@@ -354,7 +354,7 @@ void test_launcher_read_theme_file()
: "?????");
item = g_slist_next(item);
}
fprintf(stdout, "\033[0m");
fprintf(stdout, RESET);
}
gboolean str_list_contains(const GSList *list, const char *value)
@@ -381,7 +381,7 @@ void load_themes_helper(const char *name, GSList **themes, GSList **queued)
char *queued_name = queue->data;
queue = g_slist_remove(queue, queued_name);
fprintf(stderr, " '%s',", queued_name);
fprintf(stderr, "tint2: '%s',", queued_name);
IconTheme *theme = load_theme(queued_name);
if (theme != NULL) {
*themes = g_slist_append(*themes, theme);
@@ -401,7 +401,7 @@ void load_themes_helper(const char *name, GSList **themes, GSList **queued)
free(queued_name);
}
fprintf(stderr, "\n");
fprintf(stderr, "tint2: \n");
// Free the queue
GSList *l;
@@ -415,7 +415,7 @@ void load_default_theme(IconThemeWrapper *wrapper)
if (wrapper->_themes_loaded)
return;
fprintf(stderr, GREEN "Loading icon theme %s:" RESET "\n", wrapper->icon_theme_name);
fprintf(stderr, GREEN "tint2: Loading icon theme %s:" RESET "\n", wrapper->icon_theme_name);
load_themes_helper(wrapper->icon_theme_name, &wrapper->themes, &wrapper->_queued);
load_themes_helper("hicolor", &wrapper->themes, &wrapper->_queued);
@@ -428,7 +428,7 @@ void load_fallbacks(IconThemeWrapper *wrapper)
if (wrapper->_fallback_loaded)
return;
fprintf(stderr, RED "Loading additional icon themes (this means your icon theme is incomplete)..." RESET "\n");
fprintf(stderr, RED "tint2: Loading additional icon themes (this means your icon theme is incomplete)..." RESET "\n");
// Load wrapper->themes_fallback
const GSList *location;
@@ -461,7 +461,7 @@ void load_icon_cache(IconThemeWrapper *wrapper)
if (wrapper->_cache.loaded)
return;
fprintf(stderr, GREEN "Loading icon theme cache..." RESET "\n");
fprintf(stderr, GREEN "tint2: Loading icon theme cache..." RESET "\n");
gchar *cache_path = get_icon_cache_path();
load_cache(&wrapper->_cache, cache_path);
@@ -473,7 +473,7 @@ void save_icon_cache(IconThemeWrapper *wrapper)
if (!wrapper || !wrapper->_cache.dirty)
return;
fprintf(stderr, GREEN "Saving icon theme cache..." RESET "\n");
fprintf(stderr, GREEN "tint2: Saving icon theme cache..." RESET "\n");
gchar *cache_path = get_icon_cache_path();
save_cache(&wrapper->_cache, cache_path);
g_free(cache_path);
@@ -484,7 +484,7 @@ IconThemeWrapper *load_themes(const char *icon_theme_name)
IconThemeWrapper *wrapper = calloc(1, sizeof(IconThemeWrapper));
if (!icon_theme_name) {
fprintf(stderr, "Missing icon_theme_name theme, default to 'hicolor'.\n");
fprintf(stderr, "tint2: Missing icon_theme_name theme, default to 'hicolor'.\n");
icon_theme_name = "hicolor";
}
@@ -587,7 +587,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
for (theme = themes; theme; theme = g_slist_next(theme)) {
if (debug_icons)
fprintf(stderr, "Searching theme: %s\n", ((IconTheme *)theme->data)->name);
fprintf(stderr, "tint2: Searching theme: %s\n", ((IconTheme *)theme->data)->name);
((IconTheme *)theme->data)->list_directories =
g_slist_sort_with_data(((IconTheme *)theme->data)->list_directories,
compare_theme_directories,
@@ -604,7 +604,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
if (!possible)
continue;
if (debug_icons)
fprintf(stderr, "Searching directory: %s\n", ((IconThemeDir *)dir->data)->name);
fprintf(stderr, "tint2: Searching directory: %s\n", ((IconThemeDir *)dir->data)->name);
const GSList *base;
for (base = basenames; base; base = g_slist_next(base)) {
for (GSList *ext = extensions; ext; ext = g_slist_next(ext)) {
@@ -623,10 +623,10 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
// 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_icons)
fprintf(stderr, "Checking %s\n", file_name);
fprintf(stderr, "tint2: Checking %s\n", file_name);
if (g_file_test(file_name, G_FILE_TEST_EXISTS)) {
if (debug_icons)
fprintf(stderr, "Found potential match: %s\n", file_name);
fprintf(stderr, "tint2: Found potential match: %s\n", file_name);
// Closest match
if (directory_size_distance((IconThemeDir *)dir->data, size) < minimal_size &&
(!best_file_theme ? 1 : theme == best_file_theme)) {
@@ -638,7 +638,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
minimal_size = directory_size_distance((IconThemeDir *)dir->data, size);
best_file_theme = theme;
if (debug_icons)
fprintf(stderr, "best_file_name = %s; minimal_size = %d\n", best_file_name, minimal_size);
fprintf(stderr, "tint2: best_file_name = %s; minimal_size = %d\n", best_file_name, minimal_size);
}
// Next larger match
if (((IconThemeDir *)dir->data)->size >= size &&
@@ -652,7 +652,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
next_larger_size = ((IconThemeDir *)dir->data)->size;
next_larger_theme = theme;
if (debug_icons)
fprintf(stderr, "next_larger = %s; next_larger_size = %d\n", next_larger, next_larger_size);
fprintf(stderr, "tint2: next_larger = %s; next_larger_size = %d\n", next_larger, next_larger_size);
}
}
}
@@ -674,7 +674,7 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
// Look in unthemed icons
{
if (debug_icons)
fprintf(stderr, "Searching unthemed icons\n");
fprintf(stderr, "tint2: Searching unthemed icons\n");
for (const GSList *base = basenames; base; base = g_slist_next(base)) {
for (GSList *ext = extensions; ext; ext = g_slist_next(ext)) {
char *base_name = (char *)base->data;
@@ -683,10 +683,10 @@ char *get_icon_path_helper(GSList *themes, const char *icon_name, int size)
// filename = directory/iconname.extension
sprintf(file_name, "%s/%s%s", base_name, icon_name, extension);
if (debug_icons)
fprintf(stderr, "Checking %s\n", file_name);
fprintf(stderr, "tint2: Checking %s\n", file_name);
if (g_file_test(file_name, G_FILE_TEST_EXISTS)) {
if (debug_icons)
fprintf(stderr, "Found %s\n", file_name);
fprintf(stderr, "tint2: Found %s\n", file_name);
g_slist_free(extensions);
return file_name;
} else {
@@ -724,7 +724,7 @@ char *get_icon_path_from_cache(IconThemeWrapper *wrapper, const char *icon_name,
if (!g_file_test(value, G_FILE_TEST_EXISTS))
return NULL;
// fprintf(stderr, "Icon path found in cache: theme = %s, icon = %s, size = %d, path = %s\n",
// fprintf(stderr, "tint2: Icon path found in cache: theme = %s, icon = %s, size = %d, path = %s\n",
// wrapper->icon_theme_name, icon_name, size, value);
return strdup(value);
@@ -781,14 +781,14 @@ char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size,
path = get_icon_path_helper(wrapper->themes, icon_name, size);
if (path) {
if (debug_icons)
fprintf(stderr, "Icon found: %s\n", path);
fprintf(stderr, "tint2: Icon found: %s\n", path);
add_icon_path_to_cache(wrapper, icon_name, size, path);
return path;
}
if (!use_fallbacks)
goto notfound;
fprintf(stderr, YELLOW "Icon not found in default theme: %s" RESET "\n", icon_name);
fprintf(stderr, YELLOW "tint2: Icon not found in default theme: %s" RESET "\n", icon_name);
load_fallbacks(wrapper);
path = get_icon_path_helper(wrapper->themes_fallback, icon_name, size);
@@ -798,7 +798,7 @@ char *get_icon_path(IconThemeWrapper *wrapper, const char *icon_name, int size,
}
notfound:
fprintf(stderr, RED "Could not find icon '%s', using default." RESET "\n", icon_name);
fprintf(stderr, RED "tint2: Could not find icon '%s', using default." RESET "\n", icon_name);
path = get_icon_path_helper(wrapper->themes, DEFAULT_ICON, size);
if (path)
return path;