[niepce: 1/5] * List the folders to import in the import dialog



commit 55bddfbf2958ad9845a60722f87ea47e3eda0a11
Author: Hubert Figuiere <hub figuiere net>
Date:   Wed Mar 4 22:52:05 2009 -0500

    	* List the folders to import in the import dialog.
---
 ChangeLog                      |    4 +
 configure.ac                   |    2 +-
 src/fwk/toolkit/Makefile.am    |    1 +
 src/fwk/toolkit/gtkutils.cpp   |   42 +++++++
 src/fwk/toolkit/gtkutils.hpp   |   55 +++++++++
 src/niepce/ui/Makefile.am      |    2 +-
 src/niepce/ui/importdialog.cpp |  113 +++++++++++-------
 src/niepce/ui/importdialog.h   |   67 -----------
 src/niepce/ui/importdialog.hpp |   77 ++++++++++++
 src/niepce/ui/importdialog.ui  |  254 ++++++++++++++++++++++++++++++++++++++++
 src/niepce/ui/niepcewindow.cpp |   15 ++-
 11 files changed, 511 insertions(+), 121 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index faaf8d6..919cafa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-03-04  Hubert Figuiere  <hub figuiere net>
+
+	* List the folders to import in the import dialog.
+
 2009-03-02  Hubert Figuiere  <hub figuiere net>
 
 	* Add the XMP sidecard if needed to the fsfiles.
diff --git a/configure.ac b/configure.ac
index a9bcf14..1330868 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,7 +19,7 @@ AC_SUBST(NIEPCE_VERSION)
 dnl all the library version.
 dnl if one is harcoded elsewhere, it is a bug
 LIBGLIBMM_VERSION=2.0
-LIBGTKMM_VERSION=2.10.0
+LIBGTKMM_VERSION=2.12.0
 LIBGLADEMM_VERSION=2.6.0
 dnl LIBGCONFMM_VERSION=2.6.0
 LIBGCONF_VERSION=2.0.0
diff --git a/src/fwk/toolkit/Makefile.am b/src/fwk/toolkit/Makefile.am
index eb2d6a0..ea079c4 100644
--- a/src/fwk/toolkit/Makefile.am
+++ b/src/fwk/toolkit/Makefile.am
@@ -21,6 +21,7 @@ libniepceframework_a_SOURCES = configuration.cpp \
 	notificationcenter.h notificationcenter.cpp \
 	configdatabinder.h configdatabinder.cpp \
 	gdkutils.h gdkutils.cpp \
+	gtkutils.hpp gtkutils.cpp \
 	widgets/toolboxitemwidget.h widgets/toolboxitemwidget.cpp \
 	widgets/editablehscale.h widgets/editablehscale.cpp \
 	widgets/dock-item.cpp widgets/dock-item.h \
diff --git a/src/fwk/toolkit/gtkutils.cpp b/src/fwk/toolkit/gtkutils.cpp
new file mode 100644
index 0000000..cdf543a
--- /dev/null
+++ b/src/fwk/toolkit/gtkutils.cpp
@@ -0,0 +1,42 @@
+/*
+ * niepce - fwk/toolkit/gtkutils.cpp
+ *
+ * Copyright (C) 2009 Hubert Figuiere
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtkmm/liststore.h>
+
+#include "gtkutils.hpp"
+
+namespace fwk {
+
+void TextTreeviewModel::inject(Gtk::TreeView & treeview)
+{
+    treeview.set_model(Gtk::ListStore::create(*this));
+    treeview.append_column("", m_col1);
+}
+
+
+}
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
diff --git a/src/fwk/toolkit/gtkutils.hpp b/src/fwk/toolkit/gtkutils.hpp
new file mode 100644
index 0000000..f6af9b4
--- /dev/null
+++ b/src/fwk/toolkit/gtkutils.hpp
@@ -0,0 +1,55 @@
+/*
+ * niepce - fwk/toolkit/gtkutils.hpp
+ *
+ * Copyright (C) 2009 Hubert Figuiere
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __FWK_GTKUTILS_H__
+#define __FWK_GTKUTILS_H__
+
+#include <string>
+#include <gtkmm/treeview.h>
+
+
+namespace fwk {
+
+class TextTreeviewModel
+    : public Gtk::TreeModelColumnRecord
+{
+public:
+    TextTreeviewModel()
+        { add(m_col1); }
+
+    /** "inject" the model to the TreeView */
+    void inject(Gtk::TreeView & treeview);
+
+    Gtk::TreeModelColumn<std::string> m_col1;
+};
+
+}
+
+
+#endif
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
diff --git a/src/niepce/ui/Makefile.am b/src/niepce/ui/Makefile.am
index 9b04081..321de72 100644
--- a/src/niepce/ui/Makefile.am
+++ b/src/niepce/ui/Makefile.am
@@ -3,7 +3,7 @@
 DIST_SUBDIRS = thumb-view
 
 gladefiles = preferences.glade \
