cssimage: Implement symbolic coloring for -gtk-icontheme()
This commit is contained in:
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "gtkcssrgbavalueprivate.h"
|
||||||
#include "gtksettingsprivate.h"
|
#include "gtksettingsprivate.h"
|
||||||
#include "gtkstyleproviderprivate.h"
|
#include "gtkstyleproviderprivate.h"
|
||||||
|
|
||||||
@ -43,6 +44,7 @@ gtk_css_image_icon_theme_draw (GtkCssImage *image,
|
|||||||
{
|
{
|
||||||
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
GtkIconInfo *icon_info;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
gint size;
|
gint size;
|
||||||
|
|
||||||
@ -50,11 +52,21 @@ gtk_css_image_icon_theme_draw (GtkCssImage *image,
|
|||||||
if (size <= 0)
|
if (size <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pixbuf = gtk_icon_theme_load_icon_for_scale (icon_theme->icon_theme,
|
icon_info = gtk_icon_theme_lookup_icon_for_scale (icon_theme->icon_theme,
|
||||||
icon_theme->name,
|
icon_theme->name,
|
||||||
size,
|
size,
|
||||||
icon_theme->scale,
|
icon_theme->scale,
|
||||||
GTK_ICON_LOOKUP_USE_BUILTIN,
|
GTK_ICON_LOOKUP_USE_BUILTIN);
|
||||||
|
if (icon_info == NULL)
|
||||||
|
{
|
||||||
|
/* XXX: render missing icon image here? */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
pixbuf = gtk_icon_info_load_symbolic (icon_info,
|
||||||
|
&icon_theme->color,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
NULL,
|
||||||
&error);
|
&error);
|
||||||
if (pixbuf == NULL)
|
if (pixbuf == NULL)
|
||||||
{
|
{
|
||||||
@ -70,6 +82,7 @@ gtk_css_image_icon_theme_draw (GtkCssImage *image,
|
|||||||
cairo_paint (cr);
|
cairo_paint (cr);
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
|
g_object_unref (icon_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,6 +146,9 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
|||||||
copy->name = g_strdup (icon_theme->name);
|
copy->name = g_strdup (icon_theme->name);
|
||||||
copy->icon_theme = gtk_icon_theme_get_for_screen (screen);
|
copy->icon_theme = gtk_icon_theme_get_for_screen (screen);
|
||||||
copy->scale = scale;
|
copy->scale = scale;
|
||||||
|
copy->color = *_gtk_css_rgba_value_get_rgba (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR));
|
||||||
|
|
||||||
|
*dependencies = GTK_CSS_DEPENDS_ON_COLOR;
|
||||||
|
|
||||||
return GTK_CSS_IMAGE (copy);
|
return GTK_CSS_IMAGE (copy);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ struct _GtkCssImageIconTheme
|
|||||||
GtkCssImage parent;
|
GtkCssImage parent;
|
||||||
|
|
||||||
GtkIconTheme *icon_theme;
|
GtkIconTheme *icon_theme;
|
||||||
|
GdkRGBA color;
|
||||||
gint scale;
|
gint scale;
|
||||||
char *name;
|
char *name;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user