Commit 652a8495 authored by Michael J. Chudobiak's avatar Michael J. Chudobiak

First attempt at a gvfs-based photo importer - bug 583796

parent 310d2231
trunk, since last 2.10.x
Major Distro-Related Changes:
* gThumb now imports photos using the libgphoto2 backend for gvfs.
It is no longer necessary to unmount any gvfs/libgphoto2 mounts
under ~/.gvfs beforing importing. The import process may be
invoked using:
gthumb --import-photos
or
gthumb --import-photos /path/to/device/mount
If no path is given as an argument, gThumb will scan all folders
under /media and ~/.gvfs/gphoto2*, looking for "dcim" or "DCIM"
sub-folders.
UI Changes:
* Make the cropping dialog more intuitive. Bug #408342.
......
......@@ -100,8 +100,8 @@ Compiling
If the libtiff library is present you can save images in TIFF
format.
If the libgphoto2 library version >= 2.1.3 is present you can import
photos from your camera.
If the libgphoto2 backend for gvfs you can import photos from your
camera.
If the libopenraw library version >= 0.0.4 is present you can view
RAW photo thumbnails.
......
......@@ -31,7 +31,6 @@ LIBGNOMECANVAS_REQUIRED=2.6.0
GIO_REQUIRED=2.16.1
GNOME_VFS_REQUIRED=2.6.0
LIBGLADE_REQUIRED=2.4.0
LIBGPHOTO_REQUIRED=2.1.3
BONOBO_REQUIRED=2.6.0
LIBOPENRAW_REQUIRED=0.0.4
EXIV2_REQUIRED=0.18
......@@ -46,7 +45,6 @@ AC_SUBST(LIBGNOMECANVAS_REQUIRED)
AC_SUBST(GIO_REQUIRED)
AC_SUBST(GNOME_VFS_REQUIRED)
AC_SUBST(LIBGLADE_REQUIRED)
AC_SUBST(LIBGPHOTO_REQUIRED)
AC_SUBST(BONOBO_REQUIRED)
AC_SUBST(LIBOPENRAW_REQUIRED)
AC_SUBST(EXIV2_REQUIRED)
......@@ -136,21 +134,6 @@ fi
AC_SUBST(XTEST_LIBS)
#
# Checks for libgphoto2
#
AC_ARG_ENABLE([gphoto2],
[AC_HELP_STRING([--disable-gphoto2],[disable support for libgphoto2])],,
[enable_gphoto2=yes])
HAVE_GPHOTO2=no
if test x$enable_gphoto2 = xyes ; then
PKG_CHECK_MODULES(GPHOTO, libgphoto2 >= $LIBGPHOTO_REQUIRED,
[AC_DEFINE(HAVE_LIBGPHOTO, 1, [Define to 1 to enable libgphoto2 support])
HAVE_GPHOTO2=yes],
[HAVE_GPHOTO2=no])
fi
#
# Checks for libopenraw
#
......@@ -362,7 +345,6 @@ Configuration:
Have XRender: ${HAVE_RENDER}
Have XTest: ${have_xtest}
Have libtiff: ${HAVE_TIFF}
Have libgphoto: ${HAVE_GPHOTO2}
Have libopenraw: ${HAVE_LIBOPENRAW}
Have gstreamer: ${HAVE_GSTREAMER}
Use Mac OS X menu: ${HAVE_MACOSMENU}
......
......@@ -154,83 +154,6 @@
<property name="homogeneous">False</property>
<property name="spacing">24</property>
<child>
<widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkButton" id="select_model_button">
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Select a camera model</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<child>
<widget class="GtkImage" id="progress_camera_image">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="camera_model_label">
<property name="width_request">100</property>
<property name="visible">True</property>
<property name="label" translatable="yes">No camera detected</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="i_commands_table">
<property name="visible">True</property>
......@@ -743,282 +666,4 @@
</child>
</widget>
<widget class="GtkDialog" id="camera_model_dialog">
<property name="border_width">6</property>
<property name="title" translatable="yes">Camera Model</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">450</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cm_refresh_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-refresh</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="cm_helpbutton">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="cm_cancelbutton">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="cm_okbutton">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
<widget class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="label" translatable="yes">_Port:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="label" translatable="yes">_Model:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">scrolledwindow1</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="height_request">200</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="cm_model_treeview">
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">False</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox4">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkComboBox" id="cm_port_combobox">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<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>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox5">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkCheckButton" id="cm_manual_selection_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">C_hoose from the catalog</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<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>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
......@@ -3,7 +3,7 @@ _Name=gThumb Photo Import Tool
_GenericName=Photo Import Tool
_Comment=Import the photos on your camera card
Categories=GNOME;GTK;Graphics;Viewer;RasterGraphics;2DGraphics;Photography;
Exec=sh -c 'gvfs-mount -u ~/.gvfs/gphoto2*; exec gthumb --import-photos'
Exec=gthumb --import-photos %U
Icon=gthumb
MimeType=x-content/image-dcf;x-content/image-picturecd;
NoDisplay=true
......
......@@ -33,6 +33,7 @@
#include "gfile-utils.h"
#include "file-data.h"
#include "file-utils.h"
#include "gtk-utils.h"
/*
......@@ -859,3 +860,14 @@ gfile_output_stream_write_line (GFileOutputStream *ostream,
return (n1 == -1 || n2 == -1 ? -1 : n1 + n2);
}
void
gfile_list_free (GList *list)
{
if (list == NULL)
return;
g_list_foreach (list, (GFunc) g_object_unref, NULL);
g_list_free (list);
}
......@@ -84,6 +84,7 @@ GFile * gfile_get_home_dir (void);
GFile * gfile_get_tmp_dir (void);
GFile * gfile_get_temp_dir_name (void);
gboolean gfile_dir_remove_recursive (GFile *dir);
gboolean gfile_path_list_new (GFile *gfile,
GList **files,
GList **dirs);
......@@ -111,4 +112,7 @@ gssize gfile_output_stream_write (GFileOutputStream *ostream,
GError **error,
const char *str);
/* lists */
void gfile_list_free (GList *list);
#endif /* GFILE_UTILS_H */
......@@ -8,7 +8,7 @@ module GNOME {
oneway void open_browser (in string uri);
oneway void open_viewer (in string uri);
oneway void load_image (in string uri);
oneway void import_photos ();
oneway void import_photos (in string uri);
};
};
......
......@@ -22,9 +22,6 @@
#include <config.h>
#ifdef HAVE_LIBGPHOTO
#include <unistd.h>
#include <string.h>
#include <strings.h>
......@@ -33,11 +30,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libgnome/gnome-help.h>
#include <libgnomeui/gnome-icon-lookup.h>
#include <gphoto2/gphoto2-context.h>
#include <gphoto2/gphoto2-camera.h>
#include <gphoto2/gphoto2-abilities-list.h>
#include <glade/glade.h>
#include "gth-utils.h"
......@@ -46,6 +38,7 @@
#include "gth-browser.h"
#include "file-data.h"
#include "file-utils.h"
#include "gfile-utils.h"
#include "dlg-tags.h"
#include "comments.h"
#include "gth-image-list.h"
......@@ -58,8 +51,6 @@
#define GLADE_FILE "gthumb_camera.glade"
#define TAGS_GLADE_FILE "gthumb_comment.glade"
#define CAMERA_FILE "gphoto-48.png"
#define MUTE_FILE "volume-mute.png"
#define TAG_SEPARATOR ";"
#define MAX_TRIES 50
#define THUMB_SIZE 100
......@@ -71,12 +62,6 @@ typedef struct _DialogData DialogData;
typedef struct _AsyncOperationData AsyncOperationData;
typedef enum {
GTH_IMPORTER_OP_LIST_ABILITIES,
GTH_IMPORTER_OP_AUTO_DETECT
} GthImporterOp;
struct _DialogData {
GthBrowser *browser;
GladeXML *gui;
......@@ -84,8 +69,6 @@ struct _DialogData {
GtkWidget *dialog;
GtkWidget *import_dialog_vbox;
GtkWidget *import_preview_scrolledwindow;
GtkWidget *camera_model_label;
GtkWidget *select_model_button;
GtkWidget *destination_filechooserbutton;
GtkWidget *subfolder_combobox;
GtkWidget *format_code_entry;
......@@ -94,10 +77,9 @@ struct _DialogData {
GtkWidget *choose_tags_button;
GtkWidget *tags_entry;
GtkWidget *import_progressbar;
GtkWidget *progress_camera_image;
GtkWidget *import_preview_box;
GtkWidget *import_reload_button;
GtkWidget *import_delete_button;
GtkWidget *import_delete_button;
GtkWidget *import_ok_button;
GtkWidget *i_commands_table;
GtkWidget *reset_exif_tag_on_import_checkbutton;
......@@ -108,29 +90,20 @@ struct _DialogData {
GtkWidget *image_list;
GdkPixbuf *no_camera_pixbuf, *camera_present_pixbuf;
/**/
Camera *camera;
gboolean camera_setted, view_folder;
GPContext *context;
CameraAbilitiesList *abilities_list;
GPPortInfoList *port_list;
gboolean view_folder;
gboolean delete_from_camera;
gboolean adjust_orientation;
int image_n;
char *local_folder;
char *main_dest_folder;
char *last_folder;
GthImporterOp current_op;
gboolean async_operation;
gboolean interrupted;
gboolean error;
gboolean renamed_files;
float target;
float fraction;
char *progress_info;
gboolean update_ui;
......@@ -152,6 +125,9 @@ struct _DialogData {
guint idle_id;
AsyncOperationData *aodata;
GList *dcim_dirs;
char *uri;
};
......@@ -380,21 +356,15 @@ destroy_cb (GtkWidget *widget,
g_free (data->progress_info);
g_free (data->msg_text);
g_free (data->local_folder);
g_free (data->main_dest_folder);
g_free (data->last_folder);
g_free (data->uri);
if (data->no_camera_pixbuf != NULL)
g_object_unref (data->no_camera_pixbuf);
if (data->camera_present_pixbuf != NULL)