[gthumb: 15/22] [picasaweb] started work on a picasa web album importer



commit ffa5a330239ad2be5247a0a266e5355362df71ba
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Jan 28 22:09:07 2010 +0100

    [picasaweb] started work on a picasa web album importer

 extensions/photo_importer/callbacks.c              |   12 +-
 extensions/picasaweb/Makefile.am                   |    2 +
 extensions/picasaweb/actions.c                     |    9 +
 extensions/picasaweb/actions.h                     |    1 +
 extensions/picasaweb/callbacks.c                   |   11 +-
 extensions/picasaweb/data/ui/Makefile.am           |    2 +
 .../picasaweb/data/ui/export-to-picasaweb.ui       |    4 +-
 .../picasaweb/data/ui/import-from-picasaweb.ui     |  551 +++++++++++++++
 extensions/picasaweb/dlg-export-to-picasaweb.c     |   32 +-
 extensions/picasaweb/dlg-import-from-picasaweb.c   |  742 ++++++++++++++++++++
 extensions/picasaweb/dlg-import-from-picasaweb.h   |   30 +
 gthumb/gth-browser-actions-entries.h               |    1 +
 gthumb/gth-browser-ui.h                            |    7 +-
 13 files changed, 1378 insertions(+), 26 deletions(-)
---
diff --git a/extensions/photo_importer/callbacks.c b/extensions/photo_importer/callbacks.c
index 246325f..0733ed5 100644
--- a/extensions/photo_importer/callbacks.c
+++ b/extensions/photo_importer/callbacks.c
@@ -36,17 +36,19 @@ static const char *ui_info =
 "<ui>"
 "  <menubar name='MenuBar'>"
 "    <menu name='File' action='FileMenu'>"
