Commit c6421baf authored by Paolo Bacchilega's avatar Paolo Bacchilega

Merge branch 'picasaweb'

parents 05ce38c0 eee063c4
......@@ -52,6 +52,8 @@ CLUTTER_GTK_REQUIRED=0.10.0
GSTREAMER_REQUIRED=0.10
OPENRAW_REQUIRED=0.0.8
UNIQUE_REQUIRED=1.1.2
LIBSOUP_REQUIRED=2.26
GNOME_KEYRING_REQUIRED=2.28
dnl ===========================================================================
......@@ -259,7 +261,6 @@ CFLAGS+="$WARNINGS "
dnl ===========================================================================
AC_MSG_CHECKING(JPEG Support)
AC_ARG_ENABLE([jpeg],
[AS_HELP_STRING([--disable-jpeg],[do not compile code that uses the libjpeg library])],,
[enable_jpeg=yes])
......@@ -274,12 +275,9 @@ if test "x$enable_jpeg" = "xyes"; then
fi
AC_SUBST(JPEG_LIBS)
AM_CONDITIONAL(ENABLE_JPEG_TOOLS, test "x$enable_jpeg" = xyes)
AC_MSG_RESULT($enable_jpeg)
dnl ===========================================================================
AC_MSG_CHECKING(TIFF Support)
AC_ARG_ENABLE([tiff],
[AS_HELP_STRING([--disable-tiff],[do not compile code that uses the libtiff library])],,
[enable_tiff=yes])
......@@ -295,10 +293,10 @@ if test x$enable_tiff = xyes ; then
fi
fi
AC_SUBST(TIFF_LIBS)
AC_MSG_RESULT($enable_tiff)
dnl ===========================================================================
AC_MSG_CHECKING(liboperaw)
AC_ARG_ENABLE([libopenraw],
[AS_HELP_STRING([--enable-libopenraw],[use the libopenraw library to read raw files [default=no]])],,
[enable_libopenraw=no])
......@@ -309,11 +307,53 @@ if test x$enable_libopenraw = xyes ; then
[enable_libopenraw=yes],
[enable_libopenraw=no])
if test "x$enable_libopenraw" = "xyes"; then
AC_DEFINE(ENABLE_LIBOPENRAW, 1, [Define to 1 if libopenraw must be used to read raw files])
AC_DEFINE(ENABLE_LIBOPENRAW, 1, [Define to 1 if libopenraw must be used to read raw files instead of dcraw])
fi
fi
if test x$enable_libopenraw = xno ; then
enable_libopenraw='no (uses dcraw)'
fi
AC_SUBST(LIBOPENRAW_LIBS)
AC_SUBST(LIBOPENRAW_CFLAGS)
AC_MSG_RESULT($enable_libopenraw)
dnl ===========================================================================
AC_ARG_ENABLE([gnome-keyring],
[AS_HELP_STRING([--disable-gnome-keyring],[do not compile code that uses the gnome-keyring library])],,
[enable_gnome_keyring=yes])
if test x$enable_gnome_keyring = xyes ; then
PKG_CHECK_MODULES(GNOME_KEYRING,
[gnome-keyring-1 >= $GNOME_KEYRING_REQUIRED],
[AC_DEFINE(HAVE_GNOME_KEYRING, 1, [Have gnome-keyring])
enable_gnome_keyring=yes],
[enable_gnome_keyring=no])
fi
AC_SUBST(GNOME_KEYRING_CFLAGS)
AC_SUBST(GNOME_KEYRING_LIBS)
dnl ===========================================================================
AC_ARG_ENABLE([libsoup],
[AS_HELP_STRING([--disable-libsoup],[do not compile code that uses the libsoup library])],,
[enable_libsoup=yes])
if test x$enable_libsoup = xyes ; then
PKG_CHECK_MODULES(LIBSOUP_GNOME,
[libsoup-gnome-2.4 >= $LIBSOUP_REQUIRED],
[LIBSOUP_CFLAGS="$LIBSOUP_GNOME_CFLAGS"
LIBSOUP_LIBS="$LIBSOUP_GNOME_LIBS"
AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [Have libsoup-gnome])
enable_libsoup=yes],
[PKG_CHECK_MODULES(LIBSOUP,
[libsoup-2.4 >= $LIBSOUP_REQUIRED],
[enable_libsoup=yes],
[enable_libsoup=no])])
fi
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
AM_CONDITIONAL(ENABLE_WEB_SERVICES, test "x$enable_libsoup" = xyes)
dnl ===========================================================================
......@@ -374,6 +414,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
......@@ -381,6 +424,9 @@ extensions/list_tools/data/ui/Makefile
extensions/photo_importer/Makefile
extensions/photo_importer/data/Makefile
extensions/photo_importer/data/ui/Makefile
extensions/picasaweb/Makefile
extensions/picasaweb/data/Makefile
extensions/picasaweb/data/ui/Makefile
extensions/pixbuf_savers/Makefile
extensions/pixbuf_savers/data/Makefile
extensions/pixbuf_savers/data/ui/Makefile
......@@ -425,4 +471,6 @@ Configuration:
Clutter support : ${enable_clutter}
GStreamer support : ${enable_gstreamer}
Use libopenraw : ${enable_libopenraw}
Web services : ${enable_libsoup}
Use GNOME Keyring : ${enable_gnome_keyring}
"
......@@ -505,6 +505,99 @@
</locale>
</schema>
<!-- Importer -->
<schema>
<key>/schemas/apps/gthumb/importer/destination</key>
<applyto>/apps/gthumb/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/importer/subfolder_type</key>
<applyto>/apps/gthumb/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/importer/subfolder_format</key>
<applyto>/apps/gthumb/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/importer/subfolder_single</key>
<applyto>/apps/gthumb/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/importer/subfolder_custom_format</key>
<applyto>/apps/gthumb/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/importer/overwrite_files</key>
<applyto>/apps/gthumb/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/importer/adjust_orientation</key>
<applyto>/apps/gthumb/importer/adjust_orientation</applyto>
<owner>gthumb</owner>
<type>bool</type>
<default>FALSE</default>
<locale name="C">
<short></short>
<long>
</long>
</locale>
</schema>
<!-- Messages -->
<schema>
......
......@@ -12,9 +12,11 @@ SUBDIRS = \
image_print \
image_rotation \
image_viewer \
importer \
jpeg_utils \
list_tools \
photo_importer \
picasaweb \
pixbuf_savers \
raw_files \
red_eye_removal \
......
......@@ -50,8 +50,6 @@ typedef struct {
GList *file_data_list;
GFile *gio_file;
GthCatalog *catalog;
char *buffer;
gsize length;
} RemoveFromCatalogData;
......@@ -62,7 +60,6 @@ remove_from_catalog_end (GError *error,
if (error != NULL)
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not remove the files from the catalog"), &error);
g_free (data->buffer);
g_object_unref (data->catalog);
g_object_unref (data->gio_file);
_g_object_list_unref (data->file_data_list);
......@@ -71,10 +68,10 @@ remove_from_catalog_end (GError *error,
static void
catalog_save_done_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
catalog_save_done_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
RemoveFromCatalogData *data = user_data;
......@@ -102,27 +99,29 @@ catalog_save_done_cb (void *buffer,
static void
catalog_buffer_ready_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
catalog_buffer_ready_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
RemoveFromCatalogData *data = user_data;
GList *scan;
void *catalog_buffer;
gsize catalog_size;
if (error != NULL) {
remove_from_catalog_end (error, data);
return;
}
data->catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", buffer);
data->catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", *buffer);
if (data->catalog == NULL) {
error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_FAILED, _("Invalid file format"));
remove_from_catalog_end (error, data);
return;
}
gth_catalog_load_from_data (data->catalog, buffer, count, &error);
gth_catalog_load_from_data (data->catalog, *buffer, count, &error);
if (error != NULL) {
remove_from_catalog_end (error, data);
return;
......@@ -134,15 +133,15 @@ catalog_buffer_ready_cb (void *buffer,
gth_catalog_remove_file (data->catalog, file_data->file);
}
data->buffer = gth_catalog_to_data (data->catalog, &data->length);
catalog_buffer = gth_catalog_to_data (data->catalog, &catalog_size);
if (error != NULL) {
remove_from_catalog_end (error, data);
return;
}
g_write_file_async (data->gio_file,
data->buffer,
data->length,
catalog_buffer,
catalog_size,
G_PRIORITY_DEFAULT,
NULL,
catalog_save_done_cb,
......
......@@ -37,15 +37,12 @@ typedef struct {
gboolean view_destination;
GFile *catalog_file;
GthCatalog *catalog;
char *buffer;
gsize length;
} AddData;
static void
add_data_free (AddData *add_data)
{
g_free (add_data->buffer);
_g_object_unref (add_data->catalog);
_g_object_list_unref (add_data->files);
_g_object_unref (add_data->catalog_file);
......@@ -94,10 +91,10 @@ get_selected_catalog (DialogData *data)
static void
catalog_save_done_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
catalog_save_done_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
AddData *add_data = user_data;
......@@ -128,6 +125,8 @@ catalog_ready_cb (GObject *catalog,
{
AddData *add_data = user_data;
GList *scan;
char *buffer;
gsize length;
GFile *gio_file;
if (error != NULL) {
......@@ -142,11 +141,11 @@ catalog_ready_cb (GObject *catalog,
gth_catalog_insert_file (add_data->catalog, file_to_add->file, -1);
}
add_data->buffer = gth_catalog_to_data (add_data->catalog, &add_data->length);
buffer = gth_catalog_to_data (add_data->catalog, &length);
gio_file = gth_catalog_file_to_gio_file (add_data->catalog_file);
g_write_file_async (gio_file,
add_data->buffer,
add_data->length,
buffer,
length,
G_PRIORITY_DEFAULT,
NULL,
catalog_save_done_cb,
......
......@@ -52,10 +52,10 @@ destroy_cb (GtkWidget *widget,
static void
catalog_saved_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
catalog_saved_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
DialogData *data = user_data;
......@@ -80,7 +80,6 @@ catalog_saved_cb (void *buffer,
else
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not save the catalog"), &error);
g_free (buffer);
gtk_widget_destroy (data->dialog);
}
......@@ -99,7 +98,7 @@ save_button_clicked_cb (GtkButton *button,
GthDateTime *date_time;
GFile *gio_file;
char *buffer;
gsize buffer_size;
gsize size;
if (strcmp (gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("name_entry"))), "") != 0) {
GFile *parent;
......@@ -135,10 +134,10 @@ save_button_clicked_cb (GtkButton *button,
gth_hook_invoke ("dlg-catalog-properties-save", data->builder, data->file_data, data->catalog);
gio_file = gth_catalog_file_to_gio_file (data->file_data->file);
buffer = gth_catalog_to_data (data->catalog, &buffer_size);
buffer = gth_catalog_to_data (data->catalog, &size);
g_write_file_async (gio_file,
buffer,
buffer_size,
size,
G_PRIORITY_DEFAULT,
NULL,
catalog_saved_cb,
......
......@@ -561,16 +561,16 @@ catalog_file_info_ready_cb (GObject *source_object,
static void
list__catalog_buffer_ready_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
list__catalog_buffer_ready_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
ListData *list_data = user_data;
GthCatalog *catalog = list_data->catalog;
if ((error == NULL) && (buffer != NULL)) {
gth_catalog_load_from_data (catalog, buffer, count, &error);
if ((error == NULL) && (*buffer != NULL)) {
gth_catalog_load_from_data (catalog, *buffer, count, &error);
if (error != NULL) {
gth_catalog_list_done (list_data, error);
return;
......@@ -1027,18 +1027,18 @@ typedef struct {
static void
load__catalog_buffer_ready_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
load__catalog_buffer_ready_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
LoadData *load_data = user_data;
GthCatalog *catalog = NULL;
if (error == NULL) {
catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", buffer);
catalog = gth_hook_invoke_get ("gth-catalog-load-from-data", *buffer);
if (catalog != NULL)
gth_catalog_load_from_data (catalog, buffer, count, &error);
gth_catalog_load_from_data (catalog, *buffer, count, &error);
}
load_data->ready_func (G_OBJECT (catalog), error, load_data->user_data);
......
......@@ -201,30 +201,30 @@ metadata_op_free (MetadataOpData *metadata_op)
static void
write_metadata_write_buffer_ready_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
write_metadata_write_buffer_ready_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
MetadataOpData *metadata_op = user_data;
GthFileSourceCatalogs *catalogs = metadata_op->catalogs;
g_free (buffer);
metadata_op->ready_callback (G_OBJECT (catalogs), error, metadata_op->user_data);
metadata_op_free (metadata_op);
}
static void
write_metadata_load_buffer_ready_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
write_metadata_load_buffer_ready_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
MetadataOpData *metadata_op = user_data;
GthFileSourceCatalogs *catalogs = metadata_op->catalogs;
GFile *gio_file;
void *catalog_buffer;
gsize catalog_size;
if (error != NULL) {
metadata_op->ready_callback (G_OBJECT (catalogs), error, metadata_op->user_data);
......@@ -232,7 +232,7 @@ write_metadata_load_buffer_ready_cb (void *buffer,
return;
}
gth_catalog_load_from_data (metadata_op->catalog, buffer, count, &error);
gth_catalog_load_from_data (metadata_op->catalog, *buffer, count, &error);
if (error != NULL) {
metadata_op->ready_callback (G_OBJECT (catalogs), error, metadata_op->user_data);
......@@ -245,11 +245,11 @@ write_metadata_load_buffer_ready_cb (void *buffer,
g_file_info_get_attribute_string (metadata_op->file_data->info, "sort::type"),
g_file_info_get_attribute_boolean (metadata_op->file_data->info, "sort::inverse"));
buffer = gth_catalog_to_data (metadata_op->catalog, &count);
catalog_buffer = gth_catalog_to_data (metadata_op->catalog, &catalog_size);
gio_file = gth_catalog_file_to_gio_file (metadata_op->file_data->file);
g_write_file_async (gio_file,
buffer,
count,
catalog_buffer,
catalog_size,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (GTH_FILE_SOURCE (metadata_op->catalogs)),
write_metadata_write_buffer_ready_cb,
......@@ -670,15 +670,12 @@ typedef struct {
gpointer user_data;
GList *files;
GthCatalog *catalog;
char *buffer;
gsize length;
} CopyOpData;
static void
copy_op_data_free (CopyOpData *cod)
{
g_free (cod->buffer);
_g_object_unref (cod->catalog);
_g_object_list_unref (cod->files);
_g_object_list_unref (cod->file_list);
......@@ -689,10 +686,10 @@ copy_op_data_free (CopyOpData *cod)
static void
catalog_save_done_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
catalog_save_done_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
CopyOpData *cod = user_data;
......@@ -714,6 +711,8 @@ catalog_ready_cb (GObject *catalog,
{
CopyOpData *cod = user_data;
GList *scan;
char *buffer;
gsize size;
GFile *gio_file;
if (error != NULL) {
......@@ -727,11 +726,11 @@ catalog_ready_cb (GObject *catalog,
for (scan = cod->files; scan; scan = scan->next)
gth_catalog_insert_file (cod->catalog, (GFile *) scan->data, -1);
cod->buffer = gth_catalog_to_data (cod->catalog, &cod->length);
buffer = gth_catalog_to_data (cod->catalog, &size);
gio_file = gth_catalog_file_to_gio_file (cod->destination->file);
g_write_file_async (gio_file,
cod->buffer,
cod->length,
buffer,
size,
G_PRIORITY_DEFAULT,
NULL,
catalog_save_done_cb,
......@@ -842,15 +841,13 @@ reorder_data_free (ReorderData *reorder_data)
static void
reorder_buffer_ready_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
reorder_buffer_ready_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
ReorderData *reorder_data = user_data;
g_free (buffer);
gth_monitor_order_changed (gth_main_get_default_monitor (),
reorder_data->destination->file,
reorder_data->new_order);
......@@ -904,7 +901,7 @@ reorder_catalog_ready_cb (GObject *object,
ReorderData *reorder_data = user_data;
GthCatalog *catalog;
char *buffer;
gsize buffer_size;
gsize size;
GFile *gio_file;
if (error != NULL) {
......@@ -917,11 +914,11 @@ reorder_catalog_ready_cb (GObject *object,
reorder_data->new_order = reorder_catalog_list (catalog, reorder_data->file_list, reorder_data->dest_pos);
gth_catalog_set_order (catalog, "general::unsorted", FALSE);
buffer = gth_catalog_to_data (catalog, &buffer_size);
buffer = gth_catalog_to_data (catalog, &size);
gio_file = gth_file_source_to_gio_file (reorder_data->file_source, reorder_data->destination->file);
g_write_file_async (gio_file,
buffer,
buffer_size,
size,
G_PRIORITY_DEFAULT,
gth_file_source_get_cancellable (reorder_data->file_source),
reorder_buffer_ready_cb,
......
......@@ -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)
......
......@@ -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);
......
......@@ -148,7 +148,7 @@ gth_metadata_provider_exiv2_write (GthMetadataProvider *self,
char *raw;
meta = gth_metadata_new ();
raw = gth_file_data_get_attribute_as_string (file_data, "general::tags");
raw = gth_string_list_join (GTH_STRING_LIST (metadata), ", ");
g_object_set (meta, "id", "general::tags", "raw", raw, NULL);
g_file_info_set_attribute_object (file_data->info, "Xmp::iptc::Keywords", G_OBJECT (meta));
......
......@@ -106,7 +106,7 @@ gth_file_viewer_page_real_activate (GthViewerPage *base,
g_error_free (error);
}
self->priv->thumb_loader = gth_thumb_loader_new (128, 128);
self->priv->thumb_loader = gth_thumb_loader_new (128);
self->priv->thumb_loader_ready_event =
g_signal_connect (G_OBJECT (self->priv->thumb_loader),
"ready",
......
......@@ -233,14 +233,13 @@ transformation_data_free (TransformatioData *tdata)
static void
write_file_ready_cb (void *buffer,
gsize count,
GError *error,
gpointer user_data)
write_file_ready_cb (void **buffer,
gsize count,
GError *error,
gpointer user_data)
{
TransformatioData *tdata = user_data;
g_free (buffer);
tdata->ready_func (error, tdata->user_data);
transformation_data_free (tdata);
}
......@@ -259,10 +258,10 @@ pixbuf_saved_cb (GthFileData *file_data,
static void
file_buffer_ready_cb (void *buffer,
gsize count,