[gthumb: 19/22] moved the shared importer code in an new extension



commit 626f79f51a7fd482a95982760f13e9ebdcea2556
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Jan 30 14:22:20 2010 +0100

    moved the shared importer code in an new extension

 configure.ac                                       |    3 +
 extensions/Makefile.am                             |    1 +
 extensions/importer/Makefile.am                    |   66 ++++++++++
 extensions/importer/data/Makefile.am               |   18 +++
 .../importer/data/gthumb-importer.schemas.in       |   96 ++++++++++++++
 extensions/importer/data/ui/Makefile.am            |    5 +
 .../importer/data}/ui/import-preferences.ui        |    0
 .../importer}/gth-import-preferences-dialog.c      |  120 +-----------------
 .../importer}/gth-import-preferences-dialog.h      |   13 +--
 .../{photo_importer => importer}/gth-import-task.c |   17 ++--
 .../{photo_importer => importer}/gth-import-task.h |   35 ++---
 extensions/importer/importer.extension.in.in       |    7 +
 extensions/importer/importer.h                     |   33 +++++
 extensions/importer/main.c                         |   51 ++++++++
 extensions/importer/preferences.h                  |   40 ++++++
 extensions/importer/utils.c                        |  133 ++++++++++++++++++++
 extensions/importer/utils.h                        |   54 ++++++++
 extensions/jpeg_utils/jpeg_utils.extension.in.in   |    2 +-
 extensions/photo_importer/Makefile.am              |   43 +------
 extensions/photo_importer/dlg-photo-importer.c     |    3 +-
 .../photo_importer/photo_importer.extension.in.in  |    2 +-
 extensions/photo_importer/preferences.h            |    6 +-
 extensions/picasaweb/Makefile.am                   |    2 +-
 extensions/picasaweb/dlg-import-from-picasaweb.c   |   82 +++++-------
 extensions/picasaweb/picasa-web-album.c            |   21 +++
 extensions/picasaweb/picasa-web-album.h            |    3 +
 extensions/picasaweb/picasa-web-photo.c            |    3 -
 extensions/picasaweb/picasaweb.extension.in.in     |    1 +
 gthumb/Makefile.am                                 |    2 -
 gthumb/dlg-extensions.c                            |    2 +-
 gthumb/gth-extensions.c                            |    1 +
 gthumb/gth-extensions.h                            |    1 +
 gthumb/gth-main.c                                  |    3 +-
 gthumb/gth-preferences.h                           |    8 --
 gthumb/typedefs.h                                  |   15 ---
 po/POTFILES.in                                     |   53 ++++++++-
 36 files changed, 662 insertions(+), 283 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 564d023..52e6341 100644
--- a/configure.ac
+++ b/configure.ac
@@ -398,6 +398,9 @@ extensions/image_rotation/Makefile
 extensions/image_viewer/Makefile
 extensions/image_viewer/data/Makefile
 extensions/image_viewer/data/ui/Makefile
+extensions/importer/Makefile
+extensions/importer/data/Makefile
+extensions/importer/data/ui/Makefile
 extensions/jpeg_utils/Makefile
 extensions/list_tools/Makefile
 extensions/list_tools/data/Makefile
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 6523a1d..80c141a 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -12,6 +12,7 @@ SUBDIRS = 			\
 	image_print		\
 	image_rotation		\
 	image_viewer		\
+	importer		\
 	jpeg_utils		\
 	list_tools		\
 	photo_importer		\
