[gthumb/ext] Started work on the photo importer
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] Started work on the photo importer
- Date: Mon, 10 Aug 2009 16:59:18 +0000 (UTC)
commit 36415e718f0b6c8b8d7eafb65c682c465ee68303
Author: Paolo Bacchilega <paobac src gnome org>
Date: Mon Aug 10 18:58:14 2009 +0200
Started work on the photo importer
configure.ac | 3 +
extensions/Makefile.am | 13 +-
extensions/photo_importer/Makefile.am | 36 ++
extensions/photo_importer/actions.c | 35 ++
extensions/photo_importer/actions.h | 32 ++
extensions/photo_importer/callbacks.c | 92 ++++
extensions/photo_importer/callbacks.h | 30 ++
extensions/photo_importer/data/Makefile.am | 2 +
extensions/photo_importer/data/ui/Makefile.am | 5 +
.../photo_importer/data/ui/photo-importer.ui | 288 +++++++++++++
extensions/photo_importer/dlg-photo-importer.c | 441 ++++++++++++++++++++
extensions/photo_importer/dlg-photo-importer.h | 31 ++
extensions/photo_importer/gth-import-task.c | 127 ++++++
extensions/photo_importer/gth-import-task.h | 59 +++
extensions/photo_importer/main.c | 53 +++
.../photo_importer/photo_importer.extension.in.in | 10 +
gthumb/gth-browser.c | 4 +-
gthumb/gth-file-list.c | 24 +-
gthumb/gth-file-list.h | 1 -
gthumb/gth-file-source-vfs.c | 2 +-
gthumb/gth-file-source.c | 2 +
gthumb/gth-metadata-provider.c | 6 +-
gthumb/gth-metadata-provider.h | 2 +
gthumb/gth-overwrite-dialog.c | 2 +-
24 files changed, 1275 insertions(+), 25 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index fb5d33c..1075fa6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -238,6 +238,9 @@ extensions/image_viewer/data/ui/Makefile
extensions/list_tools/Makefile
extensions/list_tools/data/Makefile
extensions/list_tools/data/ui/Makefile
+extensions/photo_importer/Makefile
+extensions/photo_importer/data/Makefile
+extensions/photo_importer/data/ui/Makefile
extensions/rename_series/Makefile
extensions/rename_series/data/Makefile
extensions/rename_series/data/ui/Makefile
diff --git a/extensions/Makefile.am b/extensions/Makefile.am
index 96d3bab..5064623 100644
--- a/extensions/Makefile.am
+++ b/extensions/Makefile.am
@@ -1,3 +1,14 @@
-SUBDIRS = catalogs comments exiv2 file_manager file_tools file_viewer image_viewer list_tools rename_series search
+SUBDIRS = \
+ catalogs \
+ comments \
+ exiv2 \
+ file_manager \
+ file_tools \
+ file_viewer \
+ image_viewer \
+ list_tools \
+ photo_importer \
+ rename_series \
+ search
-include $(top_srcdir)/git.mk
diff --git a/extensions/photo_importer/Makefile.am b/extensions/photo_importer/Makefile.am
new file mode 100644
index 0000000..b1f8077
--- /dev/null
+++ b/extensions/photo_importer/Makefile.am
@@ -0,0 +1,36 @@
+SUBDIRS = data
+
+extensiondir = $(libdir)/gthumb-2.0/extensions
+extension_LTLIBRARIES = libphoto_importer.la
+
+libphoto_importer_la_SOURCES = \
+ actions.c \
+ actions.h \
+ callbacks.c \
+ callbacks.h \
+ dlg-photo-importer.c \
+ dlg-photo-importer.h \
+ gth-import-task.c \
+ gth-import-task.h \
+ main.c
+
+libphoto_importer_la_CFLAGS = $(GTHUMB_CFLAGS) $(DISABLE_DEPRECATED) $(WARNINGS) -I$(top_srcdir) -I$(top_builddir)/gthumb
+libphoto_importer_la_LDFLAGS = $(EXTENSION_LIBTOOL_FLAGS)
+libphoto_importer_la_LIBADD = $(GTHUMB_LIBS)
+libphoto_importer_la_DEPENDENCIES = $(top_builddir)/gthumb/gthumb$(EXEEXT)
+
+extensioninidir = $(extensiondir)
+extensionini_in_files = photo_importer.extension.in.in
+extensionini_DATA = $(extensionini_in_files:.extension.in.in=.extension)
+
+%.extension.in: %.extension.in.in $(extension_LTLIBRARIES)
+ 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)
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/photo_importer/actions.c b/extensions/photo_importer/actions.c
new file mode 100644
index 0000000..6606109
--- /dev/null
+++ b/extensions/photo_importer/actions.c
@@ -0,0 +1,35 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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-photo-importer.h"
+
+
+void
+gth_browser_activate_action_import_files (GtkAction *action,
+ GthBrowser *browser)
+{
+ dlg_photo_importer (browser, NULL);
+}
diff --git a/extensions/photo_importer/actions.h b/extensions/photo_importer/actions.h
new file mode 100644
index 0000000..b21ed17
--- /dev/null
+++ b/extensions/photo_importer/actions.h
@@ -0,0 +1,32 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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_import_files)
+
+#endif /* ACTIONS_H */
diff --git a/extensions/photo_importer/callbacks.c b/extensions/photo_importer/callbacks.c
new file mode 100644
index 0000000..5dad419
--- /dev/null
+++ b/extensions/photo_importer/callbacks.c
@@ -0,0 +1,92 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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 "photo-importer-browser-data"
+
+
+static const char *ui_info =
+"<ui>"
+" <menubar name='MenuBar'>"
+" <menu name='File' action='FileMenu'>"
+" <placeholder name='Misc_Actions'>"
+" <menuitem action='File_Import'/>"
+" </placeholder>"
+" </menu>"
+" </menubar>"
+"</ui>";
+
+
+static GtkActionEntry action_entries[] = {
+ { "File_Import", NULL,
+ N_("_Import..."), NULL,
+ N_("Import photos and other files from a removable device"),
+ G_CALLBACK (gth_browser_activate_action_import_files) },
+};
+
+
+typedef struct {
+ GtkActionGroup *action_group;
+} BrowserData;
+
+
+static void
+browser_data_free (BrowserData *data)
+{
+ g_free (data);
+}
+
+
+void
+pi__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 ("Photo Importer 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/photo_importer/callbacks.h b/extensions/photo_importer/callbacks.h
new file mode 100644
index 0000000..071e32c
--- /dev/null
+++ b/extensions/photo_importer/callbacks.h
@@ -0,0 +1,30 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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 pi__gth_browser_construct_cb (GthBrowser *browser);
+
+#endif /* CALLBACKS_H */
diff --git a/extensions/photo_importer/data/Makefile.am b/extensions/photo_importer/data/Makefile.am
new file mode 100644
index 0000000..4d5385d
--- /dev/null
+++ b/extensions/photo_importer/data/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = ui
+-include $(top_srcdir)/git.mk
diff --git a/extensions/photo_importer/data/ui/Makefile.am b/extensions/photo_importer/data/ui/Makefile.am
new file mode 100644
index 0000000..2af04ea
--- /dev/null
+++ b/extensions/photo_importer/data/ui/Makefile.am
@@ -0,0 +1,5 @@
+uidir = $(datadir)/gthumb-2.0/ui
+ui_DATA = photo-importer.ui
+EXTRA_DIST = $(ui_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/extensions/photo_importer/data/ui/photo-importer.ui b/extensions/photo_importer/data/ui/photo-importer.ui
new file mode 100644
index 0000000..2695c01
--- /dev/null
+++ b/extensions/photo_importer/data/ui/photo-importer.ui
@@ -0,0 +1,288 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy project-wide -->
+ <object class="GtkDialog" id="photo_importer_dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Import</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="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">4</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">_Destination:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">destination_filechooserbutton</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="GtkLabel" id="subfolder_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">S_ubFolder:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Tags:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">tags_entry</property>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFileChooserButton" id="destination_filechooserbutton">
+ <property name="visible">True</property>
+ <property name="action">select-folder</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>
+ <child>
+ <object class="GtkEntry" id="tags_entry">
+ <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>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="subfolder_box">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="subfolder_type_box">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="subfolder_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <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">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="source_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Source:</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="source_box">
+ <property name="visible">True</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <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="GtkHBox" id="filelist_box">
+ <property name="width_request">550</property>
+ <property name="height_request">450</property>
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <placeholder/>
+ </child>
+ </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="GtkButton" id="select_all_button">
+ <property name="label" translatable="yes">Select _All</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="select_none_button">
+ <property name="label" translatable="yes">Select _None</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="filter_checkbutton">
+ <property name="label" translatable="yes">_Show All</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="expand">False</property>
+ <property name="pack_type">end</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_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancel_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="ok_button">
+ <property name="label" translatable="yes">_Import</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image1</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="0">cancel_button</action-widget>
+ <action-widget response="0">ok_button</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-ok</property>
+ </object>
+</interface>
diff --git a/extensions/photo_importer/dlg-photo-importer.c b/extensions/photo_importer/dlg-photo-importer.c
new file mode 100644
index 0000000..209d59e
--- /dev/null
+++ b/extensions/photo_importer/dlg-photo-importer.c
@@ -0,0 +1,441 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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 "dlg-photo-importer.h"
+#include "gth-import-task.h"
+
+
+enum {
+ SOURCE_LIST_COLUMN_VOLUME,
+ SOURCE_LIST_COLUMN_ICON,
+ SOURCE_LIST_COLUMN_NAME,
+ SOURCE_LIST_COLUMNS
+};
+
+#define GET_WIDGET(name) _gtk_builder_get_widget (data->builder, (name))
+
+
+typedef struct {
+ GthBrowser *browser;
+ GtkWidget *dialog;
+ GtkBuilder *builder;
+ GFile *source;
+ GtkListStore *source_store;
+ GtkWidget *source_list;
+ GtkWidget *subfolder_type_list;
+ GtkWidget *file_list;
+ GCancellable *cancellable;
+ GList *files;
+ gboolean loading_list;
+ gboolean import;
+ GthFileSource *vfs_source;
+ DoneFunc done_func;
+ gboolean cancelling;
+ gulong monitor_event;
+} DialogData;
+
+
+static void
+destroy_dialog (gpointer user_data)
+{
+ DialogData *data = user_data;
+
+ g_signal_handler_disconnect (gth_main_get_default_monitor (), data->monitor_event);
+
+ if (data->import) {
+/*
+ GthTask *task;
+
+ task = gth_import_task_new (destination, subfolder, categories, delete);
+ gth_browser_exec_task (data->browser, task, FALSE);
+*/
+ }
+
+ gtk_widget_destroy (data->dialog);
+ gth_browser_set_dialog (data->browser, "photo_importer", NULL);
+
+ g_object_unref (data->vfs_source);
+ g_object_unref (data->builder);
+ _g_object_unref (data->source);
+ _g_object_unref (data->cancellable);
+ _g_object_list_unref (data->files);
+ g_free (data);
+}
+
+
+static void
+cancel_done (gpointer user_data)
+{
+ DialogData *data = user_data;
+
+ g_cancellable_reset (data->cancellable);
+ data->cancelling = FALSE;
+ data->done_func (data);
+}
+
+
+static void
+cancel (DialogData *data,
+ DoneFunc done_func)
+{
+ data->done_func = done_func;
+
+ if (data->cancelling)
+ return;
+
+ data->cancelling = TRUE;
+ if (data->loading_list)
+ g_cancellable_cancel (data->cancellable);
+ else
+ gth_file_list_cancel (GTH_FILE_LIST (data->file_list), cancel_done, data);
+}
+
+
+static void
+close_dialog (gpointer unused,
+ DialogData *data)
+{
+ cancel (data, destroy_dialog);
+}
+
+
+static gboolean
+delete_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ close_dialog (NULL, (DialogData *) user_data);
+ return TRUE;
+}
+
+
+static void
+ok_clicked_cb (GtkWidget *widget,
+ DialogData *data)
+{
+ data->import = TRUE;
+ close_dialog (NULL, data);
+}
+
+
+static void
+list_ready_cb (GList *files,
+ GError *error,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+
+ data->loading_list = FALSE;
+
+ if (data->cancelling) {
+ g_print ("...CANCELED\n");
+ gth_file_list_cancel (GTH_FILE_LIST (data->file_list), cancel_done, data);
+ return;
+ }
+
+ g_print ("...DONE\n");
+
+ if (error != NULL) {
+ _gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->dialog), _("Could not load the folder"), &error);
+ return;
+ }
+
+ data->files = _g_object_list_ref (files);
+ gth_file_list_set_files (GTH_FILE_LIST (data->file_list), data->files);
+}
+
+
+static void
+list_source_files (gpointer user_data)
+{
+ DialogData *data = user_data;
+ GList *list;
+
+ g_print ("LOADING...\n");
+
+ _g_object_list_unref (data->files);
+ data->files = NULL;
+
+ gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("Getting folder listing..."));
+
+ data->loading_list = TRUE;
+ list = g_list_prepend (NULL, data->source);
+ _g_query_all_metadata_async (list,
+ TRUE,
+ TRUE,
+ DEFINE_STANDARD_ATTRIBUTES (",preview::icon,standard::fast-content-type,gth::file::display-size"),
+ data->cancellable,
+ list_ready_cb,
+ data);
+
+ g_list_free (list);
+}
+
+
+static void
+load_file_list (DialogData *data)
+{
+ cancel (data, list_source_files);
+}
+
+
+static void
+source_list_changed_cb (GtkWidget *widget,
+ DialogData *data)
+{
+ GtkTreeIter iter;
+ GVolume *volume;
+ GMount *mount;
+
+ if (! gtk_combo_box_get_active_iter (GTK_COMBO_BOX (data->source_list), &iter)) {
+ gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("(Empty)"));
+ return;
+ }
+
+ gtk_tree_model_get (GTK_TREE_MODEL (data->source_store), &iter,
+ SOURCE_LIST_COLUMN_VOLUME, &volume,
+ -1);
+
+ if (volume == NULL) {
+ gth_file_list_clear (GTH_FILE_LIST (data->file_list), _("Empty"));
+ return;
+ }
+
+ mount = g_volume_get_mount (volume);
+ data->source = g_mount_get_root (mount);
+ load_file_list (data);
+
+ g_object_unref (mount);
+ g_object_unref (volume);
+}
+
+
+static void
+filter_checkbutton_toggled_cb (GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ DialogData *data = user_data;
+ GthTest *test = NULL;
+
+ if (! gtk_toggle_button_get_active (togglebutton))
+ test = gth_main_get_test ("file::type::is_media");
+
+ gth_file_list_set_filter (GTH_FILE_LIST (data->file_list), test);
+
+ _g_object_unref (test);
+}
+
+
+static void
+update_source_list (DialogData *data)
+{
+ gboolean source_available = FALSE;
+ GList *mounts;
+ GList *scan;
+
+ gtk_list_store_clear (data->source_store);
+
+ mounts = g_volume_monitor_get_mounts (g_volume_monitor_get ());
+ for (scan = mounts; scan; scan = scan->next) {
+ GMount *mount = scan->data;
+ GVolume *volume;
+
+ if (g_mount_is_shadowed (mount))
+ continue;
+
+ volume = g_mount_get_volume (mount);
+ if (volume != NULL) {
+ if (g_volume_can_mount (volume)) {
+ GtkTreeIter iter;
+ GFile *root;
+ GIcon *icon;
+ char *name;
+
+ gtk_list_store_append (data->source_store, &iter);
+
+ root = g_mount_get_root (mount);
+ if (data->source == NULL)
+ data->source = g_file_dup (root);
+
+ icon = g_mount_get_icon (mount);
+ name = g_volume_get_name (volume);
+ gtk_list_store_set (data->source_store, &iter,
+ SOURCE_LIST_COLUMN_VOLUME, volume,
+ SOURCE_LIST_COLUMN_ICON, icon,
+ SOURCE_LIST_COLUMN_NAME, name,
+ -1);
+
+ if (g_file_equal (data->source, root)) {
+ gtk_combo_box_set_active_iter (GTK_COMBO_BOX (data->source_list), &iter);
+ source_available = TRUE;
+ }
+
+ g_free (name);
+ g_object_unref (icon);
+ g_object_unref (root);
+ }
+
+ g_object_unref (volume);
+ }
+ }
+
+ if (! source_available) {
+ _g_object_unref (data->source);
+ data->source = NULL;
+ source_list_changed_cb (NULL, data);
+ }
+
+ _g_object_list_unref (mounts);
+}
+
+
+static void
+entry_points_changed_cb (GthMonitor *monitor,
+ DialogData *data)
+{
+ update_source_list (data);
+}
+
+
+void
+dlg_photo_importer (GthBrowser *browser,
+ GFile *source)
+{
+ DialogData *data;
+ GtkCellRenderer *renderer;
+ GthFileDataSort *sort_type;
+ GthTest *test;
+
+ if (gth_browser_get_dialog (browser, "photo_importer") != NULL) {
+ gtk_window_present (GTK_WINDOW (gth_browser_get_dialog (browser, "photo_importer")));
+ return;
+ }
+
+ data = g_new0 (DialogData, 1);
+ data->browser = browser;
+ data->builder = _gtk_builder_new_from_file ("photo-importer.ui", "photo_importer");
+ data->source = _g_object_ref (source);
+ data->cancellable = g_cancellable_new ();
+ data->vfs_source = g_object_new (GTH_TYPE_FILE_SOURCE_VFS, NULL);
+ gth_file_source_monitor_entry_points (GTH_FILE_SOURCE (data->vfs_source));
+
+ /* Get the widgets. */
+
+ data->dialog = _gtk_builder_get_widget (data->builder, "photo_importer_dialog");
+ gth_browser_set_dialog (browser, "photo_importer", data->dialog);
+ g_object_set_data (G_OBJECT (data->dialog), "dialog_data", data);
+
+ data->source_store = gtk_list_store_new (SOURCE_LIST_COLUMNS, G_TYPE_OBJECT, G_TYPE_ICON, G_TYPE_STRING);
+ data->source_list = gtk_combo_box_new_with_model (GTK_TREE_MODEL (data->source_store));
+ gtk_widget_show (data->source_list);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("source_box")), data->source_list, TRUE, TRUE, 0);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET ("source_label")), data->source_list);
+
+ g_object_unref (data->source_store);
+
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (data->source_list), renderer, FALSE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (data->source_list),
+ renderer,
+ "gicon", SOURCE_LIST_COLUMN_ICON,
+ NULL);
+
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (data->source_list), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (data->source_list),
+ renderer,
+ "text", SOURCE_LIST_COLUMN_NAME,
+ NULL);
+
+ update_source_list (data);
+
+ data->subfolder_type_list = _gtk_combo_box_new_with_texts (_("No subfolder"),
+ _("Day photo taken"),
+ _("Month photo taken"),
+ _("Current date"),
+ _("Current date and time"),
+ _("Custom"),
+ NULL);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (data->subfolder_type_list), 0);
+ gtk_widget_show (data->subfolder_type_list);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("subfolder_type_box")), data->subfolder_type_list, TRUE, TRUE, 0);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (GET_WIDGET ("subfolder_label")), data->subfolder_type_list);
+
+ data->file_list = gth_file_list_new ();
+ sort_type = gth_main_get_sort_type ("file::mtime");
+ gth_file_list_set_sort_func (GTH_FILE_LIST (data->file_list), sort_type->cmp_func, FALSE);
+ gth_file_list_enable_thumbs (GTH_FILE_LIST (data->file_list), TRUE);
+ gth_file_list_set_thumb_size (GTH_FILE_LIST (data->file_list), 128);
+ gth_file_list_set_caption (GTH_FILE_LIST (data->file_list), "standard::display-name,gth::file::display-size");
+
+ test = gth_main_get_test ("file::type::is_media");
+ gth_file_list_set_filter (GTH_FILE_LIST (data->file_list), test);
+ g_object_unref (test);
+
+ gtk_widget_show (data->file_list);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("filelist_box")), data->file_list, TRUE, TRUE, 0);
+
+ /* Set the signals handlers. */
+
+ g_signal_connect (G_OBJECT (data->dialog),
+ "delete-event",
+ G_CALLBACK (delete_event_cb),
+ data);
+ /*g_signal_connect (G_OBJECT (data->dialog),
+ "destroy",
+ G_CALLBACK (destroy_cb),
+ data);*/
+ g_signal_connect (GET_WIDGET ("ok_button"),
+ "clicked",
+ G_CALLBACK (ok_clicked_cb),
+ data);
+ g_signal_connect (GET_WIDGET ("cancel_button"),
+ "clicked",
+ G_CALLBACK (close_dialog),
+ data);
+ g_signal_connect (data->source_list,
+ "changed",
+ G_CALLBACK (source_list_changed_cb),
+ data);
+ g_signal_connect (GET_WIDGET ("filter_checkbutton"),
+ "toggled",
+ G_CALLBACK (filter_checkbutton_toggled_cb),
+ data);
+
+ data->monitor_event = g_signal_connect (gth_main_get_default_monitor (),
+ "entry_points_changed",
+ G_CALLBACK (entry_points_changed_cb),
+ data);
+
+ /* Run dialog. */
+
+ gtk_window_set_transient_for (GTK_WINDOW (data->dialog), GTK_WINDOW (browser));
+ gtk_window_set_modal (GTK_WINDOW (data->dialog), FALSE);
+ gtk_widget_show (data->dialog);
+
+ load_file_list (data);
+}
diff --git a/extensions/photo_importer/dlg-photo-importer.h b/extensions/photo_importer/dlg-photo-importer.h
new file mode 100644
index 0000000..22aab83
--- /dev/null
+++ b/extensions/photo_importer/dlg-photo-importer.h
@@ -0,0 +1,31 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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_PHOTO_IMPORTER_H
+#define DLG_PHOTO_IMPORTER_H
+
+#include <gthumb.h>
+
+void dlg_photo_importer (GthBrowser *browser,
+ GFile *source);
+
+#endif /* DLG_PHOTO_IMPORTER_H */
diff --git a/extensions/photo_importer/gth-import-task.c b/extensions/photo_importer/gth-import-task.c
new file mode 100644
index 0000000..9d454c9
--- /dev/null
+++ b/extensions/photo_importer/gth-import-task.c
@@ -0,0 +1,127 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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 "gth-import-task.h"
+
+
+struct _GthImportTaskPrivate {
+ GCancellable *cancellable;
+};
+
+
+static gpointer parent_class = NULL;
+
+
+static void
+gth_import_task_finalize (GObject *object)
+{
+ GthImportTask *self;
+
+ self = GTH_IMPORT_TASK (object);
+
+ g_object_unref (self->priv->cancellable);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+
+static void
+gth_import_task_exec (GthTask *task)
+{
+ /* FIXME */
+}
+
+
+static void
+gth_import_task_cancel (GthTask *task)
+{
+ g_cancellable_cancel (GTH_IMPORT_TASK (task)->priv->cancellable);
+}
+
+
+static void
+gth_import_task_class_init (GthImportTaskClass *klass)
+{
+ GObjectClass *object_class;
+ GthTaskClass *task_class;
+
+ parent_class = g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (GthImportTaskPrivate));
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = gth_import_task_finalize;
+
+ task_class = GTH_TASK_CLASS (klass);
+ task_class->exec = gth_import_task_exec;
+ task_class->cancel = gth_import_task_cancel;
+}
+
+
+static void
+gth_import_task_init (GthImportTask *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_IMPORT_TASK, GthImportTaskPrivate);
+ self->priv->cancellable = g_cancellable_new ();
+}
+
+
+GType
+gth_import_task_get_type (void)
+{
+ static GType type = 0;
+
+ if (! type) {
+ GTypeInfo type_info = {
+ sizeof (GthImportTaskClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gth_import_task_class_init,
+ NULL,
+ NULL,
+ sizeof (GthImportTask),
+ 0,
+ (GInstanceInitFunc) gth_import_task_init
+ };
+
+ type = g_type_register_static (GTH_TYPE_TASK,
+ "GthImportTask",
+ &type_info,
+ 0);
+ }
+
+ return type;
+}
+
+
+GthTask *
+gth_import_task_new (GFile *destination,
+ const char *subfolder,
+ char **tags,
+ gboolean move)
+{
+ GthImportTask *self;
+
+ self = GTH_IMPORT_TASK (g_object_new (GTH_TYPE_IMPORT_TASK, NULL));
+
+ return (GthTask *) self;
+}
diff --git a/extensions/photo_importer/gth-import-task.h b/extensions/photo_importer/gth-import-task.h
new file mode 100644
index 0000000..ba99aa2
--- /dev/null
+++ b/extensions/photo_importer/gth-import-task.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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 GTH_IMPORT_TASK_H
+#define GTH_IMPORT_TASK_H
+
+#include <glib.h>
+#include <gthumb.h>
+
+G_BEGIN_DECLS
+
+#define GTH_TYPE_IMPORT_TASK (gth_import_task_get_type ())
+#define GTH_IMPORT_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTH_TYPE_IMPORT_TASK, GthImportTask))
+#define GTH_IMPORT_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTH_TYPE_IMPORT_TASK, GthImportTaskClass))
+#define GTH_IS_IMPORT_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTH_TYPE_IMPORT_TASK))
+#define GTH_IS_IMPORT_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTH_TYPE_IMPORT_TASK))
+#define GTH_IMPORT_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTH_TYPE_IMPORT_TASK, GthImportTaskClass))
+
+typedef struct _GthImportTask GthImportTask;
+typedef struct _GthImportTaskClass GthImportTaskClass;
+typedef struct _GthImportTaskPrivate GthImportTaskPrivate;
+
+struct _GthImportTask {
+ GthTask __parent;
+ GthImportTaskPrivate *priv;
+};
+
+struct _GthImportTaskClass {
+ GthTaskClass __parent;
+};
+
+GType gth_import_task_get_type (void);
+GthTask * gth_import_task_new (GFile *destination,
+ const char *subfolder,
+ char **tags,
+ gboolean move);
+
+G_END_DECLS
+
+#endif /* GTH_IMPORT_TASK_H */
diff --git a/extensions/photo_importer/main.c b/extensions/photo_importer/main.c
new file mode 100644
index 0000000..cd814ee
--- /dev/null
+++ b/extensions/photo_importer/main.c
@@ -0,0 +1,53 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * GThumb
+ *
+ * Copyright (C) 2009 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 (pi__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/photo_importer/photo_importer.extension.in.in b/extensions/photo_importer/photo_importer.extension.in.in
new file mode 100644
index 0000000..3d51e65
--- /dev/null
+++ b/extensions/photo_importer/photo_importer.extension.in.in
@@ -0,0 +1,10 @@
+[Extension]
+_Name=Import photos
+_Description=Import photos from removable devices
+_Authors=gthumb development team
+Copyright=Copyright © 2009 The Free Software Foundation, Inc.
+Version=1.0
+
+[Loader]
+Type=module
+File=%LIBRARY%
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 1f3b28f..137cad8 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -1198,7 +1198,7 @@ load_data_continue (LoadData *load_data,
case GTH_ACTION_GO_TO:
filter = _gth_browser_get_file_filter (browser);
gth_file_list_set_filter (GTH_FILE_LIST (browser->priv->file_list), filter);
- gth_file_list_set_files (GTH_FILE_LIST (browser->priv->file_list), load_data->file_source, files);
+ gth_file_list_set_files (GTH_FILE_LIST (browser->priv->file_list), files);
g_object_unref (filter);
break;
default:
@@ -2769,7 +2769,7 @@ _gth_browser_construct_step2 (gpointer data)
_gth_browser_monitor_entry_points (browser);
/* force an update to load the correct icons */
- gth_monitor_file_entry_points_changed (gth_main_get_default_monitor ());
+ /*gth_monitor_file_entry_points_changed (gth_main_get_default_monitor ()); FIXME: not required anymore ? */
}
diff --git a/gthumb/gth-file-list.c b/gthumb/gth-file-list.c
index 33fc42e..ca6390f 100644
--- a/gthumb/gth-file-list.c
+++ b/gthumb/gth-file-list.c
@@ -57,7 +57,6 @@ typedef enum {
typedef struct {
GthFileListOpType type;
- GthFileSource *file_source;
GtkTreeModel *model;
GthTest *filter;
GList *file_list; /* GthFileData */
@@ -136,7 +135,6 @@ gth_file_list_op_free (GthFileListOp *op)
{
switch (op->type) {
case GTH_FILE_LIST_OP_TYPE_SET_FILES:
- g_object_unref (op->file_source);
_g_object_list_unref (op->file_list);
break;
case GTH_FILE_LIST_OP_TYPE_CLEAR_FILES:
@@ -559,6 +557,8 @@ gth_file_list_construct (GthFileList *file_list)
gtk_widget_show (file_list->priv->notebook);
gtk_box_pack_start (GTK_BOX (file_list), file_list->priv->notebook, TRUE, TRUE, 0);
+
+ gth_dumb_notebook_show_child (GTH_DUMB_NOTEBOOK (file_list->priv->notebook), GTH_FILE_LIST_PANE_MESSAGE);
}
@@ -874,19 +874,11 @@ gth_file_list_rename_file (GthFileList *file_list,
static void
-gfl_set_files (GthFileList *file_list,
- GthFileSource *file_source,
- GList *files)
+gfl_set_files (GthFileList *file_list,
+ GList *files)
{
GthFileStore *file_store;
- if (file_list->priv->file_source != NULL) {
- g_object_unref (file_list->priv->file_source);
- file_list->priv->file_source = NULL;
- }
- if (file_source != NULL)
- file_list->priv->file_source = g_object_ref (file_source);
-
file_store = (GthFileStore*) gth_file_view_get_model (GTH_FILE_VIEW (file_list->priv->view));
gth_file_store_clear (file_store);
gfl_add_files (file_list, files);
@@ -894,9 +886,8 @@ gfl_set_files (GthFileList *file_list,
void
-gth_file_list_set_files (GthFileList *file_list,
- GthFileSource *file_source,
- GList *files)
+gth_file_list_set_files (GthFileList *file_list,
+ GList *files)
{
GthFileListOp *op;
@@ -907,7 +898,6 @@ gth_file_list_set_files (GthFileList *file_list,
}
else {
op = gth_file_list_op_new (GTH_FILE_LIST_OP_TYPE_SET_FILES);
- op->file_source = g_object_ref (file_source);
op->file_list = _g_object_list_ref (files);
_gth_file_list_queue_op (file_list, op);
}
@@ -1350,7 +1340,7 @@ _gth_file_list_exec_next_op (GthFileList *file_list)
switch (op->type) {
case GTH_FILE_LIST_OP_TYPE_SET_FILES:
- gfl_set_files (file_list, op->file_source, op->file_list);
+ gfl_set_files (file_list, op->file_list);
break;
case GTH_FILE_LIST_OP_TYPE_ADD_FILES:
gfl_add_files (file_list, op->file_list);
diff --git a/gthumb/gth-file-list.h b/gthumb/gth-file-list.h
index 067a5d0..35a9b1d 100644
--- a/gthumb/gth-file-list.h
+++ b/gthumb/gth-file-list.h
@@ -57,7 +57,6 @@ void gth_file_list_cancel (GthFileList *file_list,
DoneFunc done_func,
gpointer user_data);
void gth_file_list_set_files (GthFileList *file_list,
- GthFileSource *file_source,
GList *list);
GList * gth_file_list_get_files (GthFileList *file_list,
GList *tree_path_list);
diff --git a/gthumb/gth-file-source-vfs.c b/gthumb/gth-file-source-vfs.c
index e447983..e767764 100644
--- a/gthumb/gth-file-source-vfs.c
+++ b/gthumb/gth-file-source-vfs.c
@@ -95,7 +95,7 @@ gth_file_source_vfs_get_entry_points (GthFileSource *file_source)
name = g_volume_get_name (volume);
g_file_info_set_display_name (info, name);
- icon = g_volume_get_icon (volume);
+ icon = g_mount_get_icon (mount);
g_file_info_set_icon (info, icon);
g_object_unref (icon);
diff --git a/gthumb/gth-file-source.c b/gthumb/gth-file-source.c
index f37ed3c..4452d1c 100644
--- a/gthumb/gth-file-source.c
+++ b/gthumb/gth-file-source.c
@@ -668,6 +668,8 @@ gth_file_source_read_attributes (GthFileSource *file_source,
gio_files = gth_file_source_to_gio_file_list (file_source, files);
_g_query_all_metadata_async (gio_files,
+ FALSE,
+ TRUE,
attributes,
file_source->priv->cancellable,
metadata_ready_cb,
diff --git a/gthumb/gth-metadata-provider.c b/gthumb/gth-metadata-provider.c
index 2da41a5..d5c6873 100644
--- a/gthumb/gth-metadata-provider.c
+++ b/gthumb/gth-metadata-provider.c
@@ -578,6 +578,8 @@ qam_info_ready_cb (GList *files,
void
_g_query_all_metadata_async (GList *files, /* GFile * list */
+ gboolean recursive,
+ gboolean follow_links,
const char *attributes,
GCancellable *cancellable,
InfoReadyCallback ready_func,
@@ -592,8 +594,8 @@ _g_query_all_metadata_async (GList *files, /* GFile * list */
qam->user_data = user_data;
_g_query_info_async (files,
- FALSE,
- TRUE,
+ recursive,
+ follow_links,
qam->attributes,
qam->cancellable,
qam_info_ready_cb,
diff --git a/gthumb/gth-metadata-provider.h b/gthumb/gth-metadata-provider.h
index 7e886a9..5018b03 100644
--- a/gthumb/gth-metadata-provider.h
+++ b/gthumb/gth-metadata-provider.h
@@ -79,6 +79,8 @@ void _g_write_metadata_async (GList *
ReadyFunc ready_func,
gpointer user_data);
void _g_query_all_metadata_async (GList *files, /* GFile * list */
+ gboolean recursive,
+ gboolean follow_links,
const char *attributes,
GCancellable *cancellable,
InfoReadyCallback ready_func,
diff --git a/gthumb/gth-overwrite-dialog.c b/gthumb/gth-overwrite-dialog.c
index 43f226b..1271e70 100644
--- a/gthumb/gth-overwrite-dialog.c
+++ b/gthumb/gth-overwrite-dialog.c
@@ -243,7 +243,7 @@ gth_overwrite_dialog_construct (GthOverwriteDialog *self,
files = NULL;
files = g_list_append (files, self->priv->source);
files = g_list_append (files, self->priv->destination);
- _g_query_all_metadata_async (files, "standard::*,time::modified,time::modified-usec,preview::icon", NULL, info_ready_cb, self);
+ _g_query_all_metadata_async (files, FALSE, TRUE, "standard::*,time::modified,time::modified-usec,preview::icon", NULL, info_ready_cb, self);
g_list_free (files);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]