[gnome-software: 12/25] gs-category: Rename icon to icon-name




commit e8a0563b8e4eb89d17d4f858eb584afbf29c0e34
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon Feb 1 23:52:18 2021 +0000

    gs-category: Rename icon to icon-name
    
    This makes it clearer that it’s an icon name, rather than a pixbuf or
    `GIcon`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-category.c      | 30 +++++++++++++++---------------
 lib/gs-category.h      |  6 +++---
 src/gs-category-tile.c |  2 +-
 3 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/lib/gs-category.c b/lib/gs-category.c
index 9da2c731b..c9c1d2338 100644
--- a/lib/gs-category.c
+++ b/lib/gs-category.c
@@ -28,7 +28,7 @@ struct _GsCategory
 
        gchar           *id;
        gchar           *name;
-       gchar           *icon;
+       gchar           *icon_name;
        gint             score;
        GPtrArray       *desktop_groups;
        GsCategory      *parent;
@@ -60,9 +60,9 @@ gs_category_to_string (GsCategory *category)
                g_string_append_printf (str, "  name: %s\n",
                                        category->name);
        }
-       if (category->icon != NULL) {
-               g_string_append_printf (str, "  icon: %s\n",
-                                       category->icon);
+       if (category->icon_name != NULL) {
+               g_string_append_printf (str, "  icon-name: %s\n",
+                                       category->icon_name);
        }
        g_string_append_printf (str, "  size: %u\n",
                                category->size);
@@ -208,17 +208,17 @@ gs_category_set_name (GsCategory *category, const gchar *name)
 }
 
 /**
- * gs_category_get_icon:
+ * gs_category_get_icon_name:
  * @category: a #GsCategory
  *
- * Gets the category icon.
+ * Gets the category icon name.
  *
  * Returns: the string, or %NULL
  *
  * Since: 3.22
  **/
 const gchar *
-gs_category_get_icon (GsCategory *category)
+gs_category_get_icon_name (GsCategory *category)
 {
        g_return_val_if_fail (GS_IS_CATEGORY (category), NULL);
 
@@ -230,24 +230,24 @@ gs_category_get_icon (GsCategory *category)
        if (g_strcmp0 (category->id, "featured") == 0)
                return "emblem-favorite-symbolic";
 
-       return category->icon;
+       return category->icon_name;
 }
 
 /**
- * gs_category_set_icon:
+ * gs_category_set_icon_name:
  * @category: a #GsCategory
- * @icon: a category icon, or %NULL
+ * @icon_name: a category icon name, or %NULL
  *
- * Sets the category icon.
+ * Sets the category icon name.
  *
  * Since: 3.22
  **/
 void
-gs_category_set_icon (GsCategory *category, const gchar *icon)
+gs_category_set_icon_name (GsCategory *category, const gchar *icon_name)
 {
        g_return_if_fail (GS_IS_CATEGORY (category));
-       g_free (category->icon);
-       category->icon = g_strdup (icon);
+       g_free (category->icon_name);
+       category->icon_name = g_strdup (icon_name);
 }
 
 /**
@@ -488,7 +488,7 @@ gs_category_finalize (GObject *object)
        g_ptr_array_unref (category->desktop_groups);
        g_free (category->id);
        g_free (category->name);
-       g_free (category->icon);
+       g_free (category->icon_name);
 
        G_OBJECT_CLASS (gs_category_parent_class)->finalize (object);
 }
diff --git a/lib/gs-category.h b/lib/gs-category.h
index e60bef276..9a78425b6 100644
--- a/lib/gs-category.h
+++ b/lib/gs-category.h
@@ -26,9 +26,9 @@ GsCategory    *gs_category_get_parent         (GsCategory     *category);
 const gchar    *gs_category_get_name           (GsCategory     *category);
 void            gs_category_set_name           (GsCategory     *category,
                                                 const gchar    *name);
-const gchar    *gs_category_get_icon           (GsCategory     *category);
-void            gs_category_set_icon           (GsCategory     *category,
-                                                const gchar    *icon);
+const gchar    *gs_category_get_icon_name      (GsCategory     *category);
+void            gs_category_set_icon_name      (GsCategory     *category,
+                                                const gchar    *icon_name);
 gint            gs_category_get_score          (GsCategory     *category);
 void            gs_category_set_score          (GsCategory     *category,
                                                 gint            score);
diff --git a/src/gs-category-tile.c b/src/gs-category-tile.c
index b43447871..eb35e67dd 100644
--- a/src/gs-category-tile.c
+++ b/src/gs-category-tile.c
@@ -37,7 +37,7 @@ gs_category_tile_refresh (GsCategoryTile *tile)
        gtk_label_set_label (GTK_LABEL (tile->label),
                             gs_category_get_name (tile->cat));
        gtk_image_set_from_icon_name (GTK_IMAGE (tile->image),
-                                     gs_category_get_icon (tile->cat),
+                                     gs_category_get_icon_name (tile->cat),
                                      GTK_ICON_SIZE_MENU);
 }
 


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