[gthumb/ext] [photo importer] simplified dialog layout
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] [photo importer] simplified dialog layout
- Date: Thu, 13 Aug 2009 09:02:45 +0000 (UTC)
commit 4638194c1652d29613bf32db676998673c86a915
Author: Paolo Bacchilega <paobac src gnome org>
Date: Thu Aug 13 11:00:23 2009 +0200
[photo importer] simplified dialog layout
added a preferences mini dialog for rarely used options
.../photo_importer/data/ui/photo-importer.ui | 247 ++++++++++++++------
extensions/photo_importer/dlg-photo-importer.c | 49 ++++-
extensions/photo_importer/gth-import-task.c | 9 +-
extensions/photo_importer/gth-import-task.h | 10 +-
4 files changed, 224 insertions(+), 91 deletions(-)
---
diff --git a/extensions/photo_importer/data/ui/photo-importer.ui b/extensions/photo_importer/data/ui/photo-importer.ui
index 40a6d09..d4c8254 100644
--- a/extensions/photo_importer/data/ui/photo-importer.ui
+++ b/extensions/photo_importer/data/ui/photo-importer.ui
@@ -19,62 +19,30 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
- <object class="GtkHBox" id="hbox3">
+ <object class="GtkHBox" id="hbox5">
<property name="visible">True</property>
- <property name="spacing">12</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkTable" id="table1">
+ <object class="GtkLabel" id="source_label">
<property name="visible">True</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <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>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Source:</property>
+ <property name="use_underline">True</property>
</object>
<packing>
+ <property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="status_label">
+ <object class="GtkHBox" id="source_box">
<property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="use_underline">True</property>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -109,7 +77,28 @@
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
- <property name="position">1</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="status_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
@@ -216,12 +205,133 @@
<property name="position">3</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="GtkExpander" id="expander1">
+ <object class="GtkButton" id="preferences_button">
+ <property name="label">gtk-preferences</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">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="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">1</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">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ <property name="secondary">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">preferences_button</action-widget>
+ <action-widget response="0">cancel_button</action-widget>
+ <action-widget response="0">ok_button</action-widget>
+ <action-widget response="0">button2</action-widget>
+ </action-widgets>
+ </object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-ok</property>
+ </object>
+ <object class="GtkDialog" id="preferences_dialog">
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Preferences</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <property name="type_hint">dialog</property>
+ <property name="transient_for">photo_importer_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="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkCheckButton" id="delete_checkbutton">
+ <property name="label" translatable="yes">_Delete imported files</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
<child>
- <object class="GtkAlignment" id="alignment1">
+ <object class="GtkAlignment" id="alignment2">
<property name="visible">True</property>
<property name="top_padding">6</property>
<property name="left_padding">12</property>
@@ -237,8 +347,8 @@
<child>
<object class="GtkFileChooserButton" id="destination_filechooserbutton">
<property name="visible">True</property>
- <property name="local_only">False</property>
<property name="action">select-folder</property>
+ <property name="local_only">False</property>
</object>
<packing>
<property name="position">0</property>
@@ -264,7 +374,7 @@
</child>
<child>
<object class="GtkCheckButton" id="single_subfolder_checkbutton">
- <property name="label" translatable="yes">single folder</property>
+ <property name="label" translatable="yes">as single subfolder</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -306,30 +416,34 @@
</object>
</child>
<child type="label">
- <object class="GtkLabel" id="label4">
+ <object class="GtkLabel" id="label1">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Destination</property>
- <property name="use_underline">True</property>
+ <property name="label" translatable="yes">Destination</property>
+ <property name="use_markup">True</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="position">4</property>
+ <property name="position">1</property>
</packing>
</child>
</object>
<packing>
+ <property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
+ <object class="GtkHButtonBox" id="dialog-action_area2">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="cancel_button">
- <property name="label">gtk-cancel</property>
+ <object class="GtkButton" id="p_close_button">
+ <property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -341,20 +455,6 @@
<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>
@@ -365,12 +465,7 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">cancel_button</action-widget>
- <action-widget response="0">ok_button</action-widget>
+ <action-widget response="0">p_close_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
index eab5a3a..9ec4e1c 100644
--- a/extensions/photo_importer/dlg-photo-importer.c
+++ b/extensions/photo_importer/dlg-photo-importer.c
@@ -65,8 +65,11 @@ typedef struct {
static void
destroy_dialog (gpointer user_data)
{
- DialogData *data = user_data;
- GFile *destination;
+ DialogData *data = user_data;
+ GFile *destination;
+ gboolean single_subfolder;
+ GthSubfolderType subfolder_type;
+ gboolean delete_imported;
g_signal_handler_disconnect (gth_main_get_default_monitor (), data->monitor_event);
@@ -79,18 +82,29 @@ destroy_dialog (gpointer user_data)
g_free (uri);
}
- eel_gconf_set_boolean (PREF_PHOTO_IMPORT_SUBFOLDER_SINGLE, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_subfolder_checkbutton"))));
- eel_gconf_set_enum (PREF_PHOTO_IMPORT_SUBFOLDER_TYPE, GTH_TYPE_SUBFOLDER_TYPE, gtk_combo_box_get_active (GTK_COMBO_BOX (data->subfolder_type_list)));
+
+ single_subfolder = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_subfolder_checkbutton")));
+ eel_gconf_set_boolean (PREF_PHOTO_IMPORT_SUBFOLDER_SINGLE, single_subfolder);
+
+ subfolder_type = gtk_combo_box_get_active (GTK_COMBO_BOX (data->subfolder_type_list));
+ eel_gconf_set_enum (PREF_PHOTO_IMPORT_SUBFOLDER_TYPE, GTH_TYPE_SUBFOLDER_TYPE, subfolder_type);
+
+ delete_imported = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("delete_checkbutton")));
+ eel_gconf_set_boolean (PREF_PHOTO_IMPORT_DELETE, delete_imported);
if (data->import) {
-/*
GthTask *task;
- task = gth_import_task_new (destination, subfolder, categories, delete);
+ task = gth_import_task_new (destination,
+ subfolder_type,
+ single_subfolder,
+ gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("tags_entry"))),
+ delete_imported);
gth_browser_exec_task (data->browser, task, FALSE);
-*/
}
+ _g_object_unref (destination);
+
gtk_widget_destroy (data->dialog);
gth_browser_set_dialog (data->browser, "photo_importer", NULL);
@@ -531,6 +545,14 @@ subfolder_hierarchy_checkbutton_toggled_cb (GtkWidget *widget,
}
+static void
+preferences_button_clicked_cb (GtkWidget *widget,
+ DialogData *data)
+{
+ gtk_window_present (GTK_WINDOW (GET_WIDGET ("preferences_dialog")));
+}
+
+
void
dlg_photo_importer (GthBrowser *browser,
GFile *source)
@@ -667,6 +689,7 @@ dlg_photo_importer (GthBrowser *browser,
g_free (last_destination);
}
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("delete_checkbutton")), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_DELETE, FALSE));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("single_subfolder_checkbutton")), eel_gconf_get_boolean (PREF_PHOTO_IMPORT_SUBFOLDER_SINGLE, FALSE));
gtk_combo_box_set_active (GTK_COMBO_BOX (data->subfolder_type_list), eel_gconf_get_enum (PREF_PHOTO_IMPORT_SUBFOLDER_TYPE, GTH_TYPE_SUBFOLDER_TYPE, GTH_SUBFOLDER_TYPE_FILE_DATE));
update_destination (data);
@@ -721,6 +744,18 @@ dlg_photo_importer (GthBrowser *browser,
"toggled",
G_CALLBACK (subfolder_hierarchy_checkbutton_toggled_cb),
data);
+ g_signal_connect (GET_WIDGET ("preferences_button"),
+ "clicked",
+ G_CALLBACK (preferences_button_clicked_cb),
+ data);
+ g_signal_connect (GET_WIDGET ("preferences_dialog"),
+ "delete-event",
+ G_CALLBACK (gtk_widget_hide_on_delete),
+ NULL);
+ g_signal_connect_swapped (GET_WIDGET ("p_close_button"),
+ "clicked",
+ G_CALLBACK (gtk_widget_hide_on_delete),
+ GET_WIDGET ("preferences_dialog"));
data->monitor_event = g_signal_connect (gth_main_get_default_monitor (),
"entry_points_changed",
diff --git a/extensions/photo_importer/gth-import-task.c b/extensions/photo_importer/gth-import-task.c
index 9d454c9..6758477 100644
--- a/extensions/photo_importer/gth-import-task.c
+++ b/extensions/photo_importer/gth-import-task.c
@@ -114,10 +114,11 @@ gth_import_task_get_type (void)
GthTask *
-gth_import_task_new (GFile *destination,
- const char *subfolder,
- char **tags,
- gboolean move)
+gth_import_task_new (GFile *destination,
+ GthSubfolderType subfolder_type,
+ gboolean single_subfolder,
+ const char *tags,
+ gboolean delete_imported)
{
GthImportTask *self;
diff --git a/extensions/photo_importer/gth-import-task.h b/extensions/photo_importer/gth-import-task.h
index ba99aa2..66b49d8 100644
--- a/extensions/photo_importer/gth-import-task.h
+++ b/extensions/photo_importer/gth-import-task.h
@@ -25,6 +25,7 @@
#include <glib.h>
#include <gthumb.h>
+#include "preferences.h"
G_BEGIN_DECLS
@@ -49,10 +50,11 @@ struct _GthImportTaskClass {
};
GType gth_import_task_get_type (void);
-GthTask * gth_import_task_new (GFile *destination,
- const char *subfolder,
- char **tags,
- gboolean move);
+GthTask * gth_import_task_new (GFile *destination,
+ GthSubfolderType subfolder_type,
+ gboolean single_subfolder,
+ const char *tags,
+ gboolean delete_imported);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]