[gthumb] Revert "Simplify and tidy up build files, delete unused files - bug 583463"



commit 53d94177944c4a54c3ca1d5cf3d6bd758aceb421
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Thu May 21 12:59:21 2009 -0400

    Revert "Simplify and tidy up build files, delete unused files - bug 583463"
    
    This reverts commit 8e850a2944d64b452009d370b4533991ae860cd9.
---
 configure.in                    |   16 +-
 data/gthumb-import.desktop.in   |    2 +-
 libgthumb/Makefile.am           |   15 +
 libgthumb/eel-canvas-rect.c     |  779 +++++++++++++++++++++++++++++++++++++++
 libgthumb/eel-canvas-rect.h     |   54 +++
 libgthumb/jpegutils/Makefile.am |    8 +-
 src/Makefile.am                 |   87 ++++--
 src/dlg-photo-importer.c        |   33 --
 src/main.h                      |    8 +
 9 files changed, 930 insertions(+), 72 deletions(-)

diff --git a/configure.in b/configure.in
index 2df763d..df95118 100644
--- a/configure.in
+++ b/configure.in
@@ -259,22 +259,8 @@ fi
 dnl ******************************
 
 AC_ARG_ENABLE(deprecations,AC_HELP_STRING([--enable-deprecations],[warn about deprecated usages]))
-if test "x$enable_deprecations" = "xyes"; then
-        DISABLE_DEPRECATED="-DG_DISABLE_DEPRECATED \
-        -DGDK_DISABLE_DEPRECATED \
-        -DGDK_PIXBUF_DISABLE_DEPRECATED \
-        -DGTK_DISABLE_DEPRECATED \
-        -DGNOME_VFS_DISABLE_DEPRECATED \
-        -DGNOME_DISABLE_DEPRECATED"
-        AC_SUBST(DISABLE_DEPRECATED)
-fi
-
-dnl ******************************
 
-WARNINGS="-Wall -Wimplicit -Wunused-label \
--Wpointer-arith -Wcast-align -Wtype-limits \
--Wclobbered -Wempty-body -Wignored-qualifiers"
-AC_SUBST(WARNINGS)
+AM_CONDITIONAL(ENABLE_DEPRECATIONS, test "x$enable_deprecations" = xyes)
 
 dnl ******************************
 
diff --git a/data/gthumb-import.desktop.in b/data/gthumb-import.desktop.in
index 6e6c72a..b02ca67 100644
--- a/data/gthumb-import.desktop.in
+++ b/data/gthumb-import.desktop.in
@@ -3,7 +3,7 @@ _Name=gThumb Photo Import Tool
 _GenericName=Photo Import Tool
 _Comment=Import the photos on your camera card
 Categories=GNOME;GTK;Graphics;Viewer;RasterGraphics;2DGraphics;Photography;
-Exec=gthumb --import-photos'
+Exec=sh -c 'gvfs-mount -u ~/.gvfs/gphoto2*; exec gthumb --import-photos'
 Icon=gthumb
 MimeType=x-content/image-dcf;x-content/image-picturecd;
 NoDisplay=true
diff --git a/libgthumb/Makefile.am b/libgthumb/Makefile.am
index 5bf9e96..fef1100 100644
--- a/libgthumb/Makefile.am
+++ b/libgthumb/Makefile.am
@@ -1,6 +1,16 @@
 SUBDIRS = icons cursors jpegutils
 DIST_SUBDIRS = icons cursors jpegutils
 
+if ENABLE_DEPRECATIONS
+DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED
+else
+DISABLE_DEPRECATED =
+endif
+
+WARNINGS = -Wall -Wimplicit -Wunused-label \
+	   -Wpointer-arith -Wcast-align -Wtype-limits \
+	   -Wclobbered -Wempty-body -Wignored-qualifiers
+
 gladedir = $(datadir)/gthumb/glade
 
 INCLUDES =							\
@@ -17,6 +27,10 @@ libgthumbdir = $(libdir)
 libgthumb_LTLIBRARIES = libgthumb.la
 libgthumb_la_LDFLAGS = -avoid-version -no-undefined
 
+EEL_CANVAS_RECT =		\
+	eel-canvas-rect.c	\
+	eel-canvas-rect.h
+
 ENUMS =				\
 	gthumb-enum-types.h	\
 	gthumb-enum-types.c
@@ -82,6 +96,7 @@ MD5 = 				\
 	md5.h
 
 libgthumb_la_SOURCES =			\
+	$(EEL_CANVAS_RECT)		\
 	$(ENUMS)			\
 	$(EOG_CURSORS)			\
 	$(HEADER_FILES)			\
