Commit 95747160 authored by Michael Natterer's avatar Michael Natterer 😴

icons, app, libgimpwidgets: use GResource for the compiled-in icons

And a small improvement in cursors/Makefile.am
parent 74493168
......@@ -38,7 +38,7 @@
#include "gimptempbuf.h"
#include "gimpviewable.h"
#include "icons/gimp-core-pixbufs.h"
#include "icons/gimp-core-pixbufs.c"
enum
......@@ -1089,6 +1089,7 @@ gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
{
GdkPixbuf *icon;
GdkPixbuf *pixbuf;
GError *error = NULL;
gdouble ratio;
gint w, h;
......@@ -1096,9 +1097,14 @@ gimp_viewable_get_dummy_pixbuf (GimpViewable *viewable,
g_return_val_if_fail (width > 0, NULL);
g_return_val_if_fail (height > 0, NULL);
icon = gdk_pixbuf_new_from_inline (-1, gimp_question_64, FALSE, NULL);
g_return_val_if_fail (icon != NULL, NULL);
icon = gdk_pixbuf_new_from_resource ("/org/gimp/icons/64/gimp-question.png",
&error);
if (! icon)
{
g_critical ("Failed to create icon image: %s", error->message);
g_clear_error (&error);
return NULL;
}
w = gdk_pixbuf_get_width (icon);
h = gdk_pixbuf_get_height (icon);
......
......@@ -89,9 +89,8 @@ noinst_DATA = \
gimp-color-picker-cursors.c
CLEANFILES = \
gimp-tool-cursors.c \
$(noinst_DATA) \
gimp-tool-cursors.gresource.xml \
gimp-color-picker-cursors.c \
gimp-color-picker-cursors.gresource.xml
......
/Makefile
/Makefile.in
/gimp-core-pixbufs.h
/gimp-icon-pixbufs.h
/gimp-core-pixbufs.c
/gimp-core-pixbufs.gresource.xml
/gimp-icon-pixbufs.c
/gimp-icon-pixbufs.gresource.xml
......@@ -468,16 +468,9 @@ icons64_DATA = \
CORE_IMAGES = \
64/gimp-question.png
CORE_VARIABLES = \
gimp_question_64 $(srcdir)/64/gimp-question.png
ICON_IMAGES = \
64/gimp-wilber-eek.png
ICON_VARIABLES = \
gimp_wilber_eek_64 $(srcdir)/64/gimp-wilber-eek.png
EXTRA_DIST = \
$(icons_DATA) \
$(icons12_DATA) \
......@@ -491,16 +484,44 @@ EXTRA_DIST = \
$(icons64_DATA)
noinst_DATA = \
gimp-core-pixbufs.h \
gimp-icon-pixbufs.h
gimp-core-pixbufs.c \
gimp-icon-pixbufs.c
CLEANFILES = \
$(noinst_DATA) \
gimp-core-pixbufs.gresource.xml \
gimp-icon-pixbufs.gresource.xml
gimp-core-pixbufs.gresource.xml: $(CORE_IMAGES) Makefile.am
$(AM_V_GEN) ( rm -f $@; \
echo '<?xml version="1.0" encoding="UTF-8"?>' > $@; \
echo '<gresources>' >> $@; \
echo ' <gresource prefix="/org/gimp/icons">' >> $@; \
for image in $(CURSOR_IMAGES); do \
echo " <file preprocess=\"to-pixdata\">$$image</file>" >> $@; \
done; \
echo ' </gresource>' >> $@; \
echo '</gresources>' >> $@ )
CLEANFILES = $(noinst_DATA)
gimp-core-pixbufs.c: gimp-core-pixbufs.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-core-pixbufs.gresource.xml
gimp-core-pixbufs.h: $(CORE_IMAGES) Makefile.am
$(AM_V_GEN) $(GDK_PIXBUF_CSOURCE) \
--raw --build-list $(CORE_VARIABLES) > $(@F)
gimp-icon-pixbufs.gresource.xml: $(ICON_IMAGES) Makefile.am
$(AM_V_GEN) ( rm -f $@; \
echo '<?xml version="1.0" encoding="UTF-8"?>' > $@; \
echo '<gresources>' >> $@; \
echo ' <gresource prefix="/org/gimp/icons">' >> $@; \
for image in $(CURSOR_IMAGES); do \
echo " <file preprocess=\"to-pixdata\">$$image</file>" >> $@; \
done; \
echo ' </gresource>' >> $@; \
echo '</gresources>' >> $@ )
gimp-icon-pixbufs.h: $(ICON_IMAGES) Makefile.am
$(AM_V_GEN) $(GDK_PIXBUF_CSOURCE) \
--raw --build-list $(ICON_VARIABLES) > $(@F)
gimp-icon-pixbufs.c: gimp-icon-pixbufs.gresource.xml
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ gimp-icon-pixbufs.gresource.xml
......@@ -27,7 +27,7 @@
#include "gimpstock.h"
#include "icons/gimp-icon-pixbufs.h"
#include "icons/gimp-icon-pixbufs.c"
#include "libgimp/libgimp-intl.h"
......@@ -360,6 +360,7 @@ gimp_stock_init (void)
static gboolean initialized = FALSE;
GdkPixbuf *pixbuf;
GError *error = NULL;
gchar *icons_dir;
gint i;
......@@ -401,9 +402,19 @@ gimp_stock_init (void)
icons_dir);
g_free (icons_dir);
pixbuf = gdk_pixbuf_new_from_inline (-1, gimp_wilber_eek_64, FALSE, NULL);
gtk_icon_theme_add_builtin_icon (GIMP_STOCK_WILBER_EEK, 64, pixbuf);
g_object_unref (pixbuf);
pixbuf = gdk_pixbuf_new_from_resource ("/org/gimp/icons/64/gimp-wilber-eek.png",
&error);
if (pixbuf)
{
gtk_icon_theme_add_builtin_icon (GIMP_STOCK_WILBER_EEK, 64, pixbuf);
g_object_unref (pixbuf);
}
else
{
g_critical ("Failed to create icon image: %s", error->message);
g_clear_error (&error);
}
initialized = TRUE;
}
......@@ -175,6 +175,7 @@ EXPORTS
gimp_help_set_help_data_with_markup
gimp_hint_box_get_type
gimp_hint_box_new
gimp_icon_pixbufs_get_resource
gimp_int_adjustment_update
gimp_int_combo_box_append
gimp_int_combo_box_connect
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment