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

@@ -116,7 +116,7 @@ gboolean read_desktop_file_full_path(const char *path, DesktopEntry *entry)
FILE *fp = fopen(path, "rt");
if (fp == NULL) {
fprintf(stderr, "Could not open file %s\n", path);
fprintf(stderr, "tint2: Could not open file %s\n", path);
return FALSE;
}
@@ -126,14 +126,14 @@ gboolean read_desktop_file_full_path(const char *path, DesktopEntry *entry)
int lang_index_default = 1;
#define LANG_DBG 0
if (LANG_DBG)
fprintf(stderr, "Languages:");
fprintf(stderr, "tint2: Languages:");
for (int i = 0; languages[i]; i++) {
lang_index_default = i + 1;
if (LANG_DBG)
fprintf(stderr, " %s", languages[i]);
fprintf(stderr, "tint2: %s", languages[i]);
}
if (LANG_DBG)
fprintf(stderr, "\n");
fprintf(stderr, "tint2: \n");
// we currently do not know about any Name key at all, so use an invalid index
int lang_index_name = lang_index_default + 1;
int lang_index_generic_name = lang_index_default + 1;
@@ -278,11 +278,11 @@ void free_desktop_entry(DesktopEntry *entry)
void test_read_desktop_file()
{
fprintf(stdout, "\033[1;33m");
fprintf(stderr, YELLOW);
DesktopEntry entry;
read_desktop_file("/usr/share/applications/firefox.desktop", &entry);
fprintf(stderr, "Name:%s GenericName:%s Icon:%s Exec:%s\n", entry.name, entry.generic_name, entry.icon, entry.exec);
fprintf(stdout, "\033[0m");
fprintf(stderr, "tint2: Name:%s GenericName:%s Icon:%s Exec:%s\n", entry.name, entry.generic_name, entry.icon, entry.exec);
fprintf(stderr, RESET);
}
GSList *apps_locations = NULL;

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;

View File

@@ -297,7 +297,7 @@ gboolean resize_launcher(void *obj)
launcherIcon->y = posy;
launcherIcon->x = posx;
launcher_icon_on_change_layout(launcherIcon);
// fprintf(stderr, "launcher %d : %d,%d\n", i, posx, posy);
// fprintf(stderr, "tint2: launcher %d : %d,%d\n", i, posx, posy);
if (panel_horizontal) {
if (i % icons_per_column) {
posy += launcher->icon_size + launcher->area.paddingx;
@@ -385,7 +385,7 @@ void draw_launcher_icon(void *obj, cairo_t *c)
void launcher_icon_dump_geometry(void *obj, int indent)
{
LauncherIcon *launcherIcon = (LauncherIcon *)obj;
fprintf(stderr, "%*sIcon: w = h = %d, name = %s\n", indent, "", launcherIcon->icon_size, launcherIcon->icon_name);
fprintf(stderr, "tint2: %*sIcon: w = h = %d, name = %s\n", indent, "", launcherIcon->icon_size, launcherIcon->icon_name);
}
Imlib_Image scale_icon(Imlib_Image original, int icon_size)
@@ -545,7 +545,7 @@ void launcher_reload_icon_image(Launcher *launcher, LauncherIcon *launcherIcon)
free_icon(original);
free(launcherIcon->icon_path);
launcherIcon->icon_path = new_icon_path;
// fprintf(stderr, "launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path);
// fprintf(stderr, "tint2: launcher.c %d: Using icon %s\n", __LINE__, launcherIcon->icon_path);
if (panel_config.mouse_effects) {
launcherIcon->image_hover = adjust_icon(launcherIcon->image,

View File

@@ -48,7 +48,7 @@ void xsettings_notify_cb(const char *name, XSettingsAction action, XSettingsSett
{
if ((action == XSETTINGS_ACTION_NEW || action == XSETTINGS_ACTION_CHANGED) && name != NULL && setting != NULL) {
if (strcmp(name, "Net/IconThemeName") == 0 && setting->type == XSETTINGS_TYPE_STRING) {
fprintf(stderr, "xsettings: %s = %s\n", name, setting->data.v_string);
fprintf(stderr, "tint2: xsettings: %s = %s\n", name, setting->data.v_string);
if (icon_theme_name_xsettings) {
if (strcmp(icon_theme_name_xsettings, setting->data.v_string) == 0)
return;
@@ -57,7 +57,7 @@ void xsettings_notify_cb(const char *name, XSettingsAction action, XSettingsSett
icon_theme_name_xsettings = strdup(setting->data.v_string);
default_icon_theme_changed();
} else if (strcmp(name, "Gtk/FontName") == 0 && setting->type == XSETTINGS_TYPE_STRING) {
fprintf(stderr, "xsettings: %s = %s\n", name, setting->data.v_string);
fprintf(stderr, "tint2: xsettings: %s = %s\n", name, setting->data.v_string);
if (default_font) {
if (strcmp(default_font, setting->data.v_string) == 0)
return;
@@ -191,7 +191,7 @@ static XSettingsList *parse_settings(unsigned char *data, size_t len)
result = fetch_card8(&buffer, (CARD8 *)&buffer.byte_order);
if (buffer.byte_order != MSBFirst && buffer.byte_order != LSBFirst) {
fprintf(stderr, "Invalid byte order %x in XSETTINGS property\n", buffer.byte_order);
fprintf(stderr, "tint2: Invalid byte order %x in XSETTINGS property\n", buffer.byte_order);
result = XSETTINGS_FAILED;
goto out;
}
@@ -312,13 +312,13 @@ out:
if (result != XSETTINGS_SUCCESS) {
switch (result) {
case XSETTINGS_NO_MEM:
fprintf(stderr, "Out of memory reading XSETTINGS property\n");
fprintf(stderr, "tint2: Out of memory reading XSETTINGS property\n");
break;
case XSETTINGS_ACCESS:
fprintf(stderr, "Invalid XSETTINGS property (read off end)\n");
fprintf(stderr, "tint2: Invalid XSETTINGS property (read off end)\n");
break;
case XSETTINGS_DUPLICATE_ENTRY:
fprintf(stderr, "Duplicate XSETTINGS entry for '%s'\n", setting->name);
fprintf(stderr, "tint2: Duplicate XSETTINGS entry for '%s'\n", setting->name);
case XSETTINGS_FAILED:
case XSETTINGS_SUCCESS:
case XSETTINGS_NO_ENTRY:
@@ -365,7 +365,7 @@ static void read_settings(XSettingsClient *client)
if (result == Success && type == server.atom._XSETTINGS_SETTINGS) {
if (format != 8) {
fprintf(stderr, "Invalid format for XSETTINGS property %d", format);
fprintf(stderr, "tint2: Invalid format for XSETTINGS property %d", format);
} else
client->settings = parse_settings(data, n_items);
XFree(data);
@@ -420,7 +420,7 @@ XSettingsClient *xsettings_client_new(Display *display,
check_manager_window(client);
if (client->manager_window == None) {
fprintf(stderr, "No XSETTINGS manager, tint2 uses config option 'launcher_icon_theme'.\n");
fprintf(stderr, "tint2: No XSETTINGS manager, tint2 uses config option 'launcher_icon_theme'.\n");
free(client);
return NULL;
} else {