-	importdialog.glade	
+	importdialog.ui
 
 gladedir = @datarootdir@/niepce/glade/
 glade_DATA = $(gladefiles)
diff --git a/src/niepce/ui/importdialog.cpp b/src/niepce/ui/importdialog.cpp
index 2fce7d0..6fb72c1 100644
--- a/src/niepce/ui/importdialog.cpp
+++ b/src/niepce/ui/importdialog.cpp
@@ -1,7 +1,7 @@
 /*
- * niepce - ui/importdialog.cpp
+ * niepce - niepce/ui/importdialog.cpp
  *
- * Copyright (C) 2008 Hubert Figuiere
+ * Copyright (C) 2008-2009 Hubert Figuiere
  *
  * 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
@@ -18,19 +18,20 @@
  */
 
 
-#include <boost/bind.hpp>
-
 #include <glibmm/i18n.h>
-#include <gtkmm/filechooserdialog.h>
 #include <gtkmm/button.h>
-#include <gtkmm/stock.h>
 #include <gtkmm/checkbutton.h>
 #include <gtkmm/combobox.h>
+#include <gtkmm/filechooserdialog.h>
 #include <gtkmm/label.h>
+#include <gtkmm/liststore.h>
+#include <gtkmm/stock.h>
+#include <gtkmm/builder.h>
 
+#include "fwk/utils/debug.h"
 #include "fwk/toolkit/configuration.h"
 #include "fwk/toolkit/application.h"
-#include "importdialog.h"
+#include "importdialog.hpp"
 
 using framework::Configuration;
 using framework::Application;
@@ -41,62 +42,82 @@ ImportDialog::ImportDialog()
 	: m_date_tz_combo(NULL),
 	  m_ufraw_import_check(NULL),
 	  m_rawstudio_import_check(NULL),