diff --git a/extensions/importer/Makefile.am b/extensions/importer/Makefile.am
new file mode 100644
index 0000000..4507b41
--- /dev/null
+++ b/extensions/importer/Makefile.am
@@ -0,0 +1,66 @@
+SUBDIRS = data
+
+extensiondir = $(pkglibdir)/extensions
+extension_LTLIBRARIES = libimporter.la
+
+ENUM_TYPES =					\
+	gth-import-enum-types.h			\
+	gth-import-enum-types.c
+
+HEADER_FILES = 					\
+	gth-import-preferences-dialog.h		\
+	gth-import-task.h			\
+	preferences.h				\
+	utils.h
+
+gth-import-enum-types.h: $(HEADER_FILES) $(GLIB_MKENUMS)
+	$(AM_V_GEN)( $(GLIB_MKENUMS) \
+		--fhead "#ifndef ENUM_TYPES_H\n#define ENUM_TYPES_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
+		--fprod "/* enumerations from \"@filename \" */\n" \
+		--vhead "GType @enum_name _get_type (void);\n#define GTH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
+		--ftail "G_END_DECLS\n\n#endif /* ENUM_TYPES_H */" \
+		$^> xgen-$(@F) \
+	&& (cmp -s xgen-$(@F) gth-import-enum-types.h || cp xgen-$(@F) gth-import-enum-types.h ) \
+	&& rm -f xgen-$(@F) )
+
+gth-import-enum-types.c: $(HEADER_FILES) gth-import-enum-types.h
+	$(AM_V_GEN)( $(GLIB_MKENUMS) \
+		--fhead "#include <glib-object.h>\n" \
+		--fprod "\n/* enumerations from \"@filename \" */\n#include \"@filename \"" \
+		--vhead "GType\n enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G Type@Value values[] = {" \
+		--vprod "      { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
+		--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_ type@_register_static (\"@EnumName \", values);\n  }\n  return etype;\n}\n" \
+		$^> xgen-$(@F) \
+	&& (cmp -s xgen-$(@F) gth-import-enum-types.c || cp xgen-$(@F) gth-import-enum-types.c ) \
+	&& rm -f xgen-$(@F) )
+
+libimporter_la_SOURCES = 			\
+	$(ENUM_TYPES)				\
+	$(HEADER_FILES)				\
+	gth-import-preferences-dialog.c		\
+	gth-import-task.c			\
+	importer.h				\
+	main.c					\
+	utils.c
+
+libimporter_la_CFLAGS = $(GTHUMB_CFLAGS) -I$(top_srcdir) -I$(top_builddir)/gthumb 
+libimporter_la_LDFLAGS = $(EXTENSION_LIBTOOL_FLAGS)
+libimporter_la_LIBADD = $(GTHUMB_LIBS)
+libimporter_la_DEPENDENCIES = $(top_builddir)/gthumb/gthumb$(EXEEXT)
+
+extensioninidir = $(extensiondir)
+extensionini_in_files = importer.extension.in.in
+extensionini_DATA = $(extensionini_in_files:.extension.in.in=.extension)
+
+%.extension.in: %.extension.in.in $(extension_LTLIBRARIES)
+	$(AM_V_GEN)( sed -e "s|%LIBRARY%|`. ./$(extension_LTLIBRARIES) && echo $$dlname`|" \
+	$< > $@ )
+
+%.extension: %.extension.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
+
+EXTRA_DIST = $(extensionini_in_files) 
+BUILT_SOURCES = $(ENUM_TYPES)
+CLEANFILES = $(BUILT_SOURCES)
+DISTCLEANFILES = $(extensionini_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/importer/data/Makefile.am b/extensions/importer/data/Makefile.am
new file mode 100644
index 0000000..64af671
--- /dev/null
+++ b/extensions/importer/data/Makefile.am
@@ -0,0 +1,18 @@
+SUBDIRS = ui
+
+schemadir = @GCONF_SCHEMA_FILE_DIR@
+schema_in_files = gthumb-importer.schemas.in
+schema_DATA = $(schema_in_files:.schemas.in=.schemas)
+
+ INTLTOOL_SCHEMAS_RULE@
+
+if GCONF_SCHEMAS_INSTALL
+install-data-local:
+	GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/extensions/importer/data/$(schema_DATA)
+endif
+
+EXTRA_DIST = $(schema_in_files)
+
+CLEANFILES = $(schema_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/importer/data/gthumb-importer.schemas.in b/extensions/importer/data/gthumb-importer.schemas.in
new file mode 100644
index 0000000..4054ed3
--- /dev/null
+++ b/extensions/importer/data/gthumb-importer.schemas.in
@@ -0,0 +1,96 @@
+<gconfschemafile>
+    <schemalist>
+
+      <schema>
+	<key>/schemas/apps/gthumb/ext/importer/destination</key>
+	<applyto>/apps/gthumb/ext/importer/destination</applyto>
+	<owner>gthumb</owner>
+	<type>string</type>
+	<default></default>
+	<locale name="C">
+	  <short></short>
+	  <long>
+	  </long>
+	</locale>
+      </schema>
+
+      <schema>
+	<key>/schemas/apps/gthumb/ext/importer/subfolder_type</key>
+	<applyto>/apps/gthumb/ext/importer/subfolder_type</applyto>
+	<owner>gthumb</owner>
+	<type>string</type>
+	<default>none</default>
+	<locale name="C">
+	  <short></short>
+	  <long>Possible values are: none, file_date, current_date
+	  </long>
+	</locale>
+      </schema>
+
+      <schema>
+	<key>/schemas/apps/gthumb/ext/importer/subfolder_format</key>
+	<applyto>/apps/gthumb/ext/importer/subfolder_format</applyto>
+	<owner>gthumb</owner>
+	<type>string</type>
+	<default>yyyymmdd</default>
+	<locale name="C">
+	  <short></short>
+	  <long>Possible values are: yyyymmdd, yyyymm, yyyy
+	  </long>
+	</locale>
+      </schema>
+
+      <schema>
+        <key>/schemas/apps/gthumb/ext/importer/subfolder_single</key>
+        <applyto>/apps/gthumb/ext/importer/subfolder_single</applyto>
+        <owner>gthumb</owner>
+        <type>bool</type>
+        <default>FALSE</default>
+        <locale name="C">
+          <short></short>
+          <long>
+          </long>
+        </locale>
+      </schema>
+
+      <schema>
+        <key>/schemas/apps/gthumb/ext/importer/subfolder_custom_format</key>
+        <applyto>/apps/gthumb/ext/importer/subfolder_custom_format</applyto>
+        <owner>gthumb</owner>
+        <type>string</type>
+        <default></default>
+        <locale name="C">
+          <short></short>
+          <long>
+          </long>
+        </locale>
+      </schema>
+
+      <schema>
+	<key>/schemas/apps/gthumb/ext/importer/overwrite_files</key>
+	<applyto>/apps/gthumb/ext/importer/overwrite_files</applyto>
+	<owner>gthumb</owner>
+	<type>bool</type>
+	<default>FALSE</default>
+	<locale name="C">
+	  <short></short>
+	  <long>
+	  </long>
+	</locale>
+      </schema>
+
+      <schema>
+	<key>/schemas/apps/gthumb/ext/importer/adjust_orientation</key>
+	<applyto>/apps/gthumb/ext/importer/adjust_orientation</applyto>
+	<owner>gthumb</owner>
+	<type>bool</type>
+	<default>FALSE</default>
+	<locale name="C">
+	  <short></short>
+	  <long>
+	  </long>
+	</locale>
+      </schema>
+
+    </schemalist>
+</gconfschemafile>
diff --git a/extensions/importer/data/ui/Makefile.am b/extensions/importer/data/ui/Makefile.am
new file mode 100644
index 0000000..062ed7e
--- /dev/null
+++ b/extensions/importer/data/ui/Makefile.am
@@ -0,0 +1,5 @@
+uidir = $(pkgdatadir)/ui
+ui_DATA = import-preferences.ui
+EXTRA_DIST = $(ui_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/data/ui/import-preferences.ui b/extensions/importer/data/ui/import-preferences.ui
similarity index 100%
rename from data/ui/import-preferences.ui
rename to extensions/importer/data/ui/import-preferences.ui
diff --git a/gthumb/gth-import-preferences-dialog.c b/extensions/importer/gth-import-preferences-dialog.c
similarity index 82%
rename from gthumb/gth-import-preferences-dialog.c
rename to extensions/importer/gth-import-preferences-dialog.c
index cda4346..dc9a6f5 100644
--- a/gthumb/gth-import-preferences-dialog.c
+++ b/extensions/importer/gth-import-preferences-dialog.c
@@ -22,15 +22,10 @@
 
 #include <config.h>
 #include <glib/gi18n.h>
+#include "gth-import-enum-types.h"
 #include "gth-import-preferences-dialog.h"
-#include "gth-enum-types.h"
-#include "gth-file-data.h"
-#include "gth-metadata.h"
-#include "gth-preferences.h"
-#include "gtk-utils.h"
-#include "gconf-utils.h"
-#include "glib-utils.h"
-#include "typedefs.h"
+#include "preferences.h"
+#include "utils.h"
 
 
 #define GET_WIDGET(x) (_gtk_builder_get_widget (self->priv->builder, (x)))
@@ -300,7 +295,7 @@ gth_import_preferences_dialog_init (GthImportPreferencesDialog *self)
 	char             *custom_format;
 
 	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_IMPORT_PREFERENCES_DIALOG, GthImportPreferencesDialogPrivate);
-	self->priv->builder = _gtk_builder_new_from_file ("import-preferences.ui", NULL);
+	self->priv->builder = _gtk_builder_new_from_file ("import-preferences.ui", "importer");
 
 	gtk_window_set_title (GTK_WINDOW (self), _("Preferences"));
 	gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
@@ -442,110 +437,3 @@ gth_import_preferences_dialog_set_event (GthImportPreferencesDialog *self,
 	g_free (self->priv->event);
 	self->priv->event = g_strdup (event);
 }
-
-
-GFile *
-gth_import_preferences_get_destination (void)
-{
-	char  *last_destination;
-	GFile *folder;
-
-	last_destination = eel_gconf_get_string (PREF_IMPORT_DESTINATION, NULL);
-	if ((last_destination == NULL) || (*last_destination == 0)) {
-		char *default_path;
-
-		default_path = xdg_user_dir_lookup ("PICTURES");
-		folder = g_file_new_for_path (default_path);
-
-		g_free (default_path);
-	}
-	else
-		folder = g_file_new_for_uri (last_destination);
-
-	g_free (last_destination);
-
-	return folder;
-}
-
-
-GFile *
-gth_import_utils_get_file_destination (GthFileData        *file_data,
-				       GFile              *destination,
-				       GthSubfolderType    subfolder_type,
-				       GthSubfolderFormat  subfolder_format,
-				       gboolean            single_subfolder,
-				       const char         *custom_format,
-				       const char         *event_name)
-{
-	GTimeVal  timeval;
-	char     *child;
-	GFile    *file_destination;
-
-	if (subfolder_type == GTH_SUBFOLDER_TYPE_FILE_DATE) {
-		GthMetadata *metadata;
-
-		metadata = (GthMetadata *) g_file_info_get_attribute_object (file_data->info, "Embedded::Photo::DateTimeOriginal");
-		if (metadata != NULL)
-			_g_time_val_from_exif_date (gth_metadata_get_raw (metadata), &timeval);
-		else
-			subfolder_type = GTH_SUBFOLDER_TYPE_CURRENT_DATE;
-	}
-
-	if (subfolder_type == GTH_SUBFOLDER_TYPE_CURRENT_DATE)
-		g_get_current_time (&timeval);
-
-	switch (subfolder_type) {
-	case GTH_SUBFOLDER_TYPE_FILE_DATE:
-	case GTH_SUBFOLDER_TYPE_CURRENT_DATE:
-		if (subfolder_format != GTH_SUBFOLDER_FORMAT_CUSTOM) {
-			GDate  *date;
-			char  **parts;
-
-			date = g_date_new ();
-			g_date_set_time_val (date, &timeval);
-
-			parts = g_new0 (char *, 4);
-			parts[0] = g_strdup_printf ("%04d", g_date_get_year (date));
-			if (subfolder_format != GTH_SUBFOLDER_FORMAT_YYYY) {
-				parts[1] = g_strdup_printf ("%02d", g_date_get_month (date));
-				if (subfolder_format != GTH_SUBFOLDER_FORMAT_YYYYMM)
-					parts[2] = g_strdup_printf ("%02d", g_date_get_day (date));
-			}
-
-			if (single_subfolder)
-				child = g_strjoinv ("-", parts);
-			else
-				child = g_strjoinv ("/", parts);
-
-			g_strfreev (parts);
-			g_date_free (date);
-		}
-		else {
-			char *format = NULL;
-
-			if (event_name != NULL) {
-				GRegex *re;
-
-				re = g_regex_new ("%E", 0, 0, NULL);
-				format = g_regex_replace_literal (re, custom_format, -1, 0, event_name, 0, NULL);
-
-				g_regex_unref (re);
-			}
-			if (format == NULL)
-				format = g_strdup (custom_format);
-			child = _g_time_val_strftime (&timeval, format);
-
-			g_free (format);
-		}
-		break;
-
-	case GTH_SUBFOLDER_TYPE_NONE:
-		child = NULL;
-		break;
-	}
-	file_destination = _g_file_append_path (destination, child);
-
-	g_free (child);
-
-	return file_destination;
-}
diff --git a/gthumb/gth-import-preferences-dialog.h b/extensions/importer/gth-import-preferences-dialog.h
similarity index 84%
rename from gthumb/gth-import-preferences-dialog.h
rename to extensions/importer/gth-import-preferences-dialog.h
index 27c94fb..e0bb499 100644
--- a/gthumb/gth-import-preferences-dialog.h
+++ b/extensions/importer/gth-import-preferences-dialog.h
@@ -24,8 +24,8 @@
 #define GTH_IMPORT_PREFERENCES_DIALOG_H
 
 #include <gtk/gtk.h>
-#include "gth-file-data.h"
-#include "typedefs.h"
+#include <gthumb.h>
+#include "gth-import-task.h"
 
 G_BEGIN_DECLS
 
@@ -53,15 +53,6 @@ GType        gth_import_preferences_dialog_get_type  (void);
 GtkWidget *  gth_import_preferences_dialog_new       (void);
 void         gth_import_preferences_dialog_set_event (GthImportPreferencesDialog *self,
 						      const char                 *event);
-GFile *      gth_import_preferences_get_destination  (void);
-GFile *      gth_import_utils_get_file_destination   (GthFileData        *file_data,
-						      GFile              *destination,
-						      GthSubfolderType    subfolder_type,
-						      GthSubfolderFormat  subfolder_format,
-						      gboolean            single_subfolder,
-						      const char         *custom_format,
-						      const char         *event_name);
-
 
 G_END_DECLS
 
diff --git a/extensions/photo_importer/gth-import-task.c b/extensions/importer/gth-import-task.c
similarity index 97%
rename from extensions/photo_importer/gth-import-task.c
rename to extensions/importer/gth-import-task.c
index 89409b7..ff7155f 100644
--- a/extensions/photo_importer/gth-import-task.c
+++ b/extensions/importer/gth-import-task.c
@@ -24,6 +24,7 @@
 #include <extensions/catalogs/gth-catalog.h>
 #include <extensions/image_rotation/rotation-utils.h>
 #include "gth-import-task.h"
+#include "utils.h"
 
 
 #define IMPORTED_KEY "imported"
@@ -223,7 +224,7 @@ copy_ready_cb (GError   *error,
 		return;
 	}
 
-	if (self->priv->adjust_orientation) {
+	if (self->priv->adjust_orientation && gth_main_extension_is_active ("image_rotation")) {
 		GthMetadata *metadata;
 
 		metadata = (GthMetadata *) g_file_info_get_attribute_object (self->priv->destination_file->info, "Embedded::Image::Orientation");
@@ -313,13 +314,13 @@ file_info_ready_cb (GList    *files,
 	file_data = self->priv->current->data;
 	self->priv->current_file_size = g_file_info_get_size (file_data->info);
 
-	destination = gth_import_task_get_file_destination (file_data,
-							    self->priv->destination,
-							    self->priv->subfolder_type,
-							    self->priv->subfolder_format,
-							    self->priv->single_subfolder,
-							    self->priv->custom_format,
-							    self->priv->event_name);
+	destination = gth_import_utils_get_file_destination (file_data,
+							     self->priv->destination,
+							     self->priv->subfolder_type,
+							     self->priv->subfolder_format,
+							     self->priv->single_subfolder,
+							     self->priv->custom_format,
+							     self->priv->event_name);
 	if (! g_file_make_directory_with_parents (destination, gth_task_get_cancellable (GTH_TASK (self)), &error)) {
 		if (! g_error_matches (error, G_IO_ERROR, G_IO_ERROR_EXISTS)) {
 			gth_task_completed (GTH_TASK (self), error);
diff --git a/extensions/photo_importer/gth-import-task.h b/extensions/importer/gth-import-task.h
similarity index 64%
rename from extensions/photo_importer/gth-import-task.h
rename to extensions/importer/gth-import-task.h
index 42825e3..3c7c9ed 100644
--- a/extensions/photo_importer/gth-import-task.h
+++ b/extensions/importer/gth-import-task.h
@@ -25,7 +25,7 @@
 
 #include <glib.h>
 #include <gthumb.h>
-#include "preferences.h"
+#include "utils.h"
 
 G_BEGIN_DECLS
 
@@ -49,26 +49,19 @@ struct _GthImportTaskClass {
 	GthTaskClass __parent;
 };
 
-GType       gth_import_task_get_type               (void);
-GthTask *   gth_import_task_new                    (GthBrowser         *browser,
-						    GList              *files, /* GthFileData list */
-						    GFile              *destination,
-						    GthSubfolderType    subfolder_type,
-						    GthSubfolderFormat  subfolder_format,
-						    gboolean            single_subfolder,
-						    const char         *custom_format,
-						    const char         *event_name,
-						    char              **tags,
-						    gboolean            delete_imported,
-						    gboolean            overwrite_files,
-						    gboolean            adjust_orientation);
-GFile *     gth_import_task_get_file_destination   (GthFileData        *file_data,
-					            GFile              *destination,
-					            GthSubfolderType    subfolder_type,
-					            GthSubfolderFormat  subfolder_format,
-					            gboolean            single_subfolder,
-					            const char         *custom_format,
-						    const char         *event_name);
+GType       gth_import_task_get_type   (void);
+GthTask *   gth_import_task_new        (GthBrowser         *browser,
+					GList              *files, /* GthFileData list */
+					GFile              *destination,
+					GthSubfolderType    subfolder_type,
+					GthSubfolderFormat  subfolder_format,
+					gboolean            single_subfolder,
+					const char         *custom_format,
+					const char         *event_name,
+					char              **tags,
+					gboolean            delete_imported,
+					gboolean            overwrite_files,
+					gboolean            adjust_orientation);
 
 G_END_DECLS
 
diff --git a/extensions/importer/importer.extension.in.in b/extensions/importer/importer.extension.in.in
new file mode 100644
index 0000000..4c27d27
--- /dev/null
+++ b/extensions/importer/importer.extension.in.in
@@ -0,0 +1,7 @@
+[Extension]
+Hidden=true
+
+[Loader]
+Type=module
+File=%LIBRARY%
+After=catalogs
diff --git a/extensions/importer/importer.h b/extensions/importer/importer.h
new file mode 100644
index 0000000..8a18ee1
--- /dev/null
+++ b/extensions/importer/importer.h
@@ -0,0 +1,33 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef IMPORTER_H
+#define IMPORTER_H
+
+#include "extensions/importer/gth-import-enum-types.h"
+#include "extensions/importer/gth-import-preferences-dialog.h"
+#include "extensions/importer/gth-import-task.h"
+#include "extensions/importer/preferences.h"
+#include "extensions/importer/utils.h"
+
+#endif /* IMPORTER_H */
diff --git a/extensions/importer/main.c b/extensions/importer/main.c
new file mode 100644
index 0000000..c79dff1
--- /dev/null
+++ b/extensions/importer/main.c
@@ -0,0 +1,51 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+
+#include <config.h>
+#include <gtk/gtk.h>
+#include <gthumb.h>
+
+
+G_MODULE_EXPORT void
+gthumb_extension_activate (void)
+{
+}
+
+
+G_MODULE_EXPORT void
+gthumb_extension_deactivate (void)
+{
+}
+
+
+G_MODULE_EXPORT gboolean
+gthumb_extension_is_configurable (void)
+{
+	return FALSE;
+}
+
+
+G_MODULE_EXPORT void
+gthumb_extension_configure (GtkWindow *parent)
+{
+}
diff --git a/extensions/importer/preferences.h b/extensions/importer/preferences.h
new file mode 100644
index 0000000..b1cc126
--- /dev/null
+++ b/extensions/importer/preferences.h
@@ -0,0 +1,40 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2009 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef IMPORTER_PREFERENCES_H
+#define IMPORTER_PREFERENCES_H
+
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define PREF_IMPORT_DESTINATION             "/apps/gthumb/ext/importer/destination"
+#define PREF_IMPORT_SUBFOLDER_TYPE          "/apps/gthumb/ext/importer/subfolder_type"
+#define PREF_IMPORT_SUBFOLDER_FORMAT        "/apps/gthumb/ext/importer/subfolder_format"
+#define PREF_IMPORT_SUBFOLDER_SINGLE        "/apps/gthumb/ext/importer/subfolder_single"
+#define PREF_IMPORT_SUBFOLDER_CUSTOM_FORMAT "/apps/gthumb/ext/importer/subfolder_custom_format"
+#define PREF_IMPORT_OVERWRITE               "/apps/gthumb/ext/importer/overwrite_files"
+#define PREF_IMPORT_ADJUST_ORIENTATION      "/apps/gthumb/ext/importer/adjust_orientation"
+
+G_END_DECLS
+
+#endif /* IMPORTER_PREFERENCES_H */
diff --git a/extensions/importer/utils.c b/extensions/importer/utils.c
new file mode 100644
index 0000000..48f3546
--- /dev/null
+++ b/extensions/importer/utils.c
@@ -0,0 +1,133 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+
+#include <config.h>
+#include "preferences.h"
+#include "utils.h"
+
+
+GFile *
+gth_import_preferences_get_destination (void)
+{
+	char  *last_destination;
+	GFile *folder;
+
+	last_destination = eel_gconf_get_string (PREF_IMPORT_DESTINATION, NULL);
+	if ((last_destination == NULL) || (*last_destination == 0)) {
+		char *default_path;
+
+		default_path = xdg_user_dir_lookup ("PICTURES");
+		folder = g_file_new_for_path (default_path);
+
+		g_free (default_path);
+	}
+	else
+		folder = g_file_new_for_uri (last_destination);
+
+	g_free (last_destination);
+
+	return folder;
+}
+
+
+GFile *
+gth_import_utils_get_file_destination (GthFileData        *file_data,
+				       GFile              *destination,
+				       GthSubfolderType    subfolder_type,
+				       GthSubfolderFormat  subfolder_format,
+				       gboolean            single_subfolder,
+				       const char         *custom_format,
+				       const char         *event_name)
+{
+	GTimeVal  timeval;
+	char     *child;
+	GFile    *file_destination;
+
+	if (subfolder_type == GTH_SUBFOLDER_TYPE_FILE_DATE) {
+		GthMetadata *metadata;
+
+		metadata = (GthMetadata *) g_file_info_get_attribute_object (file_data->info, "Embedded::Photo::DateTimeOriginal");
+		if (metadata != NULL)
+			_g_time_val_from_exif_date (gth_metadata_get_raw (metadata), &timeval);
+		else
+			subfolder_type = GTH_SUBFOLDER_TYPE_CURRENT_DATE;
+	}
+
+	if (subfolder_type == GTH_SUBFOLDER_TYPE_CURRENT_DATE)
+		g_get_current_time (&timeval);
+
+	switch (subfolder_type) {
+	case GTH_SUBFOLDER_TYPE_FILE_DATE:
+	case GTH_SUBFOLDER_TYPE_CURRENT_DATE:
+		if (subfolder_format != GTH_SUBFOLDER_FORMAT_CUSTOM) {
+			GDate  *date;
+			char  **parts;
+
+			date = g_date_new ();
+			g_date_set_time_val (date, &timeval);
+
+			parts = g_new0 (char *, 4);
+			parts[0] = g_strdup_printf ("%04d", g_date_get_year (date));
+			if (subfolder_format != GTH_SUBFOLDER_FORMAT_YYYY) {
+				parts[1] = g_strdup_printf ("%02d", g_date_get_month (date));
+				if (subfolder_format != GTH_SUBFOLDER_FORMAT_YYYYMM)
+					parts[2] = g_strdup_printf ("%02d", g_date_get_day (date));
+			}
+
+			if (single_subfolder)
+				child = g_strjoinv ("-", parts);
+			else
+				child = g_strjoinv ("/", parts);
+
+			g_strfreev (parts);
+			g_date_free (date);
+		}
+		else {
+			char *format = NULL;
+
+			if (event_name != NULL) {
+				GRegex *re;
+
+				re = g_regex_new ("%E", 0, 0, NULL);
+				format = g_regex_replace_literal (re, custom_format, -1, 0, event_name, 0, NULL);
+
+				g_regex_unref (re);
+			}
+			if (format == NULL)
+				format = g_strdup (custom_format);
+			child = _g_time_val_strftime (&timeval, format);
+
+			g_free (format);
+		}
+		break;
+
+	case GTH_SUBFOLDER_TYPE_NONE:
+		child = NULL;
+		break;
+	}
+	file_destination = _g_file_append_path (destination, child);
+
+	g_free (child);
+
+	return file_destination;
+}
diff --git a/extensions/importer/utils.h b/extensions/importer/utils.h
new file mode 100644
index 0000000..ec37f75
--- /dev/null
+++ b/extensions/importer/utils.h
@@ -0,0 +1,54 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ *  GThumb
+ *
+ *  Copyright (C) 2010 Free Software Foundation, Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program 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 General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef IMPORTER_UTILS_H
+#define IMPORTER_UTILS_H
+
+G_BEGIN_DECLS
+
+#include <gthumb.h>
+
+typedef enum {
+	GTH_SUBFOLDER_TYPE_NONE = 0,
+        GTH_SUBFOLDER_TYPE_FILE_DATE,
+	GTH_SUBFOLDER_TYPE_CURRENT_DATE,
+} GthSubfolderType;
+
+typedef enum {
+	GTH_SUBFOLDER_FORMAT_YYYYMMDD,
+	GTH_SUBFOLDER_FORMAT_YYYYMM,
+	GTH_SUBFOLDER_FORMAT_YYYY,
+	GTH_SUBFOLDER_FORMAT_CUSTOM
+} GthSubfolderFormat;
+
+GFile *   gth_import_preferences_get_destination  (void);
+GFile *   gth_import_utils_get_file_destination   (GthFileData        *file_data,
+						   GFile              *destination,
+						   GthSubfolderType    subfolder_type,
+						   GthSubfolderFormat  subfolder_format,
+						   gboolean            single_subfolder,
+						   const char         *custom_format,
+						   const char         *event_name);
+
+G_END_DECLS
+
+#endif /* IMPORTER_UTILS_H */
diff --git a/extensions/jpeg_utils/jpeg_utils.extension.in.in b/extensions/jpeg_utils/jpeg_utils.extension.in.in
index 9a557a4..bb60f9b 100644
--- a/extensions/jpeg_utils/jpeg_utils.extension.in.in
+++ b/extensions/jpeg_utils/jpeg_utils.extension.in.in
@@ -1,5 +1,5 @@
 [Extension]
-Mandatory=true
+Hidden=true
 
 [Loader]
 Type=module
diff --git a/extensions/photo_importer/Makefile.am b/extensions/photo_importer/Makefile.am
index f4ba85f..e0a230f 100644
--- a/extensions/photo_importer/Makefile.am
+++ b/extensions/photo_importer/Makefile.am
@@ -3,46 +3,15 @@ SUBDIRS = data
 extensiondir = $(pkglibdir)/extensions
 extension_LTLIBRARIES = libphoto_importer.la
 
-ENUM_TYPES =				\
-	enum-types.h			\
-	enum-types.c
-
-HEADER_FILES = 				\
-	actions.h			\
-	callbacks.h			\
-	dlg-photo-importer.h		\
-	gth-import-task.h		\
-	preferences.h
-
-enum-types.h: $(HEADER_FILES) $(GLIB_MKENUMS)
-	$(AM_V_GEN)( $(GLIB_MKENUMS) \
-		--fhead "#ifndef ENUM_TYPES_H\n#define ENUM_TYPES_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
-		--fprod "/* enumerations from \"@filename \" */\n" \
-		--vhead "GType @enum_name _get_type (void);\n#define GTH_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
-		--ftail "G_END_DECLS\n\n#endif /* ENUM_TYPES_H */" \
-		$^> xgen-$(@F) \
-	&& (cmp -s xgen-$(@F) enum-types.h || cp xgen-$(@F) enum-types.h ) \
-	&& rm -f xgen-$(@F) )
-
-enum-types.c: $(HEADER_FILES) enum-types.h
-	$(AM_V_GEN)( $(GLIB_MKENUMS) \
-		--fhead "#include <glib-object.h>\n" \
-		--fprod "\n/* enumerations from \"@filename \" */\n#include \"@filename \"" \
-		--vhead "GType\n enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G Type@Value values[] = {" \
-		--vprod "      { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
-		--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_ type@_register_static (\"@EnumName \", values);\n  }\n  return etype;\n}\n" \
-		$^> xgen-$(@F) \
-	&& (cmp -s xgen-$(@F) enum-types.c || cp xgen-$(@F) enum-types.c ) \
-	&& rm -f xgen-$(@F) )
-
 libphoto_importer_la_SOURCES = 		\
-	$(ENUM_TYPES)			\
-	$(HEADER_FILES)			\
 	actions.c			\
+	actions.h			\
 	callbacks.c			\
+	callbacks.h			\
 	dlg-photo-importer.c		\
-	gth-import-task.c		\
-	main.c
+	dlg-photo-importer.h		\
+	main.c				\
+	preferences.h
 	
 libphoto_importer_la_CFLAGS = $(GTHUMB_CFLAGS) -I$(top_srcdir) -I$(top_builddir)/gthumb 
 libphoto_importer_la_LDFLAGS = $(EXTENSION_LIBTOOL_FLAGS)
@@ -60,8 +29,6 @@ extensionini_DATA = $(extensionini_in_files:.extension.in.in=.extension)
 %.extension: %.extension.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@
 
 EXTRA_DIST = $(extensionini_in_files) 
-BUILT_SOURCES = $(ENUM_TYPES)
-CLEANFILES = $(BUILT_SOURCES)
 DISTCLEANFILES = $(extensionini_DATA) 
 
 dist-hook:
diff --git a/extensions/photo_importer/dlg-photo-importer.c b/extensions/photo_importer/dlg-photo-importer.c
index c0fc43e..601334b 100644
--- a/extensions/photo_importer/dlg-photo-importer.c
+++ b/extensions/photo_importer/dlg-photo-importer.c
@@ -23,9 +23,8 @@
 #include <config.h>
 #include <gtk/gtk.h>
 #include <gthumb.h>
+#include <extensions/importer/importer.h>
 #include "dlg-photo-importer.h"
-#include "enum-types.h"
-#include "gth-import-task.h"
 #include "preferences.h"
 
 
diff --git a/extensions/photo_importer/photo_importer.extension.in.in b/extensions/photo_importer/photo_importer.extension.in.in
index 8a4fc67..3d9d3dd 100644
--- a/extensions/photo_importer/photo_importer.extension.in.in
+++ b/extensions/photo_importer/photo_importer.extension.in.in
@@ -8,4 +8,4 @@ Version=1.0
 [Loader]
 Type=module
 File=%LIBRARY%
-Requires=image_rotation
+Requires=importer
diff --git a/extensions/photo_importer/preferences.h b/extensions/photo_importer/preferences.h
index 1df543b..2476394 100644
--- a/extensions/photo_importer/preferences.h
+++ b/extensions/photo_importer/preferences.h
@@ -20,8 +20,8 @@
  *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef PREFERENCES_H
-#define PREFERENCES_H
+#ifndef PHOTO_IMPORTER_PREFERENCES_H
+#define PHOTO_IMPORTER_PREFERENCES_H
 
 #include <gthumb.h>
 
@@ -31,4 +31,4 @@ G_BEGIN_DECLS
 
 G_END_DECLS
 
-#endif /* PREFERENCES_H */
+#endif /* PHOTO_IMPORTER_PREFERENCES_H */
diff --git a/extensions/picasaweb/Makefile.am b/extensions/picasaweb/Makefile.am
index 5e68a11..53d1a52 100644
--- a/extensions/picasaweb/Makefile.am
+++ b/extensions/picasaweb/Makefile.am
@@ -38,7 +38,7 @@ libpicasaweb_la_SOURCES = 			\
 
 libpicasaweb_la_CFLAGS = $(GTHUMB_CFLAGS) $(LIBSOUP_CFLAGS) $(GNOME_KEYRING_CFLAGS) -I$(top_srcdir) -I$(top_builddir)/gthumb 
 libpicasaweb_la_LDFLAGS = $(EXTENSION_LIBTOOL_FLAGS)
-libpicasaweb_la_LIBADD = $(GTHUMB_LIBS)
+libpicasaweb_la_LIBADD = $(GTHUMB_LIBS) $(LIBSOUP_LIBS) $(GNOME_KEYRING_LIBS)
 libpicasaweb_la_DEPENDENCIES = $(top_builddir)/gthumb/gthumb$(EXEEXT)
 
 extensioninidir = $(extensiondir)
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.c b/extensions/picasaweb/dlg-import-from-picasaweb.c
index 7831c05..897d676 100644
--- a/extensions/picasaweb/dlg-import-from-picasaweb.c
+++ b/extensions/picasaweb/dlg-import-from-picasaweb.c
@@ -27,6 +27,7 @@
 #include <gnome-keyring.h>
 #endif /* HAVE_GNOME_KEYRING */
 #include <gthumb.h>
+#include <extensions/importer/importer.h>
 #include "dlg-import-from-picasaweb.h"
 #include "picasa-account-chooser-dialog.h"
 #include "picasa-account-manager-dialog.h"
@@ -70,6 +71,7 @@ typedef struct {
 	char             *password;
 	char             *challange;
 	GList            *albums;
+	PicasaWebAlbum   *album;
 	GList            *photos;
 	GoogleConnection *conn;
 	PicasaWebService *picasaweb;
@@ -87,6 +89,7 @@ import_dialog_destroy_cb (GtkWidget  *widget,
 	_g_object_unref (data->picasaweb);
 	_g_object_unref (data->conn);
 	_g_object_list_unref (data->albums);
+	_g_object_unref (data->album);
 	_g_object_list_unref (data->photos);
 	g_free (data->challange);
 	g_free (data->password);
@@ -99,29 +102,24 @@ import_dialog_destroy_cb (GtkWidget  *widget,
 }
 
 
-/* FIXME
-static void get_album_list (DialogData *data);
-
-
-static void
-post_photos_ready_cb (GObject      *source_object,
-		      GAsyncResult *result,
-		      gpointer      user_data)
+GList *
+get_files_to_download (DialogData *data)
 {
-	DialogData       *data = user_data;
-	PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object);
-	GError           *error = NULL;
+	GthFileView *file_view;
+	GList       *selected;
+	GList       *file_list;
 
-	gth_task_dialog (GTH_TASK (data->conn), TRUE);
+	file_view = (GthFileView *) gth_file_list_get_view (GTH_FILE_LIST (data->file_list));
+	selected = gth_file_selection_get_selected (GTH_FILE_SELECTION (file_view));
+	if (selected != NULL)
+		file_list = gth_file_list_get_files (GTH_FILE_LIST (data->file_list), selected);
+	else
+		file_list = gth_file_store_get_visibles (GTH_FILE_STORE (gth_file_view_get_model (file_view)));
 
-	if (! picasa_web_service_post_photos_finish (picasaweb, result, &error)) {
-		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), &error);
-		return;
-	}
+	_gtk_tree_path_list_free (selected);
 
-	get_album_list (data);
+	return file_list;
 }
-*/
 
 
 static void
@@ -161,13 +159,7 @@ import_dialog_response_cb (GtkDialog *dialog,
 			gth_task_dialog (GTH_TASK (data->conn), FALSE);
 
 			/* FIXME
-			file_list = gth_file_data_list_to_file_list (data->file_list);
-			picasa_web_service_post_photos (data->picasaweb,
-							album,
-							file_list,
-							data->cancellable,
-							post_photos_ready_cb,
-							data);
+			file_list = get_files_to_download (data);
 
 			_g_object_list_unref (file_list);
 			*/
@@ -678,21 +670,14 @@ account_combobox_changed_cb (GtkComboBox *widget,
 static void
 update_selection_status (DialogData *data)
 {
-	GthFileView *file_view;
-	GList       *selected;
-	GList       *file_list;
-	int          n_selected;
-	goffset      size_selected;
-	GList       *scan;
-	char        *size_selected_formatted;
-	char        *text_selected;
-
-	file_view = (GthFileView *) gth_file_list_get_view (GTH_FILE_LIST (data->file_list));
-	selected = gth_file_selection_get_selected (GTH_FILE_SELECTION (file_view));
-	if (selected != NULL)
-		file_list = gth_file_list_get_files (GTH_FILE_LIST (data->file_list), selected);
-	else
-		file_list = gth_file_store_get_visibles (GTH_FILE_STORE (gth_file_view_get_model (file_view)));
+	GList    *file_list;
+	int       n_selected;
+	goffset   size_selected;
+	GList    *scan;
+	char     *size_selected_formatted;
+	char     *text_selected;
+
+	file_list = get_files_to_download (data);
 	n_selected = 0;
 	size_selected = 0;
 	for (scan = file_list; scan; scan = scan->next) {
@@ -701,8 +686,6 @@ update_selection_status (DialogData *data)
 		n_selected++;
 		size_selected += g_file_info_get_size (file_data->info);
 	}
-	_g_object_list_unref (file_list);
-	_gtk_tree_path_list_free (selected);
 
 	size_selected_formatted = g_format_size_for_display (size_selected);
 	text_selected = g_strdup_printf (g_dngettext (NULL, "%d file (%s)", "%d files (%s)", n_selected), n_selected, size_selected_formatted);
@@ -710,6 +693,7 @@ update_selection_status (DialogData *data)
 
 	g_free (text_selected);
 	g_free (size_selected_formatted);
+	_g_object_list_unref (file_list);
 }
 
 
@@ -757,28 +741,26 @@ static void
 album_combobox_changed_cb (GtkComboBox *widget,
 			   gpointer     user_data)
 {
-	DialogData     *data = user_data;
-	GtkTreeIter     iter;
-	PicasaWebAlbum *album;
+	DialogData  *data = user_data;
+	GtkTreeIter  iter;
 
 	if (! gtk_combo_box_get_active_iter (widget, &iter)) {
 		gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("No album selected"));
 		return;
 	}
 
+	_g_object_unref (data->album);
 	gtk_tree_model_get (gtk_combo_box_get_model (widget),
 			    &iter,
-			    ALBUM_DATA_COLUMN, &album,
+			    ALBUM_DATA_COLUMN, &data->album,
 			    -1);
 
 	gth_task_dialog (GTH_TASK (data->conn), FALSE);
 	picasa_web_service_list_photos (data->picasaweb,
-					album,
+					data->album,
 					data->cancellable,
 					list_photos_ready_cb,
 					data);
-
-	g_object_unref (album);
 }
 
 
@@ -865,6 +847,8 @@ static void
 preferences_button_clicked_cb (GtkWidget  *widget,
 			       DialogData *data)
 {
+	gth_import_preferences_dialog_set_event (GTH_IMPORT_PREFERENCES_DIALOG (data->preferences_dialog),
+						 (data->album != NULL) ? data->album->title : "");
 	gtk_window_present (GTK_WINDOW (data->preferences_dialog));
 }
 
diff --git a/extensions/picasaweb/picasa-web-album.c b/extensions/picasaweb/picasa-web-album.c
index 2a8859c..24efddf 100644
--- a/extensions/picasaweb/picasa-web-album.c
+++ b/extensions/picasaweb/picasa-web-album.c
@@ -152,6 +152,16 @@ picasa_web_album_load_from_element (DomDomizable *base,
 		else if (g_strcmp0 (node->tag_name, "gphoto:bytesUsed") == 0) {
 			picasa_web_album_set_used_bytes (self, dom_element_get_inner_text (node));
 		}
+		else if (g_strcmp0 (node->tag_name, "media:group") == 0) {
+			DomElement *child;
+
+			for (child = node->first_child; child; child = child->next_sibling) {
+				if (g_strcmp0 (child->tag_name, "media:keywords") == 0) {
+					picasa_web_album_set_keywords (self, dom_element_get_inner_text (child));
+					break;
+				}
+			}
+		}
 	}
 }
 
@@ -325,3 +335,14 @@ picasa_web_album_set_n_photos_remaining (PicasaWebAlbum *self,
 	else
 		self->n_photos_remaining = 0;
 }
+
+
+void
+picasa_web_album_set_keywords (PicasaWebAlbum *self,
+			       const char     *value)
+{
+	g_free (self->keywords);
+	self->keywords = NULL;
+	if (value != NULL)
+		self->keywords = g_strdup (value);
+}
diff --git a/extensions/picasaweb/picasa-web-album.h b/extensions/picasaweb/picasa-web-album.h
index 993a852..52178db 100644
--- a/extensions/picasaweb/picasa-web-album.h
+++ b/extensions/picasaweb/picasa-web-album.h
@@ -54,6 +54,7 @@ struct _PicasaWebAlbum {
 	int              n_photos;
 	int              n_photos_remaining;
 	goffset          used_bytes;
+	char            *keywords;
 };
 
 struct _PicasaWebAlbumClass {
@@ -83,6 +84,8 @@ void              picasa_web_album_set_n_photos      (PicasaWebAlbum *self,
 void              picasa_web_album_set_n_photos_remaining
 						     (PicasaWebAlbum *self,
 						      const char     *value);
+void              picasa_web_album_set_keywords      (PicasaWebAlbum *self,
+						      const char     *value);
 
 G_END_DECLS
 
diff --git a/extensions/picasaweb/picasa-web-photo.c b/extensions/picasaweb/picasa-web-photo.c
index b2cbf10..7acf92c 100644
--- a/extensions/picasaweb/picasa-web-photo.c
+++ b/extensions/picasaweb/picasa-web-photo.c
@@ -166,15 +166,12 @@ picasa_web_photo_load_from_element (DomDomizable *base,
 			for (child = node->first_child; child; child = child->next_sibling) {
 				if (g_strcmp0 (child->tag_name, "media:credit") == 0) {
 					picasa_web_photo_set_credit (self, dom_element_get_inner_text (child));
-					break;
 				}
 				if (g_strcmp0 (child->tag_name, "media:description") == 0) {
 					picasa_web_photo_set_description (self, dom_element_get_inner_text (child));
-					break;
 				}
 				if (g_strcmp0 (child->tag_name, "media:keywords") == 0) {
 					picasa_web_photo_set_keywords (self, dom_element_get_inner_text (child));
-					break;
 				}
 				if (g_strcmp0 (child->tag_name, "media:thumbnail") == 0) {
 					int width;
diff --git a/extensions/picasaweb/picasaweb.extension.in.in b/extensions/picasaweb/picasaweb.extension.in.in
index 78209dd..1346cfd 100644
--- a/extensions/picasaweb/picasaweb.extension.in.in
+++ b/extensions/picasaweb/picasaweb.extension.in.in
@@ -8,3 +8,4 @@ Version=1.0
 [Loader]
 Type=module
 File=%LIBRARY%
+Requires=importer
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index b7575c5..a30d276 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -72,7 +72,6 @@ PUBLIC_HEADER_FILES = 					\
 	gth-image-selector.h				\
 	gth-image-viewer.h				\
 	gth-image-viewer-tool.h				\
-	gth-import-preferences-dialog.h			\
 	gth-location-chooser.h				\
 	gth-main.h					\
 	gth-metadata.h					\
@@ -183,7 +182,6 @@ gthumb_SOURCES = 					\
 	gth-image-selector.c				\
 	gth-image-viewer.c				\
 	gth-image-viewer-tool.c				\
-	gth-import-preferences-dialog.c			\
 	gth-location-chooser.c				\
 	gth-main.c					\
 	gth-main-default-hooks.c			\
diff --git a/gthumb/dlg-extensions.c b/gthumb/dlg-extensions.c
index a3cfa5a..dfa95e8 100644
--- a/gthumb/dlg-extensions.c
+++ b/gthumb/dlg-extensions.c
@@ -426,7 +426,7 @@ dlg_extensions (GthBrowser *browser)
 		GtkTreeIter              iter;
 
 		description = gth_extension_manager_get_description (manager, name);
-		if ((description == NULL) || description->mandatory)
+		if ((description == NULL) || description->mandatory || description->hidden)
 			continue;
 
 		gtk_list_store_append (data->list_store, &iter);
diff --git a/gthumb/gth-extensions.c b/gthumb/gth-extensions.c
index 39d122f..4f0d895 100644
--- a/gthumb/gth-extensions.c
+++ b/gthumb/gth-extensions.c
@@ -535,6 +535,7 @@ gth_extension_description_load_from_file (GthExtensionDescription *desc,
 	desc->icon_name = g_key_file_get_string (key_file, "Extension", "Icon", NULL);
 	desc->url = g_key_file_get_string (key_file, "Extension", "URL", NULL);
 	desc->mandatory = g_key_file_get_boolean (key_file, "Extension", "Mandatory", NULL);
+	desc->hidden = g_key_file_get_boolean (key_file, "Extension", "Hidden", NULL);
 	desc->loader_type = g_key_file_get_string (key_file, "Loader", "Type", NULL);
 	desc->loader_file = g_key_file_get_string (key_file, "Loader", "File", NULL);
 	desc->loader_requires = g_key_file_get_string_list (key_file, "Loader", "Requires", NULL, NULL);
diff --git a/gthumb/gth-extensions.h b/gthumb/gth-extensions.h
index b276fec..f03c37d 100644
--- a/gthumb/gth-extensions.h
+++ b/gthumb/gth-extensions.h
@@ -120,6 +120,7 @@ struct _GthExtensionDescription {
 	char     **loader_requires;
 	char     **loader_after;
 	gboolean   mandatory;
+	gboolean   hidden;
 	GthExtensionDescriptionPrivate *priv;
 };
 
diff --git a/gthumb/gth-main.c b/gthumb/gth-main.c
index 0f5b0b7..7859771 100644
--- a/gthumb/gth-main.c
+++ b/gthumb/gth-main.c
@@ -1187,7 +1187,6 @@ void
 gth_main_activate_extensions (void)
 {
 	const char *mandatory_extensions[] = {	"file_viewer",
-						"jpeg_utils",
 						NULL };
 	const char *default_extensions[] = {	"bookmarks",
 						"catalogs",
@@ -1200,6 +1199,8 @@ gth_main_activate_extensions (void)
 						"image_print",
 						"image_rotation",
 						"image_viewer",
+						"importer",
+						"jpeg_utils",
 						"list_tools",
 						"photo_importer",
 						"pixbuf_savers",
diff --git a/gthumb/gth-preferences.h b/gthumb/gth-preferences.h
index f3321b9..d602f65 100644
--- a/gthumb/gth-preferences.h
+++ b/gthumb/gth-preferences.h
@@ -73,14 +73,6 @@ G_BEGIN_DECLS
 #define PREF_UI_PROPERTIES_HEIGHT           "/apps/gthumb/ui/properties_height"
 #define PREF_UI_COMMENT_HEIGHT              "/apps/gthumb/ui/comment_height"
 
-#define PREF_IMPORT_DESTINATION             "/apps/gthumb/importer/destination"
-#define PREF_IMPORT_SUBFOLDER_TYPE          "/apps/gthumb/importer/subfolder_type"
-#define PREF_IMPORT_SUBFOLDER_FORMAT        "/apps/gthumb/importer/subfolder_format"
-#define PREF_IMPORT_SUBFOLDER_SINGLE        "/apps/gthumb/importer/subfolder_single"
-#define PREF_IMPORT_SUBFOLDER_CUSTOM_FORMAT "/apps/gthumb/importer/subfolder_custom_format"
-#define PREF_IMPORT_OVERWRITE               "/apps/gthumb/importer/overwrite_files"
-#define PREF_IMPORT_ADJUST_ORIENTATION      "/apps/gthumb/importer/adjust_orientation"
-
 #define PREF_ADD_TO_CATALOG_LAST_CATALOG    "/apps/gthumb/dialogs/add_to_catalog/last_catalog"
 #define PREF_ADD_TO_CATALOG_VIEW            "/apps/gthumb/dialogs/add_to_catalog/view"
 
diff --git a/gthumb/typedefs.h b/gthumb/typedefs.h
index 14b466a..973e51f 100644
--- a/gthumb/typedefs.h
+++ b/gthumb/typedefs.h
@@ -108,21 +108,6 @@ typedef enum {
 } GthOverwriteMode;
 
 
-typedef enum {
-	GTH_SUBFOLDER_TYPE_NONE = 0,
-        GTH_SUBFOLDER_TYPE_FILE_DATE,
-	GTH_SUBFOLDER_TYPE_CURRENT_DATE,
-} GthSubfolderType;
-
-
-typedef enum {
-	GTH_SUBFOLDER_FORMAT_YYYYMMDD,
-	GTH_SUBFOLDER_FORMAT_YYYYMM,
-	GTH_SUBFOLDER_FORMAT_YYYY,
-	GTH_SUBFOLDER_FORMAT_CUSTOM
-} GthSubfolderFormat;
-
-
 typedef void (*DataFunc)         (gpointer    user_data);
 typedef void (*ReadyFunc)        (GError     *error,
 			 	  gpointer    user_data);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ab6cfd0..3d24f6b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -79,6 +79,8 @@ extensions/edit_metadata/gth-edit-comment-page.h
 extensions/edit_metadata/gth-edit-metadata-dialog.c
 extensions/edit_metadata/gth-edit-metadata-dialog.h
 extensions/edit_metadata/main.c
+[type: gettext/ini]extensions/example/src/example.extension.in.in
+extensions/example/src/main.c
 [type: gettext/glade]extensions/exiv2/data/ui/edit-exiv2-page.ui
 [type: gettext/ini]extensions/exiv2/exiv2.extension.in.in
 extensions/exiv2/exiv2-utils.cpp
@@ -189,6 +191,18 @@ extensions/image_viewer/gth-metadata-provider-image.h
 extensions/image_viewer/main.c
 extensions/image_viewer/preferences.c
 extensions/image_viewer/preferences.h
+extensions/importer/data/gthumb-importer.schemas.in
+[type: gettext/glade]extensions/importer/data/ui/import-preferences.ui
+extensions/importer/gth-import-preferences-dialog.c
+extensions/importer/gth-import-preferences-dialog.h
+extensions/importer/gth-import-task.c
+extensions/importer/gth-import-task.h
+[type: gettext/ini]extensions/importer/importer.extension.in.in
+extensions/importer/importer.h
+extensions/importer/main.c
+extensions/importer/preferences.h
+extensions/importer/utils.c
+extensions/importer/utils.h
 extensions/jpeg_utils/jmemorydest.c
 extensions/jpeg_utils/jmemorydest.h
 extensions/jpeg_utils/jmemorysrc.c
@@ -226,11 +240,46 @@ extensions/photo_importer/data/gthumb_photo_importer.schemas.in
 [type: gettext/glade]extensions/photo_importer/data/ui/photo-importer.ui
 extensions/photo_importer/dlg-photo-importer.c
 extensions/photo_importer/dlg-photo-importer.h
-extensions/photo_importer/gth-import-task.c
-extensions/photo_importer/gth-import-task.h
 extensions/photo_importer/main.c
 [type: gettext/ini]extensions/photo_importer/photo_importer.extension.in.in
 extensions/photo_importer/preferences.h
+extensions/picasaweb/actions.c
+extensions/picasaweb/actions.h
+extensions/picasaweb/callbacks.c
+extensions/picasaweb/callbacks.h
+extensions/picasaweb/data/gthumb-picasaweb.schemas.in
+[type: gettext/glade]extensions/picasaweb/data/ui/export-to-picasaweb.ui
+[type: gettext/glade]extensions/picasaweb/data/ui/import-from-picasaweb.ui
+[type: gettext/glade]extensions/picasaweb/data/ui/picasa-web-account-chooser.ui
+[type: gettext/glade]extensions/picasaweb/data/ui/picasa-web-account-manager.ui
+[type: gettext/glade]extensions/picasaweb/data/ui/picasa-web-account-properties.ui
+[type: gettext/glade]extensions/picasaweb/data/ui/picasa-web-album-properties.ui
+extensions/picasaweb/dlg-export-to-picasaweb.c
+extensions/picasaweb/dlg-export-to-picasaweb.h
+extensions/picasaweb/dlg-import-from-picasaweb.c
+extensions/picasaweb/dlg-import-from-picasaweb.h
+extensions/picasaweb/google-connection.c
+extensions/picasaweb/google-connection.h
+extensions/picasaweb/main.c
+extensions/picasaweb/picasa-account-chooser-dialog.c
+extensions/picasaweb/picasa-account-chooser-dialog.h
+extensions/picasaweb/picasa-account-manager-dialog.c
+extensions/picasaweb/picasa-account-manager-dialog.h
+extensions/picasaweb/picasa-account-properties-dialog.c
+extensions/picasaweb/picasa-account-properties-dialog.h
+extensions/picasaweb/picasa-album-properties-dialog.c
+extensions/picasaweb/picasa-album-properties-dialog.h
+extensions/picasaweb/picasa-web-album.c
+extensions/picasaweb/picasa-web-album.h
+[type: gettext/ini]extensions/picasaweb/picasaweb.extension.in.in
+extensions/picasaweb/picasa-web-photo.c
+extensions/picasaweb/picasa-web-photo.h
+extensions/picasaweb/picasa-web-service.c
+extensions/picasaweb/picasa-web-service.h
+extensions/picasaweb/picasa-web-types.h
+extensions/picasaweb/picasa-web-user.c
+extensions/picasaweb/picasa-web-user.h
+extensions/picasaweb/preferences.h
 extensions/pixbuf_savers/data/gthumb-pixbuf-savers.schemas.in
 [type: gettext/glade]extensions/pixbuf_savers/data/ui/jpeg-options.ui
 [type: gettext/glade]extensions/pixbuf_savers/data/ui/png-options.ui



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