mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-19 21:40:22 +00:00
Remove final references to "icon info" with just "icon"
This commit is contained in:
parent
2ec51b7010
commit
27799ba4f5
@ -98,7 +98,7 @@ get_image_paintable (GtkImage *image)
|
||||
{
|
||||
const gchar *icon_name;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIcon *icon_info;
|
||||
GtkIcon *icon;
|
||||
|
||||
switch (gtk_image_get_storage_type (image))
|
||||
{
|
||||
@ -107,10 +107,10 @@ get_image_paintable (GtkImage *image)
|
||||
case GTK_IMAGE_ICON_NAME:
|
||||
icon_name = gtk_image_get_icon_name (image);
|
||||
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
|
||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, 1, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
if (icon_info == NULL)
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, 1, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
if (icon == NULL)
|
||||
return NULL;
|
||||
return GDK_PAINTABLE (icon_info);
|
||||
return GDK_PAINTABLE (icon);
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (image));
|
||||
|
@ -348,7 +348,7 @@ get_image_paintable (GtkImage *image)
|
||||
{
|
||||
const gchar *icon_name;
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIcon *icon_info;
|
||||
GtkIcon *icon;
|
||||
int size;
|
||||
|
||||
switch (gtk_image_get_storage_type (image))
|
||||
@ -359,11 +359,11 @@ get_image_paintable (GtkImage *image)
|
||||
icon_name = gtk_image_get_icon_name (image);
|
||||
size = gtk_image_get_pixel_size (image);
|
||||
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
|
||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, size, 1,
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme, icon_name, size, 1,
|
||||
GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
if (icon_info == NULL)
|
||||
if (icon == NULL)
|
||||
return NULL;
|
||||
return GDK_PAINTABLE (icon_info);
|
||||
return GDK_PAINTABLE (icon);
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (image));
|
||||
|
@ -103,7 +103,7 @@ icon_loaded (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkIcon *info = GTK_ICON_INFO (object);
|
||||
GtkIcon *icon = GTK_ICON (object);
|
||||
GNSMenuItem *item = user_data;
|
||||
GError *error = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
@ -117,7 +117,7 @@ icon_loaded (GObject *object,
|
||||
scale = roundf ([[NSScreen mainScreen] backingScaleFactor]);
|
||||
#endif
|
||||
|
||||
pixbuf = gtk_icon_load_symbolic_finish (info, result, NULL, &error);
|
||||
pixbuf = gtk_icon_load_symbolic_finish (icon, result, NULL, &error);
|
||||
|
||||
if (pixbuf != NULL)
|
||||
{
|
||||
@ -278,7 +278,7 @@ icon_loaded (GObject *object,
|
||||
static GdkRGBA error;
|
||||
|
||||
GtkIconTheme *theme;
|
||||
GtkIcon *info;
|
||||
GtkIcon *icon;
|
||||
gint scale = 1;
|
||||
|
||||
if (!parsed)
|
||||
@ -300,14 +300,14 @@ icon_loaded (GObject *object,
|
||||
if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)])
|
||||
scale = roundf ([[NSScreen mainScreen] backingScaleFactor]);
|
||||
#endif
|
||||
info = gtk_icon_theme_lookup_by_gicon (theme, icon, ICON_SIZE, scale, GTK_ICON_LOOKUP_USE_BUILTIN);
|
||||
icon = gtk_icon_theme_lookup_by_gicon (theme, icon, ICON_SIZE, scale, GTK_ICON_LOOKUP_USE_BUILTIN);
|
||||
|
||||
if (info != NULL)
|
||||
if (icon != NULL)
|
||||
{
|
||||
cancellable = g_cancellable_new ();
|
||||
gtk_icon_load_symbolic_async (info, &foreground, &success, &warning, &error,
|
||||
gtk_icon_load_symbolic_async (icon, &foreground, &success, &warning, &error,
|
||||
cancellable, icon_loaded, self);
|
||||
g_object_unref (info);
|
||||
g_object_unref (icon);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
|
||||
double height)
|
||||
{
|
||||
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
||||
GtkIcon *icon_info;
|
||||
GtkIcon *icon;
|
||||
double icon_width, icon_height;
|
||||
gint size;
|
||||
double x, y;
|
||||
@ -57,31 +57,31 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
|
||||
if (size == icon_theme->cached_size &&
|
||||
icon_theme->cached_icon != NULL)
|
||||
{
|
||||
icon_info = icon_theme->cached_icon;
|
||||
icon = icon_theme->cached_icon;
|
||||
}
|
||||
else
|
||||
{
|
||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme->icon_theme,
|
||||
icon_theme->name,
|
||||
size,
|
||||
icon_theme->scale,
|
||||
GTK_ICON_LOOKUP_USE_BUILTIN);
|
||||
if (icon_info == NULL)
|
||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme->icon_theme,
|
||||
"image-missing",
|
||||
size, icon_theme->scale,
|
||||
GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme->icon_theme,
|
||||
icon_theme->name,
|
||||
size,
|
||||
icon_theme->scale,
|
||||
GTK_ICON_LOOKUP_USE_BUILTIN);
|
||||
if (icon == NULL)
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme->icon_theme,
|
||||
"image-missing",
|
||||
size, icon_theme->scale,
|
||||
GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
|
||||
g_assert (icon_info != NULL);
|
||||
g_assert (icon != NULL);
|
||||
|
||||
g_clear_object (&icon_theme->cached_icon);
|
||||
|
||||
icon_theme->cached_size = size;
|
||||
icon_theme->cached_icon = icon_info;
|
||||
icon_theme->cached_icon = icon;
|
||||
}
|
||||
|
||||
icon_width = (double) MIN (gdk_paintable_get_intrinsic_width (GDK_PAINTABLE (icon_info)), width);
|
||||
icon_height = (double) MIN (gdk_paintable_get_intrinsic_height (GDK_PAINTABLE (icon_info)), height);
|
||||
icon_width = (double) MIN (gdk_paintable_get_intrinsic_width (GDK_PAINTABLE (icon)), width);
|
||||
icon_height = (double) MIN (gdk_paintable_get_intrinsic_height (GDK_PAINTABLE (icon)), height);
|
||||
|
||||
x = (width - icon_width) / 2;
|
||||
y = (height - icon_height) / 2;
|
||||
@ -91,13 +91,13 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
|
||||
}
|
||||
gtk_icon_snapshot_with_colors (icon_info, snapshot,
|
||||
icon_width,
|
||||
icon_height,
|
||||
&icon_theme->color,
|
||||
&icon_theme->success,
|
||||
&icon_theme->warning,
|
||||
&icon_theme->error);
|
||||
gtk_icon_snapshot_with_colors (icon, snapshot,
|
||||
icon_width,
|
||||
icon_height,
|
||||
&icon_theme->color,
|
||||
&icon_theme->success,
|
||||
&icon_theme->warning,
|
||||
&icon_theme->error);
|
||||
if (x != 0 || y != 0)
|
||||
gtk_snapshot_restore (snapshot);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ ensure_paintable_for_gicon (GtkIconHelper *self,
|
||||
{
|
||||
GtkIconTheme *icon_theme;
|
||||
gint width, height;
|
||||
GtkIcon *info;
|
||||
GtkIcon *icon;
|
||||
GtkIconLookupFlags flags;
|
||||
|
||||
icon_theme = gtk_css_icon_theme_value_get_icon_theme (style->core->icon_theme);
|
||||
@ -110,18 +110,18 @@ ensure_paintable_for_gicon (GtkIconHelper *self,
|
||||
|
||||
width = height = gtk_icon_helper_get_size (self);
|
||||
|
||||
info = gtk_icon_theme_lookup_by_gicon (icon_theme,
|
||||
icon = gtk_icon_theme_lookup_by_gicon (icon_theme,
|
||||
gicon,
|
||||
MIN (width, height),
|
||||
scale, flags);
|
||||
if (info == NULL)
|
||||
info = gtk_icon_theme_lookup_icon (icon_theme,
|
||||
if (icon == NULL)
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme,
|
||||
"image-missing",
|
||||
width, scale,
|
||||
flags | GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
|
||||
*symbolic = gtk_icon_is_symbolic (info);
|
||||
return GDK_PAINTABLE (info);
|
||||
*symbolic = gtk_icon_is_symbolic (icon);
|
||||
return GDK_PAINTABLE (icon);
|
||||
}
|
||||
|
||||
static GdkPaintable *
|
||||
|
@ -134,7 +134,7 @@
|
||||
* There is a global "icon_cache" G_LOCK, which protects icon_cache
|
||||
* and lru_cache in GtkIconTheme as well as its reverse pointer
|
||||
* GtkIcon->in_cache. This is sometimes taken with the theme lock held
|
||||
* (from the theme side) and sometimes not (from the icon info side),
|
||||
* (from the theme side) and sometimes not (from the icon side),
|
||||
* but we never take another lock after taking it, so this is safe.
|
||||
* Since this is a global (not per icon/theme) lock we should never
|
||||
* block while holding it.
|
||||
@ -252,7 +252,7 @@ typedef struct {
|
||||
gint size;
|
||||
gint scale;
|
||||
GtkIconLookupFlags flags;
|
||||
} IconInfoKey;
|
||||
} IconKey;
|
||||
|
||||
struct _GtkIconClass
|
||||
{
|
||||
@ -275,7 +275,7 @@ struct _GtkIcon
|
||||
|
||||
/* Information about the source
|
||||
*/
|
||||
IconInfoKey key;
|
||||
IconKey key;
|
||||
GtkIconTheme *in_cache; /* Protected by icon_cache lock */
|
||||
|
||||
gchar *filename;
|
||||
@ -498,7 +498,7 @@ gtk_icon_theme_unlock (GtkIconTheme *self)
|
||||
static guint
|
||||
icon_key_hash (gconstpointer _key)
|
||||
{
|
||||
const IconInfoKey *key = _key;
|
||||
const IconKey *key = _key;
|
||||
guint h = 0;
|
||||
int i;
|
||||
for (i = 0; key->icon_names[i] != NULL; i++)
|
||||
@ -515,8 +515,8 @@ static gboolean
|
||||
icon_key_equal (gconstpointer _a,
|
||||
gconstpointer _b)
|
||||
{
|
||||
const IconInfoKey *a = _a;
|
||||
const IconInfoKey *b = _b;
|
||||
const IconKey *a = _a;
|
||||
const IconKey *b = _b;
|
||||
int i;
|
||||
|
||||
if (a->size != b->size)
|
||||
@ -549,9 +549,9 @@ icon_key_equal (gconstpointer _a,
|
||||
|
||||
/* This is called with icon_cache lock held so must not take any locks */
|
||||
static gboolean
|
||||
_icon_cache_should_lru_cache (GtkIcon *info)
|
||||
_icon_cache_should_lru_cache (GtkIcon *icon)
|
||||
{
|
||||
return info->desired_size <= MAX_LRU_TEXTURE_SIZE;
|
||||
return icon->desired_size <= MAX_LRU_TEXTURE_SIZE;
|
||||
}
|
||||
|
||||
/* This returns the old lru element because we can't unref it with
|
||||
@ -573,7 +573,7 @@ _icon_cache_add_to_lru_cache (GtkIconTheme *theme, GtkIcon *icon)
|
||||
}
|
||||
|
||||
static GtkIcon *
|
||||
icon_cache_lookup (GtkIconTheme *theme, IconInfoKey *key)
|
||||
icon_cache_lookup (GtkIconTheme *theme, IconKey *key)
|
||||
{
|
||||
GtkIcon *old_icon = NULL;
|
||||
GtkIcon *icon;
|
||||
@ -605,7 +605,7 @@ icon_cache_lookup (GtkIconTheme *theme, IconInfoKey *key)
|
||||
return icon;
|
||||
}
|
||||
|
||||
/* The icon info was removed from the icon_hash hash table.
|
||||
/* The icon was removed from the icon_hash hash table.
|
||||
* This is a callback from the icon_cache hashtable, so the icon_cache lock is already held.
|
||||
*/
|
||||
static void
|
||||
@ -1869,7 +1869,7 @@ real_choose_icon (GtkIconTheme *self,
|
||||
gboolean allow_svg;
|
||||
IconTheme *theme = NULL;
|
||||
gint i;
|
||||
IconInfoKey key;
|
||||
IconKey key;
|
||||
|
||||
if (!ensure_valid_themes (self, non_blocking))
|
||||
{
|
||||
|
@ -1169,14 +1169,14 @@ add_pid_to_process_list_store (GtkMountOperation *mount_operation,
|
||||
if (texture == NULL)
|
||||
{
|
||||
GtkIconTheme *theme;
|
||||
GtkIcon *info;
|
||||
GtkIcon *icon;
|
||||
|
||||
theme = gtk_css_icon_theme_value_get_icon_theme
|
||||
(_gtk_style_context_peek_property (gtk_widget_get_style_context (GTK_WIDGET (mount_operation->priv->dialog)),
|
||||
GTK_CSS_PROPERTY_ICON_THEME));
|
||||
info = gtk_icon_theme_lookup_icon (theme, "application-x-executable", 24, 1, 0);
|
||||
texture = gtk_icon_download_texture (info, NULL);
|
||||
g_object_unref (info);
|
||||
icon = gtk_icon_theme_lookup_icon (theme, "application-x-executable", 24, 1, 0);
|
||||
texture = gtk_icon_download_texture (icon, NULL);
|
||||
g_object_unref (icon);
|
||||
}
|
||||
|
||||
markup = g_strdup_printf ("<b>%s</b>\n"
|
||||
|
@ -10,7 +10,7 @@ get_image_texture (GtkImage *image,
|
||||
int width = 48;
|
||||
GdkPaintable *paintable;
|
||||
GdkTexture *texture = NULL;
|
||||
GtkIcon *icon_info;
|
||||
GtkIcon *icon;
|
||||
|
||||
switch (gtk_image_get_storage_type (image))
|
||||
{
|
||||
@ -25,10 +25,10 @@ get_image_texture (GtkImage *image,
|
||||
icon_name = gtk_image_get_icon_name (image);
|
||||
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
|
||||
*out_size = width;
|
||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, width, 1, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
if (icon_info)
|
||||
texture = gtk_icon_download_texture (icon_info, NULL);
|
||||
g_object_unref (icon_info);
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme, icon_name, width, 1, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
|
||||
if (icon)
|
||||
texture = gtk_icon_download_texture (icon, NULL);
|
||||
g_object_unref (icon);
|
||||
default:
|
||||
g_warning ("Image storage type %d not handled",
|
||||
gtk_image_get_storage_type (image));
|
||||
|
@ -60,7 +60,7 @@ int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkIconTheme *icon_theme;
|
||||
GtkIcon *icon_info;
|
||||
GtkIcon *icon;
|
||||
char *context;
|
||||
char *themename;
|
||||
GList *list;
|
||||
@ -184,18 +184,18 @@ main (int argc, char *argv[])
|
||||
if (argc >= 6)
|
||||
scale = atoi (argv[5]);
|
||||
|
||||
icon_info = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, scale, flags);
|
||||
icon = gtk_icon_theme_lookup_icon (icon_theme, argv[3], size, scale, flags);
|
||||
g_print ("icon for %s at %dx%d@%dx is %s\n", argv[3], size, size, scale,
|
||||
icon_info ? gtk_icon_get_filename (icon_info) : "<none>");
|
||||
icon ? gtk_icon_get_filename (icon) : "<none>");
|
||||
|
||||
if (icon_info)
|
||||
if (icon)
|
||||
{
|
||||
GdkPaintable *paintable = GDK_PAINTABLE (icon_info);
|
||||
GdkPaintable *paintable = GDK_PAINTABLE (icon);
|
||||
|
||||
g_print ("Base size: %d, Scale: %d\n", gtk_icon_get_base_size (icon_info), gtk_icon_get_base_scale (icon_info));
|
||||
g_print ("Base size: %d, Scale: %d\n", gtk_icon_get_base_size (icon), gtk_icon_get_base_scale (icon));
|
||||
g_print ("texture size: %dx%d\n", gdk_paintable_get_intrinsic_width (paintable), gdk_paintable_get_intrinsic_height (paintable));
|
||||
|
||||
g_object_unref (icon_info);
|
||||
g_object_unref (icon);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user