aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetar Petrov <ppetrov@paju.oulu.fi>2013-06-03 16:27:37 -0500
committerRobby Workman <rworkman@slackbuilds.org>2013-06-04 00:11:33 -0500
commit9a1f447dfc912da1dbb9c656ee1ab54cbb8af686 (patch)
treebc879b2ab623028224152b9220dc3958633e8a8f
parentbf4ab6962d0aa471d1906c66041b0f45f8e0391f (diff)
graphics/gpaint: Added (GNU Paint: a small-scale GTK2 painting program)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
-rw-r--r--graphics/gpaint/README11
-rw-r--r--graphics/gpaint/doinst.sh3
-rw-r--r--graphics/gpaint/gpaint.153
-rw-r--r--graphics/gpaint/gpaint.SlackBuild124
-rw-r--r--graphics/gpaint/gpaint.desktop7
-rw-r--r--graphics/gpaint/gpaint.info10
-rw-r--r--graphics/gpaint/gpaint.pngbin0 -> 3379 bytes
-rw-r--r--graphics/gpaint/patches/01_drawing.patch21
-rw-r--r--graphics/gpaint/patches/02_remove_menu_h_reference.patch16
-rw-r--r--graphics/gpaint/patches/09_fix_menu_entry.patch25
-rw-r--r--graphics/gpaint/patches/10_fix_crash_on_font_select.patch97
-rw-r--r--graphics/gpaint/patches/11_fix_image_rotation.patch110
-rw-r--r--graphics/gpaint/patches/20_fix_line_width_combo.patch352
-rw-r--r--graphics/gpaint/patches/21_fix_crash_on_fill_button_click.patch25
-rw-r--r--graphics/gpaint/patches/22_fix_not_printable_string.patch21
-rw-r--r--graphics/gpaint/patches/23_add_accelerator_keys.patch92
-rw-r--r--graphics/gpaint/patches/24_fix_crash_on_failed_write.patch105
-rw-r--r--graphics/gpaint/patches/25_fix_color_selection.patch79
-rw-r--r--graphics/gpaint/patches/26_fix_toolbar.patch21
-rw-r--r--graphics/gpaint/slack-desc19
20 files changed, 1191 insertions, 0 deletions
diff --git a/graphics/gpaint/README b/graphics/gpaint/README
new file mode 100644
index 0000000000000..cf767f945d01c
--- /dev/null
+++ b/graphics/gpaint/README
@@ -0,0 +1,11 @@
+This is gpaint (GNU Paint), a small-scale GTK2 painting program, based
+on xpaint, along the lines of "Paintbrush".
+
+Currently gpaint has the following features:
+- Drawing tools such as ovals, freehand, polygon and text, with fill
+ or shadow for polygons and closed freehand shapes.
+- Cut and paste by selecting irregular regions or polygons.
+- Preliminary print support using gnome-print.
+- Modern, ease-to-use user interface with tool and color palettes.
+- Multiple-image editing in a single instance of the program.
+- All the image processing features present in xpaint.
diff --git a/graphics/gpaint/doinst.sh b/graphics/gpaint/doinst.sh
new file mode 100644
index 0000000000000..5fb28930db0b9
--- /dev/null
+++ b/graphics/gpaint/doinst.sh
@@ -0,0 +1,3 @@
+if [ -x /usr/bin/update-desktop-database ]; then
+ /usr/bin/update-desktop-database -q usr/share/applications >/dev/null 2>&1
+fi
diff --git a/graphics/gpaint/gpaint.1 b/graphics/gpaint/gpaint.1
new file mode 100644
index 0000000000000..d49bc9723bc4e
--- /dev/null
+++ b/graphics/gpaint/gpaint.1
@@ -0,0 +1,53 @@
+.TH GPAINT 1 "June 7, 2001"
+
+.SH NAME
+gpaint \- a small easy to use paint program for GNOME
+
+.SH SYNOPSIS
+gpaint [filename]...
+
+.SH DESCRIPTION
+This manual page briefly documents gpaint (GNU Paint), a small-scale
+painting program for GNOME, the GNU Desktop Environment. gpaint does
+not attempt to compete with GIMP, it is just a simple drawing package
+based on xpaint, along the lines of 'Paintbrush' from a popular
+non-free operating system.
+
+gpaint is still work in progress and many features are still being
+developed. However, gpaint is usable and useful for simple image
+editing tasks.
+
+.SH FEATURES
+Currently gpaint has the following features:
+.TP
+* Drawing tools such as ovals, freehand, polygon and text, with fill or shadow for polygons and closed freehand shapes.
+.TP
+* Cut and paste by selecting irregular regions or polygons.
+.TP
+* Preliminary print support using gnome-print.
+.TP
+* Modern, easy to use user interface with tool and color palettes.
+.TP
+* Multiple-image editing in a single instance of the program.
+.TP
+* All the image processing features present in xpaint.
+
+.SH TODO
+Future plans include the implementation of zooming in/out, image
+scaling/rotation, and turning gpaint into a Bonobo component for
+simple image editing tasks inside other programs.
+
+.SH BUGS
+For bugs or general comments you can send mail to the developers list <gpaint-develop@gnu.org>, or you can enter a bug into the Debian Bug Tracking
+system. Details of how to use this system can be found on
+http://bugs.debian.org/.
+
+.SH SEE-ALSO
+\fB X (1), gnome (1)\fP
+
+.SH AUTHOR
+This manual page was written by Stephen Stafford
+<stephen@clothcat.demon.co.uk>, for the Debian GNU/Linux system, but
+may be used by others. It is based on the README file included in
+the source distribution of gpaint which was written by Andy Tai
+<atai@atai.org>.
diff --git a/graphics/gpaint/gpaint.SlackBuild b/graphics/gpaint/gpaint.SlackBuild
new file mode 100644
index 0000000000000..76c486b6c27e6
--- /dev/null
+++ b/graphics/gpaint/gpaint.SlackBuild
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+# Slackware build script for gpaint
+
+# Copyright 2013 Petar Petrov, ppetrov@paju.oulu.fi
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=gpaint
+VERSION=${VERSION:-0.3.3}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-2-$VERSION
+tar xvf $CWD/${PRGNAM}_${VERSION}.orig.tar.gz
+cd $PRGNAM-2-$VERSION
+chown -R root:root .
+find . \
+ \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+# Thanks to Debian for the patches! And the man page and icon! And the
+# whole source tarball, actually...
+patch -p1 -i $CWD/patches/01_drawing.patch
+patch -p1 -i $CWD/patches/02_remove_menu_h_reference.patch
+patch -p1 -i $CWD/patches/09_fix_menu_entry.patch
+patch -p1 -i $CWD/patches/10_fix_crash_on_font_select.patch
+patch -p1 -i $CWD/patches/11_fix_image_rotation.patch
+patch -p1 -i $CWD/patches/20_fix_line_width_combo.patch
+patch -p1 -i $CWD/patches/21_fix_crash_on_fill_button_click.patch
+patch -p1 -i $CWD/patches/22_fix_not_printable_string.patch
+patch -p1 -i $CWD/patches/23_add_accelerator_keys.patch
+patch -p1 -i $CWD/patches/24_fix_crash_on_failed_write.patch
+patch -p1 -i $CWD/patches/25_fix_color_selection.patch
+patch -p1 -i $CWD/patches/26_fix_toolbar.patch
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+
+install -D -m644 $CWD/$PRGNAM.1 $PKG/usr/man/man1/$PRGNAM.1
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ AUTHORS ChangeLog COPYING INSTALL NEWS README THANKS TODO \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+# Menu item and icon
+mkdir -p $PKG/usr/share/{applications,pixmaps}
+cp $CWD/$PRGNAM.desktop $PKG/usr/share/applications
+cp $CWD/$PRGNAM.png $PKG/usr/share/pixmaps
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/graphics/gpaint/gpaint.desktop b/graphics/gpaint/gpaint.desktop
new file mode 100644
index 0000000000000..81e89d9e82205
--- /dev/null
+++ b/graphics/gpaint/gpaint.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Categories=Graphics;
+Exec=gpaint-2
+Icon=gpaint.png
+Name=gPaint
+StartupNotify=false
+Type=Application
diff --git a/graphics/gpaint/gpaint.info b/graphics/gpaint/gpaint.info
new file mode 100644
index 0000000000000..836fabda7ac14
--- /dev/null
+++ b/graphics/gpaint/gpaint.info
@@ -0,0 +1,10 @@
+PRGNAM="gpaint"
+VERSION="0.3.3"
+HOMEPAGE="http://www.gnu.org/software/gpaint/"
+DOWNLOAD="http://ftp.de.debian.org/debian/pool/main/g/gpaint/gpaint_0.3.3.orig.tar.gz"
+MD5SUM="037cc283d2cdd806dbdc462839bb3b72"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Petar Petrov"
+EMAIL="ppetrov@paju.oulu.fi"
diff --git a/graphics/gpaint/gpaint.png b/graphics/gpaint/gpaint.png
new file mode 100644
index 0000000000000..43751d4f20242
--- /dev/null
+++ b/graphics/gpaint/gpaint.png
Binary files differ
diff --git a/graphics/gpaint/patches/01_drawing.patch b/graphics/gpaint/patches/01_drawing.patch
new file mode 100644
index 0000000000000..9b587f9f926cf
--- /dev/null
+++ b/graphics/gpaint/patches/01_drawing.patch
@@ -0,0 +1,21 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Fixes compiling with recent versions of libgtk
+ Newer versions of Gtk+ don't define the GTK_RESPONSE_DISCARD symbol, so we
+ replace its ocurrence by GTK_RESPONSE_NO to make gpaint build without
+ errors.
+Bug: https://savannah.gnu.org/bugs/index.php?21703
+Forwarded: https://savannah.gnu.org/patch/?7047
+
+Index: b/src/drawing.c
+===================================================================
+--- a/src/drawing.c 2009-12-19 17:11:48.000000000 -0200
++++ b/src/drawing.c 2009-12-19 17:12:10.000000000 -0200
+@@ -427,7 +427,7 @@
+ _("Do you want to save the changes you made to \"%s\"?\nYour changes will be lost if you don't save them."),
+ drawing->filename->str);
+ #ifdef GTK_STOCK_DISCARD
+- gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_DISCARD,GTK_RESPONSE_DISCARD);
++ gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_DISCARD,GTK_RESPONSE_NO);
+ #else
+ gtk_dialog_add_button(GTK_DIALOG(dialog), _("Close _without Saving"), GTK_RESPONSE_NO);
+ #endif /* !GTK_STOCK_DISCARD */
diff --git a/graphics/gpaint/patches/02_remove_menu_h_reference.patch b/graphics/gpaint/patches/02_remove_menu_h_reference.patch
new file mode 100644
index 0000000000000..192a457bcc225
--- /dev/null
+++ b/graphics/gpaint/patches/02_remove_menu_h_reference.patch
@@ -0,0 +1,16 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Removes reference to non-existent menu.h file
+Forwarded: https://savannah.gnu.org/patch/?7050
+
+Index: b/src/menu.c
+===================================================================
+--- a/src/menu.c 2009-12-19 17:11:48.000000000 -0200
++++ b/src/menu.c 2009-12-19 17:12:10.000000000 -0200
+@@ -34,7 +34,6 @@
+ #include "image.h"
+ #include "image_processing.h"
+ #include "tool_palette.h"
+-#include "menu.h"
+ #include "print.h"
+ #include "file.h"
+ #include "text.h"
diff --git a/graphics/gpaint/patches/09_fix_menu_entry.patch b/graphics/gpaint/patches/09_fix_menu_entry.patch
new file mode 100644
index 0000000000000..309a548a66f84
--- /dev/null
+++ b/graphics/gpaint/patches/09_fix_menu_entry.patch
@@ -0,0 +1,25 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Fixes the gpaint.desktop file
+ Change executable and icon filenames according to changes applied in the
+ Debian packaging.
+
+Index: b/gpaint.desktop
+===================================================================
+--- a/gpaint.desktop 2009-12-19 17:11:48.000000000 -0200
++++ b/gpaint.desktop 2009-12-19 17:12:10.000000000 -0200
+@@ -3,11 +3,9 @@
+ Comment=A small-scale painting program for GNOME, the GNU Desktop
+ Comment[fr]=Un petit outil de dessin pour GNOME, le desktop GNU
+ Comment[pt_BR]=Um pequeno programa de desenho para o GNOME, o Desktop GNU
+-TryExec=gpaint-2
+-Exec=gpaint-2
+-Icon=gnome-logo-icon-transparent.png
++TryExec=gpaint
++Exec=gpaint
++Icon=gpaint.svg
+ Terminal=0
+ Type=Application
+-
+-
+-
++Categories=Graphics;2DGraphics;RasterGraphics;
diff --git a/graphics/gpaint/patches/10_fix_crash_on_font_select.patch b/graphics/gpaint/patches/10_fix_crash_on_font_select.patch
new file mode 100644
index 0000000000000..868c05a569692
--- /dev/null
+++ b/graphics/gpaint/patches/10_fix_crash_on_font_select.patch
@@ -0,0 +1,97 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Avoids crash on font selection
+ Makes the font selection button active only when the text tool is selected,
+ avoiding a crash that would occur if it is clicked without selectiong the
+ text tool.
+Bug-Debian: http://bugs.debian.org/497201
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gpaint/+bug/262889
+Forwarded: https://savannah.gnu.org/patch/?6645
+
+Index: b/gpaint.glade
+===================================================================
+--- a/gpaint.glade 2009-12-19 17:11:48.000000000 -0200
++++ b/gpaint.glade 2009-12-19 17:12:10.000000000 -0200
+@@ -1137,6 +1137,7 @@
+ <child>
+ <widget class="GtkFontButton" id="fontpicker">
+ <property name="visible">True</property>
++ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="show_style">True</property>
+ <property name="show_size">True</property>
+Index: b/src/main.c
+===================================================================
+--- a/src/main.c 2009-12-19 17:11:48.000000000 -0200
++++ b/src/main.c 2009-12-19 17:12:10.000000000 -0200
+@@ -73,6 +73,10 @@
+ tool_palette_set_active_button(main_window, "pen_button");
+ /* make the pen tool the default initial tool so the user can draw right away */
+
++ gpaint_tool *text_tool = tool_palette_get_tool(main_window, "text");
++ widget = lookup_widget(main_window, "fontpicker");
++ text_set_fontpicker(text_tool, widget);
++
+ #if (!defined(HAVE_GTK_PRINT) && !defined(HAVE_GNOME_PRINT))
+ /* disable print menus and buttons if no print support available*/
+ widget = lookup_widget(main_window, "print_button");
+Index: b/src/text.c
+===================================================================
+--- a/src/text.c 2009-12-19 17:11:48.000000000 -0200
++++ b/src/text.c 2009-12-19 17:12:10.000000000 -0200
+@@ -54,6 +54,7 @@
+ GString *textbuf;
+ int max_width;
+ int max_height;
++ GtkFontButton *fontpicker;
+ } gpaint_text;
+
+
+@@ -94,6 +95,7 @@
+ GPAINT_TOOL(text)->commit_change = text_commit_change;
+
+ text->textbuf = g_string_new(0);
++ text->fontpicker = NULL;
+ return GPAINT_TOOL(text);
+ }
+
+@@ -118,6 +120,7 @@
+ g_string_printf(text->textbuf, "");
+ text->timer = g_timeout_add(TEXT_CURSOR_BLINK_RATE,
+ (GtkFunction)(text_handle_timeout), text);
++ gtk_widget_set_sensitive(GTK_WIDGET(text->fontpicker), TRUE);
+ }
+
+ static void
+@@ -145,7 +148,7 @@
+ text_draw_string(text);
+ }
+ text_clear(text);
+-
++ gtk_widget_set_sensitive(GTK_WIDGET(text->fontpicker), FALSE);
+ }
+
+ static gboolean
+@@ -474,6 +477,8 @@
+
+ }
+
+-
+-
+-
++void text_set_fontpicker(gpaint_tool *tool, GtkFontButton *fontpicker)
++{
++ gpaint_text *text = GPAINT_TEXT(tool);
++ text->fontpicker = fontpicker;
++}
+Index: b/src/text.h
+===================================================================
+--- a/src/text.h 2009-12-19 17:11:48.000000000 -0200
++++ b/src/text.h 2009-12-19 17:12:10.000000000 -0200
+@@ -30,6 +30,6 @@
+
+
+ gpaint_tool* text_create(const char *name);
+-
++void text_set_fontpicker(gpaint_tool *tool, GtkFontButton *fontpicker);
+
+ #endif
diff --git a/graphics/gpaint/patches/11_fix_image_rotation.patch b/graphics/gpaint/patches/11_fix_image_rotation.patch
new file mode 100644
index 0000000000000..4990b52c28619
--- /dev/null
+++ b/graphics/gpaint/patches/11_fix_image_rotation.patch
@@ -0,0 +1,110 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Fixes rotation operations
+ Implement the rotation in multiples of 90 degrees using the
+ gdk_pixbuf_rotate_simple function instead of the custom (and broken)
+ rotation algorithm
+Bug-Debian: http://bugs.debian.org/497487
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/262942
+Forwarded: https://savannah.gnu.org/patch/?6643
+
+Index: b/src/drawing.c
+===================================================================
+--- a/src/drawing.c 2009-12-19 17:12:10.000000000 -0200
++++ b/src/drawing.c 2009-12-19 17:12:11.000000000 -0200
+@@ -462,12 +462,23 @@
+ }
+
+ void
+-drawing_rotate(gpaint_drawing *drawing, double degrees)
++drawing_rotate(gpaint_drawing *drawing, int degrees)
+ {
+ gpaint_image *image = drawing_create_image(drawing);
+ if (image)
+ {
+- image_rotate(image, degrees);
++ switch (degrees)
++ {
++ case 0:
++ case 90:
++ case 180:
++ case 270:
++ image_rotate_simple(image, degrees);
++ break;
++ default:
++ image_rotate(image, degrees);
++ break;
++ }
+
+ /* copy rotated image on the pixmap */
+ gdk_pixmap_unref(drawing->backing_pixmap);
+Index: b/src/drawing.h
+===================================================================
+--- a/src/drawing.h 2009-12-19 17:11:48.000000000 -0200
++++ b/src/drawing.h 2009-12-19 17:12:11.000000000 -0200
+@@ -58,6 +58,6 @@
+ void drawing_clear(gpaint_drawing *drawing);
+ void drawing_clear_selection(gpaint_drawing *drawing, gpaint_point_array *points);
+ gboolean drawing_prompt_to_save(gpaint_drawing *drawing);
+-void drawing_rotate(gpaint_drawing *drawing, double degrees);
++void drawing_rotate(gpaint_drawing *drawing, int degrees);
+
+ #endif
+Index: b/src/image.c
+===================================================================
+--- a/src/image.c 2009-12-19 17:11:48.000000000 -0200
++++ b/src/image.c 2009-12-19 17:12:11.000000000 -0200
+@@ -628,6 +628,27 @@
+ return 0;
+ }
+
++int
++image_rotate_simple (gpaint_image *image, int degrees)
++{
++ GdkPixbuf *newpixbuf;
++
++ switch (degrees)
++ {
++ case GDK_PIXBUF_ROTATE_NONE:
++ case GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE:
++ case GDK_PIXBUF_ROTATE_UPSIDEDOWN:
++ case GDK_PIXBUF_ROTATE_CLOCKWISE:
++ newpixbuf = gdk_pixbuf_rotate_simple (image->pixbuf, degrees);
++ gdk_pixbuf_unref (image->pixbuf);
++ image->pixbuf = newpixbuf;
++ return 0;
++ break;
++ default:
++ return 1;
++ }
++}
++
+
+ GdkPixbuf* image_pixbuf(gpaint_image* image) {
+ return image->pixbuf;
+Index: b/src/image.h
+===================================================================
+--- a/src/image.h 2009-12-19 17:11:48.000000000 -0200
++++ b/src/image.h 2009-12-19 17:12:11.000000000 -0200
+@@ -45,5 +45,6 @@
+ int image_flip_x(gpaint_image *image);
+ int image_flip_y(gpaint_image *image);
+ int image_rotate(gpaint_image *image, double radians);
++int image_rotate_simple(gpaint_image *image, int degrees);
+ GdkPixbuf* image_pixbuf(gpaint_image *image);
+ #endif
+Index: b/src/menu.c
+===================================================================
+--- a/src/menu.c 2009-12-19 17:12:10.000000000 -0200
++++ b/src/menu.c 2009-12-19 17:12:11.000000000 -0200
+@@ -486,9 +486,9 @@
+
+ sscanf(name, "rotate_%c%d_menu", &sign, &degrees);
+ debug2("sign = %c degrees = %d", sign, degrees);
+- if (sign=='n')
++ if (sign=='p')
+ {
+- degrees *= -1;
++ degrees = 360 - degrees;
+ }
+ canvas_focus_lost(canvas);
+ drawing_rotate(canvas->drawing, degrees);
diff --git a/graphics/gpaint/patches/20_fix_line_width_combo.patch b/graphics/gpaint/patches/20_fix_line_width_combo.patch
new file mode 100644
index 0000000000000..61cabff2908e4
--- /dev/null
+++ b/graphics/gpaint/patches/20_fix_line_width_combo.patch
@@ -0,0 +1,352 @@
+Author: Thomas Viehmann <tv@beamnet.de>
+Description: Fix line width combo box
+ Fixes the line width combo box by puting items in the drop down
+ menu in the gpaint.glade file.
+Bug-Debian: http://bugs.debian.org/497484
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/209173
+Forwarded: https://savannah.gnu.org/patch/?6644
+
+Index: b/gpaint.glade
+===================================================================
+--- a/gpaint.glade 2009-12-19 17:12:10.000000000 -0200
++++ b/gpaint.glade 2009-12-19 17:12:11.000000000 -0200
+@@ -1230,6 +1230,34 @@
+ <property name="column_spacing">0</property>
+
+ <child>
++ <widget class="GtkLabel" id="Line Width">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">line width</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_CENTER</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0.5</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ <signal name="realize" handler="on_small_label_realize"/>
++ </widget>
++ <packing>
++ <property name="left_attach">0</property>
++ <property name="right_attach">1</property>
++ <property name="top_attach">0</property>
++ <property name="bottom_attach">1</property>
++ <property name="x_options"></property>
++ <property name="y_options"></property>
++ </packing>
++ </child>
++ <child>
+ <widget class="GtkCombo" id="line_width_combo">
+ <property name="width_request">60</property>
+ <property name="height_request">25</property>
+@@ -1239,27 +1267,264 @@
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+- <signal name="check_resize" handler="on_line_width_combo_check_resize"/>
+ <signal name="add" handler="on_line_width_combo_add"/>
++ <signal name="check_resize" handler="on_line_width_combo_check_resize"/>
+
+ <child internal-child="entry">
+- <widget class="GtkEntry" id="entry1">
++ <widget class="GtkEntry" id="line_width_combo_combo_entry">
+ <property name="visible">True</property>
++ <property name="tooltip" translatable="yes">line width</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+- <property name="invisible_char">•</property>
++ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
++ <signal name="changed" handler="on_line_width_combo_combo_entry_changed"/>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+- <widget class="GtkList" id="list1">
++ <widget class="GtkList" id="convertwidget1">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget2">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget3">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">1</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget4">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget5">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">2</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget6">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget7">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">3</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget8">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget9">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">4</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget10">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget11">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">5</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
++
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget12">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget13">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">6</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget14">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget15">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">7</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget16">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget17">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">8</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
++
++ <child>
++ <widget class="GtkListItem" id="convertwidget18">
++ <property name="visible">True</property>
++
++ <child>
++ <widget class="GtkLabel" id="convertwidget19">
++ <property name="visible">True</property>
++ <property name="label" translatable="yes">9</property>
++ <property name="use_underline">False</property>
++ <property name="use_markup">False</property>
++ <property name="justify">GTK_JUSTIFY_LEFT</property>
++ <property name="wrap">False</property>
++ <property name="selectable">False</property>
++ <property name="xalign">0</property>
++ <property name="yalign">0.5</property>
++ <property name="xpad">0</property>
++ <property name="ypad">0</property>
++ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
++ <property name="width_chars">-1</property>
++ <property name="single_line_mode">False</property>
++ <property name="angle">0</property>
++ </widget>
++ </child>
++ </widget>
++ </child>
+ </widget>
+ </child>
+ </widget>
+@@ -1272,35 +1537,6 @@
+ <property name="y_options"></property>
+ </packing>
+ </child>
+-
+- <child>
+- <widget class="GtkLabel" id="Line Width">
+- <property name="visible">True</property>
+- <property name="label" translatable="yes">line width</property>
+- <property name="use_underline">False</property>
+- <property name="use_markup">False</property>
+- <property name="justify">GTK_JUSTIFY_CENTER</property>
+- <property name="wrap">False</property>
+- <property name="selectable">False</property>
+- <property name="xalign">0.5</property>
+- <property name="yalign">0.5</property>
+- <property name="xpad">0</property>
+- <property name="ypad">0</property>
+- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+- <property name="width_chars">-1</property>
+- <property name="single_line_mode">False</property>
+- <property name="angle">0</property>
+- <signal name="realize" handler="on_small_label_realize"/>
+- </widget>
+- <packing>
+- <property name="left_attach">0</property>
+- <property name="right_attach">1</property>
+- <property name="top_attach">0</property>
+- <property name="bottom_attach">1</property>
+- <property name="x_options"></property>
+- <property name="y_options"></property>
+- </packing>
+- </child>
+ </widget>
+ </child>
+ </widget>
diff --git a/graphics/gpaint/patches/21_fix_crash_on_fill_button_click.patch b/graphics/gpaint/patches/21_fix_crash_on_fill_button_click.patch
new file mode 100644
index 0000000000000..132b3490302a8
--- /dev/null
+++ b/graphics/gpaint/patches/21_fix_crash_on_fill_button_click.patch
@@ -0,0 +1,25 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: fix crash on fill button click
+ Avoid crashing when clicking on fill button by checking that
+ tool->canvas->drawing_area is not null before casting it to GtkWidget
+Bug-Debian: http://bugs.debian.org/544162
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/227174
+Bug: https://savannah.gnu.org/bugs/?25117
+Forwarded: https://savannah.gnu.org/patch/?7045
+
+Index: pkg-gpaint/src/text.c
+===================================================================
+--- pkg-gpaint.orig/src/text.c 2009-12-22 21:03:29.000000000 -0200
++++ pkg-gpaint/src/text.c 2009-12-23 13:01:33.000000000 -0200
+@@ -156,7 +156,10 @@
+ {
+ debug_fn();
+ GtkStyle *style;
+- GtkWidget *widget = GTK_WIDGET(tool->canvas->drawing_area);
++ GtkWidget *widget = NULL;
++
++ if ((tool->canvas == NULL) || (tool->canvas->drawing_area == NULL)) return FALSE;
++ widget = GTK_WIDGET(tool->canvas->drawing_area);
+ style = gtk_widget_get_style(widget);
+ g_assert(style);
+
diff --git a/graphics/gpaint/patches/22_fix_not_printable_string.patch b/graphics/gpaint/patches/22_fix_not_printable_string.patch
new file mode 100644
index 0000000000000..6e2b98734f2fd
--- /dev/null
+++ b/graphics/gpaint/patches/22_fix_not_printable_string.patch
@@ -0,0 +1,21 @@
+Author: Ying-Chun Liu (PaulLiu) <grandpaul@gmail.com>
+Description: Ignore non-printable characters on text input
+Bug-Debian: http://bugs.debian.org/535217
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/262648
+Bug: https://savannah.gnu.org/bugs/?26923
+Forwarded: https://savannah.gnu.org/patch/?7051
+
+Index: b/src/text.c
+===================================================================
+--- a/src/text.c 2009-12-19 17:12:11.000000000 -0200
++++ b/src/text.c 2009-12-19 17:12:11.000000000 -0200
+@@ -238,7 +238,9 @@
+ }
+ else if (keyevent->string)
+ {
++ if (isprint(keyevent->string[0])) {
+ g_string_append(text->textbuf, keyevent->string);
++ }
+ }
+ else if ((keyevent->keyval >= GDK_space) && (keyevent->keyval < GDK_Shift_L))
+ {
diff --git a/graphics/gpaint/patches/23_add_accelerator_keys.patch b/graphics/gpaint/patches/23_add_accelerator_keys.patch
new file mode 100644
index 0000000000000..f53813444c5fd
--- /dev/null
+++ b/graphics/gpaint/patches/23_add_accelerator_keys.patch
@@ -0,0 +1,92 @@
+Author: Matt Wheeler <m@funkyhat.org>
+Description: Add accelerator keys to common functions
+ Add accelerator keys for common operations in gpaint
+Bug-Debian: http://bugs.debian.org/550305
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/444750
+Bug: https://savannah.gnu.org/bugs/?27618
+Forwarded: https://savannah.gnu.org/patch/?7053
+
+Index: b/gpaint.glade
+===================================================================
+--- a/gpaint.glade 2009-12-19 17:12:11.000000000 -0200
++++ b/gpaint.glade 2009-12-19 17:12:11.000000000 -0200
+@@ -341,6 +341,7 @@
+ <property name="label" translatable="yes">_New</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_new_file_menu_activate"/>
++ <accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image25">
+@@ -362,6 +363,7 @@
+ <property name="label" translatable="yes">_Open</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_open_menu_activate"/>
++ <accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image26">
+@@ -383,6 +385,7 @@
+ <property name="label" translatable="yes">_Save</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_save_menu_activate"/>
++ <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image27">
+@@ -453,6 +456,7 @@
+ <property name="label" translatable="yes">_Print</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_print_menu_activate"/>
++ <accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image30">
+@@ -480,6 +484,7 @@
+ <property name="label" translatable="yes">_Close</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_close_window_activate"/>
++ <accelerator key="W" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image31">
+@@ -501,6 +506,7 @@
+ <property name="label" translatable="yes">_Quit</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_quit_menu_activate"/>
++ <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image32">
+@@ -535,6 +541,7 @@
+ <property name="label" translatable="yes">Cu_t</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_cut_menu_activate"/>
++ <accelerator key="X" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image33">
+@@ -556,6 +563,7 @@
+ <property name="label" translatable="yes">_Copy</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_copy_menu_activate"/>
++ <accelerator key="C" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image34">
+@@ -577,6 +585,7 @@
+ <property name="label" translatable="yes">_Paste</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_paste_menu_activate"/>
++ <accelerator key="V" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+
+ <child internal-child="image">
+ <widget class="GtkImage" id="image35">
+@@ -625,6 +634,7 @@
+ <property name="label" translatable="yes">_Select All</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_select_all_activate"/>
++ <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+ </widget>
+ </child>
+ </widget>
diff --git a/graphics/gpaint/patches/24_fix_crash_on_failed_write.patch b/graphics/gpaint/patches/24_fix_crash_on_failed_write.patch
new file mode 100644
index 0000000000000..92be4e8020d43
--- /dev/null
+++ b/graphics/gpaint/patches/24_fix_crash_on_failed_write.patch
@@ -0,0 +1,105 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Fix crash when saving in unsupported format
+ Check if the format chosen by the user is supported before trying to save.
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/386234
+Bug: https://savannah.gnu.org/bugs/?25334
+Forwarded: https://savannah.gnu.org/patch/?7052
+
+Index: b/src/drawing.c
+===================================================================
+--- a/src/drawing.c 2009-12-19 17:12:11.000000000 -0200
++++ b/src/drawing.c 2009-12-19 17:12:12.000000000 -0200
+@@ -262,7 +262,7 @@
+ (error && error->message) ? error->message : "");
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(GTK_WIDGET(dialog));
+- g_free(error); /* allocated by gdk-pixbuf library */
++ g_error_free(error); /* allocated by gdk-pixbuf library */
+ }
+ return saved;
+ }
+Index: b/src/image.c
+===================================================================
+--- a/src/image.c 2009-12-19 17:12:11.000000000 -0200
++++ b/src/image.c 2009-12-19 17:12:12.000000000 -0200
+@@ -32,6 +32,7 @@
+ #include <gdk/gdkx.h> /* for gdk_root_parent */
+ #include <gdk-pixbuf/gdk-pixbuf.h>
+
++#define _(String) gettext (String)
+
+ static int cmp_int(const void *a, const void *b);
+ static void fill_polygon(
+@@ -191,13 +192,48 @@
+ return image;
+ }
+
++
++gboolean
++is_writable (GSList *formats, gchar *type)
++{
++ gboolean writable = FALSE;
++
++ while (!writable && formats != NULL)
++ {
++ gchar** extensions = gdk_pixbuf_format_get_extensions((GdkPixbufFormat *)(formats->data));
++ gchar** e = NULL;
++ for (e = extensions; *e; ++e)
++ {
++ if (!strcmp(*e, type))
++ {
++ writable = TRUE;
++ break;
++ }
++ }
++ g_strfreev (extensions);
++ formats = g_slist_next (formats);
++ }
++ return writable;
++}
++
++void add_if_writable (GdkPixbufFormat *data, GSList **list)
++{
++ if (gdk_pixbuf_format_is_writable (data))
++ *list = g_slist_prepend (*list, data);
++}
++
+ int
+ image_write(gpaint_image* image, const gchar* filename, GError **perror)
+ {
+ gboolean saved = FALSE;
+ gchar *ext = NULL;
+ gchar *type = NULL;
+-
++
++ GSList *formats = gdk_pixbuf_get_formats ();
++ GSList *writable_formats = NULL;
++ g_slist_foreach (formats, add_if_writable, &writable_formats);
++ g_slist_free (formats);
++
+ ext = g_strrstr(filename, ".");
+ if (!ext)
+ {
+@@ -214,13 +250,20 @@
+ {
+ type = g_ascii_strdown(ext+1,-1);
+ debug1("type=[%s]",type);
+- saved = gdk_pixbuf_save(image->pixbuf, filename, type, perror, NULL);
++ if (is_writable (writable_formats, type))
++ {
++ saved = gdk_pixbuf_save(image->pixbuf, filename, type, perror, NULL);
++ } else {
++ saved = FALSE;
++ *perror = g_error_new (GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_BAD_OPTION, _("Saving in the '%s' format is not supported by gdk_pixbuf"), type);
++ }
+ g_free(type);
+ }
+ if (!saved && *perror)
+ {
+ g_warning("Could not save image %s: %s\n", filename, (*perror)->message);
+- }
++ }
++ g_slist_free (writable_formats);
+ return saved;
+ }
+
diff --git a/graphics/gpaint/patches/25_fix_color_selection.patch b/graphics/gpaint/patches/25_fix_color_selection.patch
new file mode 100644
index 0000000000000..7af4eb2ed11f0
--- /dev/null
+++ b/graphics/gpaint/patches/25_fix_color_selection.patch
@@ -0,0 +1,79 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Fix foreground/background color selection
+ Fixes the foreground/background color selection by checking the GtkColorButton
+ color when the user chooses the color.
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/344237
+Forwarded: https://savannah.gnu.org/patch/index.php?7028
+
+diff --git a/src/callbacks.h b/src/callbacks.h
+index 985dddf..5485329 100644
+--- a/src/callbacks.h
++++ b/src/callbacks.h
+@@ -359,18 +359,10 @@ on_fontpicker_font_set (GtkFontButton *gnomefontpicker,
+
+ void
+ on_foreground_color_picker_color_set (GtkColorButton *gnomecolorpicker,
+- guint arg1,
+- guint arg2,
+- guint arg3,
+- guint arg4,
+ gpointer user_data);
+
+ void
+ on_background_color_picker_color_set (GtkColorButton *gnomecolorpicker,
+- guint arg1,
+- guint arg2,
+- guint arg3,
+- guint arg4,
+ gpointer user_data);
+
+ void
+diff --git a/src/color_palette.c b/src/color_palette.c
+index 9502acc..8c259e7 100644
+--- a/src/color_palette.c
++++ b/src/color_palette.c
+@@ -338,7 +338,7 @@ change_color(gpaint_color_swatch *swatch, gpaint_color_mode mode)
+ g_assert(swatch);
+ canvas = canvas_lookup(swatch->widget);
+ gdk_gc_get_values(swatch->gc, &gcvalues);
+-
++
+ if (mode==FOREGROUND)
+ {
+ change_foreground_color(canvas, &(gcvalues.foreground));
+@@ -362,15 +362,12 @@ change_color(gpaint_color_swatch *swatch, gpaint_color_mode mode)
+ */
+ void
+ on_foreground_color_picker_color_set (GtkColorButton *gnomecolorpicker,
+- guint arg1,
+- guint arg2,
+- guint arg3,
+- guint arg4,
+ gpointer user_data)
+ {
+- GdkColor color = {0, arg1, arg2, arg3};
++ GdkColor color;
+ gpaint_canvas *canvas = canvas_lookup(GTK_WIDGET(gnomecolorpicker));
+
++ gtk_color_button_get_color(gnomecolorpicker, &color);
+ gdk_color_alloc(gdk_colormap_get_system(), &color);
+ change_foreground_color(canvas, &color);
+ }
+@@ -380,15 +377,12 @@ on_foreground_color_picker_color_set (GtkColorButton *gnomecolorpicker,
+ */
+ void
+ on_background_color_picker_color_set (GtkColorButton *gnomecolorpicker,
+- guint arg1,
+- guint arg2,
+- guint arg3,
+- guint arg4,
+ gpointer user_data)
+ {
+- GdkColor color = {0, arg1, arg2, arg3};
++ GdkColor color;
+ gpaint_canvas *canvas = canvas_lookup(GTK_WIDGET(gnomecolorpicker));
+
++ gtk_color_button_get_color(gnomecolorpicker, &color);
+ gdk_color_alloc(gdk_colormap_get_system(), &color);
+ change_background_color(canvas, &color);
+ }
diff --git a/graphics/gpaint/patches/26_fix_toolbar.patch b/graphics/gpaint/patches/26_fix_toolbar.patch
new file mode 100644
index 0000000000000..c6fdc63e33988
--- /dev/null
+++ b/graphics/gpaint/patches/26_fix_toolbar.patch
@@ -0,0 +1,21 @@
+Author: Goedson Teixeira Paixao <goedson@debian.org>
+Description: Fix toolbar behaviour
+ Do not set a fixed toolbar style so that gpaint follows the style set in
+ the user preferences
+Bug-Debian: http://bugs.debian.org/497488
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/gpaint/+bug/127296
+Bug: https://savannah.gnu.org/bugs/?21260
+Forwarded: https://savannah.gnu.org/patch/index.php?7044
+
+Index: pkg-gpaint/gpaint.glade
+===================================================================
+--- pkg-gpaint.orig/gpaint.glade 2009-12-22 20:56:13.000000000 -0200
++++ pkg-gpaint/gpaint.glade 2009-12-22 20:56:33.000000000 -0200
+@@ -1004,7 +1004,6 @@
+ <property name="height_request">55</property>
+ <property name="visible">True</property>
+ <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
+- <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
+ <property name="tooltips">True</property>
+ <property name="show_arrow">True</property>
+
diff --git a/graphics/gpaint/slack-desc b/graphics/gpaint/slack-desc
new file mode 100644
index 0000000000000..473a8e82f8f0a
--- /dev/null
+++ b/graphics/gpaint/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+gpaint: gpaint (GNU Paint: a small-scale GTK2 painting program)
+gpaint:
+gpaint: This is gpaint (GNU Paint), a small-scale GTK2 painting program,
+gpaint: on xpaint, along the lines of "Paintbrush".
+gpaint:
+gpaint:
+gpaint:
+gpaint:
+gpaint:
+gpaint:
+gpaint: