summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-12-29 18:55:46 +0100
committerBram Moolenaar <Bram@vim.org>2015-12-29 18:55:46 +0100
commit36e294c00c784b9ddd05a4fdbea2e331ab2b1ca8 (patch)
tree77faf338e0f4e46d4d80c20781c6a08124b40ce7
parent4e5a31c8b3e259605f4d8543aaae68578cf9b0d7 (diff)
downloadvim-git-36e294c00c784b9ddd05a4fdbea2e331ab2b1ca8.tar.gz
patch 7.4.995v7.4.995
Problem: gdk_pixbuf_new_from_inline() is deprecated. Solution: Generate auto/gui_gtk_gresources.c. (Kazunobu Kazunobu, closes #507)
-rw-r--r--.gitignore2
-rw-r--r--pixmaps/stock_vim_build_tags.pngbin0 -> 439 bytes
-rw-r--r--pixmaps/stock_vim_find_help.pngbin0 -> 1717 bytes
-rw-r--r--pixmaps/stock_vim_save_all.pngbin0 -> 1021 bytes
-rw-r--r--pixmaps/stock_vim_session_load.pngbin0 -> 1301 bytes
-rw-r--r--pixmaps/stock_vim_session_new.pngbin0 -> 1034 bytes
-rw-r--r--pixmaps/stock_vim_session_save.pngbin0 -> 1280 bytes
-rw-r--r--pixmaps/stock_vim_shell.pngbin0 -> 2953 bytes
-rw-r--r--pixmaps/stock_vim_window_maximize.pngbin0 -> 540 bytes
-rw-r--r--pixmaps/stock_vim_window_maximize_width.pngbin0 -> 514 bytes
-rw-r--r--pixmaps/stock_vim_window_minimize.pngbin0 -> 352 bytes
-rw-r--r--pixmaps/stock_vim_window_minimize_width.pngbin0 -> 369 bytes
-rw-r--r--pixmaps/stock_vim_window_split.pngbin0 -> 246 bytes
-rw-r--r--pixmaps/stock_vim_window_split_vertical.pngbin0 -> 196 bytes
-rw-r--r--src/Makefile32
-rwxr-xr-xsrc/auto/configure84
-rw-r--r--src/config.h.in3
-rw-r--r--src/config.mk.in5
-rw-r--r--src/configure.in34
-rw-r--r--src/gui_gtk.c54
-rw-r--r--src/gui_gtk_gresources.xml18
-rw-r--r--src/gui_gtk_x11.c9
-rw-r--r--src/proto/gui_gtk_gresources.pro5
-rw-r--r--src/version.c2
24 files changed, 240 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore
index f0db64d17..cecb64dda 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,8 @@
src/vim
src/xxd/xxd
src/auto/if_perl.c
+src/auto/gui_gtk_gresources.c
+src/auto/gui_gtk_gresources.h
src/tags
# We do need src/auto/configure.
diff --git a/pixmaps/stock_vim_build_tags.png b/pixmaps/stock_vim_build_tags.png
new file mode 100644
index 000000000..3ed7085b2
--- /dev/null
+++ b/pixmaps/stock_vim_build_tags.png
Binary files differ
diff --git a/pixmaps/stock_vim_find_help.png b/pixmaps/stock_vim_find_help.png
new file mode 100644
index 000000000..9214945d8
--- /dev/null
+++ b/pixmaps/stock_vim_find_help.png
Binary files differ
diff --git a/pixmaps/stock_vim_save_all.png b/pixmaps/stock_vim_save_all.png
new file mode 100644
index 000000000..1f9e78137
--- /dev/null
+++ b/pixmaps/stock_vim_save_all.png
Binary files differ
diff --git a/pixmaps/stock_vim_session_load.png b/pixmaps/stock_vim_session_load.png
new file mode 100644
index 000000000..34251d1fe
--- /dev/null
+++ b/pixmaps/stock_vim_session_load.png
Binary files differ
diff --git a/pixmaps/stock_vim_session_new.png b/pixmaps/stock_vim_session_new.png
new file mode 100644
index 000000000..5fb0626b7
--- /dev/null
+++ b/pixmaps/stock_vim_session_new.png
Binary files differ
diff --git a/pixmaps/stock_vim_session_save.png b/pixmaps/stock_vim_session_save.png
new file mode 100644
index 000000000..6256c79de
--- /dev/null
+++ b/pixmaps/stock_vim_session_save.png
Binary files differ
diff --git a/pixmaps/stock_vim_shell.png b/pixmaps/stock_vim_shell.png
new file mode 100644
index 000000000..ca9b8037c
--- /dev/null
+++ b/pixmaps/stock_vim_shell.png
Binary files differ
diff --git a/pixmaps/stock_vim_window_maximize.png b/pixmaps/stock_vim_window_maximize.png
new file mode 100644
index 000000000..c3aea0fd2
--- /dev/null
+++ b/pixmaps/stock_vim_window_maximize.png
Binary files differ
diff --git a/pixmaps/stock_vim_window_maximize_width.png b/pixmaps/stock_vim_window_maximize_width.png
new file mode 100644
index 000000000..f4173213e
--- /dev/null
+++ b/pixmaps/stock_vim_window_maximize_width.png
Binary files differ
diff --git a/pixmaps/stock_vim_window_minimize.png b/pixmaps/stock_vim_window_minimize.png
new file mode 100644
index 000000000..4dd17afd7
--- /dev/null
+++ b/pixmaps/stock_vim_window_minimize.png
Binary files differ
diff --git a/pixmaps/stock_vim_window_minimize_width.png b/pixmaps/stock_vim_window_minimize_width.png
new file mode 100644
index 000000000..8aa4f67c0
--- /dev/null
+++ b/pixmaps/stock_vim_window_minimize_width.png
Binary files differ
diff --git a/pixmaps/stock_vim_window_split.png b/pixmaps/stock_vim_window_split.png
new file mode 100644
index 000000000..dcf5a3c7b
--- /dev/null
+++ b/pixmaps/stock_vim_window_split.png
Binary files differ
diff --git a/pixmaps/stock_vim_window_split_vertical.png b/pixmaps/stock_vim_window_split_vertical.png
new file mode 100644
index 000000000..7522d1f29
--- /dev/null
+++ b/pixmaps/stock_vim_window_split_vertical.png
Binary files differ
diff --git a/src/Makefile b/src/Makefile
index 231b0367d..2cbf6e4e5 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1199,10 +1199,10 @@ NONE_INSTALL = install_normal
### GTK GUI
GTK_SRC = gui.c gui_gtk.c gui_gtk_x11.c pty.c gui_gtk_f.c \
- gui_beval.c
+ gui_beval.c $(GRESOURCE_SRC)
GTK_OBJ = objects/gui.o objects/gui_gtk.o objects/gui_gtk_x11.o \
objects/pty.o objects/gui_gtk_f.o \
- objects/gui_beval.o
+ objects/gui_beval.o $(GRESOURCE_OBJ)
GTK_DEFS = -DFEAT_GUI_GTK $(NARROW_PROTO)
GTK_IPATH = $(GUI_INC_LOC)
GTK_LIBS_DIR = $(GUI_LIB_LOC)
@@ -1527,7 +1527,8 @@ TAGS_SRC = *.c *.cpp if_perl.xs
EXTRA_SRC = hangulin.c if_lua.c if_mzsch.c auto/if_perl.c if_perlsfio.c \
if_python.c if_python3.c if_tcl.c if_ruby.c if_sniff.c \
- gui_beval.c workshop.c wsdebug.c integration.c netbeans.c
+ gui_beval.c workshop.c wsdebug.c integration.c netbeans.c \
+ $(GRESOURCE_SRC)
# Unittest files
MEMFILE_TEST_SRC = memfile_test.c
@@ -1869,6 +1870,9 @@ os_vms.pro: os_vms.c
if_perl.pro: auto/if_perl.c
$(CPROTO) -DFEAT_GUI auto/if_perl.c | sed "/_VI/d" > proto/$@
+gui_gtk_gresources.pro: auto/gui_gtk_gresources.c
+ $(CPROTO) -DFEAT_GUI $< > proto/$@
+ echo "/* vim: set ft=c : */" >> proto/$@
notags:
-rm -f tags
@@ -2441,7 +2445,7 @@ uninstall_runtime:
# We support common typing mistakes for Juergen! :-)
clean celan: testclean
-rm -f *.o objects/* core $(VIMTARGET).core $(VIMTARGET) vim xxd/*.o
- -rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c
+ -rm -f $(TOOLS) auto/osdef.h auto/pathdef.c auto/if_perl.c auto/gui_gtk_gresources.c auto/gui_gtk_gresources.h
-rm -f conftest* *~ auto/link.sed
-rm -f $(UNITTEST_TARGETS)
-rm -f runtime pixmaps
@@ -2578,6 +2582,11 @@ auto/pathdef.c: Makefile auto/config.mk
-@echo '";' >> $@
-@sh $(srcdir)/pathdef.sh
+auto/gui_gtk_gresources.c: gui_gtk_gresources.xml
+ $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=../pixmaps --generate --c-name=gui_gtk --manual-register $<
+auto/gui_gtk_gresources.h: gui_gtk_gresources.xml
+ $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=../pixmaps --generate --c-name=gui_gtk --manual-register $<
+
# All the object files are put in the "objects" directory. Since not all make
# commands understand putting object files in another directory, it must be
# specified for each file separately.
@@ -2663,6 +2672,9 @@ objects/gui_gtk.o: gui_gtk.c
objects/gui_gtk_f.o: gui_gtk_f.c
$(CCC) -o $@ gui_gtk_f.c
+objects/gui_gtk_gresources.o: auto/gui_gtk_gresources.c
+ $(CCC) $(PERL_CFLAGS) -o $@ auto/gui_gtk_gresources.c
+
objects/gui_gtk_x11.o: gui_gtk_x11.c
$(CCC) -o $@ gui_gtk_x11.c
@@ -3145,6 +3157,16 @@ objects/gui_gtk_f.o: gui_gtk_f.c vim.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \
globals.h farsi.h arabic.h gui_gtk_f.h
+objects/gui_gtk_gresources.o: auto/gui_gtk_gresources.c gui_gtk_gresources.xml \
+ ../pixmaps/stock_vim_build_tags.png ../pixmaps/stock_vim_find_help.png \
+ ../pixmaps/stock_vim_save_all.png ../pixmaps/stock_vim_session_load.png \
+ ../pixmaps/stock_vim_session_new.png ../pixmaps/stock_vim_session_save.png \
+ ../pixmaps/stock_vim_shell.png ../pixmaps/stock_vim_window_maximize.png \
+ ../pixmaps/stock_vim_window_maximize_width.png \
+ ../pixmaps/stock_vim_window_minimize.png \
+ ../pixmaps/stock_vim_window_minimize_width.png \
+ ../pixmaps/stock_vim_window_split.png \
+ ../pixmaps/stock_vim_window_split_vertical.png
objects/gui_motif.o: gui_motif.c vim.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \
@@ -3197,7 +3219,7 @@ objects/gui_gtk_x11.o: gui_gtk_x11.c vim.h auto/config.h feature.h os_unix.h \
auto/osdef.h ascii.h keymap.h term.h macros.h option.h structs.h \
regexp.h gui.h gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h \
globals.h farsi.h arabic.h gui_gtk_f.h ../runtime/vim32x32.xpm \
- ../runtime/vim16x16.xpm ../runtime/vim48x48.xpm
+ ../runtime/vim16x16.xpm ../runtime/vim48x48.xpm $(GRESOURCE_HDR)
objects/gui_x11.o: gui_x11.c vim.h auto/config.h feature.h os_unix.h auto/osdef.h \
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
gui_beval.h proto/gui_beval.pro ex_cmds.h proto.h globals.h farsi.h \
diff --git a/src/auto/configure b/src/auto/configure
index 7e1d76dcf..38e1cb992 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -636,6 +636,10 @@ GUI_LIB_LOC
GUI_INC_LOC
NARROW_PROTO
MOTIF_LIBNAME
+GRESOURCE_OBJ
+GRESOURCE_SRC
+GRESOURCE_HDR
+GLIB_COMPILE_RESOURCES
GNOME_INCLUDEDIR
GNOME_LIBDIR
GNOME_LIBS
@@ -8907,6 +8911,86 @@ $as_echo "not found" >&6; }
fi
fi
+if test "x$GUITYPE" = "xGTK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of Gdk-Pixbuf" >&5
+$as_echo_n "checking version of Gdk-Pixbuf... " >&6; }
+ gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0`
+ if test "x$gdk_pixbuf_version" != x ; then
+ gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \
+ sed -e 's/[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*/\1/'`
+ if test "x$gdk_pixbuf_version_minor" != x -a \
+ $gdk_pixbuf_version_minor -ge 32 ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: OK." >&5
+$as_echo "OK." >&6; }
+ # Extract the first word of "glib-compile-resources", so it can be a program name with args.
+set dummy glib-compile-resources; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GLIB_COMPILE_RESOURCES+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case $GLIB_COMPILE_RESOURCES in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_GLIB_COMPILE_RESOURCES="$GLIB_COMPILE_RESOURCES" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_GLIB_COMPILE_RESOURCES="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+ test -z "$ac_cv_path_GLIB_COMPILE_RESOURCES" && ac_cv_path_GLIB_COMPILE_RESOURCES="no"
+ ;;
+esac
+fi
+GLIB_COMPILE_RESOURCES=$ac_cv_path_GLIB_COMPILE_RESOURCES
+if test -n "$GLIB_COMPILE_RESOURCES"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GLIB_COMPILE_RESOURCES" >&5
+$as_echo "$GLIB_COMPILE_RESOURCES" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking glib-compile-resources" >&5
+$as_echo_n "checking glib-compile-resources... " >&6; }
+ if test "x$GLIB_COMPILE_RESOURCES" = xno ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot be found in PATH." >&5
+$as_echo "cannot be found in PATH." >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: usable." >&5
+$as_echo "usable." >&6; }
+ $as_echo "#define USE_GRESOURCE 1" >>confdefs.h
+
+ GRESOURCE_HDR="auto/gui_gtk_gresources.h"
+ GRESOURCE_SRC="auto/gui_gtk_gresources.c"
+ GRESOURCE_OBJ="objects/gui_gtk_gresources.o"
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not usable." >&5
+$as_echo "not usable." >&6; }
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot obtain from pkg_config." >&5
+$as_echo "cannot obtain from pkg_config." >&6; }
+ fi
+fi
+
+
+
+
+
if test -z "$SKIP_MOTIF"; then
gui_XXX="/usr/XXX/Motif* /usr/Motif*/XXX /usr/XXX /usr/shlib /usr/X11*/XXX /usr/XXX/X11* /usr/dt/XXX /local/Motif*/XXX /local/XXX/Motif* /usr/local/Motif*/XXX /usr/local/XXX/Motif* /usr/local/XXX /usr/local/X11*/XXX /usr/local/LessTif/Motif*/XXX $MOTIFHOME/XXX"
diff --git a/src/config.h.in b/src/config.h.in
index e8d61831a..e92cc5e9f 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -452,3 +452,6 @@
/* Define if Xutf8SetWMProperties() is in an X library. */
#undef HAVE_XUTF8SETWMPROPERTIES
+
+/* Define if GResource is used to load icons */
+#undef USE_GRESOURCE
diff --git a/src/config.mk.in b/src/config.mk.in
index 15b5a6239..9e16d1325 100644
--- a/src/config.mk.in
+++ b/src/config.mk.in
@@ -158,6 +158,11 @@ GUI_X_LIBS = @GUI_X_LIBS@
MOTIF_LIBNAME = @MOTIF_LIBNAME@
GTK_LIBNAME = @GTK_LIBNAME@
+GLIB_COMPILE_RESOURCES = @GLIB_COMPILE_RESOURCES@
+GRESOURCE_HDR = @GRESOURCE_HDR@
+GRESOURCE_SRC = @GRESOURCE_SRC@
+GRESOURCE_OBJ = @GRESOURCE_OBJ@
+
### Any OS dependent extra source and object file
OS_EXTRA_SRC = @OS_EXTRA_SRC@
OS_EXTRA_OBJ = @OS_EXTRA_OBJ@
diff --git a/src/configure.in b/src/configure.in
index 7b901d828..91c055574 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -2500,6 +2500,40 @@ if test -z "$SKIP_GTK2"; then
fi
fi
+dnl Check the version of Gdk-Pixbuf. If the version is 2.32 or later and
+dnl glib-compile-resources is found in PATH, use GResource.
+if test "x$GUITYPE" = "xGTK"; then
+ AC_MSG_CHECKING([version of Gdk-Pixbuf])
+ gdk_pixbuf_version=`$PKG_CONFIG --modversion gdk-pixbuf-2.0`
+ if test "x$gdk_pixbuf_version" != x ; then
+ gdk_pixbuf_version_minor=`echo $gdk_pixbuf_version | \
+ sed -e 's/[[0-9]][[0-9]]*\.\([[0-9]][[0-9]]*\)\.[[0-9]][[0-9]]*/\1/'`
+ if test "x$gdk_pixbuf_version_minor" != x -a \
+ $gdk_pixbuf_version_minor -ge 32 ; then
+ AC_MSG_RESULT([OK.])
+ AC_PATH_PROG(GLIB_COMPILE_RESOURCES,[glib-compile-resources],no)
+ AC_MSG_CHECKING([glib-compile-resources])
+ if test "x$GLIB_COMPILE_RESOURCES" = xno ; then
+ AC_MSG_RESULT([cannot be found in PATH.])
+ else
+ AC_MSG_RESULT([usable.])
+ AC_DEFINE(USE_GRESOURCE)
+ GRESOURCE_HDR="auto/gui_gtk_gresources.h"
+ GRESOURCE_SRC="auto/gui_gtk_gresources.c"
+ GRESOURCE_OBJ="objects/gui_gtk_gresources.o"
+ fi
+ else
+ AC_MSG_RESULT([not usable.])
+ fi
+ else
+ AC_MSG_RESULT([cannot obtain from pkg_config.])
+ fi
+fi
+AC_SUBST(GLIB_COMPILE_RESOURCES)
+AC_SUBST(GRESOURCE_HDR)
+AC_SUBST(GRESOURCE_SRC)
+AC_SUBST(GRESOURCE_OBJ)
+
dnl Check for Motif include files location.
dnl The LAST one found is used, this makes the highest version to be used,
dnl e.g. when Motif1.2 and Motif2.0 are both present.
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index 48537f449..b5da5c35f 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -140,6 +140,31 @@ static const char * const menu_stock_ids[] =
/* 31 */ GTK_STOCK_QUIT
};
+#ifdef USE_GRESOURCE
+typedef struct IconNames {
+ const char *icon_name;
+ const char *file_name;
+} IconNames;
+
+static IconNames stock_vim_icons[] = {
+ { "vim-build-tags", "stock_vim_build_tags.png" },
+ { "vim-find-help", "stock_vim_find_help.png" },
+ { "vim-save-all", "stock_vim_save_all.png" },
+ { "vim-session-load", "stock_vim_session_load.png" },
+ { "vim-session-new", "stock_vim_session_new.png" },
+ { "vim-session-save", "stock_vim_session_save.png" },
+ { "vim-shell", "stock_vim_shell.png" },
+ { "vim-window-maximize", "stock_vim_window_maximize.png" },
+ { "vim-window-maximize-width", "stock_vim_window_maximize_width.png" },
+ { "vim-window-minimize", "stock_vim_window_minimize.png" },
+ { "vim-window-minimize-width", "stock_vim_window_minimize_width.png" },
+ { "vim-window-split", "stock_vim_window_split.png" },
+ { "vim-window-split-vertical", "stock_vim_window_split_vertical.png" },
+ { NULL, NULL }
+};
+#endif
+
+#ifndef USE_GRESOURCE
static void
add_stock_icon(GtkIconFactory *factory,
const char *stock_id,
@@ -157,6 +182,7 @@ add_stock_icon(GtkIconFactory *factory,
gtk_icon_set_unref(icon_set);
g_object_unref(pixbuf);
}
+#endif
static int
lookup_menu_iconfile(char_u *iconfile, char_u *dest)
@@ -262,11 +288,12 @@ toolbar_button_focus_in_event(GtkWidget *widget UNUSED,
void
gui_gtk_register_stock_icons(void)
{
-# include "../pixmaps/stock_icons.h"
+#ifndef USE_GRESOURCE
+# include "../pixmaps/stock_icons.h"
GtkIconFactory *factory;
factory = gtk_icon_factory_new();
-# define ADD_ICON(Name, Data) add_stock_icon(factory, Name, Data, (int)sizeof(Data))
+# define ADD_ICON(Name, Data) add_stock_icon(factory, Name, Data, (int)sizeof(Data))
ADD_ICON("vim-build-tags", stock_vim_build_tags);
ADD_ICON("vim-find-help", stock_vim_find_help);
@@ -282,7 +309,28 @@ gui_gtk_register_stock_icons(void)
ADD_ICON("vim-window-split", stock_vim_window_split);
ADD_ICON("vim-window-split-vertical", stock_vim_window_split_vertical);
-# undef ADD_ICON
+# undef ADD_ICON
+#else
+ GtkIconFactory * const factory = gtk_icon_factory_new();
+ const char * const path_prefix = "/org/vim/gui/icon";
+ IconNames *names;
+
+ for (names = stock_vim_icons; names->icon_name != NULL; names++)
+ {
+ char path[MAXPATHL];
+ GdkPixbuf *pixbuf;
+
+ vim_snprintf(path, MAXPATHL, "%s/%s", path_prefix, names->file_name);
+ pixbuf = gdk_pixbuf_new_from_resource(path, NULL);
+ if (pixbuf != NULL)
+ {
+ GtkIconSet *icon_set = gtk_icon_set_new_from_pixbuf(pixbuf);
+ gtk_icon_factory_add(factory, names->icon_name, icon_set);
+ gtk_icon_set_unref(icon_set);
+ g_object_unref(pixbuf);
+ }
+ }
+#endif
gtk_icon_factory_add_default(factory);
g_object_unref(factory);
}
diff --git a/src/gui_gtk_gresources.xml b/src/gui_gtk_gresources.xml
new file mode 100644
index 000000000..d6c7a592b
--- /dev/null
+++ b/src/gui_gtk_gresources.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/vim/gui/icon">
+ <file>stock_vim_build_tags.png</file>
+ <file>stock_vim_find_help.png</file>
+ <file>stock_vim_save_all.png</file>
+ <file>stock_vim_session_load.png</file>
+ <file>stock_vim_session_new.png</file>
+ <file>stock_vim_session_save.png</file>
+ <file>stock_vim_shell.png</file>
+ <file>stock_vim_window_maximize.png</file>
+ <file>stock_vim_window_maximize_width.png</file>
+ <file>stock_vim_window_minimize.png</file>
+ <file>stock_vim_window_minimize_width.png</file>
+ <file>stock_vim_window_split.png</file>
+ <file>stock_vim_window_split_vertical.png</file>
+ </gresource>
+</gresources>
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 9b3bf61c7..e543b0a37 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -22,6 +22,9 @@
*/
#include "vim.h"
+#ifdef USE_GRESOURCE
+#include "auto/gui_gtk_gresources.h"
+#endif
#ifdef FEAT_GUI_GNOME
/* Gnome redefines _() and N_(). Grrr... */
@@ -1434,6 +1437,9 @@ gui_mch_early_init_check(void)
EMSG(_((char *)e_opendisp));
return FAIL;
}
+#ifdef USE_GRESOURCE
+ gui_gtk_register_resource();
+#endif
return OK;
}
@@ -3620,6 +3626,9 @@ mainwin_destroy_cb(GtkObject *object UNUSED, gpointer data UNUSED)
IOSIZE - 1);
preserve_exit();
}
+#ifdef USE_GRESOURCE
+ gui_gtk_unregister_resource();
+#endif
}
diff --git a/src/proto/gui_gtk_gresources.pro b/src/proto/gui_gtk_gresources.pro
new file mode 100644
index 000000000..6758047c4
--- /dev/null
+++ b/src/proto/gui_gtk_gresources.pro
@@ -0,0 +1,5 @@
+/* auto/gui_gtk_gresources.c */
+GResource *gui_gtk_get_resource __ARGS((void));
+void gui_gtk_register_resource __ARGS((void));
+void gui_gtk_unregister_resource __ARGS((void));
+/* vim: set ft=c : */
diff --git a/src/version.c b/src/version.c
index 6ec3c6dd7..b438afa29 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 995,
+/**/
994,
/**/
993,