bug-gnubg
[Top][All Lists]
Advanced

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

[Bug-gnubg] Remove deprecated funtion gdk_pixbuf_new_from_inline


From: Jeremy Moore
Subject: [Bug-gnubg] Remove deprecated funtion gdk_pixbuf_new_from_inline
Date: Wed, 20 Apr 2016 17:22:34 +0300

Hello,

I've got a patch prepared to replace the deprecated
gdk_pixbuf_new_from_inline() with gdk_pixbuf_new_from_resource().

Changes are:
- configure.ac: Check for the glib-compile-resources executable
- pixmaps/Makefile.am: Build all icons into a resources library if
glib-compile-resources is available
- Makefile.am: Link in the resources library and add its generated
header to the include path
- gnubgstock.c: Replace pointers to inline data with resource paths
- gtklocdefs.[ch]: Map the resource paths back to the old-style inline
data on systems which are unable to compile resources.

Slightly lengthy patch follows, but it's mostly just listing out all
the new paths. Let me know if I've broken any guidelines or put things
in the wrong places.

Jeremy


--- a/configure.ac
+++ b/configure.ac
@@ -342,8 +342,16 @@ if test "$no_gtk" = "no"; then
   if test "x$GDK_PIXBUF_CSOURCE" = "xno"; then
     AC_MSG_WARN([Could not find gdk-pixbuf-csource in your PATH,
cannot rebuild pixmaps])
   fi
+
+  AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources, no)
+  if test "x$GLIB_COMPILE_RESOURCES" = "xno"; then
+    AC_MSG_WARN([Could not find glib-compile-resources in your PATH,
will use legacy pixmaps instead])
+  else
+    AC_DEFINE(USE_GRESOURCE, 1, [Define if you want to use GResource
to load images])
+  fi
 fi
 AM_CONDITIONAL(FOUND_GDK_PIXBUF_CSOURCE, test "x$GDK_PIXBUF_CSOURCE" != "xno" )
+AM_CONDITIONAL(FOUND_GLIB_COMPILE_RESOURCES, test
"x$GLIB_COMPILE_RESOURCES" != "xno" )

 dnl
 dnl Check for Python
--- a/pixmaps/Makefile.am
+++ b/pixmaps/Makefile.am
@@ -75,6 +75,7 @@ EXTRA_DIST = \

 if USE_GTK

+CLEANFILES =
 PIXMAPS = gnubg-big.png

 stock-icons.list: $(STOCK_IMAGES) Makefile.am
@@ -88,7 +89,7 @@ stock-icons.list: $(STOCK_IMAGES) Makefile.am
 if FOUND_GDK_PIXBUF_CSOURCE
 gnubg-stock-pixbufs.h: stock-icons.list
  $(GDK_PIXBUF_CSOURCE) --raw --build-list `cat $<` > $(@F)
-CLEANFILES=stock-icons.list gnubg-stock-pixbufs.h
+CLEANFILES+=stock-icons.list gnubg-stock-pixbufs.h
 else
 gnubg-stock-pixbufs.h: stock-icons.list
  @echo ' ****************************'
@@ -96,6 +97,16 @@ gnubg-stock-pixbufs.h: stock-icons.list
  @echo ' ****************************'
 endif

+stock-icons.xml: $(STOCK_IMAGES) Makefile.am
+ @echo '<?xml version="1.0" encoding="UTF-8"?>' > $@
+ @echo '<gresources>' >> $@
+ @echo ' <gresource prefix="/org/gnubg">' >> $@
+ @for image in $(STOCK_IMAGES); do echo "  <file>$$image</file>" >> $@; done
+ @echo ' </gresource>' >> $@
+ @echo '</gresources>' >> $@
+
+gnubg-stock-resources.c gnubg-stock-resources.h: stock-icons.xml
+ $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir)
--generate --c-name=gnubg_stock --manual-register $<

 nobase_dist_gnubgicons_DATA = \
       $(ICONS_16) \
@@ -108,4 +119,12 @@ dist_gnubgpixmaps_DATA = $(PIXMAPS)

 noinst_DATA = gnubg-stock-pixbufs.h

