[gtk: 32/40] Remove final references to "icon info" with just "icon"



commit 27799ba4f5a15cd3a63be371f94688a4c89bfd9f
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jan 30 10:52:09 2020 +0100

    Remove final references to "icon info" with just "icon"

 demos/gtk-demo/clipboard.c          |  8 +++----
 demos/icon-browser/iconbrowserwin.c |  8 +++----
 gtk/gtkapplication-quartz-menu.c    | 14 +++++------
 gtk/gtkcssimageicontheme.c          | 48 ++++++++++++++++++-------------------
 gtk/gtkiconhelper.c                 | 12 +++++-----
 gtk/gtkicontheme.c                  | 22 ++++++++---------
 gtk/gtkmountoperation.c             |  8 +++----
 tests/testdnd2.c                    | 10 ++++----
 tests/testicontheme.c               | 14 +++++------
 9 files changed, 72 insertions(+), 72 deletions(-)
---
diff --git a/demos/gtk-demo/clipboard.c b/demos/gtk-demo/clipboard.c
index fba169ee45..5708b888c4 100644
--- a/demos/gtk-demo/clipboard.c
+++ b/demos/gtk-demo/clipboard.c
@@ -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));
diff --git a/demos/icon-browser/iconbrowserwin.c b/demos/icon-browser/iconbrowserwin.c
index 6a047662cd..a0e61f34a2 100644
--- a/demos/icon-browser/iconbrowserwin.c
+++ b/demos/icon-browser/iconbrowserwin.c
@@ -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));
diff --git a/gtk/gtkapplication-quartz-menu.c b/gtk/gtkapplication-quartz-menu.c
index 2d31dc0463..1ed137c41c 100644
--- a/gtk/gtkapplication-quartz-menu.c
+++ b/gtk/gtkapplication-quartz-menu.c
@@ -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;
         }
     }
diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c
index 86786b8f61..03bbc2795f 100644
--- a/gtk/gtkcssimageicontheme.c
+++ b/gtk/gtkcssimageicontheme.c
@@ -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);
-
-      g_assert (icon_info != NULL);
+      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 != 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);
 }
diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c
index 47b5b675b0..4091722cc4 100644
--- a/gtk/gtkiconhelper.c
+++ b/gtk/gtkiconhelper.c
@@ -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 *
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index f60dc2c09a..d558a5fc89 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -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))
     {
diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c
index b23734d0bf..20e61d0831 100644
--- a/gtk/gtkmountoperation.c
+++ b/gtk/gtkmountoperation.c
@@ -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"
diff --git a/tests/testdnd2.c b/tests/testdnd2.c
index 4086688ea1..11d604fee5 100644
--- a/tests/testdnd2.c
+++ b/tests/testdnd2.c
@@ -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));
diff --git a/tests/testicontheme.c b/tests/testicontheme.c
index c5ba70ed1b..c988f10ce5 100644
--- a/tests/testicontheme.c
+++ b/tests/testicontheme.c
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]