st/icon-theme: Replace GTK debug code

We won't copy GTK's debug logging, so either remove messages or
turn them into reglar g_debug() calls.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2620>
This commit is contained in:
Florian Müllner 2023-01-26 03:36:03 +01:00 committed by Marge Bot
parent 0919932f4b
commit 5e44e2f3cd
2 changed files with 20 additions and 66 deletions

View File

@ -19,9 +19,6 @@
#include "st-icon-cache.h"
#include "gtkdebug.h"
#include "gtkiconcachevalidator.h"
#include <glib/gstdio.h>
#include <gdk-pixbuf/gdk-pixdata.h>
@ -68,7 +65,7 @@ _gtk_icon_cache_unref (GtkIconCache *cache)
if (cache->ref_count == 0)
{
GTK_NOTE (ICONTHEME, g_message ("unmapping icon cache"));
g_debug ("unmapping icon cache");
if (cache->map)
g_mapped_file_unref (cache->map);
@ -90,7 +87,7 @@ _gtk_icon_cache_new_for_path (const char *path)
/* Check if we have a cache file */
cache_filename = g_build_filename (path, "icon-theme.cache", NULL);
GTK_NOTE (ICONTHEME, g_message ("look for icon cache in %s", path));
g_debug ("look for icon cache in %s", path);
if (g_stat (path, &path_st) < 0)
goto done;
@ -107,7 +104,7 @@ _gtk_icon_cache_new_for_path (const char *path)
/* Verify cache is uptodate */
if (st.st_mtime < path_st.st_mtime)
{
GTK_NOTE (ICONTHEME, g_message ("icon cache outdated"));
g_debug ("icon cache outdated");
goto done;
}
@ -116,27 +113,7 @@ _gtk_icon_cache_new_for_path (const char *path)
if (!map)
goto done;
#ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (ICONTHEME))
{
CacheInfo info;
info.cache = g_mapped_file_get_contents (map);
info.cache_size = g_mapped_file_get_length (map);
info.n_directories = 0;
info.flags = CHECK_OFFSETS|CHECK_STRINGS;
if (!_gtk_icon_cache_validate (&info))
{
g_mapped_file_unref (map);
g_warning ("Icon cache '%s' is invalid", cache_filename);
goto done;
}
}
#endif
GTK_NOTE (ICONTHEME, g_message ("found icon cache for %s", path));
g_debug ("found icon cache for %s", path);
cache = g_new0 (GtkIconCache, 1);
cache->ref_count = 1;
@ -487,7 +464,7 @@ _gtk_icon_cache_get_icon (GtkIconCache *cache,
if (type != 0)
{
GTK_NOTE (ICONTHEME, g_message ("invalid pixel data type %u", type));
g_debug ("invalid pixel data type %u", type);
return NULL;
}
@ -498,7 +475,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
(guchar *)(cache->buffer + pixel_data_offset + 8),
&error))
{
GTK_NOTE (ICONTHEME, g_message ("could not deserialize data: %s", error->message));
g_debug ("could not deserialize data: %s", error->message);
g_error_free (error);
return NULL;
@ -512,7 +489,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
cache);
if (!pixbuf)
{
GTK_NOTE (ICONTHEME, g_message ("could not convert pixdata to pixbuf: %s", error->message));
g_debug ("could not convert pixdata to pixbuf: %s", error->message);
g_error_free (error);
return NULL;

View File

@ -29,7 +29,6 @@
#include "st-icon-theme.h"
#include "gtkcsspalettevalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkdebug.h"
#include "deprecated/gtkiconfactory.h"
#include "st-icon-cache.h"
#include "gtkintl.h"
@ -789,8 +788,7 @@ do_theme_change (GtkIconTheme *icon_theme)
if (!priv->themes_valid)
return;
GTK_NOTE (ICONTHEME,
g_message ("change to icon theme \"%s\"", priv->current_theme));
g_debug ("change to icon theme \"%s\"", icon_theme->current_theme);
blow_themes (icon_theme);
queue_theme_changed (icon_theme);
@ -1419,20 +1417,6 @@ load_themes (GtkIconTheme *icon_theme)
g_get_current_time (&tv);
priv->last_stat_time = tv.tv_sec;
GTK_NOTE (ICONTHEME, {
GList *l;
GString *s;
s = g_string_new ("Current icon themes ");
for (l = icon_theme->priv->themes; l; l = l->next)
{
IconTheme *theme = l->data;
g_string_append (s, theme->name);
g_string_append_c (s, ' ');
}
g_message ("%s", s->str);
g_string_free (s, TRUE);
});
}
static void
@ -1705,11 +1689,6 @@ real_choose_icon (GtkIconTheme *icon_theme,
use_builtin = flags & GTK_ICON_LOOKUP_USE_BUILTIN;
/* This is used in the icontheme unit test */
GTK_NOTE (ICONTHEME,
for (i = 0; icon_names[i]; i++)
g_message ("\tlookup name: %s", icon_names[i]));
/* For symbolic icons, do a search in all registered themes first;
* a theme that inherits them from a parent theme might provide
* an alternative full-color version, but still expect the symbolic icon
@ -2015,7 +1994,7 @@ gtk_icon_theme_lookup_icon (GtkIconTheme *icon_theme,
g_return_val_if_fail ((flags & GTK_ICON_LOOKUP_NO_SVG) == 0 ||
(flags & GTK_ICON_LOOKUP_FORCE_SVG) == 0, NULL);
GTK_NOTE (ICONTHEME, g_message ("looking up icon %s", icon_name));
g_debug ("looking up icon %s", icon_name);
return gtk_icon_theme_lookup_icon_for_scale (icon_theme, icon_name,
size, 1, flags);
@ -2056,7 +2035,7 @@ gtk_icon_theme_lookup_icon_for_scale (GtkIconTheme *icon_theme,
(flags & GTK_ICON_LOOKUP_FORCE_SVG) == 0, NULL);
g_return_val_if_fail (scale >= 1, NULL);
GTK_NOTE (ICONTHEME, g_message ("looking up icon %s for scale %d", icon_name, scale));
g_debug ("looking up icon %s for scale %d", icon_name, scale);
if (flags & GTK_ICON_LOOKUP_GENERIC_FALLBACK)
{
@ -2922,7 +2901,7 @@ theme_dir_get_icon_suffix (IconThemeDir *dir,
else
suffix = GPOINTER_TO_UINT (g_hash_table_lookup (dir->icons, icon_name));
GTK_NOTE (ICONTHEME, g_message ("get icon suffix%s: %u", dir->cache ? " (cached)" : "", suffix));
g_debug ("get icon suffix%s: %u", dir->cache ? " (cached)" : "", suffix);
return suffix;
}
@ -3030,7 +3009,7 @@ theme_lookup_icon (IconTheme *theme,
{
dir = l->data;
GTK_NOTE (ICONTHEME, g_message ("look up icon dir %s", dir->dir));
g_debug ("look up icon dir %s", dir->dir);
suffix = theme_dir_get_icon_suffix (dir, icon_name, NULL);
if (best_suffix (suffix, allow_svg) != ICON_SUFFIX_NONE)
{
@ -3181,7 +3160,7 @@ scan_directory (GtkIconThemePrivate *icon_theme,
GDir *gdir;
const char *name;
GTK_NOTE (ICONTHEME, g_message ("scanning directory %s", full_dir));
g_debug ("scanning directory %s", full_dir);
gdir = g_dir_open (full_dir, 0, NULL);
@ -3219,7 +3198,7 @@ scan_resources (GtkIconThemePrivate *icon_theme,
int i;
char **children;
GTK_NOTE (ICONTHEME, g_message ("scanning resources %s", full_dir));
g_debug ("scanning resources %s", full_dir);
children = g_resources_enumerate_children (full_dir, 0, NULL);
if (!children)
@ -4631,16 +4610,14 @@ gtk_icon_info_load_symbolic_svg (GtkIconInfo *icon_info,
symbolic_size = MAX (icon_info->symbolic_width, icon_info->symbolic_height);
GTK_NOTE (ICONTHEME,
if (icon_info->dir_type == ICON_THEME_DIR_UNTHEMED)
g_message ("Symbolic icon %s is not in an icon theme directory",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename);
g_debug ("Symbolic icon %s is not in an icon theme directory",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename);
else if (icon_info->dir_size * icon_info->dir_scale != symbolic_size)
g_message ("Symbolic icon %s of size %d is in an icon theme directory of size %d",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename,
symbolic_size,
icon_info->dir_size * icon_info->dir_scale)
);
g_debug ("Symbolic icon %s of size %d is in an icon theme directory of size %d",
icon_info->key.icon_names ? icon_info->key.icon_names[0] : icon_info->filename,
symbolic_size,
icon_info->dir_size * icon_info->dir_scale)
width = g_strdup_printf ("%d", icon_info->symbolic_width);
height = g_strdup_printf ("%d", icon_info->symbolic_height);