+if FOUND_GLIB_COMPILE_RESOURCES
+noinst_LTLIBRARIES = libresources.la
+nodist_libresources_la_SOURCES = gnubg-stock-resources.c
gnubg-stock-resources.h
+AM_CPPFLAGS = @GLIB_CFLAGS@
+BUILT_SOURCES = gnubg-stock-resources.h
+CLEANFILES += gnubg-stock-resources.c gnubg-stock-resources.h stock-icons.xml
+endif
+
 endif
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,7 +15,7 @@ else
 localeloc=-DLOCALEDIR=\"$(localedir)\"
 endif

-AM_CPPFLAGS = -I$(srcdir)/lib -I$(srcdir)/board3d -I$(srcdir)/pixmaps \
+AM_CPPFLAGS = -I$(srcdir)/lib -I$(srcdir)/board3d
-I$(builddir)/pixmaps -I$(srcdir)/pixmaps \
    $(localeloc) @FREETYPE2_CFLAGS@ @GLIB_CFLAGS@ \
    @LIBPNG_CFLAGS@ @GTK_CFLAGS@ @CAIRO_CFLAGS@ @PANGOCAIRO_CFLAGS@ \
    @GTHREAD_CFLAGS@ @GTKGLEXT_CFLAGS@ @CANBERRA_CFLAGS@ @GOBJECT_CFLAGS@ \
@@ -169,6 +169,9 @@ endif
 if USE_BOARD3D
 gnubg_LDADD += -L$(srcdir)/board3d board3d/libboard3d.la
$(GTKGLEXT_LIBS) $(GLU_LIBS)
 endif
+if FOUND_GLIB_COMPILE_RESOURCES
+gnubg_LDADD += pixmaps/libresources.la
+endif

 if WIN32
 if USE_GTK
--- a/gnubgstock.c
+++ b/gnubgstock.c
@@ -24,13 +24,18 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include "gnubgstock.h"
-#include "gnubg-stock-pixbufs.h"
+
+#ifdef USE_GRESOURCE
+#include "gnubg-stock-resources.h"
+#else
+#include "gtklocdefs.h"
+#endif

 static GtkIconFactory *gnubg_stock_factory = NULL;

 static void
