[gthumb: 2/22] started work on a picasa web uploader
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb: 2/22] started work on a picasa web uploader
- Date: Sat, 30 Jan 2010 23:19:26 +0000 (UTC)
commit d9c1f19c07be38e74edf775c87fee13464f459a5
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat Jan 23 02:10:39 2010 +0100
started work on a picasa web uploader
configure.ac | 22 +
extensions/Makefile.am | 1 +
extensions/picasaweb/Makefile.am | 47 ++
extensions/picasaweb/actions.c | 35 ++
extensions/picasaweb/actions.h | 32 ++
extensions/picasaweb/callbacks.c | 94 ++++
extensions/picasaweb/callbacks.h | 30 ++
extensions/picasaweb/data/Makefile.am | 18 +
.../picasaweb/data/gthumb-picasaweb.schemas.in | 17 +
extensions/picasaweb/data/ui/Makefile.am | 7 +
.../picasaweb/data/ui/export-to-picasaweb.ui | 390 +++++++++++++++
extensions/picasaweb/data/ui/picasaweb-account.ui | 358 ++++++++++++++
extensions/picasaweb/dlg-export-to-picasaweb.c | 498 ++++++++++++++++++++
extensions/picasaweb/dlg-export-to-picasaweb.h | 30 ++
extensions/picasaweb/google-connection.c | 173 +++++++
extensions/picasaweb/google-connection.h | 82 ++++
extensions/picasaweb/gth-account-chooser-dialog.c | 114 +++++
extensions/picasaweb/gth-account-chooser-dialog.h | 59 +++
.../picasaweb/gth-account-properties-dialog.c | 135 ++++++
.../picasaweb/gth-account-properties-dialog.h | 60 +++
extensions/picasaweb/main.c | 53 ++
extensions/picasaweb/picasa-web-service.c | 130 +++++
extensions/picasaweb/picasa-web-service.h | 62 +++
extensions/picasaweb/picasaweb.extension.in.in | 10 +
extensions/picasaweb/preferences.h | 28 ++
gthumb/Makefile.am | 2 +
gthumb/gth-browser-actions-entries.h | 2 +-
gthumb/gth-browser-ui.h | 3 +
28 files changed, 2491 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 022f8f1..564d023 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,6 +46,7 @@ GSTREAMER_REQUIRED=0.10
OPENRAW_REQUIRED=0.0.8
UNIQUE_REQUIRED=1.1.2
LIBSOUP_REQUIRED=2.26
+GNOME_KEYRING_REQUIRED=2.28
dnl ===========================================================================
@@ -302,6 +303,22 @@ 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])
@@ -320,6 +337,7 @@ if test x$enable_libsoup = xyes ; then
fi
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
+AM_CONDITIONAL(ENABLE_WEB_SERVICES, test "x$enable_libsoup" = xyes)
dnl ===========================================================================
@@ -387,6 +405,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
@@ -432,4 +453,5 @@ Configuration:
GStreamer support : ${enable_gstreamer}
Use libopenraw : ${enable_libopenraw}
Web services : ${enable_libsoup}
+ Use GNOME Keyring : ${enable_gnome_keyring}
"
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 49cbdbd..6523a1d 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -15,6 +15,7 @@ SUBDIRS = \
jpeg_utils \
list_tools \
photo_importer \
+ picasaweb \
pixbuf_savers \
raw_files \
red_eye_removal \
diff --git a/extensions/picasaweb/Makefile.am b/extensions/picasaweb/Makefile.am
new file mode 100644
index 0000000..4a86d7a
--- /dev/null
+++ b/extensions/picasaweb/Makefile.am
@@ -0,0 +1,47 @@
+if ENABLE_WEB_SERVICES
+
+SUBDIRS = data
+
+extensiondir = $(pkglibdir)/extensions
+extension_LTLIBRARIES = libpicasaweb.la
+
+libpicasaweb_la_SOURCES = \
+ actions.c \
+ actions.h \
+ callbacks.c \
+ callbacks.h \
+ dlg-export-to-picasaweb.c \
+ dlg-export-to-picasaweb.h \
+ google-connection.c \
+ google-connection.h \
+ gth-account-chooser-dialog.c \
+ gth-account-chooser-dialog.h \
+ gth-account-properties-dialog.c \
+ gth-account-properties-dialog.h \
+ main.c \
+ picasa-web-service.c \
+ picasa-web-service.h \
+ preferences.h
+
+libpicasaweb_la_CPPFLAGS = $(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_DEPENDENCIES = $(top_builddir)/gthumb/gthumb$(EXEEXT)
+
+extensioninidir = $(extensiondir)
+extensionini_in_files = picasaweb.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)
+
+DISTCLEANFILES = $(extensionini_DATA)
+
+endif
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/picasaweb/actions.c b/extensions/picasaweb/actions.c
new file mode 100644
index 0000000..98489e9
--- /dev/null
+++ b/extensions/picasaweb/actions.c
@@ -0,0 +1,35 @@
+/* -*- 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 <glib/gi18n.h>
+#include <gthumb.h>
+#include "dlg-export-to-picasaweb.h"
+
+
+void
+gth_browser_activate_action_export_picasaweb (GtkAction *action,
+ GthBrowser *browser)
+{
+ dlg_export_to_picasaweb (browser);
+}
diff --git a/extensions/picasaweb/actions.h b/extensions/picasaweb/actions.h
new file mode 100644
index 0000000..26b5da8
--- /dev/null
+++ b/extensions/picasaweb/actions.h
@@ -0,0 +1,32 @@
+/* -*- 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 ACTIONS_H
+#define ACTIONS_H
+
+#include <gtk/gtk.h>
+
+#define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
+
+DEFINE_ACTION(gth_browser_activate_action_export_picasaweb)
+
+#endif /* ACTIONS_H */
diff --git a/extensions/picasaweb/callbacks.c b/extensions/picasaweb/callbacks.c
new file mode 100644
index 0000000..8d158be
--- /dev/null
+++ b/extensions/picasaweb/callbacks.c
@@ -0,0 +1,94 @@
+/* -*- 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 <glib/gi18n.h>
+#include <glib-object.h>
+#include <gthumb.h>
+#include "actions.h"
+
+
+#define BROWSER_DATA_KEY "picasaweb-browser-data"
+
+
+static const char *ui_info =
+"<ui>"
+" <menubar name='MenuBar'>"
+" <menu name='File' action='FileMenu'>"
+" <menu name='Export' action='ExportMenu'>"
+" <placeholder name='Web_Services'>"
+" <menuitem action='File_Export_PicasaWeb'/>"
+" </placeholder>"
+" </menu>"
+" </menu>"
+" </menubar>"
+"</ui>";
+
+
+static GtkActionEntry action_entries[] = {
+ { "File_Export_PicasaWeb", NULL,
+ N_("Picasa Web Album..."), NULL,
+ N_("Upload photos to Picasa Web Album"),
+ G_CALLBACK (gth_browser_activate_action_export_picasaweb) },
+};
+
+
+typedef struct {
+ GtkActionGroup *action_group;
+} BrowserData;
+
+
+static void
+browser_data_free (BrowserData *data)
+{
+ g_free (data);
+}
+
+
+void
+pw__gth_browser_construct_cb (GthBrowser *browser)
+{
+ BrowserData *data;
+ GError *error = NULL;
+ guint merge_id;
+
+ g_return_if_fail (GTH_IS_BROWSER (browser));
+
+ data = g_new0 (BrowserData, 1);
+
+ data->action_group = gtk_action_group_new ("Picasa Web Actions");
+ gtk_action_group_set_translation_domain (data->action_group, NULL);
+ gtk_action_group_add_actions (data->action_group,
+ action_entries,
+ G_N_ELEMENTS (action_entries),
+ browser);
+ gtk_ui_manager_insert_action_group (gth_browser_get_ui_manager (browser), data->action_group, 0);
+
+ merge_id = gtk_ui_manager_add_ui_from_string (gth_browser_get_ui_manager (browser), ui_info, -1, &error);
+ if (merge_id == 0) {
+ g_warning ("building ui failed: %s", error->message);
+ g_clear_error (&error);
+ }
+
+ g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
+}
diff --git a/extensions/picasaweb/callbacks.h b/extensions/picasaweb/callbacks.h
new file mode 100644
index 0000000..a5c05c0
--- /dev/null
+++ b/extensions/picasaweb/callbacks.h
@@ -0,0 +1,30 @@
+/* -*- 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 CALLBACKS_H
+#define CALLBACKS_H
+
+#include <gthumb.h>
+
+void pw__gth_browser_construct_cb (GthBrowser *browser);
+
+#endif /* CALLBACKS_H */
diff --git a/extensions/picasaweb/data/Makefile.am b/extensions/picasaweb/data/Makefile.am
new file mode 100644
index 0000000..c99d2e5
--- /dev/null
+++ b/extensions/picasaweb/data/Makefile.am
@@ -0,0 +1,18 @@
+SUBDIRS = ui
+
+schemadir = @GCONF_SCHEMA_FILE_DIR@
+schema_in_files = gthumb-picasaweb.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/picasaweb/data/$(schema_DATA)
+endif
+
+EXTRA_DIST = $(schema_in_files)
+
+CLEANFILES = $(schema_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/picasaweb/data/gthumb-picasaweb.schemas.in b/extensions/picasaweb/data/gthumb-picasaweb.schemas.in
new file mode 100644
index 0000000..285017c
--- /dev/null
+++ b/extensions/picasaweb/data/gthumb-picasaweb.schemas.in
@@ -0,0 +1,17 @@
+<gconfschemafile>
+ <schemalist>
+
+ <schema>
+ <key>/schemas/apps/gthumb/ext/picasaweb/synchronize</key>
+ <applyto>/apps/gthumb/ext/picasaweb/synchronize</applyto>
+ <owner>gthumb</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short></short>
+ <long></long>
+ </locale>
+ </schema>
+
+ </schemalist>
+</gconfschemafile>
diff --git a/extensions/picasaweb/data/ui/Makefile.am b/extensions/picasaweb/data/ui/Makefile.am
new file mode 100644
index 0000000..c5ff2c3
--- /dev/null
+++ b/extensions/picasaweb/data/ui/Makefile.am
@@ -0,0 +1,7 @@
+uidir = $(pkgdatadir)/ui
+ui_DATA = \
+ export-to-picasaweb.ui \
+ picasaweb-account.ui
+EXTRA_DIST = $(ui_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/picasaweb/data/ui/export-to-picasaweb.ui b/extensions/picasaweb/data/ui/export-to-picasaweb.ui
new file mode 100644
index 0000000..9ee5b76
--- /dev/null
+++ b/extensions/picasaweb/data/ui/export-to-picasaweb.ui
@@ -0,0 +1,390 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkDialog" id="export_dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Upload to Picasa Web Albums</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox7">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">A_ccount:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="account_combobox">
+ <property name="width_request">300</property>
+ <property name="visible">True</property>
+ <property name="model">account_liststore</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="sensitive">4</attribute>
+ <attribute name="icon-name">3</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext3"/>
+ <attributes>
+ <attribute name="sensitive">4</attribute>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Albums:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="height_request">150</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">album_liststore</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">1</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="title">column</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/>
+ <attributes>
+ <attribute name="icon-name">3</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext5"/>
+ <attributes>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Add a new album</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area7">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="upload_button">
+ <property name="label" translatable="yes">_Upload</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">upload_image</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">close_button</action-widget>
+ <action-widget response="-5">upload_button</action-widget>
+ <action-widget response="-11">button1</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkImage" id="upload_image">
+ <property name="visible">True</property>
+ <property name="stock">gtk-goto-top</property>
+ </object>
+ <object class="GtkListStore" id="album_liststore">
+ <columns>
+ <!-- column-name album data -->
+ <column type="gpointer"/>
+ <!-- column-name type -->
+ <column type="gint"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name icon name -->
+ <column type="gchararray"/>
+ <!-- column-name sensitive -->
+ <column type="gboolean"/>
+ </columns>
+ </object>
+ <object class="GtkListStore" id="account_liststore">
+ <columns>
+ <!-- column-name account data -->
+ <column type="gpointer"/>
+ <!-- column-name type -->
+ <column type="gint"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name icon name -->
+ <column type="gchararray"/>
+ <!-- column-name sensitive -->
+ <column type="gboolean"/>
+ </columns>
+ </object>
+ <object class="GtkDialog" id="choose_account_dialog">
+ <property name="border_width">5</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">A_ccount:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="choose_account_combobox">
+ <property name="width_request">300</property>
+ <property name="visible">True</property>
+ <property name="model">account_liststore</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrenderertext2"/>
+ <attributes>
+ <attribute name="sensitive">4</attribute>
+ <attribute name="icon-name">3</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext4"/>
+ <attributes>
+ <attribute name="sensitive">4</attribute>
+ <attribute name="text">2</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button3">
+ <property name="label">gtk-new</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button4">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button5">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="1">button3</action-widget>
+ <action-widget response="-6">button4</action-widget>
+ <action-widget response="-5">button5</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/extensions/picasaweb/data/ui/picasaweb-account.ui b/extensions/picasaweb/data/ui/picasaweb-account.ui
new file mode 100644
index 0000000..8e7ed7f
--- /dev/null
+++ b/extensions/picasaweb/data/ui/picasaweb-account.ui
@@ -0,0 +1,358 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkDialog" id="account_dialog">
+ <property name="border_width">5</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">6</property>
+ <property name="row_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_E-Mail:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">email_entry</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="email_entry">
+ <property name="width_request">300</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="password_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property name="invisible_char_set">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="challange_box">
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="challenge_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Type the characters you see in the picture below. Letters are not case-sensitive.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="challenge_image">
+ <property name="visible">True</property>
+ <property name="ypad">12</property>
+ <property name="stock">gtk-missing-image</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="challenge_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="top_padding">5</property>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">_Password:</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">button2</action-widget>
+ <action-widget response="-5">button1</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkDialog" id="accounts_dialog">
+ <property name="border_width">5</property>
+ <property name="type_hint">normal</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox2">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Accounts:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="account_treeview">
+ <property name="width_request">300</property>
+ <property name="height_request">150</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">accounts_liststore</property>
+ <property name="headers_visible">False</property>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkButton" id="button6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">New account</property>
+ <child>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-add</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Account properties</property>
+ <child>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-properties</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Delete account</property>
+ <child>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-delete</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area2">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button3">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">button3</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkListStore" id="accounts_liststore">
+ <columns>
+ <!-- column-name account data -->
+ <column type="gpointer"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
+</interface>
diff --git a/extensions/picasaweb/dlg-export-to-picasaweb.c b/extensions/picasaweb/dlg-export-to-picasaweb.c
new file mode 100644
index 0000000..4b237ff
--- /dev/null
+++ b/extensions/picasaweb/dlg-export-to-picasaweb.c
@@ -0,0 +1,498 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2010 The 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>
+#ifdef HAVE_GNOME_KEYRING
+#include <gnome-keyring.h>
+#endif /* HAVE_GNOME_KEYRING */
+#include <gthumb.h>
+#include "dlg-export-to-picasaweb.h"
+#include "gth-account-chooser-dialog.h"
+#include "gth-account-properties-dialog.h"
+#include "picasa-web-service.h"
+
+
+#define GET_WIDGET(x) (_gtk_builder_get_widget (data->builder, (x)))
+
+
+typedef enum {
+ ITEM_TYPE_COMMAND,
+ ITEM_TYPE_ENTRY,
+ ITEM_TYPE_SEPARATOR
+} ItemType;
+
+
+enum {
+ ACCOUNT_DATA_COLUMN,
+ ACCOUNT_TYPE_COLUMN,
+ ACCOUNT_NAME_COLUMN,
+ ACCOUNT_ICON_COLUMN,
+ ACCOUNT_SENSITIVE_COLUMN
+};
+
+
+enum {
+ ALBUM_DATA_COLUMN,
+ ALBUM_TYPE_COLUMN,
+ ALBUM_NAME_COLUMN,
+ ALBUM_ICON_COLUMN,
+ ALBUM_SENSITIVE_COLUMN
+};
+
+
+typedef struct {
+ GthBrowser *browser;
+ GtkBuilder *builder;
+ GtkWidget *dialog;
+ GtkWidget *progress_dialog;
+ GList *accounts;
+ char *email;
+ char *password;
+ GList *albums;
+ GoogleConnection *conn;
+ PicasaWebService *picasaweb;
+ GCancellable *cancellable;
+} DialogData;
+
+
+static void
+export_dialog_destroy_cb (GtkWidget *widget,
+ DialogData *data)
+{
+ _g_object_unref (data->cancellable);
+ _g_object_unref (data->picasaweb);
+ _g_object_unref (data->conn);
+ _g_object_list_unref (data->albums);
+ g_free (data->password);
+ g_free (data->email);
+ _g_string_list_free (data->accounts);
+ g_object_unref (data->builder);
+ g_free (data);
+}
+
+
+static void
+export_dialog_response_cb (GtkDialog *dialog,
+ int response_id,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+
+ switch (response_id) {
+ case GTK_RESPONSE_HELP:
+ show_help_dialog (GTK_WINDOW (data->browser), "export-to-picasaweb");
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ gtk_widget_destroy (data->dialog);
+ break;
+
+ case GTK_RESPONSE_OK:
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+static void
+show_export_dialog (DialogData *data)
+{
+ /* FIXME: update widgets data */
+
+ gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (data->browser));
+ gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
+ gtk_window_present (GTK_WINDOW (data->dialog));
+}
+
+
+static void
+list_albums_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object);
+ GError *error = NULL;
+
+ _g_object_list_unref (data->albums);
+ data->albums = picasa_web_service_list_albums_finish (picasaweb, result, &error);
+ if (error != NULL) {
+ _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
+ gtk_widget_destroy (data->dialog);
+ return;
+ }
+
+ show_export_dialog (data);
+}
+
+
+static void
+connection_ready_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ GoogleConnection *conn = GOOGLE_CONNECTION (source_object);
+ GError *error;
+
+ if (! google_connection_connect_finish (conn, result, &error)) {
+ if (g_error_matches (error, GOOGLE_CONNECTION_ERROR, GOOGLE_CONNECTION_ERROR_CAPTCHA_REQUIRED)) {
+ /* FIXME: request to insert the captcha text */
+ }
+ else {
+ _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
+ gtk_widget_destroy (data->dialog);
+ }
+ return;
+ }
+
+ if (data->picasaweb == NULL)
+ data->picasaweb = picasa_web_service_new (conn);
+ picasa_web_service_list_albums (data->picasaweb,
+ "default",
+ data->cancellable,
+ list_albums_ready_cb,
+ data);
+}
+
+
+static void
+connect_to_server (DialogData *data)
+{
+ if (data->conn == NULL) {
+ data->conn = google_connection_new (GOOGLE_SERVICE_PICASA_WEB_ALBUM);
+ data->progress_dialog = gth_progress_dialog_new (GTK_WINDOW (data->browser));
+ gth_progress_dialog_add_task (GTH_PROGRESS_DIALOG (data->progress_dialog), GTH_TASK (data->conn));
+ }
+
+ google_connection_connect (data->conn,
+ data->email,
+ data->password,
+ NULL,
+ data->cancellable,
+ connection_ready_cb,
+ data);
+}
+
+
+#ifdef HAVE_GNOME_KEYRING
+static void
+store_password_done_cb (GnomeKeyringResult result,
+ gpointer user_data)
+{
+ connect_to_server ((DialogData *) user_data);
+}
+#endif
+
+
+static void
+new_account_dialog_response_cb (GtkDialog *dialog,
+ int response_id,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+
+ switch (response_id) {
+ case GTK_RESPONSE_HELP:
+ show_help_dialog (GTK_WINDOW (dialog), "new-picasaweb-account");
+ break;
+
+ case GTK_RESPONSE_CANCEL:
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_widget_destroy (data->dialog);
+ break;
+
+ case GTK_RESPONSE_OK:
+ {
+ g_free (data->email);
+ g_free (data->password);
+ data->email = g_strdup (gth_account_properties_dialog_get_email (GTH_ACCOUNT_PROPERTIES_DIALOG (dialog)));
+ data->password = g_strdup (gth_account_properties_dialog_get_password (GTH_ACCOUNT_PROPERTIES_DIALOG (dialog)));
+ data->accounts = g_list_append (data->accounts, g_strdup (data->email));
+#ifdef HAVE_GNOME_KEYRING
+ if (gnome_keyring_is_available ())
+ gnome_keyring_store_password (GNOME_KEYRING_NETWORK_PASSWORD,
+ GNOME_KEYRING_SESSION,
+ _("Picasa Web Album"),
+ data->password,
+ store_password_done_cb,
+ data,
+ NULL,
+ "user", data->email,
+ "server", "picasaweb.google.com",
+ "protocol", "http",
+ NULL);
+ else
+#endif
+ connect_to_server (data);
+ }
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+static void
+new_account_dialog (DialogData *data)
+{
+ GtkWidget *dialog;
+
+ dialog = gth_account_properties_dialog_new (NULL, NULL);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (new_account_dialog_response_cb),
+ data);
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (data->browser));
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_present (GTK_WINDOW (dialog));
+}
+
+
+static void
+account_chooser_dialog_response_cb (GtkDialog *dialog,
+ int response_id,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+
+ switch (response_id) {
+ case GTK_RESPONSE_CANCEL:
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_widget_destroy (data->dialog);
+ break;
+
+ case GTK_RESPONSE_OK:
+ g_free (data->password);
+ data->password = NULL;
+ g_free (data->email);
+ data->email = g_strdup (gth_account_chooser_dialog_get_active (GTH_ACCOUNT_CHOOSER_DIALOG (dialog)));
+ if (data->email != NULL) {
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ connect_to_server (data);
+ }
+ break;
+
+ case GTH_ACCOUNT_CHOOSER_RESPONSE_NEW:
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ new_account_dialog (data);
+ break;
+
+ default:
+ break;
+ }
+}
+
+
+static gboolean
+account_combobox_row_separator_func (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ int item_type;
+
+ gtk_tree_model_get (model, iter, ACCOUNT_TYPE_COLUMN, &item_type, -1);
+
+ return item_type == ITEM_TYPE_SEPARATOR;
+}
+
+
+static gboolean
+album_combobox_row_separator_func (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ int item_type;
+
+ gtk_tree_model_get (model, iter, ALBUM_TYPE_COLUMN, &item_type, -1);
+
+ return item_type == ITEM_TYPE_SEPARATOR;
+}
+
+
+static GList *
+picasaweb_accounts_read_from_file (void)
+{
+ GList *accounts = NULL;
+ char *filename;
+ char *buffer;
+ gsize len;
+ GError *error;
+ DomDocument *doc;
+
+ filename = gth_user_dir_get_file (GTH_DIR_CONFIG, GTHUMB_DIR, "accounts", "picasaweb.xml", NULL);
+ g_file_get_contents (filename, &buffer, &len, &error);
+
+ doc = dom_document_new ();
+ if (dom_document_load (doc, buffer, len, &error)) {
+ DomElement *node;
+
+ node = DOM_ELEMENT (doc)->first_child;
+ if ((node != NULL) && (g_strcmp0 (node->tag_name, "accounts") == 0)) {
+ DomElement *child;
+
+ for (child = node->first_child;
+ child != NULL;
+ child = child->next_sibling)
+ {
+ if (strcmp (child->tag_name, "account") == 0) {
+ const char *value;
+
+ value = dom_element_get_attribute (child, "email");
+ if (value != NULL)
+ accounts = g_list_prepend (accounts, g_strdup (value));
+ }
+ }
+
+ accounts = g_list_reverse (accounts);
+ }
+ }
+
+ g_object_unref (doc);
+ g_free (buffer);
+ g_free (filename);
+
+ return accounts;
+}
+
+
+void
+dlg_export_to_picasaweb (GthBrowser *browser)
+{
+ DialogData *data;
+ GtkTreeIter iter;
+
+ data = g_new0 (DialogData, 1);
+ data->browser = browser;
+ data->builder = _gtk_builder_new_from_file ("export-to-picasaweb.ui", "picasaweb");
+ data->dialog = _gtk_builder_get_widget (data->builder, "export_dialog");
+ data->cancellable = g_cancellable_new ();
+
+ /* Set the widget data */
+
+ gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (GET_WIDGET ("account_combobox")),
+ account_combobox_row_separator_func,
+ data,
+ NULL);
+ gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (GET_WIDGET ("album_combobox")),
+ album_combobox_row_separator_func,
+ data,
+ NULL);
+
+ /* Account */
+
+ data->accounts = picasaweb_accounts_read_from_file ();
+
+ /*
+ gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter,
+ ACCOUNT_DATA_COLUMN, NULL,
+ ACCOUNT_TYPE_COLUMN, ITEM_TYPE_ENTRY,
+ ACCOUNT_NAME_COLUMN, "",
+ ACCOUNT_SENSITIVE_COLUMN, FALSE,
+ -1);
+
+ gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter,
+ ACCOUNT_TYPE_COLUMN, ITEM_TYPE_SEPARATOR,
+ ACCOUNT_SENSITIVE_COLUMN, TRUE,
+ -1);
+
+ gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("account_liststore")), &iter,
+ ACCOUNT_DATA_COLUMN, NULL,
+ ACCOUNT_TYPE_COLUMN, ITEM_TYPE_COMMAND,
+ ACCOUNT_ICON_COLUMN, GTK_STOCK_EDIT,
+ ACCOUNT_NAME_COLUMN, _("Edit Accounts..."),
+ ACCOUNT_SENSITIVE_COLUMN, TRUE,
+ -1);
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("account_combobox")), 0);
+ */
+
+ /* Album */
+
+ /*
+ gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter,
+ ALBUM_DATA_COLUMN, NULL,
+ ALBUM_TYPE_COLUMN, ITEM_TYPE_ENTRY,
+ ALBUM_NAME_COLUMN, _("(Empty)"),
+ ALBUM_SENSITIVE_COLUMN, FALSE,
+ -1);
+
+ gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter,
+ ALBUM_TYPE_COLUMN, ITEM_TYPE_SEPARATOR,
+ ALBUM_SENSITIVE_COLUMN, TRUE,
+ -1);
+
+ gtk_list_store_append (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (GET_WIDGET ("album_liststore")), &iter,
+ ALBUM_DATA_COLUMN, NULL,
+ ALBUM_TYPE_COLUMN, ITEM_TYPE_COMMAND,
+ ALBUM_ICON_COLUMN, GTK_STOCK_EDIT,
+ ALBUM_NAME_COLUMN, _("Edit Albums..."),
+ ALBUM_SENSITIVE_COLUMN, TRUE,
+ -1);
+
+ gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("album_combobox")), 0);
+ */
+
+ /* Set the signals handlers. */
+
+ g_signal_connect (G_OBJECT (data->dialog),
+ "destroy",
+ G_CALLBACK (export_dialog_destroy_cb),
+ data);
+ g_signal_connect (data->dialog,
+ "response",
+ G_CALLBACK (export_dialog_response_cb),
+ data);
+
+ if (data->accounts != NULL) {
+ if (data->accounts->next == NULL) {
+ data->email = g_strdup ((char *)data->accounts->data);
+ connect_to_server (data);
+ }
+ else {
+ GtkWidget *dialog;
+
+ dialog = gth_account_chooser_dialog_new (data->accounts);
+ g_signal_connect (dialog,
+ "response",
+ G_CALLBACK (account_chooser_dialog_response_cb),
+ data);
+
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (browser));
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+ gtk_window_present (GTK_WINDOW (dialog));
+ }
+ }
+ else
+ new_account_dialog (data);
+}
diff --git a/extensions/picasaweb/dlg-export-to-picasaweb.h b/extensions/picasaweb/dlg-export-to-picasaweb.h
new file mode 100644
index 0000000..dabc0bd
--- /dev/null
+++ b/extensions/picasaweb/dlg-export-to-picasaweb.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2010 The 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 DLG_EXPORT_TO_PICASAWEB_H
+#define DLG_EXPORT_TO_PICASAWEB_H
+
+#include <gthumb.h>
+
+void dlg_export_to_picasaweb (GthBrowser *browser);
+
+#endif /* DLG_EXPORT_TO_PICASAWEB_H */
diff --git a/extensions/picasaweb/google-connection.c b/extensions/picasaweb/google-connection.c
new file mode 100644
index 0000000..3a2a7bd
--- /dev/null
+++ b/extensions/picasaweb/google-connection.c
@@ -0,0 +1,173 @@
+/* -*- 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 <glib.h>
+#include <glib/gi18n.h>
+#include <gthumb.h>
+#include "google-connection.h"
+
+
+GQuark
+google_connection_error_quark (void)
+{
+ static GQuark quark;
+
+ if (!quark)
+ quark = g_quark_from_static_string ("google_connection");
+
+ return quark;
+}
+
+
+struct _GoogleConnectionPrivate
+{
+ char *service;
+ char *token;
+};
+
+
+static gpointer parent_class = NULL;
+
+
+static void
+google_connection_finalize (GObject *object)
+{
+ GoogleConnection *self;
+
+ self = GOOGLE_CONNECTION (object);
+ g_free (self->priv->service);
+ g_free (self->priv->token);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+google_connection_exec (GthTask *base)
+{
+ /* void */
+}
+
+
+static void
+google_connection_cancelled (GthTask *base)
+{
+ /* void */
+}
+
+
+static void
+google_connection_class_init (GoogleConnectionClass *klass)
+{
+ GObjectClass *object_class;
+ GthTaskClass *task_class;
+
+ parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (GoogleConnectionPrivate));
+
+ object_class = (GObjectClass*) klass;
+ object_class->finalize = google_connection_finalize;
+
+ task_class = (GthTaskClass*) klass;
+ task_class->exec = google_connection_exec;
+ task_class->cancelled = google_connection_cancelled;
+}
+
+
+static void
+google_connection_init (GoogleConnection *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GOOGLE_TYPE_CONNECTION, GoogleConnectionPrivate);
+ self->priv->service = NULL;
+ self->priv->token = NULL;
+}
+
+
+GType
+google_connection_get_type (void)
+{
+ static GType type = 0;
+
+ if (! type) {
+ GTypeInfo type_info = {
+ sizeof (GoogleConnectionClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) google_connection_class_init,
+ NULL,
+ NULL,
+ sizeof (GoogleConnection),
+ 0,
+ (GInstanceInitFunc) google_connection_init
+ };
+
+ type = g_type_register_static (GTH_TYPE_TASK,
+ "GoogleConnection",
+ &type_info,
+ 0);
+ }
+
+ return type;
+}
+
+
+GoogleConnection *
+google_connection_new (const char *service)
+{
+ GoogleConnection *self;
+
+ self = (GoogleConnection *) g_object_new (GOOGLE_TYPE_CONNECTION, NULL);
+ self->priv->service = g_strdup (service);
+
+ return self;
+}
+
+
+void
+google_connection_connect (GoogleConnection *conn,
+ const char *email,
+ const char *password,
+ const char *challange,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ /* FIXME */
+}
+
+
+gboolean
+google_connection_connect_finish (GoogleConnection *conn,
+ GAsyncResult *result,
+ GError **error)
+{
+ /* FIXME */
+ return FALSE;
+}
+
+
+const char *
+google_connection_get_token (GoogleConnection*conn)
+{
+ return conn->priv->token;
+}
diff --git a/extensions/picasaweb/google-connection.h b/extensions/picasaweb/google-connection.h
new file mode 100644
index 0000000..4227379
--- /dev/null
+++ b/extensions/picasaweb/google-connection.h
@@ -0,0 +1,82 @@
+/* -*- 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 GOOGLE_CONNECTION_H
+#define GOOGLE_CONNECTION_H
+
+#include <glib-object.h>
+#include <gthumb.h>
+
+#define GOOGLE_SERVICE_PICASA_WEB_ALBUM "lh2"
+
+typedef enum {
+ GOOGLE_CONNECTION_ERROR_BAD_AUTHENTICATION,
+ GOOGLE_CONNECTION_ERROR_NOT_VERIFIED,
+ GOOGLE_CONNECTION_ERROR_TERMS_NOT_AGREED,
+ GOOGLE_CONNECTION_ERROR_CAPTCHA_REQUIRED,
+ GOOGLE_CONNECTION_ERROR_UNKNOWN,
+ GOOGLE_CONNECTION_ERROR_ACCOUNT_DELETED,
+ GOOGLE_CONNECTION_ERROR_ACCOUNT_DISABLED,
+ GOOGLE_CONNECTION_ERROR_SERVICE_DISABLED,
+ GOOGLE_CONNECTION_ERROR_SERVICE_UNAVAILABLE
+} GoogleConnectionError;
+
+#define GOOGLE_CONNECTION_ERROR google_connection_error_quark ()
+GQuark google_connection_error_quark (void);
+
+#define GOOGLE_TYPE_CONNECTION (google_connection_get_type ())
+#define GOOGLE_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GOOGLE_TYPE_CONNECTION, GoogleConnection))
+#define GOOGLE_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GOOGLE_TYPE_CONNECTION, GoogleConnectionClass))
+#define GOOGLE_IS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOOGLE_TYPE_CONNECTION))
+#define GOOGLE_IS_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GOOGLE_TYPE_CONNECTION))
+#define GOOGLE_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GOOGLE_TYPE_CONNECTION, GoogleConnectionClass))
+
+typedef struct _GoogleConnection GoogleConnection;
+typedef struct _GoogleConnectionPrivate GoogleConnectionPrivate;
+typedef struct _GoogleConnectionClass GoogleConnectionClass;
+
+struct _GoogleConnection
+{
+ GthTask __parent;
+ GoogleConnectionPrivate *priv;
+};
+
+struct _GoogleConnectionClass
+{
+ GthTaskClass __parent_class;
+};
+
+GType google_connection_get_type (void) G_GNUC_CONST;
+GoogleConnection * google_connection_new (const char *service);
+void google_connection_connect (GoogleConnection *conn,
+ const char *email,
+ const char *password,
+ const char *challange,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+gboolean google_connection_connect_finish (GoogleConnection *conn,
+ GAsyncResult *result,
+ GError **error);
+const char * google_connection_get_token (GoogleConnection *conn);
+
+#endif /* GOOGLE_CONNECTION_H */
diff --git a/extensions/picasaweb/gth-account-chooser-dialog.c b/extensions/picasaweb/gth-account-chooser-dialog.c
new file mode 100644
index 0000000..86deacd
--- /dev/null
+++ b/extensions/picasaweb/gth-account-chooser-dialog.c
@@ -0,0 +1,114 @@
+/* -*- 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 <glib/gi18n.h>
+#include "gth-account-chooser-dialog.h"
+
+
+static gpointer parent_class = NULL;
+
+
+struct _GthAccountChooserDialogPrivate {
+ GList *accounts;
+};
+
+
+static void
+gth_account_chooser_dialog_finalize (GObject *object)
+{
+ GthAccountChooserDialog *self;
+
+ self = GTH_ACCOUNT_CHOOSER_DIALOG (object);
+ _g_string_list_free (self->priv->accounts);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+gth_account_chooser_dialog_class_init (GthAccountChooserDialogClass *klass)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (GthAccountChooserDialogPrivate));
+
+ object_class = (GObjectClass*) klass;
+ object_class->finalize = gth_account_chooser_dialog_finalize;
+}
+
+
+static void
+gth_account_chooser_dialog_init (GthAccountChooserDialog *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_ACCOUNT_CHOOSER_DIALOG, GthAccountChooserDialogPrivate);
+ self->priv->accounts = NULL;
+}
+
+
+GType
+gth_account_chooser_dialog_get_type (void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ static const GTypeInfo g_define_type_info = {
+ sizeof (GthAccountChooserDialogClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gth_account_chooser_dialog_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (GthAccountChooserDialog),
+ 0,
+ (GInstanceInitFunc) gth_account_chooser_dialog_init,
+ NULL
+ };
+ type = g_type_register_static (GTK_TYPE_DIALOG,
+ "GthAccountChooserDialog",
+ &g_define_type_info,
+ 0);
+ }
+
+ return type;
+}
+
+
+GtkWidget *
+gth_account_chooser_dialog_new (GList *accounts)
+{
+ GthAccountChooserDialog *self;
+
+ self = g_object_new (GTH_TYPE_ACCOUNT_CHOOSER_DIALOG, NULL);
+ self->priv->accounts = _g_string_list_dup (accounts);
+
+ return (GtkWidget *) self;
+}
+
+
+const char *
+gth_account_chooser_dialog_get_active (GthAccountChooserDialog *self)
+{
+ /* FIXME */
+ return NULL;
+}
diff --git a/extensions/picasaweb/gth-account-chooser-dialog.h b/extensions/picasaweb/gth-account-chooser-dialog.h
new file mode 100644
index 0000000..e467667
--- /dev/null
+++ b/extensions/picasaweb/gth-account-chooser-dialog.h
@@ -0,0 +1,59 @@
+/* -*- 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 GTH_ACCOUNT_CHOOSER_DIALOG_H
+#define GTH_ACCOUNT_CHOOSER_DIALOG_H
+
+#include <gtk/gtk.h>
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define GTH_ACCOUNT_CHOOSER_RESPONSE_NEW 1
+
+#define GTH_TYPE_ACCOUNT_CHOOSER_DIALOG (gth_account_chooser_dialog_get_type ())
+#define GTH_ACCOUNT_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_ACCOUNT_CHOOSER_DIALOG, GthAccountChooserDialog))
+#define GTH_ACCOUNT_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_ACCOUNT_CHOOSER_DIALOG, GthAccountChooserDialogClass))
+#define GTH_IS_ACCOUNT_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_ACCOUNT_CHOOSER_DIALOG))
+#define GTH_IS_ACCOUNT_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_ACCOUNT_CHOOSER_DIALOG))
+#define GTH_ACCOUNT_CHOOSER_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTH_TYPE_ACCOUNT_CHOOSER_DIALOG, GthAccountChooserDialogClass))
+
+typedef struct _GthAccountChooserDialog GthAccountChooserDialog;
+typedef struct _GthAccountChooserDialogClass GthAccountChooserDialogClass;
+typedef struct _GthAccountChooserDialogPrivate GthAccountChooserDialogPrivate;
+
+struct _GthAccountChooserDialog {
+ GtkDialog parent_instance;
+ GthAccountChooserDialogPrivate *priv;
+};
+
+struct _GthAccountChooserDialogClass {
+ GtkDialogClass parent_class;
+};
+
+GType gth_account_chooser_dialog_get_type (void);
+GtkWidget * gth_account_chooser_dialog_new (GList *accounts);
+const char * gth_account_chooser_dialog_get_active (GthAccountChooserDialog *self);
+
+G_END_DECLS
+
+#endif /* GTH_ACCOUNT_CHOOSER_DIALOG_H */
diff --git a/extensions/picasaweb/gth-account-properties-dialog.c b/extensions/picasaweb/gth-account-properties-dialog.c
new file mode 100644
index 0000000..c8c4ad4
--- /dev/null
+++ b/extensions/picasaweb/gth-account-properties-dialog.c
@@ -0,0 +1,135 @@
+/* -*- 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 <glib/gi18n.h>
+#include "gth-account-properties-dialog.h"
+
+
+static gpointer parent_class = NULL;
+
+
+struct _GthAccountPropertiesDialogPrivate {
+ char *email;
+ char *password;
+ char *challange;
+};
+
+
+static void
+gth_account_properties_dialog_finalize (GObject *object)
+{
+ GthAccountPropertiesDialog *self;
+
+ self = GTH_ACCOUNT_PROPERTIES_DIALOG (object);
+ g_free (self->priv->email);
+ g_free (self->priv->password);
+ g_free (self->priv->challange);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+gth_account_properties_dialog_class_init (GthAccountPropertiesDialogClass *klass)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (GthAccountPropertiesDialogPrivate));
+
+ object_class = (GObjectClass*) klass;
+ object_class->finalize = gth_account_properties_dialog_finalize;
+}
+
+
+static void
+gth_account_properties_dialog_init (GthAccountPropertiesDialog *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_ACCOUNT_PROPERTIES_DIALOG, GthAccountPropertiesDialogPrivate);
+ self->priv->email = NULL;
+ self->priv->password = NULL;
+ self->priv->challange = NULL;
+}
+
+
+GType
+gth_account_properties_dialog_get_type (void)
+{
+ static GType type = 0;
+
+ if (type == 0) {
+ static const GTypeInfo g_define_type_info = {
+ sizeof (GthAccountPropertiesDialogClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gth_account_properties_dialog_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL,
+ sizeof (GthAccountPropertiesDialog),
+ 0,
+ (GInstanceInitFunc) gth_account_properties_dialog_init,
+ NULL
+ };
+ type = g_type_register_static (GTK_TYPE_DIALOG,
+ "GthAccountPropertiesDialog",
+ &g_define_type_info,
+ 0);
+ }
+
+ return type;
+}
+
+
+GtkWidget *
+gth_account_properties_dialog_new (const char *email,
+ const char *password)
+{
+ GthAccountPropertiesDialog *self;
+
+ self = g_object_new (GTH_TYPE_ACCOUNT_PROPERTIES_DIALOG, NULL);
+ self->priv->email = g_strdup (email);
+ self->priv->password = g_strdup (password);
+
+ return (GtkWidget *) self;
+}
+
+
+const char *
+gth_account_properties_dialog_get_email (GthAccountPropertiesDialog *self)
+{
+ return self->priv->email;
+}
+
+
+const char *
+gth_account_properties_dialog_get_password (GthAccountPropertiesDialog *self)
+{
+ return self->priv->password;
+}
+
+
+const char *
+gth_account_properties_dialog_get_challange (GthAccountPropertiesDialog *self)
+{
+ return self->priv->challange;
+}
diff --git a/extensions/picasaweb/gth-account-properties-dialog.h b/extensions/picasaweb/gth-account-properties-dialog.h
new file mode 100644
index 0000000..9be0ada
--- /dev/null
+++ b/extensions/picasaweb/gth-account-properties-dialog.h
@@ -0,0 +1,60 @@
+/* -*- 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 GTH_ACCOUNT_PROPERTIES_DIALOG_H
+#define GTH_ACCOUNT_PROPERTIES_DIALOG_H
+
+#include <gtk/gtk.h>
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_ACCOUNT_PROPERTIES_DIALOG (gth_account_properties_dialog_get_type ())
+#define GTH_ACCOUNT_PROPERTIES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_ACCOUNT_PROPERTIES_DIALOG, GthAccountPropertiesDialog))
+#define GTH_ACCOUNT_PROPERTIES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_ACCOUNT_PROPERTIES_DIALOG, GthAccountPropertiesDialogClass))
+#define GTH_IS_ACCOUNT_PROPERTIES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_ACCOUNT_PROPERTIES_DIALOG))
+#define GTH_IS_ACCOUNT_PROPERTIES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_ACCOUNT_PROPERTIES_DIALOG))
+#define GTH_ACCOUNT_PROPERTIES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTH_TYPE_ACCOUNT_PROPERTIES_DIALOG, GthAccountPropertiesDialogClass))
+
+typedef struct _GthAccountPropertiesDialog GthAccountPropertiesDialog;
+typedef struct _GthAccountPropertiesDialogClass GthAccountPropertiesDialogClass;
+typedef struct _GthAccountPropertiesDialogPrivate GthAccountPropertiesDialogPrivate;
+
+struct _GthAccountPropertiesDialog {
+ GtkDialog parent_instance;
+ GthAccountPropertiesDialogPrivate *priv;
+};
+
+struct _GthAccountPropertiesDialogClass {
+ GtkDialogClass parent_class;
+};
+
+GType gth_account_properties_dialog_get_type (void);
+GtkWidget * gth_account_properties_dialog_new (const char *email,
+ const char *password);
+const char * gth_account_properties_dialog_get_email (GthAccountPropertiesDialog *self);
+const char * gth_account_properties_dialog_get_password (GthAccountPropertiesDialog *self);
+const char * gth_account_properties_dialog_get_challange (GthAccountPropertiesDialog *self);
+
+G_END_DECLS
+
+#endif /* GTH_ACCOUNT_PROPERTIES_DIALOG_H */
diff --git a/extensions/picasaweb/main.c b/extensions/picasaweb/main.c
new file mode 100644
index 0000000..137ecf8
--- /dev/null
+++ b/extensions/picasaweb/main.c
@@ -0,0 +1,53 @@
+/* -*- 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>
+#include "callbacks.h"
+
+
+G_MODULE_EXPORT void
+gthumb_extension_activate (void)
+{
+ gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (pw__gth_browser_construct_cb), NULL);
+}
+
+
+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/picasaweb/picasa-web-service.c b/extensions/picasaweb/picasa-web-service.c
new file mode 100644
index 0000000..5173fed
--- /dev/null
+++ b/extensions/picasaweb/picasa-web-service.c
@@ -0,0 +1,130 @@
+/* -*- 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 <glib.h>
+#include <glib/gi18n.h>
+#include <gthumb.h>
+#include "picasa-web-service.h"
+
+
+struct _PicasaWebServicePrivate
+{
+ GoogleConnection *conn;
+};
+
+
+static gpointer parent_class = NULL;
+
+
+static void
+picasa_web_service_finalize (GObject *object)
+{
+ PicasaWebService *self;
+
+ self = PICASA_WEB_SERVICE (object);
+ _g_object_unref (self->priv->conn);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+picasa_web_service_class_init (PicasaWebServiceClass *klass)
+{
+ GObjectClass *object_class;
+
+ parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (PicasaWebServicePrivate));
+
+ object_class = (GObjectClass*) klass;
+ object_class->finalize = picasa_web_service_finalize;
+}
+
+
+static void
+picasa_web_service_init (PicasaWebService *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, PICASA_TYPE_WEB_SERVICE, PicasaWebServicePrivate);
+ self->priv->conn = NULL;
+}
+
+
+GType
+picasa_web_service_get_type (void)
+{
+ static GType type = 0;
+
+ if (! type) {
+ GTypeInfo type_info = {
+ sizeof (PicasaWebServiceClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) picasa_web_service_class_init,
+ NULL,
+ NULL,
+ sizeof (PicasaWebService),
+ 0,
+ (GInstanceInitFunc) picasa_web_service_init
+ };
+
+ type = g_type_register_static (G_TYPE_OBJECT,
+ "PicasaWebService",
+ &type_info,
+ 0);
+ }
+
+ return type;
+}
+
+
+PicasaWebService *
+picasa_web_service_new (GoogleConnection *conn)
+{
+ PicasaWebService *self;
+
+ self = (PicasaWebService *) g_object_new (PICASA_TYPE_WEB_SERVICE, NULL);
+ self->priv->conn = g_object_ref (conn);
+
+ return self;
+}
+
+
+void
+picasa_web_service_list_albums (PicasaWebService *service,
+ const char *user_id,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ /* FIXME */
+}
+
+
+GList *
+picasa_web_service_list_albums_finish (PicasaWebService *service,
+ GAsyncResult *result,
+ GError **error)
+{
+ /* FIXME */
+ return NULL;
+}
diff --git a/extensions/picasaweb/picasa-web-service.h b/extensions/picasaweb/picasa-web-service.h
new file mode 100644
index 0000000..2a774e4
--- /dev/null
+++ b/extensions/picasaweb/picasa-web-service.h
@@ -0,0 +1,62 @@
+/* -*- 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 PICASA_WEB_SERVICE_H
+#define PICASA_WEB_SERVICE_H
+
+#include <glib-object.h>
+#include "google-connection.h"
+
+#define PICASA_TYPE_WEB_SERVICE (picasa_web_service_get_type ())
+#define PICASA_WEB_SERVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PICASA_TYPE_WEB_SERVICE, PicasaWebService))
+#define PICASA_WEB_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), PICASA_TYPE_WEB_SERVICE, PicasaWebServiceClass))
+#define PICASA_IS_WEB_SERVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PICASA_TYPE_WEB_SERVICE))
+#define PICASA_IS_WEB_SERVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PICASA_TYPE_WEB_SERVICE))
+#define PICASA_WEB_SERVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), PICASA_TYPE_WEB_SERVICE, PicasaWebServiceClass))
+
+typedef struct _PicasaWebService PicasaWebService;
+typedef struct _PicasaWebServicePrivate PicasaWebServicePrivate;
+typedef struct _PicasaWebServiceClass PicasaWebServiceClass;
+
+struct _PicasaWebService
+{
+ GObject __parent;
+ PicasaWebServicePrivate *priv;
+};
+
+struct _PicasaWebServiceClass
+{
+ GObjectClass __parent_class;
+};
+
+GType picasa_web_service_get_type (void) G_GNUC_CONST;
+PicasaWebService * picasa_web_service_new (GoogleConnection *conn);
+void picasa_web_service_list_albums (PicasaWebService *service,
+ const char *user_id,
+ GCancellable *cancellable,
+ GAsyncReadyCallback callback,
+ gpointer user_data);
+GList * picasa_web_service_list_albums_finish (PicasaWebService *service,
+ GAsyncResult *result,
+ GError **error);
+
+#endif /* PICASA_WEB_SERVICE_H */
diff --git a/extensions/picasaweb/picasaweb.extension.in.in b/extensions/picasaweb/picasaweb.extension.in.in
new file mode 100644
index 0000000..78209dd
--- /dev/null
+++ b/extensions/picasaweb/picasaweb.extension.in.in
@@ -0,0 +1,10 @@
+[Extension]
+_Name=Picasa Web Albums
+_Description=Upload images to Picasa Web Albums
+Authors=gthumb development team
+Copyright=Copyright © 2010 The Free Software Foundation, Inc.
+Version=1.0
+
+[Loader]
+Type=module
+File=%LIBRARY%
diff --git a/extensions/picasaweb/preferences.h b/extensions/picasaweb/preferences.h
new file mode 100644
index 0000000..033b287
--- /dev/null
+++ b/extensions/picasaweb/preferences.h
@@ -0,0 +1,28 @@
+/* -*- 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 PREFERENCES_H
+#define PREFERENCES_H
+
+#define PREF_PICASAWEB_SYNCHRONIZE "/apps/gthumb/ext/picasaweb/synchronize"
+
+#endif /* PREFERENCES_H */
diff --git a/gthumb/Makefile.am b/gthumb/Makefile.am
index 42a575d..a30d276 100644
--- a/gthumb/Makefile.am
+++ b/gthumb/Makefile.am
@@ -242,8 +242,10 @@ gthumb_LDADD = \
$(JPEG_LIBS) \
$(TIFF_LIBS) \
$(CLUTTER_LIBS) \
+ $(GNOME_KEYRING_LIBS) \
$(GSTREAMER_LIBS) \
$(LIBOPENRAW_LIBS) \
+ $(LIBSOUP_LIBS) \
$(NULL)
if RUN_IN_PLACE
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index 355cec8..6a460f1 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -34,7 +34,7 @@ static GtkActionEntry gth_browser_action_entries[] = {
{ "GoMenu", NULL, N_("_Go") },
{ "HelpMenu", NULL, N_("_Help") },
{ "OpenWithMenu", NULL, N_("Open _With") },
- { "ExportMenu", NULL, N_("E_xport") },
+ { "ExportMenu", NULL, N_("E_xport To") },
{ "File_NewWindow", "window-new",
N_("New _Window"), "<control>N",
diff --git a/gthumb/gth-browser-ui.h b/gthumb/gth-browser-ui.h
index 3ca465c..1f14fdf 100644
--- a/gthumb/gth-browser-ui.h
+++ b/gthumb/gth-browser-ui.h
@@ -41,6 +41,9 @@ static const char *fixed_ui_info =
" <separator/>"
" <placeholder name='Misc_Actions'/>"
" <menu name='Export' action='ExportMenu'>"
+" <placeholder name='Web_Services'/>"
+" <separator/>"
+" <placeholder name='Misc_Actions'/>"
" </menu>"
" <separator/>"
" <menuitem action='File_CloseWindow'/>"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]