[gnome-software: 5/6] Unconditionally apply .icon-dropshadow




commit d079a4e22677588abae3a220035e9ddf3bb48ff0
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Thu Jul 29 10:18:08 2021 +0200

    Unconditionally apply .icon-dropshadow
    
    We don't use symbolic icons anymore, and gs_app_get_use_drop_shadow()
    incorrectly assumes icons with *any* name are symbolic and shouldn't
    have drop shadows. Instead, this drops gs_app_get_use_drop_shadow() and
    applies .icon-dropshadow to all app icons.

 lib/gs-app.c           | 40 ----------------------------------------
 lib/gs-app.h           |  1 -
 src/gs-app-row.c       |  5 -----
 src/gs-app-row.ui      |  3 +++
 src/gs-summary-tile.c  |  7 -------
 src/gs-summary-tile.ui |  3 +++
 6 files changed, 6 insertions(+), 53 deletions(-)
---
diff --git a/lib/gs-app.c b/lib/gs-app.c
index ce334de38..ec005ccf0 100644
--- a/lib/gs-app.c
+++ b/lib/gs-app.c
@@ -2010,46 +2010,6 @@ gs_app_remove_all_icons (GsApp *app)
                g_ptr_array_set_size (priv->icons, 0);
 }
 
-/**
- * gs_app_get_use_drop_shadow:
- * @app: a #GsApp
- *
- * Uses a heuristic to work out if the application pixbuf should have a drop
- * shadow applied.
- *
- * Returns: %TRUE if a drop shadow should be applied
- *
- * Since: 3.34
- **/
-gboolean
-gs_app_get_use_drop_shadow (GsApp *app)
-{
-       GsAppPrivate *priv = gs_app_get_instance_private (app);
-       GIcon *icon;
-       const gchar * const *names;
-
-       g_return_val_if_fail (GS_IS_APP (app), FALSE);
-
-       /* guess */
-       if (priv->icons == NULL || priv->icons->len == 0)
-               return TRUE;
-
-       icon = g_ptr_array_index (priv->icons, 0);
-
-       /* Apply drop shadows to non-themed icons. */
-       if (!G_IS_THEMED_ICON (icon))
-               return TRUE;
-
-       /* Don’t apply drop shadows to symbolic icons. */
-       names = g_themed_icon_get_names (G_THEMED_ICON (icon));
-       for (gsize i = 0; names[i] != NULL; i++) {
-               if (g_str_has_suffix (names[i], "-symbolic"))
-                       return FALSE;
-       }
-
-       return TRUE;
-}
-
 /**
  * gs_app_get_agreement:
  * @app: a #GsApp
diff --git a/lib/gs-app.h b/lib/gs-app.h
index 935344ea2..f9f36e070 100644
--- a/lib/gs-app.h
+++ b/lib/gs-app.h
@@ -368,7 +368,6 @@ GPtrArray   *gs_app_get_icons               (GsApp          *app);
 void            gs_app_add_icon                (GsApp          *app,
                                                 GIcon          *icon);
 void            gs_app_remove_all_icons        (GsApp          *app);
-gboolean        gs_app_get_use_drop_shadow     (GsApp          *app);
 GFile          *gs_app_get_local_file          (GsApp          *app);
 void            gs_app_set_local_file          (GsApp          *app,
                                                 GFile          *local_file);
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index 4b028bb0f..ae407b77c 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -428,11 +428,6 @@ gs_app_row_actually_refresh (GsAppRow *app_row)
        else
                gtk_style_context_remove_class (context, "dimmer-label");
 
-       if (gs_app_get_use_drop_shadow (priv->app))
-               gtk_style_context_add_class (context, "icon-dropshadow");
-       else
-               gtk_style_context_remove_class (context, "icon-dropshadow");
-
        /* pending label */
        switch (gs_app_get_state (priv->app)) {
        case GS_APP_STATE_QUEUED_FOR_INSTALL:
diff --git a/src/gs-app-row.ui b/src/gs-app-row.ui
index 34cda38a5..1547eaa49 100644
--- a/src/gs-app-row.ui
+++ b/src/gs-app-row.ui
@@ -19,6 +19,9 @@
             <property name="visible">True</property>
             <property name="pixel_size">64</property>
             <property name="valign">center</property>
+            <style>
+              <class name="icon-dropshadow"/>
+            </style>
           </object>
         </child>
         <child>
diff --git a/src/gs-summary-tile.c b/src/gs-summary-tile.c
index c62eff266..33622c212 100644
--- a/src/gs-summary-tile.c
+++ b/src/gs-summary-tile.c
@@ -40,7 +40,6 @@ gs_summary_tile_refresh (GsAppTile *self)
        GsSummaryTile *tile = GS_SUMMARY_TILE (self);
        GsApp *app = gs_app_tile_get_app (self);
        AtkObject *accessible;
-       GtkStyleContext *context;
        g_autoptr(GIcon) icon = NULL;
        gboolean installed;
        g_autofree gchar *name = NULL;
@@ -65,12 +64,6 @@ gs_summary_tile_refresh (GsAppTile *self)
                                         "system-component-application");
        gtk_image_set_from_gicon (GTK_IMAGE (tile->image), icon, GTK_ICON_SIZE_DIALOG);
 
-       context = gtk_widget_get_style_context (tile->image);
-       if (gs_app_get_use_drop_shadow (app))
-               gtk_style_context_add_class (context, "icon-dropshadow");
-       else
-               gtk_style_context_remove_class (context, "icon-dropshadow");
-
        accessible = gtk_widget_get_accessible (GTK_WIDGET (tile));
 
        switch (gs_app_get_state (app)) {
diff --git a/src/gs-summary-tile.ui b/src/gs-summary-tile.ui
index 5d130013e..f23bafde3 100644
--- a/src/gs-summary-tile.ui
+++ b/src/gs-summary-tile.ui
@@ -69,6 +69,9 @@
                   <object class="GtkImage" id="image">
                     <property name="visible">True</property>
                     <property name="pixel-size">64</property>
+                    <style>
+                      <class name="icon-dropshadow"/>
+                    </style>
                   </object>
                   <packing>
                     <property name="left-attach">0</property>


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