...
 
Commits (2)
  • Florian Müllner's avatar
    Revert "texture-cache: Use image-missing image when no other icon was loaded" · fecc0c06
    Florian Müllner authored
    The commit broke StIcon's :fallback-gicon property, as it relies on failure to load
    an icon to determine that the fallback should be shown.
    
    Luckily StIcon is the only user of st_texture_cache_load_gicon() (at least in
    regular shell code), so we'll be able to implement the 'image-missing' fallback
    there.
    
    This reverts commit 3dd8ffc2.
    
    !1127
    fecc0c06
  • Florian Müllner's avatar
    st/icon: Add a default fallback icon · c89d6a63
    Florian Müllner authored
    The idea behind commit 3dd8ffc2 to try harder to avoid empty
    icon actors because of missing icons was sound, so implement that
    behavior in StIcon itself:
    
    If the main gicon was not found, and the fallback gicon isn't set or
    wasn't found either, fall back to the standard 'missing-image' icon.
    
    !1127
    c89d6a63
......@@ -59,6 +59,7 @@ struct _StIconPrivate
gint theme_icon_size; /* icon size from theme node */
gint icon_size; /* icon size we are using */
GIcon *fallback_gicon;
GIcon *default_gicon;
CoglPipeline *shadow_pipeline;
StShadow *shadow_spec;
......@@ -72,6 +73,7 @@ static gboolean st_icon_update_icon_size (StIcon *icon);
static void st_icon_update_shadow_pipeline (StIcon *icon);
static void st_icon_clear_shadow_pipeline (StIcon *icon);
#define IMAGE_MISSING_ICON_NAME "image-missing"
#define DEFAULT_ICON_SIZE 48
static void
......@@ -166,6 +168,7 @@ st_icon_dispose (GObject *gobject)
g_clear_object (&priv->gicon);
g_clear_object (&priv->fallback_gicon);
g_clear_object (&priv->default_gicon);
g_clear_pointer (&priv->shadow_pipeline, cogl_object_unref);
g_clear_pointer (&priv->shadow_spec, st_shadow_unref);
......@@ -298,6 +301,8 @@ st_icon_init (StIcon *self)
CLUTTER_BIN_ALIGNMENT_FILL);
clutter_actor_set_layout_manager (CLUTTER_ACTOR (self), layout_manager);
self->priv->default_gicon = g_themed_icon_new (IMAGE_MISSING_ICON_NAME);
self->priv->icon_size = DEFAULT_ICON_SIZE;
self->priv->prop_icon_size = -1;
......@@ -442,6 +447,14 @@ st_icon_update (StIcon *icon)
paint_scale,
resource_scale);
if (priv->pending_texture == NULL)
priv->pending_texture = st_texture_cache_load_gicon (cache,
theme_node,
priv->default_gicon,
priv->icon_size,
paint_scale,
resource_scale);
if (priv->pending_texture)
{
g_object_ref_sink (priv->pending_texture);
......
......@@ -34,8 +34,6 @@
#define CACHE_PREFIX_FILE "file:"
#define CACHE_PREFIX_FILE_FOR_CAIRO "file-for-cairo:"
#define IMAGE_MISSING_ICON_NAME "image-missing"
struct _StTextureCachePrivate
{
GtkIconTheme *icon_theme;
......@@ -996,15 +994,7 @@ st_texture_cache_load_gicon (StTextureCache *cache,
size, scale,
lookup_flags);
if (info == NULL)
{
/* Do not give up without even trying to pick the image-missing fallback icon. */
info = gtk_icon_theme_lookup_icon_for_scale (theme,
IMAGE_MISSING_ICON_NAME,
size, scale,
GTK_ICON_LOOKUP_USE_BUILTIN);
if (info == NULL)
return NULL;
}
return NULL;
gicon_string = g_icon_to_string (icon);
/* A return value of NULL indicates that the icon can not be serialized,
......