-"      <placeholder name='Misc_Actions'>"
-"        <menuitem action='File_Import'/>"
-"      </placeholder>"
+"      <menu name='Import' action='ImportMenu'>"
+"        <placeholder name='Misc_Actions'>"
+"          <menuitem action='File_ImportFromDevice'/>"
+"        </placeholder>"
+"      </menu>"
 "    </menu>"
 "  </menubar>"
 "</ui>";
 
 
 static GtkActionEntry action_entries[] = {
-	{ "File_Import", NULL,
-	  N_("_Import..."), NULL,
+	{ "File_ImportFromDevice", NULL,
+	  N_("_Removable Device..."), NULL,
 	  N_("Import photos and other files from a removable device"),
 	  G_CALLBACK (gth_browser_activate_action_import_files) },
 };
diff --git a/extensions/picasaweb/Makefile.am b/extensions/picasaweb/Makefile.am
index e6f5c68..2261800 100644
--- a/extensions/picasaweb/Makefile.am
+++ b/extensions/picasaweb/Makefile.am
@@ -12,6 +12,8 @@ libpicasaweb_la_SOURCES = 			\
 	callbacks.h				\
 	dlg-export-to-picasaweb.c		\
 	dlg-export-to-picasaweb.h		\
+	dlg-import-from-picasaweb.c		\
+	dlg-import-from-picasaweb.h		\
 	google-connection.c			\
 	google-connection.h			\
 	main.c					\
diff --git a/extensions/picasaweb/actions.c b/extensions/picasaweb/actions.c
index bb3e40b..e9df397 100644
--- a/extensions/picasaweb/actions.c
+++ b/extensions/picasaweb/actions.c
@@ -25,6 +25,15 @@
 #include <glib/gi18n.h>
 #include <gthumb.h>
 #include "dlg-export-to-picasaweb.h"
+#include "dlg-import-from-picasaweb.h"
+
+
+void
+gth_browser_activate_action_import_picasaweb (GtkAction  *action,
+					      GthBrowser *browser)
+{
+	dlg_import_from_picasaweb (browser);
+}
 
 
 void
diff --git a/extensions/picasaweb/actions.h b/extensions/picasaweb/actions.h
index 26b5da8..903fe7d 100644
--- a/extensions/picasaweb/actions.h
+++ b/extensions/picasaweb/actions.h
@@ -27,6 +27,7 @@
 
 #define DEFINE_ACTION(x) void x (GtkAction *action, gpointer data);
 
+DEFINE_ACTION(gth_browser_activate_action_import_picasaweb)
 DEFINE_ACTION(gth_browser_activate_action_export_picasaweb)
 
 #endif /* ACTIONS_H */
diff --git a/extensions/picasaweb/callbacks.c b/extensions/picasaweb/callbacks.c
index 8d158be..4656d8b 100644
--- a/extensions/picasaweb/callbacks.c
+++ b/extensions/picasaweb/callbacks.c
@@ -35,6 +35,11 @@ static const char *ui_info =
 "<ui>"
 "  <menubar name='MenuBar'>"
 "    <menu name='File' action='FileMenu'>"
+"      <menu name='Import' action='ImportMenu'>"
+"        <placeholder name='Web_Services'>"
+"          <menuitem action='File_Import_PicasaWeb'/>"
+"        </placeholder>"
+"      </menu>"
 "      <menu name='Export' action='ExportMenu'>"
 "        <placeholder name='Web_Services'>"
 "          <menuitem action='File_Export_PicasaWeb'/>"
@@ -46,8 +51,12 @@ static const char *ui_info =
 
 
 static GtkActionEntry action_entries[] = {
+	{ "File_Import_PicasaWeb", NULL,
+	  N_("_Picasa Web Album..."), NULL,
+	  N_("Download photos from Picasa Web Album"),
+	  G_CALLBACK (gth_browser_activate_action_import_picasaweb) },
 	{ "File_Export_PicasaWeb", NULL,
-	  N_("Picasa Web Album..."), NULL,
+	  N_("_Picasa Web Album..."), NULL,
 	  N_("Upload photos to Picasa Web Album"),
 	  G_CALLBACK (gth_browser_activate_action_export_picasaweb) },
 };
diff --git a/extensions/picasaweb/data/ui/Makefile.am b/extensions/picasaweb/data/ui/Makefile.am
index c8d5702..bda5ffb 100644
--- a/extensions/picasaweb/data/ui/Makefile.am
+++ b/extensions/picasaweb/data/ui/Makefile.am
@@ -1,6 +1,8 @@
 uidir = $(pkgdatadir)/ui
 ui_DATA = 					\
 	export-to-picasaweb.ui			\
+	import-from-picasaweb.ui		\
+	picasa-web-account-chooser.ui		\
 	picasa-web-account-manager.ui		\
 	picasa-web-account-properties.ui	\
 	picasa-web-album-properties.ui
diff --git a/extensions/picasaweb/data/ui/export-to-picasaweb.ui b/extensions/picasaweb/data/ui/export-to-picasaweb.ui
index 8a703d5..b265cb5 100644
--- a/extensions/picasaweb/data/ui/export-to-picasaweb.ui
+++ b/extensions/picasaweb/data/ui/export-to-picasaweb.ui
@@ -30,7 +30,7 @@
   </object>
   <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="title" translatable="yes">Export to Picasa Web Albums</property>
     <property name="type_hint">dialog</property>
     <property name="has_separator">False</property>
     <child internal-child="vbox">
@@ -49,7 +49,7 @@
                 <property name="height_request">220</property>
                 <property name="visible">True</property>
                 <property name="orientation">vertical</property>
-                <property name="spacing">6</property>
+                <property name="spacing">3</property>
                 <child>
                   <object class="GtkLabel" id="images_info_label">
                     <property name="visible">True</property>
diff --git a/extensions/picasaweb/data/ui/import-from-picasaweb.ui b/extensions/picasaweb/data/ui/import-from-picasaweb.ui
new file mode 100644
index 0000000..8044eac
--- /dev/null
+++ b/extensions/picasaweb/data/ui/import-from-picasaweb.ui
@@ -0,0 +1,551 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkListStore" id="account_liststore">
+    <columns>
+      <!-- column-name email -->
+      <column type="gchararray"/>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name icon -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkDialog" id="import_dialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Import from 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="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="border_width">5</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkVBox" id="vbox1">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkTable" id="table1">
+                    <property name="visible">True</property>
+                    <property name="n_rows">2</property>
+                    <property name="n_columns">2</property>
+                    <property name="column_spacing">6</property>
+                    <property name="row_spacing">5</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox4">
+                        <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">3</property>
+                        <child>
+                          <object class="GtkHBox" id="hbox4">
+                            <property name="visible">True</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkComboBox" id="account_combobox">
+                                <property name="visible">True</property>
+                                <property name="model">account_liststore</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                                  <attributes>
+                                    <attribute name="text">1</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="edit_accounts_button">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="tooltip_text" translatable="yes">Edit accounts</property>
+                                <child>
+                                  <object class="GtkImage" id="image2">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-edit</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                      </packing>
+                    </child>
+                    <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="x_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">_Album:</property>
+                        <property name="use_underline">True</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkComboBox" id="album_combobox">
+                        <property name="visible">True</property>
+                        <property name="model">album_liststore</property>
+                      </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>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="images_box">
+                <property name="width_request">460</property>
+                <property name="height_request">220</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">3</property>
+                <child>
+                  <object class="GtkLabel" id="images_info_label">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">0</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_area7">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <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">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="preferences_button">
+                <property name="label">gtk-preferences</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="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">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="download_button">
+                <property name="label" translatable="yes">_Download</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="image">download_image</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</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="-11">button1</action-widget>
+      <action-widget response="0">preferences_button</action-widget>
+      <action-widget response="-6">close_button</action-widget>
+      <action-widget response="-5">download_button</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkImage" id="download_image">
+    <property name="visible">True</property>
+    <property name="stock">gtk-goto-bottom</property>
+  </object>
+  <object class="GtkDialog" id="preferences_dialog">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Preferences</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="transient_for">import_dialog</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox4">
+        <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>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkFrame" id="frame1">
+                <property name="visible">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox3">
+                        <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkHBox" id="hbox2">
+                            <property name="visible">True</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkFileChooserButton" id="destination_filechooserbutton">
+                                <property name="visible">True</property>
+                                <property name="create_folders">False</property>
+                                <property name="local_only">False</property>
+                                <property name="action">select-folder</property>
+                              </object>
+                              <packing>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Destination</property>
+                    <property name="use_markup">True</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="vbox6">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkCheckButton" id="autosubfolder_checkbutton">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="draw_indicator">True</property>
+                    <child>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Automatic subfolder</property>
+                        <property name="use_underline">True</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment1">
+                    <property name="visible">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">14</property>
+                    <child>
+                      <object class="GtkHBox" id="subfolder_type_box">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <object class="GtkNotebook" id="subfolder_options_notebook">
+                            <property name="visible">True</property>
+                            <property name="show_tabs">False</property>
+                            <property name="show_border">False</property>
+                            <child>
+                              <object class="GtkCheckButton" id="single_subfolder_checkbutton">
+                                <property name="label" translatable="yes">as _single subfolder</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <property name="draw_indicator">True</property>
+                              </object>
+                            </child>
+                            <child type="tab">
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <object class="GtkEntry" id="custom_format_entry">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="invisible_char">&#x25CF;</property>
+                              </object>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child type="tab">
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child type="tab">
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="pack_type">end</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkAlignment" id="alignment3">
+                    <property name="visible">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">14</property>
+                    <child>
+                      <object class="GtkLabel" id="example_label">
+                        <property name="visible">True</property>
+                        <property name="xalign">0</property>
+                        <property name="label">example: file:///home/paolo/images/2009/08/12</property>
+                        <attributes>
+                          <attribute name="size" value="8500"/>
+                        </attributes>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame2">
+                <property name="visible">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment4">
+                    <property name="visible">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox5">
+                        <property name="visible">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkCheckButton" id="overwrite_checkbutton">
+                            <property name="label" translatable="yes">_Overwrite existing files</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label5">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Files</property>
+                    <property name="use_markup">True</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</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_area4">
+            <property name="visible">True</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="p_close_button">
+                <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>
+            <child>
+              <object class="GtkButton" id="help_button">
+                <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">1</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="0">p_close_button</action-widget>
+      <action-widget response="0">help_button</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkListStore" id="album_liststore">
+    <columns>
+      <!-- column-name data -->
+      <column type="GObject"/>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name icon -->
+      <column type="gchararray"/>
+      <!-- column-name size -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+</interface>
diff --git a/extensions/picasaweb/dlg-export-to-picasaweb.c b/extensions/picasaweb/dlg-export-to-picasaweb.c
index dda2d22..9ca53c5 100644
--- a/extensions/picasaweb/dlg-export-to-picasaweb.c
+++ b/extensions/picasaweb/dlg-export-to-picasaweb.c
@@ -81,7 +81,6 @@ export_dialog_destroy_cb (GtkWidget  *widget,
 {
 	if (data->conn != NULL)
 		gth_task_completed (GTH_TASK (data->conn), NULL);
-
 	_g_object_unref (data->cancellable);
 	_g_object_unref (data->picasaweb);
 	_g_object_unref (data->conn);
@@ -232,7 +231,6 @@ update_album_list (DialogData *data)
 				    ALBUM_NAME_COLUMN, album->title,
 				    ALBUM_REMAINING_IMAGES_COLUMN, n_photos_remaining,
 				    ALBUM_USED_BYTES_COLUMN, used_bytes,
-				    ALBUM_EMBLEM_COLUMN, "emblem-readonly",
 				    -1);
 
 		if (album->access == PICASA_WEB_ACCESS_PRIVATE)
@@ -795,28 +793,28 @@ dlg_export_to_picasaweb (GthBrowser *browser,
 	data->cancellable = g_cancellable_new ();
 
 	{
-		GtkTreeViewColumn *tree_column;
-		GtkCellRenderer   *renderer;
+		GtkCellLayout   *cell_layout;
+		GtkCellRenderer *renderer;
 
-		tree_column = GTK_TREE_VIEW_COLUMN (GET_WIDGET ("name_treeviewcolumn"));
+		cell_layout = GTK_CELL_LAYOUT (GET_WIDGET ("name_treeviewcolumn"));
 
 		renderer = gtk_cell_renderer_pixbuf_new ();
-		gtk_tree_view_column_pack_start (tree_column, renderer, FALSE);
-		gtk_tree_view_column_set_attributes (tree_column, renderer,
-						     "icon-name", ALBUM_ICON_COLUMN,
-						     NULL);
+		gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
+		gtk_cell_layout_set_attributes (cell_layout, renderer,
+						"icon-name", ALBUM_ICON_COLUMN,
+						NULL);
 
 		renderer = gtk_cell_renderer_text_new ();
-		gtk_tree_view_column_pack_start (tree_column, renderer, TRUE);
-		gtk_tree_view_column_set_attributes (tree_column, renderer,
-						     "text", ALBUM_NAME_COLUMN,
-						     NULL);
+		gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
+		gtk_cell_layout_set_attributes (cell_layout, renderer,
+						"text", ALBUM_NAME_COLUMN,
+						NULL);
 
 		renderer = gtk_cell_renderer_pixbuf_new ();
-		gtk_tree_view_column_pack_start (tree_column, renderer, FALSE);
-		gtk_tree_view_column_set_attributes (tree_column, renderer,
-						     "icon-name", ALBUM_EMBLEM_COLUMN,
-						     NULL);
+		gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
+		gtk_cell_layout_set_attributes (cell_layout, renderer,
+						"icon-name", ALBUM_EMBLEM_COLUMN,
+						NULL);
 	}
 
 	data->file_list = NULL;
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.c b/extensions/picasaweb/dlg-import-from-picasaweb.c
new file mode 100644
index 0000000..ed9b509
--- /dev/null
+++ b/extensions/picasaweb/dlg-import-from-picasaweb.c
@@ -0,0 +1,742 @@
+/* -*- 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-import-from-picasaweb.h"
+#include "picasa-account-chooser-dialog.h"
+#include "picasa-account-manager-dialog.h"
+#include "picasa-account-properties-dialog.h"
+#include "picasa-album-properties-dialog.h"
+#include "picasa-web-album.h"
+#include "picasa-web-service.h"
+#include "picasa-web-user.h"
+
+
+#define GET_WIDGET(x) (_gtk_builder_get_widget (data->builder, (x)))
+
+
+enum {
+	ACCOUNT_EMAIL_COLUMN,
+	ACCOUNT_NAME_COLUMN,
+	ACCOUNT_ICON_COLUMN
+};
+
+
+enum {
+	ALBUM_DATA_COLUMN,
+	ALBUM_NAME_COLUMN,
+	ALBUM_ICON_COLUMN,
+	ALBUM_SIZE_COLUMN
+};
+
+
+typedef struct {
+	GthBrowser       *browser;
+	GthFileData      *location;
+	GtkBuilder       *builder;
+	GtkWidget        *dialog;
+	GtkWidget        *progress_dialog;
+	GtkWidget        *list_view;
+	GList            *accounts;
+	PicasaWebUser    *user;
+	char             *email;
+	char             *password;
+	char             *challange;
+	GList            *albums;
+	GoogleConnection *conn;
+	PicasaWebService *picasaweb;
+	GCancellable     *cancellable;
+} DialogData;
+
+
+static void
+import_dialog_destroy_cb (GtkWidget  *widget,
+			  DialogData *data)
+{
+	if (data->conn != NULL)
+		gth_task_completed (GTH_TASK (data->conn), NULL);
+	_g_object_unref (data->cancellable);
+	_g_object_unref (data->picasaweb);
+	_g_object_unref (data->conn);
+	_g_object_list_unref (data->albums);
+	g_free (data->challange);
+	g_free (data->password);
+	g_free (data->email);
+	_g_object_unref (data->user);
+	_g_string_list_free (data->accounts);
+	_g_object_unref (data->builder);
+	_g_object_unref (data->location);
+	g_free (data);
+}
+
+
+/* FIXME
+static void get_album_list (DialogData *data);
+
+
+static void
+post_photos_ready_cb (GObject      *source_object,
+		      GAsyncResult *result,
+		      gpointer      user_data)
+{
+	DialogData       *data = user_data;
+	PicasaWebService *picasaweb = PICASA_WEB_SERVICE (source_object);
+	GError           *error = NULL;
+
+	gth_task_dialog (GTH_TASK (data->conn), TRUE);
+
+	if (! picasa_web_service_post_photos_finish (picasaweb, result, &error)) {
+		_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), &error);
+		return;
+	}
+
+	get_album_list (data);
+}
+*/
+
+
+static void
+import_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_DELETE_EVENT:
+	case GTK_RESPONSE_CANCEL:
+		picasa_web_accounts_save_to_file (data->accounts, data->email);
+		gtk_widget_destroy (data->dialog);
+		break;
+
+	case GTK_RESPONSE_OK:
+		{
+			GtkTreeModel   *tree_model;
+			GtkTreeIter     iter;
+			PicasaWebAlbum *album;
+			/*GList          *file_list;*/
+
+			if (! gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (GET_WIDGET ("albums_treeview"))), &tree_model, &iter)) {
+				gtk_widget_set_sensitive (GET_WIDGET ("download_button"), FALSE);
+				return;
+			}
+
+			gtk_tree_model_get (tree_model, &iter,
+					    ALBUM_DATA_COLUMN, &album,
+					    -1);
+
+			gth_task_dialog (GTH_TASK (data->conn), FALSE);
+
+			/* FIXME
+			file_list = gth_file_data_list_to_file_list (data->file_list);
+			picasa_web_service_post_photos (data->picasaweb,
+							album,
+							file_list,
+							data->cancellable,
+							post_photos_ready_cb,
+							data);
+
+			_g_object_list_unref (file_list);
+			*/
+			g_object_unref (album);
+		}
+		break;
+
+	default:
+		break;
+	}
+}
+
+
+static void
+update_account_list (DialogData *data)
+{
+	GtkTreeIter  iter;
+	int          current_account;
+	int          idx;
+	GList       *scan;
+
+	current_account = 0;
+	gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("account_liststore")));
+	for (scan = data->accounts, idx = 0; scan; scan = scan->next, idx++) {
+		char *account = scan->data;
+
+		if (g_strcmp0 (account, data->email) == 0)
+			current_account = idx;
+
+		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_EMAIL_COLUMN, account,
+				    ACCOUNT_NAME_COLUMN, account,
+				    -1);
+	}
+
+	gtk_combo_box_set_active (GTK_COMBO_BOX (GET_WIDGET ("account_combobox")), current_account);
+}
+
+
+static void
+update_album_list (DialogData *data)
+{
+	GtkTreeIter  iter;
+	GList       *scan;
+
+	g_return_if_fail (data->user != NULL);
+
+	gtk_list_store_clear (GTK_LIST_STORE (GET_WIDGET ("album_liststore")));
+	for (scan = data->albums; scan; scan = scan->next) {
+		PicasaWebAlbum *album = scan->data;
+
+		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, album,
+				    ALBUM_ICON_COLUMN, "file-catalog",
+				    ALBUM_NAME_COLUMN, album->title,
+				    -1);
+	}
+
+	gtk_widget_set_sensitive (GET_WIDGET ("download_button"), FALSE);
+}
+
+
+static void
+show_import_dialog (DialogData *data)
+{
+	update_account_list (data);
+	update_album_list (data);
+	gth_task_dialog (GTH_TASK (data->conn), TRUE);
+
+	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 get the album list"), &error);
+		gtk_widget_destroy (data->dialog);
+		return;
+	}
+
+	_g_object_unref (data->user);
+	data->user = g_object_ref (picasa_web_service_get_user (picasaweb));
+	show_import_dialog (data);
+}
+
+
+static void
+get_album_list (DialogData *data)
+{
+	if (data->picasaweb == NULL)
+		data->picasaweb = picasa_web_service_new (data->conn);
+	picasa_web_service_list_albums (data->picasaweb,
+				        "default",
+				        data->cancellable,
+				        list_albums_ready_cb,
+				        data);
+}
+
+
+#ifdef HAVE_GNOME_KEYRING
+static void
+store_password_done_cb (GnomeKeyringResult result,
+			gpointer           user_data)
+{
+	get_album_list ((DialogData *) user_data);
+}
+#endif
+
+
+static void account_properties_dialog (DialogData *data,
+			               const char *email);
+static void challange_account_dialog  (DialogData *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 = NULL;
+
+	if (! google_connection_connect_finish (conn, result, &error)) {
+		if (g_error_matches (error, GOOGLE_CONNECTION_ERROR, GOOGLE_CONNECTION_ERROR_CAPTCHA_REQUIRED)) {
+			challange_account_dialog (data);
+		}
+		else if (g_error_matches (error, GOOGLE_CONNECTION_ERROR, GOOGLE_CONNECTION_ERROR_BAD_AUTHENTICATION)) {
+			account_properties_dialog (data, data->email);
+		}
+		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 (! g_list_find_custom (data->accounts, data->email, (GCompareFunc) strcmp))
+		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);
+		return;
+	}
+#endif
+
+	get_album_list (data);
+}
+
+
+static void connect_to_server (DialogData *data);
+
+
+static void
+account_properties_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), "picasaweb-account-properties");
+		break;
+
+	case GTK_RESPONSE_DELETE_EVENT:
+	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);
+		g_free (data->challange);
+		data->email = g_strdup (picasa_account_properties_dialog_get_email (PICASA_ACCOUNT_PROPERTIES_DIALOG (dialog)));
+		data->password = g_strdup (picasa_account_properties_dialog_get_password (PICASA_ACCOUNT_PROPERTIES_DIALOG (dialog)));
+		data->challange = NULL;
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		connect_to_server (data);
+		break;
+
+	default:
+		break;
+	}
+}
+
+
+static void
+account_properties_dialog (DialogData *data,
+			   const char *email)
+{
+	GtkWidget *dialog;
+
+	if (data->conn != NULL)
+		gth_task_dialog (GTH_TASK (data->conn), TRUE);
+
+	dialog = picasa_account_properties_dialog_new (email, NULL, NULL);
+	g_signal_connect (dialog,
+			  "response",
+			  G_CALLBACK (account_properties_dialog_response_cb),
+			  data);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Account"));
+	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
+connect_to_server_step2 (DialogData *data)
+{
+	if (data->password == NULL) {
+		gth_task_dialog (GTH_TASK (data->conn), TRUE);
+		account_properties_dialog (data, data->email);
+	}
+	else {
+		gth_task_dialog (GTH_TASK (data->conn), FALSE);
+		google_connection_connect (data->conn,
+					   data->email,
+					   data->password,
+					   data->challange,
+					   data->cancellable,
+					   connection_ready_cb,
+					   data);
+	}
+}
+
+
+#ifdef HAVE_GNOME_KEYRING
+static void
+find_password_cb (GnomeKeyringResult result,
+                  const char        *string,
+                  gpointer           user_data)
+{
+	DialogData *data = user_data;
+
+	if (string != NULL)
+		data->password = g_strdup (string);
+	connect_to_server_step2 (data);
+}
+#endif
+
+
+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));
+	}
+
+#ifdef HAVE_GNOME_KEYRING
+	if ((data->password == NULL) && gnome_keyring_is_available ()) {
+		gnome_keyring_find_password (GNOME_KEYRING_NETWORK_PASSWORD,
+					     find_password_cb,
+					     data,
+					     NULL,
+					     "user", data->email,
+					     "server", "picasaweb.google.com",
+					     "protocol", "http",
+					     NULL);
+		return;
+	}
+#endif
+
+	connect_to_server_step2 (data);
+}
+
+
+static void
+challange_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), "picasaweb-account-challange");
+		break;
+
+	case GTK_RESPONSE_DELETE_EVENT:
+	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 (picasa_account_properties_dialog_get_email (PICASA_ACCOUNT_PROPERTIES_DIALOG (dialog)));
+		data->password = g_strdup (picasa_account_properties_dialog_get_password (PICASA_ACCOUNT_PROPERTIES_DIALOG (dialog)));
+		data->challange = g_strdup (picasa_account_properties_dialog_get_challange (PICASA_ACCOUNT_PROPERTIES_DIALOG (dialog)));
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		connect_to_server (data);
+		break;
+
+	default:
+		break;
+	}
+}
+
+
+static void
+challange_account_dialog (DialogData *data)
+{
+	GtkWidget *dialog;
+
+	dialog = picasa_account_properties_dialog_new (data->email, data->password, google_connection_get_challange_url (data->conn));
+	g_signal_connect (dialog,
+			  "response",
+			  G_CALLBACK (challange_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_DELETE_EVENT:
+	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->challange);
+		data->challange = NULL;
+		g_free (data->email);
+		data->email = picasa_account_chooser_dialog_get_active (PICASA_ACCOUNT_CHOOSER_DIALOG (dialog));
+		if (data->email != NULL) {
+			gtk_widget_destroy (GTK_WIDGET (dialog));
+			connect_to_server (data);
+		}
+
+		break;
+
+	case PICASA_ACCOUNT_CHOOSER_RESPONSE_NEW:
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		account_properties_dialog (data, NULL);
+		break;
+
+	default:
+		break;
+	}
+}
+
+
+static void
+auto_select_account (DialogData *data)
+{
+	gtk_widget_hide (data->dialog);
+
+	if (data->accounts != NULL) {
+		if (data->email != NULL) {
+			connect_to_server (data);
+		}
+		else if (data->accounts->next == NULL) {
+			data->email = g_strdup ((char *)data->accounts->data);
+			connect_to_server (data);
+		}
+		else {
+			GtkWidget *dialog;
+
+			dialog = picasa_account_chooser_dialog_new (data->accounts, data->email);
+			g_signal_connect (dialog,
+					  "response",
+					  G_CALLBACK (account_chooser_dialog_response_cb),
+					  data);
+
+			gtk_window_set_title (GTK_WINDOW (dialog), _("Choose Account"));
+			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));
+		}
+	}
+	else
+		account_properties_dialog (data, NULL);
+}
+
+
+static void
+account_manager_dialog_response_cb (GtkDialog *dialog,
+			            int        response_id,
+			            gpointer   user_data)
+{
+	DialogData *data = user_data;
+
+	switch (response_id) {
+	case GTK_RESPONSE_DELETE_EVENT:
+	case GTK_RESPONSE_CANCEL:
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		break;
+
+	case GTK_RESPONSE_OK:
+		_g_string_list_free (data->accounts);
+		data->accounts = picasa_account_manager_dialog_get_accounts (PICASA_ACCOUNT_MANAGER_DIALOG (dialog));
+		if (! g_list_find_custom (data->accounts, data->email, (GCompareFunc) strcmp)) {
+			g_free (data->email);
+			data->email = NULL;
+			auto_select_account (data);
+		}
+		else
+			update_account_list (data);
+		picasa_web_accounts_save_to_file (data->accounts, data->email);
+		gtk_widget_destroy (GTK_WIDGET (dialog));
+		break;
+
+	default:
+		break;
+	}
+}
+
+
+static void
+edit_accounts_button_clicked_cb (GtkButton *button,
+			         gpointer   user_data)
+{
+	DialogData *data = user_data;
+	GtkWidget  *dialog;
+
+	dialog = picasa_account_manager_dialog_new (data->accounts);
+	g_signal_connect (dialog,
+			  "response",
+			  G_CALLBACK (account_manager_dialog_response_cb),
+			  data);
+
+	gtk_window_set_title (GTK_WINDOW (dialog), _("Edit Accounts"));
+	gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (data->dialog));
+	gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
+	gtk_window_present (GTK_WINDOW (dialog));
+}
+
+
+static void
+account_combobox_changed_cb (GtkComboBox *widget,
+			     gpointer     user_data)
+{
+	DialogData  *data = user_data;
+	GtkTreeIter  iter;
+	char        *email;
+
+	if (! gtk_combo_box_get_active_iter (widget, &iter))
+		return;
+
+	gtk_tree_model_get (gtk_combo_box_get_model (widget),
+			    &iter,
+			    ACCOUNT_EMAIL_COLUMN, &email,
+			    -1);
+
+	if (g_strcmp0 (email, data->email) != 0) {
+		g_free (data->email);
+		data->email = email;
+		auto_select_account (data);
+	}
+	else
+		g_free (email);
+}
+
+
+void
+dlg_import_from_picasaweb (GthBrowser *browser)
+{
+	DialogData *data;
+
+	data = g_new0 (DialogData, 1);
+	data->browser = browser;
+	data->location = gth_file_data_dup (gth_browser_get_location_data (browser));
+	data->builder = _gtk_builder_new_from_file ("import-from-picasaweb.ui", "picasaweb");
+	data->dialog = _gtk_builder_get_widget (data->builder, "import_dialog");
+	data->cancellable = g_cancellable_new ();
+
+	{
+		GtkCellLayout   *cell_layout;
+		GtkCellRenderer *renderer;
+
+		cell_layout = GTK_CELL_LAYOUT (GET_WIDGET ("album_combobox"));
+
+		renderer = gtk_cell_renderer_pixbuf_new ();
+		gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
+		gtk_cell_layout_set_attributes (cell_layout, renderer,
+						"icon-name", ALBUM_ICON_COLUMN,
+						NULL);
+
+		renderer = gtk_cell_renderer_text_new ();
+		gtk_cell_layout_pack_start (cell_layout, renderer, TRUE);
+		gtk_cell_layout_set_attributes (cell_layout, renderer,
+						"text", ALBUM_NAME_COLUMN,
+						NULL);
+
+		renderer = gtk_cell_renderer_text_new ();
+		gtk_cell_layout_pack_start (cell_layout, renderer, FALSE);
+		gtk_cell_layout_set_attributes (cell_layout, renderer,
+						"text", ALBUM_SIZE_COLUMN,
+						NULL);
+	}
+
+	/* Set the widget data */
+
+	data->list_view = gth_file_list_new (GTH_FILE_LIST_TYPE_NO_SELECTION);
+	gth_file_list_set_thumb_size (GTH_FILE_LIST (data->list_view), 112);
+	gth_file_view_set_spacing (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->list_view))), 0);
+	gth_file_list_enable_thumbs (GTH_FILE_LIST (data->list_view), TRUE);
+	gth_file_list_set_caption (GTH_FILE_LIST (data->list_view), "none");
+	gth_file_list_set_sort_func (GTH_FILE_LIST (data->list_view), gth_main_get_sort_type ("file::name")->cmp_func, FALSE);
+	gtk_widget_show (data->list_view);
+	gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), data->list_view, TRUE, TRUE, 0);
+
+	gtk_widget_set_sensitive (GET_WIDGET ("download_button"), FALSE);
+
+	/* Set the signals handlers. */
+
+	g_signal_connect (G_OBJECT (data->dialog),
+			  "destroy",
+			  G_CALLBACK (import_dialog_destroy_cb),
+			  data);
+	g_signal_connect (data->dialog,
+			  "response",
+			  G_CALLBACK (import_dialog_response_cb),
+			  data);
+	g_signal_connect (GET_WIDGET ("edit_accounts_button"),
+			  "clicked",
+			  G_CALLBACK (edit_accounts_button_clicked_cb),
+			  data);
+	g_signal_connect (GET_WIDGET ("account_combobox"),
+			  "changed",
+			  G_CALLBACK (account_combobox_changed_cb),
+			  data);
+	/* FIXME
+	g_signal_connect (GET_WIDGET ("album_combobox"),
+			  "changed",
+			  G_CALLBACK (album_combobox_changed_cb),
+			  data);
+	*/
+
+	data->accounts = picasa_web_accounts_load_from_file (&data->email);
+	auto_select_account (data);
+}
diff --git a/extensions/picasaweb/dlg-import-from-picasaweb.h b/extensions/picasaweb/dlg-import-from-picasaweb.h
new file mode 100644
index 0000000..cf33521
--- /dev/null
+++ b/extensions/picasaweb/dlg-import-from-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_IMPORT_FROM_PICASAWEB_H
+#define DLG_IMPORT_FROM_PICASAWEB_H
+
+#include <gthumb.h>
+
+void dlg_import_from_picasaweb (GthBrowser *browser);
+
+#endif /* DLG_IMPORT_FROM_PICASAWEB_H */
diff --git a/gthumb/gth-browser-actions-entries.h b/gthumb/gth-browser-actions-entries.h
index 6a460f1..9f8a334 100644
--- a/gthumb/gth-browser-actions-entries.h
+++ b/gthumb/gth-browser-actions-entries.h
@@ -34,6 +34,7 @@ static GtkActionEntry gth_browser_action_entries[] = {
 	{ "GoMenu", NULL, N_("_Go") },
 	{ "HelpMenu", NULL, N_("_Help") },
 	{ "OpenWithMenu", NULL, N_("Open _With") },
+	{ "ImportMenu", NULL, N_("I_mport From") },
 	{ "ExportMenu", NULL, N_("E_xport To") },
 
 	{ "File_NewWindow", "window-new",
diff --git a/gthumb/gth-browser-ui.h b/gthumb/gth-browser-ui.h
index 1f14fdf..35e20b5 100644
--- a/gthumb/gth-browser-ui.h
+++ b/gthumb/gth-browser-ui.h
@@ -39,12 +39,17 @@ static const char *fixed_ui_info =
 "      <separator/>"
 "      <placeholder name='Folder_Actions'/>"
 "      <separator/>"
-"      <placeholder name='Misc_Actions'/>"
+"      <menu name='Import' action='ImportMenu'>"
+"        <placeholder name='Misc_Actions'/>"
+"        <separator/>"
+"        <placeholder name='Web_Services'/>"
+"      </menu>"
 "      <menu name='Export' action='ExportMenu'>"
 "        <placeholder name='Web_Services'/>"
 "        <separator/>"
 "        <placeholder name='Misc_Actions'/>"
 "      </menu>"
+"      <placeholder name='Misc_Actions'/>"
 "      <separator/>"
 "      <menuitem action='File_CloseWindow'/>"
 "    </menu>"



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