diff --git a/libgthumb/eel-canvas-rect.c b/libgthumb/eel-canvas-rect.c
new file mode 100644
index 0000000..0c9b1bc
--- /dev/null
+++ b/libgthumb/eel-canvas-rect.c
@@ -0,0 +1,779 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* eel-canvas-rect.c: Rectangle canvas item with AA support.
+
+   Copyright (C) 2002 Alexander Larsson.
+
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Authors: Alexander Larsson <alla lysator liu se>
+*/
+
+#include <config.h>
+#include <math.h>
+#include <string.h>
+
+#include <glib.h>
+#include <libgnome/gnome-macros.h>
+#include <libgnomecanvas/gnome-canvas-util.h>
+
+#include "eel-canvas-rect.h"
+
+#ifdef HAVE_RENDER
+#include <gdk/gdkx.h>
+#include <X11/extensions/Xrender.h>
+#endif
+
+/*
+ * name			type		read/write	description
+ * ------------------------------------------------------------------------------------------
+ * x1			double		RW		Leftmost coordinate of rectangle or ellipse
+ * y1			double		RW		Topmost coordinate of rectangle or ellipse
+ * x2			double		RW		Rightmost coordinate of rectangle or ellipse
+ * y2			double		RW		Bottommost coordinate of rectangle or ellipse
+ * fill_color_rgba	uint		RW		RGBA color for fill,
+ * outline_color_rgba	uint		RW		RGBA color for outline
+ * width_pixels		uint		RW		Width of the outline in pixels.  The outline will
+ *							not be scaled when the canvas zoom factor is changed.
+ */
+
+enum {
+	PROP_0,
+
+	PROP_X1,
+	PROP_Y1,
+	PROP_X2,
+	PROP_Y2,
+
+	PROP_FILL_COLOR_RGBA,
+	PROP_OUTLINE_COLOR_RGBA,
+
+	PROP_WIDTH_PIXELS
+};
+
+struct EelCanvasRectDetails {
+	double x1, y1, x2, y2;
+	guint fill_color;
+	guint outline_color;
+	guint width_pixels;
+
+	ArtDRect last_update_rect;
+	ArtDRect last_outline_update_rect;
+	GdkGC *fill_gc;		/* GC for fill, lazily allocated */
+	GdkGC *outline_gc;	/* GC for outline */
+
+#ifdef HAVE_RENDER
+	gboolean use_render;
+	XRenderPictFormat *format;
+#endif
+};
+
+GNOME_CLASS_BOILERPLATE (EelCanvasRect, eel_canvas_rect,
+			 GnomeCanvasItem, GNOME_TYPE_CANVAS_ITEM);
+
+
+static ArtDRect  make_drect (double x0, double y0, double x1, double y1);
+static void      diff_rects (ArtDRect r1, ArtDRect r2, int *count, ArtDRect result[4]);
+
+static void
+eel_canvas_rect_update_fill_gc (EelCanvasRect *rect,
+				gboolean       create)
+{
+	EelCanvasRectDetails *details;
+	GnomeCanvasItem *item;
+	GdkColor c;
+
+	item = GNOME_CANVAS_ITEM (rect);
+	
+	details = rect->details;
+	
+	if (details->fill_gc == NULL) {
+		if (!create) {
+			return;
+		}
+		details->fill_gc =
+			gdk_gc_new (GTK_WIDGET (item->canvas)->window);
+	}
+	
+	c.pixel = gnome_canvas_get_color_pixel (item->canvas,
+						details->fill_color);
+	gdk_gc_set_foreground (details->fill_gc, &c);
+}
+
+static void
+eel_canvas_rect_update_outline_gc (EelCanvasRect *rect,
+				   gboolean       create)
+{
+	EelCanvasRectDetails *details;
+	GnomeCanvasItem *item;
+	GdkColor c;
+
+	item = GNOME_CANVAS_ITEM (rect);
+	
+	details = rect->details;
+	
+	if (details->outline_gc == NULL) {
+		if (!create) {
+			return;
+		}
+		details->outline_gc =
+			gdk_gc_new (GTK_WIDGET (item->canvas)->window);
+	}
+	
+	c.pixel = gnome_canvas_get_color_pixel (item->canvas,
+						details->outline_color);
+	gdk_gc_set_foreground (details->outline_gc, &c);
+	gdk_gc_set_line_attributes (details->outline_gc,
+				    details->width_pixels,
+				    GDK_LINE_SOLID,
+				    GDK_CAP_BUTT,
+				    GDK_JOIN_MITER);
+}
+
+
+static void
+eel_canvas_rect_instance_init (EelCanvasRect *rect)
+{
+	rect->details = g_new0 (EelCanvasRectDetails, 1);
+}
+
+
+static void
+eel_canvas_rect_finalize (GObject *object)
+{
+	EelCanvasRect *rect;
+
+	g_return_if_fail (EEL_IS_CANVAS_RECT (object));
+	
+	rect = EEL_CANVAS_RECT (object);
+
+	g_free (rect->details);
+
+	G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+eel_canvas_rect_set_property (GObject      *object,
+			      guint         param_id,
+			      const GValue *value,
+			      GParamSpec   *pspec)
+{
+	GnomeCanvasItem *item;
+	EelCanvasRect *rect;
+	EelCanvasRectDetails *details;
+
+	item = GNOME_CANVAS_ITEM (object);
+	rect = EEL_CANVAS_RECT (object);
+	details = rect->details;
+
+	switch (param_id) {
+	case PROP_X1:
+		details->x1 = g_value_get_double (value);
+		gnome_canvas_item_request_update (item);
+		break;
+
+	case PROP_Y1:
+		details->y1 = g_value_get_double (value);
+		gnome_canvas_item_request_update (item);
+		break;
+
+	case PROP_X2:
+		details->x2 = g_value_get_double (value);
+		gnome_canvas_item_request_update (item);
+		break;
+
+	case PROP_Y2:
+		details->y2 = g_value_get_double (value);
+		gnome_canvas_item_request_update (item);
+		break;
+
+	case PROP_FILL_COLOR_RGBA:
+		details->fill_color = g_value_get_uint (value);
+
+		eel_canvas_rect_update_fill_gc (rect, FALSE);
+		
+		gnome_canvas_item_request_update (item);
+		break;
+		
+	case PROP_OUTLINE_COLOR_RGBA:
+		details->outline_color = g_value_get_uint (value);
+
+		eel_canvas_rect_update_outline_gc (rect, FALSE);
+		
+		gnome_canvas_item_request_update (item);
+		break;
+
+	case PROP_WIDTH_PIXELS:
+		details->width_pixels = g_value_get_uint (value);
+		eel_canvas_rect_update_outline_gc (rect, FALSE);
+		gnome_canvas_item_request_update (item);
+		break;
+
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+		break;
+	}
+	
+}
+
+static void
+eel_canvas_rect_get_property (GObject     *object,
+			      guint        param_id,
+			      GValue      *value,
+			      GParamSpec  *pspec)
+{
+	EelCanvasRect *rect;
+	EelCanvasRectDetails *details;
+
+	rect = EEL_CANVAS_RECT (object);
+	details = rect->details;
+
+	switch (param_id) {
+	case PROP_X1:
+		g_value_set_double (value,  details->x1);
+		break;
+
+	case PROP_Y1:
+		g_value_set_double (value,  details->y1);
+		break;
+
+	case PROP_X2:
+		g_value_set_double (value,  details->x2);
+		break;
+
+	case PROP_Y2:
+		g_value_set_double (value,  details->y2);
+		break;
+		
+	case PROP_FILL_COLOR_RGBA:
+		g_value_set_uint (value, details->fill_color);
+		break;
+		
+	case PROP_OUTLINE_COLOR_RGBA:
+		g_value_set_uint (value, details->outline_color);
+		break;
+
+	case PROP_WIDTH_PIXELS:
+		g_value_set_uint (value, details->width_pixels);
+		break;
+	default:
+		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+		break;
+	}	
+}
+
+static void
+request_redraw_borders (GnomeCanvas *canvas,
+			ArtDRect    *update_rect,
+			double       width)
+{
+	gnome_canvas_request_redraw (canvas,
+				     update_rect->x0, update_rect->y0,
+				     update_rect->x1, update_rect->y0 + width);
+	gnome_canvas_request_redraw (canvas,
+				     update_rect->x0, update_rect->y1-width,
+				     update_rect->x1, update_rect->y1);
+	gnome_canvas_request_redraw (canvas,
+				     update_rect->x0,       update_rect->y0,
+				     update_rect->x0+width, update_rect->y1);
+	gnome_canvas_request_redraw (canvas,
+				     update_rect->x1-width, update_rect->y0,
+				     update_rect->x1,       update_rect->y1);
+}
+
+static void
+eel_canvas_rect_update (GnomeCanvasItem *item,
+			double *affine,
+			ArtSVP *clip_path,
+			int flags)
+{
+	EelCanvasRect *rect;
+	EelCanvasRectDetails *details;
+	double x1, y1, x2, y2;
+	int cx1, cy1, cx2, cy2;
+	ArtDRect update_rect, repaint_rects[4];
+	int repaint_rects_count, i;
+	double width_lt, width_rb;
+
+	rect = EEL_CANVAS_RECT (item);
+	details = rect->details;
+
+	if (parent_class->update) {
+		(* parent_class->update) (item, affine, clip_path, flags);
+	}
+
+	/* Update bounding box: */
+	width_lt = floor (details->width_pixels / 2.0) / item->canvas->pixels_per_unit;
+	width_rb = ceil (details->width_pixels / 2.0) / item->canvas->pixels_per_unit;
+	
+	x1 = details->x1;
+	y1 = details->y1;
+	x2 = details->x2;
+	y2 = details->y2;
+
+	gnome_canvas_item_i2w (item, &x1, &y1);
+	gnome_canvas_item_i2w (item, &x2, &y2);
+
+	/* Inner box: */
+	gnome_canvas_w2c (item->canvas, x1 + width_rb, y1 + width_rb, &cx1, &cy1);
+	gnome_canvas_w2c (item->canvas, x2 - width_lt, y2 - width_lt, &cx2, &cy2);
+
+	update_rect = make_drect (cx1, cy1, cx2, cy2);
+	diff_rects (update_rect, details->last_update_rect,
+		    &repaint_rects_count, repaint_rects);
+	for (i = 0; i < repaint_rects_count; i++) {
+		gnome_canvas_request_redraw (item->canvas,
+					     repaint_rects[i].x0, repaint_rects[i].y0,
+					     repaint_rects[i].x1, repaint_rects[i].y1);
+	}
+	details->last_update_rect = update_rect;
+
+	
+	/* Outline and bounding box */
+	gnome_canvas_w2c (item->canvas, x1 - width_lt, y1 - width_lt, &cx1, &cy1);
+	gnome_canvas_w2c (item->canvas, x2 + width_rb, y2 + width_rb, &cx2, &cy2);
+	
+	update_rect = make_drect (cx1, cy1, cx2, cy2);
+	request_redraw_borders (item->canvas, &details->last_outline_update_rect,
+				(width_lt + width_rb)*item->canvas->pixels_per_unit);
+	request_redraw_borders (item->canvas, &update_rect,
+				(width_lt + width_rb)*item->canvas->pixels_per_unit);
+	details->last_outline_update_rect = update_rect;
+	
+	item->x1 = cx1;
+	item->y1 = cy1;
+	item->x2 = cx2;
+	item->y2 = cy2;
+}
+
+static void
+eel_canvas_rect_realize (GnomeCanvasItem *item)
+{
+	EelCanvasRect *rect;
+	EelCanvasRectDetails *details;
+#ifdef HAVE_RENDER
+	int event_base, error_base;
+#endif
+	rect = EEL_CANVAS_RECT (item);
+	details = rect->details;
+	
+	eel_canvas_rect_update_outline_gc (rect, TRUE);
+
+#ifdef HAVE_RENDER
+	details->use_render = XRenderQueryExtension (gdk_display, &event_base, &error_base);
+
+	if (details->use_render) {
+		Display *dpy;
+		GdkVisual *gdk_visual;
+		Visual *visual;
+
+		dpy = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (item->canvas)->window);
+		gdk_visual = gtk_widget_get_visual (GTK_WIDGET (item->canvas));
+		visual = gdk_x11_visual_get_xvisual (gdk_visual);
+
+		details->format = XRenderFindVisualFormat (dpy, visual);
+	}
+#endif
+
+	if (parent_class->realize) {
+		(* parent_class->realize) (item);
+	}
+}
+
+static void
+eel_canvas_rect_unrealize (GnomeCanvasItem *item)
+{
+	EelCanvasRect *rect;
+	EelCanvasRectDetails *details;
+
+	rect = EEL_CANVAS_RECT (item);
+	details = rect->details;
+
+	if (details->outline_gc) {
+		g_object_unref (details->outline_gc);
+		details->outline_gc = NULL;
+	}
+	
+	if (details->fill_gc) {
+		g_object_unref (details->fill_gc);
+		details->fill_gc = NULL;
+	}
+
+	if (parent_class->unrealize) {
+		(* parent_class->unrealize) (item);
+	}
+}
+
+static void
+eel_canvas_rect_render (GnomeCanvasItem *item,
+			GnomeCanvasBuf  *buf)
+{
+	g_assert_not_reached ();
+}
+
+static double
+eel_canvas_rect_point (GnomeCanvasItem *item,
+		       double x, double y,
+		       int cx, int cy,
+		       GnomeCanvasItem **actual_item)
+{
+	EelCanvasRect *rect;
+	EelCanvasRectDetails *details;
+	double x1, y1, x2, y2;
+	double hwidth;
+	double dx, dy;
+
+	rect = EEL_CANVAS_RECT (item);
+	details = rect->details;
+
+	*actual_item = item;
+
+	hwidth = (details->width_pixels / item->canvas->pixels_per_unit) / 2.0;
+	x1 = details->x1 - hwidth;
+	y1 = details->y1 - hwidth;
+	x2 = details->x2 + hwidth;
+	y2 = details->y2 + hwidth;
+
+
+	if ((x >= x1) && (y >= y1) && (x <= x2) && (y <= y2)) {
+		return 0.0;
+	}
+
+	/* Point is outside rectangle */
+	if (x < x1)
+		dx = x1 - x;
+	else if (x > x2)
+		dx = x - x2;
+	else
+		dx = 0.0;
+
+	if (y < y1)
+		dy = y1 - y;
+	else if (y > y2)
+		dy = y - y2;
+	else
+		dy = 0.0;
+
+	return sqrt (dx * dx + dy * dy);
+}
+
+static void
+render_rect_alpha (EelCanvasRect *rect,
+		   GdkDrawable *drawable,
+		   int x, int y,
+		   int width, int height,
+		   guint32 rgba)
+{
+	GdkPixbuf *pixbuf;
+	guchar *data;
+	int rowstride, i;
+	guchar r, g, b, a;
+	EelCanvasRectDetails *details;
+
+	if (width <= 0 || height <= 0 ) {
+		return;
+	}
+	
+	details = rect->details;
+
+	r = (rgba >> 24) & 0xff;
+	g = (rgba >> 16) & 0xff;
+	b = (rgba >> 8) & 0xff;
+	a = (rgba >> 0) & 0xff;
+
+#ifdef HAVE_RENDER
+	if (details->use_render) {
+		Display *dpy;
+		Picture  pict;
+		XRenderPictureAttributes attributes;
+		XRenderColor color;
+	
+		dpy = gdk_x11_drawable_get_xdisplay (drawable);
+
+		pict = XRenderCreatePicture (dpy,
+					     gdk_x11_drawable_get_xid (drawable),
+					     details->format,
+					     0,
+					     &attributes);
+
+
+		/* Convert to premultiplied alpha: */
+		r = r * a / 255;
+		g = g * a / 255;
+		b = b * a / 255;
+		
+		color.red = (r << 8) + r;
+		color.green = (g << 8) + g;
+		color.blue = (b << 8) + b;
+		color.alpha = (a << 8) + a;
+		
+		XRenderFillRectangle (dpy,
+				      PictOpOver,
+				      pict,
+				      &color,
+				      x, y,
+				      width, height);
+		XRenderFreePicture (dpy, pict);
+
+		return;
+	}
+#endif
+	pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
+	data = gdk_pixbuf_get_pixels (pixbuf);
+	rowstride = gdk_pixbuf_get_rowstride (pixbuf);
+	
+	r = (rgba >> 24) & 0xff;
+	g = (rgba >> 16) & 0xff;
+	b = (rgba >> 8) & 0xff;
+	a = (rgba >> 0) & 0xff;
+	
+	for (i = 0; i < width*4; ) {
+		data[i++] = r;
+		data[i++] = g;
+		data[i++] = b;
+		data[i++] = a;
+	}
+	
+	for (i = 1; i < height; i++) {
+		memcpy (data + i*rowstride, data, width*4);
+	}
+	
+	gdk_pixbuf_render_to_drawable_alpha (pixbuf,
+					     drawable,
+					     0, 0,
+					     x, y,
+					     width, height,
+					     GDK_PIXBUF_ALPHA_FULL,
+					     255,
+					     GDK_RGB_DITHER_NONE, 0, 0);
+	g_object_unref (pixbuf);
+}
+
+
+static void
+eel_canvas_rect_draw (GnomeCanvasItem *item,
+		      GdkDrawable *drawable,
+		      int x, int y,
+		      int width, int height)
+{
+	EelCanvasRect *rect;
+	EelCanvasRectDetails *details;
+	double x1, y1, x2, y2;
+	int cx1, cy1, cx2, cy2;
+	double width_lt, width_rb;
+
+	rect = EEL_CANVAS_RECT (item);
+	details = rect->details;
+
+	/* Update bounding box: */
+	width_lt = floor (details->width_pixels / 2.0) / item->canvas->pixels_per_unit;
+	width_rb = ceil (details->width_pixels / 2.0) / item->canvas->pixels_per_unit;
+
+	x1 = details->x1;
+	y1 = details->y1;
+	x2 = details->x2;
+	y2 = details->y2;
+
+	gnome_canvas_item_i2w (item, &x1, &y1);
+	gnome_canvas_item_i2w (item, &x2, &y2);
+
+	/* Inner box: */
+	gnome_canvas_w2c (item->canvas, x1 + width_rb, y1 + width_rb, &cx1, &cy1);
+	gnome_canvas_w2c (item->canvas, x2 - width_lt, y2 - width_lt, &cx2, &cy2);
+
+	/* Clip and offset to dest drawable */
+	cx1 = MAX (0, cx1 - x);
+	cy1 = MAX (0, cy1 - y);
+	cx2 = MIN (width, cx2 - x);
+	cy2 = MIN (height, cy2 - y);
+	
+	if ((details->fill_color & 0xff) != 255) {
+		render_rect_alpha (rect,
+				   drawable,
+				   cx1, cy1,
+				   cx2 - cx1, cy2 - cy1,
+				   details->fill_color);
+	} else {
+		if (details->fill_gc == NULL) {
+			eel_canvas_rect_update_fill_gc (rect, TRUE);
+		}
+		gdk_draw_rectangle (drawable,
+				    details->fill_gc,
+				    TRUE,
+				    cx1, cy1,
+				    cx2, cy2);
+	}
+
+	/* Box outline: */
+	
+	gnome_canvas_w2c (item->canvas, x1, y1, &cx1, &cy1);
+	gnome_canvas_w2c (item->canvas, x2, y2, &cx2, &cy2);
+	
+	/* FIXME: Doesn't handle alpha for outline. Nautilus doesn't currently use this */
+	gdk_draw_rectangle (drawable,
+			    details->outline_gc,
+			    FALSE,
+			    cx1 - x, cy1 - y,
+			    cx2 - cx1, cy2 - cy1);
+}
+
+static void
+eel_canvas_rect_bounds (GnomeCanvasItem *item,
+			double *x1, double *y1,
+			double *x2, double *y2)
+{
+	EelCanvasRect *rect;
+	EelCanvasRectDetails *details;
+	double hwidth;
+
+	rect = EEL_CANVAS_RECT (item);
+	details = rect->details;
+
+	hwidth = (details->width_pixels / item->canvas->pixels_per_unit) / 2.0;
+	
+	*x1 = details->x1 - hwidth;
+	*y1 = details->y1 - hwidth;
+	*x2 = details->x2 + hwidth;
+	*y2 = details->y2 + hwidth;
+}
+
+static void
+eel_canvas_rect_class_init (EelCanvasRectClass *class)
+{
+	GObjectClass *gobject_class;
+	GnomeCanvasItemClass *item_class;
+
+	gobject_class = G_OBJECT_CLASS (class);
+	item_class = GNOME_CANVAS_ITEM_CLASS (class);
+	
+	gobject_class->finalize = eel_canvas_rect_finalize;
+	gobject_class->set_property = eel_canvas_rect_set_property;
+	gobject_class->get_property = eel_canvas_rect_get_property;
+
+	item_class->update = eel_canvas_rect_update;
+	item_class->realize = eel_canvas_rect_realize;
+	item_class->unrealize = eel_canvas_rect_unrealize;
+	item_class->draw = eel_canvas_rect_draw;
+	item_class->point = eel_canvas_rect_point;
+	item_class->render = eel_canvas_rect_render;
+	item_class->bounds = eel_canvas_rect_bounds;
+	
+        g_object_class_install_property (gobject_class,
+					 PROP_X1,
+					 g_param_spec_double ("x1", NULL, NULL,
+							      -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+							      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+        g_object_class_install_property (gobject_class,
+					 PROP_Y1,
+					 g_param_spec_double ("y1", NULL, NULL,
+							      -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+							      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+        g_object_class_install_property (gobject_class,
+					 PROP_X2,
+					 g_param_spec_double ("x2", NULL, NULL,
+							      -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+							      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+        g_object_class_install_property (gobject_class,
+					 PROP_Y2,
+					 g_param_spec_double ("y2", NULL, NULL,
+							      -G_MAXDOUBLE, G_MAXDOUBLE, 0,
+							      (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+	
+        g_object_class_install_property (gobject_class,
+                                         PROP_FILL_COLOR_RGBA,
+                                         g_param_spec_uint ("fill_color_rgba", NULL, NULL,
+                                                            0, G_MAXUINT, 0,
+                                                            (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+        g_object_class_install_property (gobject_class,
+                                         PROP_OUTLINE_COLOR_RGBA,
+                                         g_param_spec_uint ("outline_color_rgba", NULL, NULL,
+                                                            0, G_MAXUINT, 0,
+                                                            (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+        g_object_class_install_property (gobject_class,
+                                         PROP_WIDTH_PIXELS,
+                                         g_param_spec_uint ("width_pixels", NULL, NULL,
+                                                            0, G_MAXUINT, 0,
+                                                            (G_PARAM_READABLE | G_PARAM_WRITABLE)));
+}
+
+
+static ArtDRect
+make_drect (double x0, double y0, double x1, double y1)
+{
+	ArtDRect r;
+
+	r.x0 = x0;
+	r.y0 = y0;
+	r.x1 = x1;
+	r.y1 = y1;
+	return r;
+}
+
+static gboolean
+rects_intersect (ArtDRect r1, ArtDRect r2)
+{
+	if (r1.x0 >= r2.x1) {
+		return FALSE;
+	}
+	if (r2.x0 >= r1.x1) {
+		return FALSE;
+	}
+	if (r1.y0 >= r2.y1) {
+		return FALSE;
+	}
+	if (r2.y0 >= r1.y1) {
+		return FALSE;
+	}
+	return TRUE;
+}
+
+static void
+diff_rects_guts (ArtDRect ra, ArtDRect rb, int *count, ArtDRect result[4])
+{
+	if (ra.x0 < rb.x0) {
+		result[(*count)++] = make_drect (ra.x0, ra.y0, rb.x0, ra.y1);
+	}
+	if (ra.y0 < rb.y0) {
+		result[(*count)++] = make_drect (ra.x0, ra.y0, ra.x1, rb.y0);
+	}
+	if (ra.x1 < rb.x1) {
+		result[(*count)++] = make_drect (ra.x1, rb.y0, rb.x1, rb.y1);
+	}
+	if (ra.y1 < rb.y1) {
+		result[(*count)++] = make_drect (rb.x0, ra.y1, rb.x1, rb.y1);
+	}
+}
+
+static void
+diff_rects (ArtDRect r1, ArtDRect r2, int *count, ArtDRect result[4])
+{
+	g_assert (count != NULL);
+	g_assert (result != NULL);
+
+	*count = 0;
+
+	if (rects_intersect (r1, r2)) {
+		diff_rects_guts (r1, r2, count, result);
+		diff_rects_guts (r2, r1, count, result);
+	} else {
+		if (!art_drect_empty (&r1)) {
+			result[(*count)++] = r1;
+		}
+		if (!art_drect_empty (&r2)) {
+			result[(*count)++] = r2;
+		}
+	}
+}
diff --git a/libgthumb/eel-canvas-rect.h b/libgthumb/eel-canvas-rect.h
new file mode 100644
index 0000000..d5b3017
--- /dev/null
+++ b/libgthumb/eel-canvas-rect.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+
+/* eel-canvas-rect.h: rectangle canvas item with AA support.
+
+   Copyright (C) 2002 Alexander Larsson.
+
+   The Gnome Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The Gnome Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the Gnome Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+
+   Authors: Alexander Larsson <alla lysator liu se>
+*/
+
+#ifndef EEL_CANVAS_RECT_H
+#define EEL_CANVAS_RECT_H
+
+#include <libgnomecanvas/gnome-canvas.h>
+
+G_BEGIN_DECLS
+
+#define EEL_TYPE_CANVAS_RECT            (eel_canvas_rect_get_type ())
+#define EEL_CANVAS_RECT(obj)            (GTK_CHECK_CAST ((obj), EEL_TYPE_CANVAS_RECT, EelCanvasRect))
+#define EEL_CANVAS_RECT_CLASS(klass)    (GTK_CHECK_CLASS_CAST ((klass), EEL_TYPE_CANVAS_RECT, EelCanvasRectClass))
+#define EEL_IS_CANVAS_RECT(obj)         (GTK_CHECK_TYPE ((obj), EEL_TYPE_CANVAS_RECT))
+
+typedef struct EelCanvasRectDetails EelCanvasRectDetails;
+
+typedef struct
+{
+	GnomeCanvasItem item;
+	EelCanvasRectDetails *details;
+} EelCanvasRect;
+
+typedef struct
+{
+	GnomeCanvasItemClass parent_class;
+} EelCanvasRectClass;
+
+GType      eel_canvas_rect_get_type (void);
+
+G_END_DECLS
+
+#endif /* EEL_CANVAS_RECT_H */
diff --git a/libgthumb/jpegutils/Makefile.am b/libgthumb/jpegutils/Makefile.am
index 2574f9f..5cfe3c3 100644
--- a/libgthumb/jpegutils/Makefile.am
+++ b/libgthumb/jpegutils/Makefile.am
@@ -1,9 +1,15 @@
+if ENABLE_DEPRECATIONS
+DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED
+else
+DISABLE_DEPRECATED =
+endif
+
 INCLUDES = 				\
 	-I$(top_srcdir)/libgthumb	\
 	$(DISABLE_DEPRECATED)		\
-	$(WARNINGS)			\
 	$(GTHUMB_CFLAGS)
 
+
 noinst_LTLIBRARIES = libgthumb-jpegutils.la
 
 libgthumb_jpegutils_la_SOURCES =	\
diff --git a/src/Makefile.am b/src/Makefile.am
index 2e6d44a..8f32f22 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,13 +3,24 @@ DIST_SUBDIRS = icons
 
 gladedir = $(datadir)/gthumb/glade
 
+if ENABLE_DEPRECATIONS
+DISABLE_DEPRECATED = -DG_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGNOME_VFS_DISABLE_DEPRECATED -DGNOME_DISABLE_DEPRECATED
+else
+DISABLE_DEPRECATED =
+endif
+
+WARNINGS = -Wall -Wimplicit -Wunused-label \
+	   -Wpointer-arith -Wcast-align -Wtype-limits \
+	   -Wclobbered -Wempty-body -Wignored-qualifiers
+
 INCLUDES =					\
 	-I$(top_srcdir)/libgthumb		\
+	-I../libgthumb				\
 	$(GTHUMB_CFLAGS)			\
+	$(DISABLE_DEPRECATED)			\
 	$(GPHOTO_CFLAGS)			\
 	$(IGE_MAC_INTEGRATION_CFLAGS)		\
 	$(GTKUNIQUE_CFLAGS)			\
-	$(DISABLE_DEPRECATED)			\
 	$(WARNINGS)       			\
 	-DGTHUMB_PREFIX=\"$(prefix)\"		\
 	-DGTHUMB_SYSCONFDIR=\"$(sysconfdir)\"	\
@@ -138,26 +149,7 @@ gthumb_SOURCES = 				\
 	totem-scrsaver.c			\
 	totem-scrsaver.h			\
 	rotation-utils.c			\
-	rotation-utils.h 			\
-	dlg-duplicates.c 			\
-	dlg-duplicates.h 			\
-	dlg-jpegtran.c 				\
-	dlg-jpegtran.h 				\
-	catalog-png-exporter.c			\
-	catalog-png-exporter.h			\
-	dlg-png-exporter.c			\
-	dlg-png-exporter.h 			\
-	dlg-search.c 				\
-	dlg-search.h 				\
-	albumtheme.c				\
-	albumtheme-private.c			\
-	albumtheme-private.h			\
-	catalog-web-exporter.c			\
-	catalog-web-exporter.h			\
-	dlg-web-exporter.c			\
-	dlg-web-exporter.h      		\
-	dlg-photo-importer.c    		\
-	dlg-photo-importer.h
+	rotation-utils.h
 
 if PLATFORM_WIN32
 gthumb_LDFLAGS = -Wl,--export-all-symbols,--out-implib,.libs/gthumb.exe.a
@@ -172,8 +164,59 @@ gthumb_LDADD = 					\
 	$(RENDER_LIBS)				\
 	$(GPHOTO_LIBS)				\
 	$(IGE_MAC_INTEGRATION_LIBS)		\
-	$(XTEST_LIBS)
+	$(XF86GAMMA_LIBS)			\
+	$(XTEST_LIBS)				\
+	$(GTKUNIQUE_LIBS)
+
+moduledir = $(libdir)/gthumb/modules
+module_LTLIBRARIES = 		\
+	libduplicates.la	\
+	libjpegtran.la		\
+	libpngexporter.la	\
+	libsearch.la		\
+	libwebexporter.la	\
+	libphotoimporter.la
+
+libduplicates_la_SOURCES = dlg-duplicates.c dlg-duplicates.h
+libduplicates_la_LDFLAGS = $(MODULE_LIBTOOL_FLAGS)
+libduplicates_la_LIBADD = $(top_builddir)/libgthumb/libgthumb.la $(JPEG_LIBS) $(PNG_LIBS) $(TIFF_LIBS) $(GTHUMB_LIBS)
+libduplicates_la_DEPENDENCIES = gthumb$(EXEEXT)
+
+libjpegtran_la_SOURCES = dlg-jpegtran.c dlg-jpegtran.h
+libjpegtran_la_LDFLAGS = $(MODULE_LIBTOOL_FLAGS)
+libjpegtran_la_LIBADD  = $(top_builddir)/libgthumb/jpegutils/libgthumb-jpegutils.la $(top_builddir)/libgthumb/libgthumb.la $(JPEG_LIBS) $(GTHUMB_LIBS)
+libjpegtran_la_DEPENDENCIES = gthumb$(EXEEXT)
+
+libpngexporter_la_SOURCES = 	\
+	catalog-png-exporter.c	\
+	catalog-png-exporter.h	\
+	dlg-png-exporter.c	\
+	dlg-png-exporter.h
+libpngexporter_la_LDFLAGS = $(MODULE_LIBTOOL_FLAGS)
+libpngexporter_la_LIBADD = $(top_builddir)/libgthumb/libgthumb.la $(GTHUMB_LIBS) $(PNG_LIBS)
+libpngexporter_la_DEPENDENCIES = gthumb$(EXEEXT)
+
+libsearch_la_SOURCES = dlg-search.c dlg-search.h
+libsearch_la_LDFLAGS = $(MODULE_LIBTOOL_FLAGS)
+libsearch_la_LIBADD = $(top_builddir)/libgthumb/libgthumb.la $(JPEG_LIBS) $(TIFF_LIBS) $(PNG_LIBS) $(GTHUMB_LIBS)
+libsearch_la_DEPENDENCIES = gthumb$(EXEEXT)
+
+libwebexporter_la_SOURCES = 	\
+	albumtheme.c		\
+	albumtheme-private.c	\
+	albumtheme-private.h	\
+	catalog-web-exporter.c	\
+	catalog-web-exporter.h	\
+	dlg-web-exporter.c	\
+	dlg-web-exporter.h
+libwebexporter_la_LDFLAGS = $(MODULE_LIBTOOL_FLAGS)
+libwebexporter_la_LIBADD = $(top_builddir)/libgthumb/libgthumb.la $(GTHUMB_LIBS)
+libwebexporter_la_DEPENDENCIES = gthumb$(EXEEXT)
 
+libphotoimporter_la_SOURCES = dlg-photo-importer.c dlg-photo-importer.h
+libphotoimporter_la_LDFLAGS = $(MODULE_LIBTOOL_FLAGS)
+libphotoimporter_la_LIBADD  = $(top_builddir)/libgthumb/jpegutils/libgthumb-jpegutils.la $(top_builddir)/libgthumb/libgthumb.la $(GTHUMB_LIBS) $(JPEG_LIBS) $(GPHOTO_LIBS)
+libphotoimporter_la_DEPENDENCIES = gthumb$(EXEEXT)
 
 AUTHORS.tab : $(top_srcdir)/AUTHORS
 	sed -e 's/^/"/' -e 's/$$/",/' < $(top_srcdir)/AUTHORS > $  tmp
diff --git a/src/dlg-photo-importer.c b/src/dlg-photo-importer.c
index 1dc1db9..2764710 100644
--- a/src/dlg-photo-importer.c
+++ b/src/dlg-photo-importer.c
@@ -961,48 +961,15 @@ autodetect_camera (DialogData *data)
 	gboolean    detected = FALSE;
 	const char *model = NULL, *port = NULL;
 
-	GList	   *gvfs_dirs = NULL;
-	GList      *scan;
-	char       *gvfs_base;
-
 	data->current_op = GTH_IMPORTER_OP_AUTO_DETECT;
 
 	gp_list_new (&list);
 
-	/* Detect gvfs-gphoto2 mounts */
-	gvfs_base = g_strconcat (g_get_home_dir(), "/.gvfs", NULL);
-	path_list_new (gvfs_base, NULL, &gvfs_dirs);
-	for (scan = gvfs_dirs; scan; scan=scan->next) {
-		char *dir = (gchar*) scan->data;
-		FileData *fd = file_data_new (dir);
-		if (strstr (dir, "gphoto2") && file_data_has_local_path (fd, NULL)) {
-			if (strlen (fd->local_path) > 63) {
-				g_warning ("Can't fit %s into a 64 byte string!",fd->local_path);
-			} else {
-				GPPortInfo pi;
-				pi.type = GP_PORT_DISK;
-				g_strlcpy (pi.path, fd->local_path, sizeof (pi.path));
-				gp_port_info_list_append (data->port_list, pi);
-				printf ("port found %s\n",g_strconcat ("disk:",pi.path,NULL));
-			}
-		}
-		file_data_unref (fd);
-	}			
-
 	gp_abilities_list_detect (data->abilities_list,
 				  data->port_list,
 				  list,
 				  data->context);
-
 	count = gp_list_count (list);
-
-int i;
-for (i=0; i<count; i++) {
-gp_list_get_name (list, 0, &model);
-gp_list_get_value (list, 0, &port);
-printf ("%s %s\n",model,port);
-}
-
 	if (count >= 1) {
 		gp_list_get_name (list, 0, &model);
 		gp_list_get_value (list, 0, &port);
diff --git a/src/main.h b/src/main.h
index 6c2e776..5755aa2 100644
--- a/src/main.h
+++ b/src/main.h
@@ -23,11 +23,19 @@
 #ifndef __MAIN_H__
 #define __MAIN_H__
 
+#ifdef HAVE_GTKUNIQUE
+#include <gtkunique/gtkunique.h>
+#endif /* HAVE_GTKUNIQUE */
+
 #include "image-viewer.h"
 #include "gth-monitor.h"
 #include "gth-window.h"
 #include "preferences.h"
 
+#ifdef HAVE_GTKUNIQUE
+extern GtkUniqueApp     *gth_application;
+#endif /* HAVE_GTKUNIQUE */
+
 extern GthWindow        *current_window;
 extern GthMonitor       *gth_monitor;
 extern Preferences       preferences;



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