[gthumb: 20/22] [picasaweb] use the import task to import from picasa web
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb: 20/22] [picasaweb] use the import task to import from picasa web
- Date: Sat, 30 Jan 2010 23:20:56 +0000 (UTC)
commit 85e75d78e6735573df782135fde9431ac49a1fff
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Jan 30 17:03:05 2010 +0100
[picasaweb] use the import task to import from picasa web
extensions/exiv2/Makefile.am | 2 +-
extensions/exiv2/exiv2-utils.cpp | 9 ++++
extensions/picasaweb/dlg-import-from-picasaweb.c | 54 ++++++++++++++++++---
3 files changed, 56 insertions(+), 9 deletions(-)
---
diff --git a/extensions/exiv2/Makefile.am b/extensions/exiv2/Makefile.am
index f905128..8edf668 100644
--- a/extensions/exiv2/Makefile.am
+++ b/extensions/exiv2/Makefile.am
@@ -16,7 +16,7 @@ libexiv2_la_SOURCES = \
libexiv2_la_CPPFLAGS = $(GTHUMB_CFLAGS) $(EXIV2_CFLAGS) -I$(top_srcdir) -I$(top_builddir)/gthumb
libexiv2_la_LDFLAGS = $(EXTENSION_LIBTOOL_FLAGS)
-libexiv2_la_LIBADD = $(GTHUMB_LIBS)
+libexiv2_la_LIBADD = $(GTHUMB_LIBS) $(EXIV2_LIBS)
libexiv2_la_DEPENDENCIES = $(top_builddir)/gthumb/gthumb$(EXEEXT)
extensioninidir = $(extensiondir)
diff --git a/extensions/exiv2/exiv2-utils.cpp b/extensions/exiv2/exiv2-utils.cpp
index aadc2a6..cf602b8 100644
--- a/extensions/exiv2/exiv2-utils.cpp
+++ b/extensions/exiv2/exiv2-utils.cpp
@@ -440,6 +440,12 @@ exiv2_read_metadata_from_file (GFile *file,
char *path;
path = g_file_get_path (file);
+ if (path == NULL) {
+ if (error != NULL)
+ *error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid file format"));
+ return FALSE;
+ }
+
Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path);
g_free (path);
@@ -498,6 +504,9 @@ exiv2_read_sidecar (GFile *file,
char *path;
path = g_file_get_path (file);
+ if (path == NULL)
+ return FALSE;
+
Exiv2::DataBuf buf = Exiv2::readFile(path);
g_free (path);
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.c b/extensions/picasaweb/dlg-import-from-picasaweb.c
index 897d676..458cbeb 100644
--- a/extensions/picasaweb/dlg-import-from-picasaweb.c
+++ b/extensions/picasaweb/dlg-import-from-picasaweb.c
@@ -142,27 +142,65 @@ import_dialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_OK:
{
- GtkTreeModel *tree_model;
GtkTreeIter iter;
PicasaWebAlbum *album;
- /*GList *file_list;*/
+ GList *file_list;
- if (! gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (GET_WIDGET ("albums_treeview"))), &tree_model, &iter)) {
+ if (! gtk_combo_box_get_active_iter (GTK_COMBO_BOX (GET_WIDGET ("album_combobox")), &iter)) {
gtk_widget_set_sensitive (GET_WIDGET ("download_button"), FALSE);
return;
}
- gtk_tree_model_get (tree_model, &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (GET_WIDGET ("album_liststore")), &iter,
ALBUM_DATA_COLUMN, &album,
-1);
- gth_task_dialog (GTH_TASK (data->conn), FALSE);
-
- /* FIXME
file_list = get_files_to_download (data);
+ if (file_list != NULL) {
+ GFile *destination;
+ gboolean single_subfolder;
+ GthSubfolderType subfolder_type;
+ GthSubfolderFormat subfolder_format;
+ char *custom_format;
+ gboolean overwrite_files;
+ gboolean adjust_orientation;
+ char **tags;
+ int i;
+ GthTask *task;
+
+ destination = gth_import_preferences_get_destination ();
+ subfolder_type = eel_gconf_get_enum (PREF_IMPORT_SUBFOLDER_TYPE, GTH_TYPE_SUBFOLDER_TYPE, GTH_SUBFOLDER_TYPE_FILE_DATE);
+ subfolder_format = eel_gconf_get_enum (PREF_IMPORT_SUBFOLDER_FORMAT, GTH_TYPE_SUBFOLDER_FORMAT, GTH_SUBFOLDER_FORMAT_YYYYMMDD);
+ single_subfolder = eel_gconf_get_boolean (PREF_IMPORT_SUBFOLDER_SINGLE, FALSE);
+ custom_format = eel_gconf_get_string (PREF_IMPORT_SUBFOLDER_CUSTOM_FORMAT, "");
+ overwrite_files = eel_gconf_get_boolean (PREF_IMPORT_OVERWRITE, FALSE);
+ adjust_orientation = eel_gconf_get_boolean (PREF_IMPORT_ADJUST_ORIENTATION, FALSE);
+
+ tags = g_strsplit ((album->keywords != NULL ? album->keywords : ""), ",", -1);
+ for (i = 0; tags[i] != NULL; i++)
+ tags[i] = g_strstrip (tags[i]);
+
+ task = gth_import_task_new (data->browser,
+ file_list,
+ destination,
+ subfolder_type,
+ subfolder_format,
+ single_subfolder,
+ custom_format,
+ (album->title != NULL ? album->title : ""),
+ tags,
+ FALSE,
+ overwrite_files,
+ adjust_orientation);
+ gth_browser_exec_task (data->browser, task, FALSE);
+ gtk_widget_destroy (data->dialog);
+
+ g_object_unref (task);
+ g_strfreev (tags);
+ _g_object_unref (destination);
+ }
_g_object_list_unref (file_list);
- */
g_object_unref (album);
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]