/** * st_texture_cache_load_icon_name: * @cache: The texture cache instance * @theme_node: (allow-none): a #StThemeNode * @name: Name of a themed icon * @icon_type: the type of icon to load * @size: Size of themed icon * * Load a themed icon into a texture. See the #StIconType documentation * for an explanation of how @icon_type affects the returned icon. The * colors used for symbolic icons are derived from @theme_node. * * Return Value: (transfer none): A new #ClutterTexture for the icon */ ClutterActor * st_texture_cache_load_icon_name (StTextureCache *cache, StThemeNode *theme_node, const char *name, StIconType icon_type, gint size) { ClutterActor *texture; GIcon *themed; char **names; g_return_val_if_fail (!(icon_type == ST_ICON_SYMBOLIC && theme_node == NULL), NULL); switch (icon_type) { case ST_ICON_SYMBOLIC: names = symbolic_names_for_icon (name); themed = g_themed_icon_new_from_names (names, -1); g_strfreev (names); texture = load_gicon_with_colors (cache, themed, size, st_theme_node_get_icon_colors (theme_node)); g_object_unref (themed); if (texture == NULL) { /* We don't have an equivalent of image-missing * for the symbolic icon theme, so just create a blank * actor. */ texture = (ClutterActor *) create_default_texture (); clutter_actor_set_size (texture, size, size); } return texture; break; case ST_ICON_FULLCOLOR: themed = g_themed_icon_new_with_default_fallbacks (name); texture = load_gicon_with_colors (cache, themed, size, NULL); g_object_unref (themed); if (texture == NULL) { themed = g_themed_icon_new ("image-missing"); texture = load_gicon_with_colors (cache, themed, size, NULL); g_object_unref (themed); } return texture; break; default: g_assert_not_reached (); } }
/** * st_texture_cache_load_gicon: * @cache: The texture cache instance * @theme_node: (allow-none): The #StThemeNode to use for colors, or NULL * if the icon must not be recolored * @icon: the #GIcon to load * @size: Size of themed * * This method returns a new #ClutterActor for a given #GIcon. If the * icon isn't loaded already, the texture will be filled * asynchronously. * * Return Value: (transfer none): A new #ClutterActor for the icon, or %NULL if not found */ ClutterActor * st_texture_cache_load_gicon (StTextureCache *cache, StThemeNode *theme_node, GIcon *icon, gint size) { return load_gicon_with_colors (cache, icon, size, theme_node ? st_theme_node_get_icon_colors (theme_node) : NULL); }
/** * st_texture_cache_load_icon_name: * @cache: The texture cache instance * @theme_node: (allow-none): a #StThemeNode * @name: Name of a themed icon * @icon_type: the type of icon to load * @size: Size of themed * * Load a themed icon into a texture. See the #StIconType documentation * for an explanation of how @icon_type affects the returned icon. The * colors used for symbolic icons are derived from @theme_node. * * Return Value: (transfer none): A new #ClutterTexture for the icon */ ClutterActor * st_texture_cache_load_icon_name (StTextureCache *cache, StThemeNode *theme_node, const char *name, StIconType icon_type, gint size) { ClutterActor *texture; GIcon *themed; char *symbolic_name; g_return_val_if_fail (!(icon_type == ST_ICON_SYMBOLIC && theme_node == NULL), NULL); switch (icon_type) { case ST_ICON_APPLICATION: themed = g_themed_icon_new (name); texture = load_gicon_with_colors (cache, themed, size, cache->priv->scale, NULL); g_object_unref (themed); if (texture == NULL) { themed = g_themed_icon_new ("application-x-executable"); texture = load_gicon_with_colors (cache, themed, size, cache->priv->scale, NULL); g_object_unref (themed); } return CLUTTER_ACTOR (texture); break; case ST_ICON_DOCUMENT: themed = g_themed_icon_new (name); texture = load_gicon_with_colors (cache, themed, size, cache->priv->scale, NULL); g_object_unref (themed); if (texture == NULL) { themed = g_themed_icon_new ("x-office-document"); texture = load_gicon_with_colors (cache, themed, size, cache->priv->scale, NULL); g_object_unref (themed); } return CLUTTER_ACTOR (texture); break; case ST_ICON_SYMBOLIC: symbolic_name = symbolic_name_for_icon (name); themed = g_themed_icon_new (symbolic_name); free (symbolic_name); texture = load_gicon_with_colors (cache, themed, size, cache->priv->scale, st_theme_node_get_icon_colors (theme_node)); g_object_unref (themed); return CLUTTER_ACTOR (texture); break; case ST_ICON_FULLCOLOR: themed = g_themed_icon_new (name); texture = load_gicon_with_colors (cache, themed, size, cache->priv->scale, NULL); g_object_unref (themed); if (texture == NULL) { themed = g_themed_icon_new ("image-missing"); texture = load_gicon_with_colors (cache, themed, size, cache->priv->scale, NULL); g_object_unref (themed); } return CLUTTER_ACTOR (texture); break; default: g_assert_not_reached (); } }