[gthumb] Use fd->local_path in scripts, if available



commit 0a491b9e25c7cb18ad53a86d94b3b96b3c88fe33
Author: Michael J. Chudobiak <mjc avtechpulse com>
Date:   Thu May 7 09:56:13 2009 -0400

    Use fd->local_path in scripts, if available
---
 libgthumb/gtk-utils.c |   14 --------------
 libgthumb/gtk-utils.h |    3 ---
 src/dlg-scripts.c     |   36 ++++++++++++++++++++----------------
 3 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/libgthumb/gtk-utils.c b/libgthumb/gtk-utils.c
index 789a200..47200a4 100644
--- a/libgthumb/gtk-utils.c
+++ b/libgthumb/gtk-utils.c
@@ -746,20 +746,6 @@ _gtk_entry_get_filename_text (GtkEntry   *entry)
 
 
 void
-_gtk_label_set_filename_text (GtkLabel   *label,
-			      const char *text)
-{
-	char *utf8_text;
-
-	if (text == NULL)
-		text = "";
-	utf8_text = get_utf8_display_name_from_uri (text);
-	gtk_label_set_text (label, utf8_text);
-	g_free (utf8_text);
-}
-
-
-void
 _gtk_button_set_filename_label (GtkButton   *button,
 			      const char *text)
 {
diff --git a/libgthumb/gtk-utils.h b/libgthumb/gtk-utils.h
index d0758b0..e407015 100644
--- a/libgthumb/gtk-utils.h
+++ b/libgthumb/gtk-utils.h
@@ -93,9 +93,6 @@ void        _gtk_entry_set_filename_text (GtkEntry   *entry,
 
 char *      _gtk_entry_get_filename_text (GtkEntry   *entry);
 
-void        _gtk_label_set_filename_text (GtkLabel   *label,
-					  const char *text);
-
 void        _gtk_button_set_filename_label (GtkButton   *button,
 					  const char *text);
 
diff --git a/src/dlg-scripts.c b/src/dlg-scripts.c
index 31afe14..08b51d8 100644
--- a/src/dlg-scripts.c
+++ b/src/dlg-scripts.c
@@ -567,24 +567,25 @@ exec_shell_script (GtkWindow  *window,
 		load_thumbnail (data, file_list->data);
 
 		for (scan = file_list; scan; scan = scan->next) {
-			char *filename;
-			char *e_filename;
-			char *new_file_list;
-
-			if (is_local_file (scan->data))
-				filename = get_utf8_display_name_from_uri (remove_host_from_uri (scan->data));
+			char     *e_filename;
+			char     *new_file_list;
+			FileData *fd;
+			
+			fd = file_data_new (scan->data);
+
+			if (fd->local_path != NULL)
+				e_filename = shell_escape (fd->local_path);
 			else
-				filename = get_utf8_display_name_from_uri (scan->data);
-
-			e_filename = shell_escape (filename);
+				e_filename = shell_escape (fd->utf8_path);
 
 			new_file_list = g_strconcat (file_list_string, e_filename, " ", NULL);
 
 			g_free (e_filename);
 			g_free (file_list_string);
 			file_list_string = g_strdup (new_file_list);
-
 			g_free (new_file_list);
+			
+			file_data_unref (fd);
 		}
 
 		command1 = _g_substitute_pattern (script, 'F', file_list_string);
@@ -597,7 +598,7 @@ exec_shell_script (GtkWindow  *window,
 		g_free (command0);
 
 
-		_gtk_label_set_filename_text (GTK_LABEL (label), script);
+		gtk_label_set_text (GTK_LABEL (label), script);
 		gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar),
 					       (gdouble) 1.0);
 		while (gtk_events_pending())
@@ -625,13 +626,15 @@ exec_shell_script (GtkWindow  *window,
 			char *command5 = NULL;
 			char *command6 = NULL;
 			char *command7 = NULL;
+                        FileData *fd;
 
 			load_thumbnail (data, scan->data);
 
-			if (is_local_file (scan->data))
-				filename = get_utf8_display_name_from_uri (remove_host_from_uri (scan->data));
-			else
-				filename = get_utf8_display_name_from_uri (scan->data);
+                        fd = file_data_new (scan->data);
+                        if (fd->local_path != NULL)
+                                filename = g_strdup (fd->local_path);
+                        else
+                                filename = g_strdup (fd->utf8_path);
 
 			name_wo_ext = remove_extension_from_path (filename);
 			extension = g_filename_to_utf8 (strrchr (filename, '.'), -1, 0, 0, 0);
@@ -680,8 +683,9 @@ exec_shell_script (GtkWindow  *window,
 			g_free (parent);
 			g_free (basename);
 			g_free (basename_wo_ext);
+			file_data_unref (fd);
 
-			_gtk_label_set_filename_text (GTK_LABEL (label), command0);
+			gtk_label_set_text (GTK_LABEL (label), command0);
 			gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar),
 						       (gdouble) (i + 0.5) / n);
 



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