-	  m_directory_name(NULL)
+	  m_directory_name(NULL),
+    m_folderList(NULL)
 {
 }
 
 
 Gtk::Widget * ImportDialog::buildWidget()
 {
-	Glib::RefPtr<Gnome::Glade::Xml> xml 
-		= Gnome::Glade::Xml::create(GLADEDIR"importdialog.glade");
-	Gtk::Dialog *dlg = NULL;
-	dlg = xml->get_widget("importDialog", dlg);
+    Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file(GLADEDIR"importdialog.ui");
+    Gtk::Dialog *dlg = NULL;
+    builder->get_widget("importDialog", dlg);
 
-	Gtk::Button *select_directories = xml->get_widget("select_directories",
-													  select_directories);
-	select_directories->signal_clicked().connect(
-			boost::bind(&ImportDialog::do_select_directories, this));
-	m_date_tz_combo = xml->get_widget("date_tz_combo", m_date_tz_combo);
-	m_ufraw_import_check = xml->get_widget("ufraw_import_check", 
-										   m_ufraw_import_check);
-	m_rawstudio_import_check = xml->get_widget("rawstudio_import_check",
-											   m_rawstudio_import_check);
-	m_directory_name = xml->get_widget("directory_name",
-									   m_directory_name);
-	
-	return dlg;
+    Gtk::Button *select_directories = NULL;
+    builder->get_widget("select_directories", select_directories);
+    select_directories->signal_clicked().connect(
+        sigc::mem_fun(*this, &ImportDialog::do_select_directories));
+    builder->get_widget("date_tz_combo", m_date_tz_combo);
+    builder->get_widget("ufraw_import_check", m_ufraw_import_check);
+    builder->get_widget("rawstudio_import_check", m_rawstudio_import_check);
+    builder->get_widget("directory_name", m_directory_name);
+    builder->get_widget("folderList", m_folderList);
+    m_folderListModel.inject(*m_folderList);
+    return dlg;
 }
 
 
 void ImportDialog::do_select_directories()
 {
-	Configuration & cfg = Application::app()->config();
-	
-	Gtk::FileChooserDialog dialog(gtkWindow(), _("Import picture folder"),
-								  Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
+    Configuration & cfg = Application::app()->config();
 	
-	dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
-	dialog.add_button(_("Import"), Gtk::RESPONSE_OK);
+    Gtk::FileChooserDialog dialog(gtkWindow(), _("Import picture folder"),
+                                  Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER);
 	
-	std::string last_import_location;
-	last_import_location = cfg.getValue("last_import_location", "");
-	if(!last_import_location.empty()) {
-		dialog.set_filename(last_import_location);
-	}
+    dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+    dialog.add_button(_("Import"), Gtk::RESPONSE_OK);
+    dialog.set_select_multiple(true);
+    std::string last_import_location;
+    last_import_location = cfg.getValue("last_import_location", "");
+    if(!last_import_location.empty()) {
+        dialog.set_filename(last_import_location);
+    }
 	
-	int result = dialog.run();
-	switch(result)
-	{
-	case Gtk::RESPONSE_OK:
-		m_to_import = dialog.get_filename();
-		m_directory_name->set_label(m_to_import);
-		break;
-	default:
-		break;
-	}
+    int result = dialog.run();
+    switch(result)
+    {
+    case Gtk::RESPONSE_OK:
+        set_to_import(dialog.get_filenames());
+//        m_directory_name->set_label(m_to_import);
+        break;
+    default:
+        break;
+    }
 }
 
+void ImportDialog::set_to_import(const Glib::SListHandle<Glib::ustring> & l)
+{
+    m_list_to_import = l;
+    Glib::RefPtr<Gtk::ListStore> store 
+        = Glib::RefPtr<Gtk::ListStore>::cast_dynamic(m_folderList->get_model());
+    store->clear();
+    for(std::list<std::string>::const_iterator i = m_list_to_import.begin();
+        i != m_list_to_import.end(); ++i) {
+        DBG_OUT("selected %s", i->c_str());
+        Gtk::TreeIter iter = store->append();
+        iter->set_value(m_folderListModel.m_col1, *i);
+    }
+}
 
 }
 
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
diff --git a/src/niepce/ui/importdialog.h b/src/niepce/ui/importdialog.h
deleted file mode 100644
index 0b375d3..0000000
--- a/src/niepce/ui/importdialog.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * niepce - ui/importdialog.h
- *
- * Copyright (C) 2008 Hubert Figuiere
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-
-
-
-#ifndef __UI_IMPORTDIALOG_H__
-#define __UI_IMPORTDIALOG_H__
-
-#include <glibmm/refptr.h>
-#include <libglademm/xml.h>
-
-#include "fwk/toolkit/frame.h"
-
-namespace Gtk {
-	class Dialog;
-	class ComboBox;
-	class CheckButton;
-}
-
-namespace ui {
-
-class ImportDialog 
-	: public framework::Frame
-{
-public:
-	typedef boost::shared_ptr<ImportDialog> Ptr;
-
-	ImportDialog();
-
- 	Gtk::Widget * buildWidget();
-
-	const Glib::ustring & to_import() const
-		{ return m_to_import; }
-
-private:
-	class ImportParam;
-
-	void do_select_directories();
-	
-	Glib::ustring m_to_import;
-	Gtk::ComboBox *m_date_tz_combo;
-	Gtk::CheckButton *m_ufraw_import_check;
-	Gtk::CheckButton *m_rawstudio_import_check;
-	Gtk::Label *m_directory_name;
-};
-
-}
-
-#endif
-
diff --git a/src/niepce/ui/importdialog.hpp b/src/niepce/ui/importdialog.hpp
new file mode 100644
index 0000000..f4dfe18
--- /dev/null
+++ b/src/niepce/ui/importdialog.hpp
@@ -0,0 +1,77 @@
+/*
+ * niepce - niepce/ui/importdialog.h
+ *
+ * Copyright (C) 2008-2009 Hubert Figuiere
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+
+
+
+#ifndef __UI_IMPORTDIALOG_H__
+#define __UI_IMPORTDIALOG_H__
+
+#include <list>
+#include <string>
+
+#include <glibmm/refptr.h>
+
+#include "fwk/toolkit/gtkutils.hpp"
+#include "fwk/toolkit/frame.h"
+
+namespace Gtk {
+	class Dialog;
+	class ComboBox;
+	class CheckButton;
+	class TreeView;
+}
+
+namespace ui {
+
+class ImportDialog 
+	: public framework::Frame
+{
+public:
+	typedef boost::shared_ptr<ImportDialog> Ptr;
+
+	ImportDialog();
+
+ 	Gtk::Widget * buildWidget();
+
+//	const Glib::ustring & to_import() const
+//		{ return m_to_import; }
+	const std::list<std::string> & to_import() const
+		{ return m_list_to_import; }
+	void set_to_import(const Glib::SListHandle<Glib::ustring> & l);
+
+private:
+	class ImportParam;
+
+	void do_select_directories();
+	
+//	Glib::ustring m_to_import;
+	std::list<std::string> m_list_to_import;
+	Gtk::ComboBox *m_date_tz_combo;
+	Gtk::CheckButton *m_ufraw_import_check;
+	Gtk::CheckButton *m_rawstudio_import_check;
+	Gtk::Label *m_directory_name;
+	Gtk::TreeView *m_folderList;
+	fwk::TextTreeviewModel m_folderListModel;
+};
+
+}
+
+#endif
+
diff --git a/src/niepce/ui/importdialog.ui b/src/niepce/ui/importdialog.ui
new file mode 100644
index 0000000..c8a099f
--- /dev/null
+++ b/src/niepce/ui/importdialog.ui
@@ -0,0 +1,254 @@
+<?xml version="1.0"?>
+<interface>
+  <object class="GtkListStore" id="model1">
+    <columns>
+      <column type="gchararray"/>
+    </columns>
+    <data>
+      <row>
+        <col id="0">Date is local</col>
+      </row>
+      <row>
+        <col id="0">Date is UTC</col>
+      </row>
+    </data>
+  </object>
+  <object class="GtkDialog" id="importDialog">
+    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Import</property>
+    <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox2">
+        <property name="visible">True</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <property name="spacing">2</property>
+        <child>
+          <object class="GtkVBox" id="vbox2">
+            <property name="visible">True</property>
+            <property name="spacing">8</property>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="spacing">8</property>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">_Directory:</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="directory_name">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="select_directories">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label" translatable="yes">...</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Folders</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">folderList</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scroller1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+                <property name="shadow_type">GTK_SHADOW_IN</property>
+                <child>
+                  <object class="GtkTreeView" id="folderList">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="headers_visible">False</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkExpander" id="expander1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="expanded">True</property>
+                <child>
+                  <object class="GtkVBox" id="vbox3">
+                    <property name="visible">True</property>
+                    <child>
+                      <object class="GtkCheckButton" id="ufraw_import_check">
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">Import _UFRaw</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="rawstudio_import_check">
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="label" translatable="yes">Import Raw_Studio</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkFrame" id="date_frame">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label_xalign">0</property>
+                        <property name="shadow_type">GTK_SHADOW_IN</property>
+                        <child>
+                          <object class="GtkVBox" id="vbox1">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="spacing">4</property>
+                            <child>
+                              <object class="GtkComboBox" id="date_tz_combo">
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="active">0</property>
+                                <property name="model">model1</property>
+                                <child>
+                                  <object class="GtkCellRendererText" id="renderer1"/>
+                                  <attributes>
+                                    <attribute name="text">0</attribute>
+                                  </attributes>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label5">
+                                <property name="visible">True</property>
+                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">You can still change this after importing the pictures.</property>
+                                <property name="wrap">True</property>
+                              </object>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                        <child type="label">
+                          <object class="GtkLabel" id="label4">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="label" translatable="yes">&lt;b&gt;Date:&lt;/b&gt;</property>
+                            <property name="use_markup">True</property>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="padding">4</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">_Options</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="position">3</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="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <object class="GtkButton" id="button3">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label" translatable="yes">gtk-cancel</property>
+                <property name="use_stock">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkButton" id="button4">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label" translatable="yes">_Import</property>
+                <property name="use_underline">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="1">button3</action-widget>
+      <action-widget response="0">button4</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/src/niepce/ui/niepcewindow.cpp b/src/niepce/ui/niepcewindow.cpp
index 6d9df4e..c669a0f 100644
--- a/src/niepce/ui/niepcewindow.cpp
+++ b/src/niepce/ui/niepcewindow.cpp
@@ -1,7 +1,7 @@
 /*
  * niepce - ui/niepcewindow.cpp
  *
- * Copyright (C) 2007-2008 Hubert Figuiere
+ * Copyright (C) 2007-2009 Hubert Figuiere
  *
  * 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
@@ -46,7 +46,7 @@
 #include "eog-thumb-view.h"
 #include "niepcewindow.h"
 #include "librarymainviewcontroller.h"
-#include "importdialog.h"
+#include "importdialog.hpp"
 #include "selectioncontroller.h"
 
 using libraryclient::LibraryClient;
@@ -399,12 +399,15 @@ void NiepceWindow::on_action_file_import()
     case 0:
     {
         // import
-        const Glib::ustring & to_import(import_dialog->to_import());
+        const std::list<std::string> & to_import(import_dialog->to_import());
         if(!to_import.empty()) {
-            cfg.setValue("last_import_location", to_import);
+            cfg.setValue("last_import_location", to_import.front());
 			
-            DBG_OUT("%s", to_import.c_str());
-            m_libClient->importFromDirectory(to_import, false);
+            //DBG_OUT("%s", to_import.c_str());
+            std::for_each(to_import.begin(), to_import.end(),
+                          boost::bind(&LibraryClient::importFromDirectory,
+                                      m_libClient, _1, false));
+//            m_libClient->importFromDirectory(to_import, false);
         }
         break;
     }



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