[gthumb] [photo_importer] highlight the auto-subfolder part in the destination



commit 3ea4f3617f51491be43c21c7f107f946ed03b658
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Aug 4 22:10:10 2010 +0200

    [photo_importer] highlight the auto-subfolder part in the destination

 .../importer/gth-import-preferences-dialog.c       |    7 +++++
 .../importer/gth-import-preferences-dialog.h       |    2 +
 .../photo_importer/data/ui/photo-importer.ui       |   29 +++++++++++++++++--
 extensions/photo_importer/dlg-photo-importer.c     |   20 ++++++++++++-
 4 files changed, 53 insertions(+), 5 deletions(-)
---
diff --git a/extensions/importer/gth-import-preferences-dialog.c b/extensions/importer/gth-import-preferences-dialog.c
index 27b50ab..81a60aa 100644
--- a/extensions/importer/gth-import-preferences-dialog.c
+++ b/extensions/importer/gth-import-preferences-dialog.c
@@ -472,6 +472,13 @@ gth_import_preferences_dialog_set_event (GthImportPreferencesDialog *self,
 
 
 GFile *
+gth_import_preferences_dialog_get_destination (GthImportPreferencesDialog *self)
+{
+	return gtk_file_chooser_get_file (GTK_FILE_CHOOSER (GET_WIDGET ("destination_filechooserbutton")));
+}
+
+
+GFile *
 gth_import_preferences_dialog_get_destination_example (GthImportPreferencesDialog *self)
 {
 	GFile              *destination;
diff --git a/extensions/importer/gth-import-preferences-dialog.h b/extensions/importer/gth-import-preferences-dialog.h
index 2d254b3..2c07416 100644
--- a/extensions/importer/gth-import-preferences-dialog.h
+++ b/extensions/importer/gth-import-preferences-dialog.h
@@ -57,6 +57,8 @@ GType        gth_import_preferences_dialog_get_type  (void);
 GtkWidget *  gth_import_preferences_dialog_new       (void);
 void         gth_import_preferences_dialog_set_event (GthImportPreferencesDialog *self,
 						      const char                 *event);
+GFile *      gth_import_preferences_dialog_get_destination
+						     (GthImportPreferencesDialog *self);
 GFile *      gth_import_preferences_dialog_get_destination_example
 						     (GthImportPreferencesDialog *self);
 
diff --git a/extensions/photo_importer/data/ui/photo-importer.ui b/extensions/photo_importer/data/ui/photo-importer.ui
index d57eb9d..6c50903 100644
--- a/extensions/photo_importer/data/ui/photo-importer.ui
+++ b/extensions/photo_importer/data/ui/photo-importer.ui
@@ -231,10 +231,33 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="destination_label">
+                          <object class="GtkHBox" id="hbox3">
                             <property name="visible">True</property>
-                            <property name="xalign">0</property>
-                            <property name="ellipsize">start</property>
+                            <child>
+                              <object class="GtkLabel" id="destination_label">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label">/home/user/Images</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="destination_example_label">
+                                <property name="visible">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label">/garden/2010-06-23</property>
+                                <property name="ellipsize">end</property>
+                                <attributes>
+                                  <attribute name="foreground" value="#b1eb33440710"/>
+                                </attributes>
+                              </object>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
                           </object>
                           <packing>
                             <property name="position">1</property>
diff --git a/extensions/photo_importer/dlg-photo-importer.c b/extensions/photo_importer/dlg-photo-importer.c
index 1b3a93d..b01f762 100644
--- a/extensions/photo_importer/dlg-photo-importer.c
+++ b/extensions/photo_importer/dlg-photo-importer.c
@@ -273,15 +273,28 @@ static void
 preferences_dialog_destination_changed_cb (GthImportPreferencesDialog *dialog,
 					   DialogData                 *data)
 {
+	GFile *destination;
 	GFile *destination_example;
 
+	destination = gth_import_preferences_dialog_get_destination (dialog);
 	destination_example = gth_import_preferences_dialog_get_destination_example (dialog);
-	if (destination_example != NULL) {
+	if ((destination != NULL) && (destination_example != NULL)) {
 		char *name;
 
-		name = g_file_get_parse_name (destination_example);
+		name = g_file_get_parse_name (destination);
 		gtk_image_set_from_icon_name(GTK_IMAGE (GET_WIDGET("destination_icon")), "folder", GTK_ICON_SIZE_MENU);
 		gtk_label_set_text (GTK_LABEL (GET_WIDGET ("destination_label")), name);
+		g_free (name);
+
+		name = g_file_get_relative_path (destination, destination_example);
+		if ((name != NULL) && (strcmp (name, "") != 0)) {
+			char *example_path;
+
+			example_path = g_strconcat (G_DIR_SEPARATOR_S, name, NULL);
+			gtk_label_set_text (GTK_LABEL (GET_WIDGET ("destination_example_label")), example_path);
+
+			g_free (example_path);
+		}
 
 		g_free (name);
 	}
@@ -289,6 +302,9 @@ preferences_dialog_destination_changed_cb (GthImportPreferencesDialog *dialog,
 		gtk_image_set_from_icon_name(GTK_IMAGE (GET_WIDGET("destination_icon")), "dialog-error", GTK_ICON_SIZE_MENU);
 		gtk_label_set_text (GTK_LABEL (GET_WIDGET ("destination_label")), _("Invalid Destination"));
 	}
+
+	_g_object_unref (destination_example);
+	_g_object_unref (destination);
 }
 
 



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