-icon_set_from_inline(GtkIconSet * set,
-                     const guchar * inline_data, GtkIconSize size,
GtkTextDirection direction, gboolean fallback)
+icon_set_from_resource_path(GtkIconSet * set,
+                            const char * resource_path, GtkIconSize
size, GtkTextDirection direction, gboolean fallback)
 {
     GtkIconSource *source;
     GdkPixbuf *pixbuf;
@@ -45,7 +50,7 @@ icon_set_from_inline(GtkIconSet * set,
     gtk_icon_source_set_size(source, size);
     gtk_icon_source_set_size_wildcarded(source, FALSE);

-    pixbuf = gdk_pixbuf_new_from_inline(-1, inline_data, FALSE, NULL);
+    pixbuf = gdk_pixbuf_new_from_resource(resource_path, NULL);

     g_assert(pixbuf);

@@ -65,8 +70,8 @@ icon_set_from_inline(GtkIconSet * set,

 static void
 add_sized_with_same_fallback(GtkIconFactory * factory,
-                             const guchar * inline_data,
-                             const guchar * inline_data_rtl,
GtkIconSize size, const gchar * stock_id)
+                             const char * resource_path,
+                             const char * resource_path_rtl,
GtkIconSize size, const gchar * stock_id)
 {
     GtkIconSet *set;
     gboolean fallback = FALSE;
@@ -81,10 +86,10 @@ add_sized_with_same_fallback(GtkIconFactory * factory,
         fallback = TRUE;
     }

-    icon_set_from_inline(set, inline_data, size, GTK_TEXT_DIR_NONE, fallback);
+    icon_set_from_resource_path(set, resource_path, size,
GTK_TEXT_DIR_NONE, fallback);

-    if (inline_data_rtl)
-        icon_set_from_inline(set, inline_data_rtl, size,
GTK_TEXT_DIR_RTL, fallback);
+    if (resource_path_rtl)
+        icon_set_from_resource_path(set, resource_path_rtl, size,
GTK_TEXT_DIR_RTL, fallback);
 }

 static const GtkStockItem gnubg_stock_items[] = {
@@ -108,54 +113,54 @@ static const GtkStockItem gnubg_stock_items[] = {

 static const struct {
     const gchar *stock_id;
-    gconstpointer ltr;
-    gconstpointer rtl;
+    const char *ltr;
+    const char *rtl;
     GtkIconSize size;
 } gnubg_stock_pixbufs[] = {
     {
-    GNUBG_STOCK_ACCEPT, ok_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_ACCEPT, ok_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_ANTI_CLOCKWISE, anti_clockwise_24, NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_CLOCKWISE, clockwise_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_DOUBLE, double_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_DOUBLE, double_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_END_GAME, runit_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_END_GAME, runit_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_GO_NEXT_CMARKED, go_next_cmarked_16, NULL,
GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_GO_NEXT_CMARKED, go_next_cmarked_24, NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_GO_NEXT_GAME, go_next_game_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_GO_NEXT_GAME, go_next_game_24, NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_GO_NEXT, go_next_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_GO_NEXT, go_next_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_GO_NEXT_MARKED, go_next_marked_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_GO_NEXT_MARKED, go_next_marked_24, NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_GO_PREV_CMARKED, go_prev_cmarked_16, NULL,
GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_GO_PREV_CMARKED, go_prev_cmarked_24, NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_GO_PREV_GAME, go_prev_game_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_GO_PREV_GAME, go_prev_game_24, NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_GO_PREV, go_prev_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_GO_PREV, go_prev_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_GO_PREV_MARKED, go_prev_marked_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_GO_PREV_MARKED, go_prev_marked_24, NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_HINT, hint_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_HINT, hint_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW0, new0_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW11, new11_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW13, new13_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW15, new15_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW17, new17_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW1, new1_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW3, new3_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW5, new5_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW7, new7_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_NEW9, new9_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_REJECT, cancel_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_REJECT, cancel_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_RESIGN, resign_16, NULL, GTK_ICON_SIZE_MENU}, {
-    GNUBG_STOCK_RESIGN, resign_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_RESIGNSB, resignsb_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_RESIGNSG, resignsg_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
-    GNUBG_STOCK_RESIGNSN, resignsn_24, NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}
+    GNUBG_STOCK_ACCEPT, "/org/gnubg/16x16/actions/ok_16.png", NULL,
GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_ACCEPT, "/org/gnubg/24x24/actions/ok_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_ANTI_CLOCKWISE,
"/org/gnubg/24x24/actions/anti_clockwise_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_CLOCKWISE,
"/org/gnubg/24x24/actions/clockwise_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_DOUBLE, "/org/gnubg/16x16/actions/double_16.png",
NULL, GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_DOUBLE, "/org/gnubg/24x24/actions/double_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_END_GAME, "/org/gnubg/16x16/actions/runit_16.png",
NULL, GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_END_GAME, "/org/gnubg/24x24/actions/runit_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_GO_NEXT_CMARKED,
"/org/gnubg/16x16/actions/go_next_cmarked_16.png", NULL,
GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_GO_NEXT_CMARKED,
"/org/gnubg/24x24/actions/go_next_cmarked_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_GO_NEXT_GAME,
"/org/gnubg/16x16/actions/go_next_game_16.png", NULL,
GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_GO_NEXT_GAME,
"/org/gnubg/24x24/actions/go_next_game_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_GO_NEXT, "/org/gnubg/16x16/actions/go_next_16.png",
NULL, GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_GO_NEXT, "/org/gnubg/24x24/actions/go_next_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_GO_NEXT_MARKED,
"/org/gnubg/16x16/actions/go_next_marked_16.png", NULL,
GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_GO_NEXT_MARKED,
"/org/gnubg/24x24/actions/go_next_marked_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_GO_PREV_CMARKED,
"/org/gnubg/16x16/actions/go_prev_cmarked_16.png", NULL,
GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_GO_PREV_CMARKED,
"/org/gnubg/24x24/actions/go_prev_cmarked_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_GO_PREV_GAME,
"/org/gnubg/16x16/actions/go_prev_game_16.png", NULL,
GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_GO_PREV_GAME,
"/org/gnubg/24x24/actions/go_prev_game_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_GO_PREV, "/org/gnubg/16x16/actions/go_prev_16.png",
NULL, GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_GO_PREV, "/org/gnubg/24x24/actions/go_prev_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_GO_PREV_MARKED,
"/org/gnubg/16x16/actions/go_prev_marked_16.png", NULL,
GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_GO_PREV_MARKED,
"/org/gnubg/24x24/actions/go_prev_marked_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_HINT, "/org/gnubg/16x16/actions/hint_16.png", NULL,
GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_HINT, "/org/gnubg/24x24/actions/hint_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW0, "/org/gnubg/24x24/actions/new0_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW11, "/org/gnubg/24x24/actions/new11_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW13, "/org/gnubg/24x24/actions/new13_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW15, "/org/gnubg/24x24/actions/new15_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW17, "/org/gnubg/24x24/actions/new17_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW1, "/org/gnubg/24x24/actions/new1_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW3, "/org/gnubg/24x24/actions/new3_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW5, "/org/gnubg/24x24/actions/new5_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW7, "/org/gnubg/24x24/actions/new7_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_NEW9, "/org/gnubg/24x24/actions/new9_24.png", NULL,
GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_REJECT, "/org/gnubg/16x16/actions/cancel_16.png",
NULL, GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_REJECT, "/org/gnubg/24x24/actions/cancel_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_RESIGN, "/org/gnubg/16x16/actions/resign_16.png",
NULL, GTK_ICON_SIZE_MENU}, {
+    GNUBG_STOCK_RESIGN, "/org/gnubg/24x24/actions/resign_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_RESIGNSB, "/org/gnubg/24x24/actions/resignsb_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_RESIGNSG, "/org/gnubg/24x24/actions/resignsg_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}, {
+    GNUBG_STOCK_RESIGNSN, "/org/gnubg/24x24/actions/resignsn_24.png",
NULL, GTK_ICON_SIZE_LARGE_TOOLBAR}
 };

 /**
@@ -168,6 +173,7 @@ gnubg_stock_init(void)
 {
     guint i;
     gnubg_stock_factory = gtk_icon_factory_new();
+    gnubg_stock_register_resource();

     for (i = 0; i < G_N_ELEMENTS(gnubg_stock_pixbufs); i++) {
         add_sized_with_same_fallback(gnubg_stock_factory,
--- a/gtklocdefs.c
+++ b/gtklocdefs.c
@@ -130,4 +130,74 @@ toolbar_set_orientation(GtkToolbar * toolbar,
GtkOrientation orientation)
 #endif
 }

+#ifndef USE_GRESOURCE
+#include <string.h>
+#include "gnubg-stock-pixbufs.h"
+
+static const struct {
+    const char *resource_path;
+    gconstpointer inline_data;
+} resource_to_inline[] = {
+    {"/org/gnubg/16x16/actions/ok_16.png", ok_16},
+    {"/org/gnubg/24x24/actions/ok_24.png", ok_24},
+    {"/org/gnubg/24x24/actions/anti_clockwise_24.png", anti_clockwise_24},
+    {"/org/gnubg/24x24/actions/clockwise_24.png", clockwise_24},
+    {"/org/gnubg/16x16/actions/double_16.png", double_16},
+    {"/org/gnubg/24x24/actions/double_24.png", double_24},
+    {"/org/gnubg/16x16/actions/runit_16.png", runit_16},
+    {"/org/gnubg/24x24/actions/runit_24.png", runit_24},
+    {"/org/gnubg/16x16/actions/go_next_cmarked_16.png", go_next_cmarked_16},
+    {"/org/gnubg/24x24/actions/go_next_cmarked_24.png", go_next_cmarked_24},
+    {"/org/gnubg/16x16/actions/go_next_game_16.png", go_next_game_16},
+    {"/org/gnubg/24x24/actions/go_next_game_24.png", go_next_game_24},
+    {"/org/gnubg/16x16/actions/go_next_16.png", go_next_16},
+    {"/org/gnubg/24x24/actions/go_next_24.png", go_next_24},
+    {"/org/gnubg/16x16/actions/go_next_marked_16.png", go_next_marked_16},
+    {"/org/gnubg/24x24/actions/go_next_marked_24.png", go_next_marked_24},
+    {"/org/gnubg/16x16/actions/go_prev_cmarked_16.png", go_prev_cmarked_16},
+    {"/org/gnubg/24x24/actions/go_prev_cmarked_24.png", go_prev_cmarked_24},
+    {"/org/gnubg/16x16/actions/go_prev_game_16.png", go_prev_game_16},
+    {"/org/gnubg/24x24/actions/go_prev_game_24.png", go_prev_game_24},
+    {"/org/gnubg/16x16/actions/go_prev_16.png", go_prev_16},
+    {"/org/gnubg/24x24/actions/go_prev_24.png", go_prev_24},
+    {"/org/gnubg/16x16/actions/go_prev_marked_16.png", go_prev_marked_16},
+    {"/org/gnubg/24x24/actions/go_prev_marked_24.png", go_prev_marked_24},
+    {"/org/gnubg/16x16/actions/hint_16.png", hint_16},
+    {"/org/gnubg/24x24/actions/hint_24.png", hint_24},
+    {"/org/gnubg/24x24/actions/new0_24.png", new0_24},
+    {"/org/gnubg/24x24/actions/new11_24.png", new11_24},
+    {"/org/gnubg/24x24/actions/new13_24.png", new13_24},
+    {"/org/gnubg/24x24/actions/new15_24.png", new15_24},
+    {"/org/gnubg/24x24/actions/new17_24.png", new17_24},
+    {"/org/gnubg/24x24/actions/new1_24.png", new1_24},
+    {"/org/gnubg/24x24/actions/new3_24.png", new3_24},
+    {"/org/gnubg/24x24/actions/new5_24.png", new5_24},
+    {"/org/gnubg/24x24/actions/new7_24.png", new7_24},
+    {"/org/gnubg/24x24/actions/new9_24.png", new9_24},
+    {"/org/gnubg/16x16/actions/cancel_16.png", cancel_16},
+    {"/org/gnubg/24x24/actions/cancel_24.png", cancel_24},
+    {"/org/gnubg/16x16/actions/resign_16.png", resign_16},
+    {"/org/gnubg/24x24/actions/resign_24.png", resign_24},
+    {"/org/gnubg/24x24/actions/resignsb_24.png", resignsb_24},
+    {"/org/gnubg/24x24/actions/resignsg_24.png", resignsg_24},
+    {"/org/gnubg/24x24/actions/resignsn_24.png", resignsn_24}
+};
+
+GdkPixbuf *
+gdk_pixbuf_new_from_resource(const char *resource_path, GError **error)
+{
+    guint i;
+    GdkPixbuf *pixbuf = NULL;
+
+    for (i = 0; i < G_N_ELEMENTS(resource_to_inline) && !pixbuf; i++) {
+        if (strcmp(resource_path, resource_to_inline[i].resource_path) == 0) {
+            const guchar *inline_data = resource_to_inline[i].inline_data;
+            pixbuf = gdk_pixbuf_new_from_inline(-1, inline_data, FALSE, NULL);
+        }
+    }
+
+    return pixbuf;
+}
+#endif
+
 #endif
--- a/gtklocdefs.h
+++ b/gtklocdefs.h
@@ -106,6 +106,11 @@ extern GtkTooltips *ptt;
 extern GtkWidget *get_statusbar_label(GtkStatusbar * statusbar);
 extern void toolbar_set_orientation(GtkToolbar * toolbar,
GtkOrientation orientation);

+#ifndef USE_GRESOURCE
+#define gnubg_stock_register_resource()
+extern GdkPixbuf *gdk_pixbuf_new_from_resource(const char
*resource_path, GError **error);
+#endif
+
 #ifdef GTK_DISABLE_DEPRECATED
 #define USE_GTKUIMANAGER 1
 #endif



reply via email to

[Prev in Thread] Current Thread [Next in Thread]