[gthumb/ext] [rename dialog] use a better default value for the template
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gthumb/ext] [rename dialog] use a better default value for the template
- Date: Sun, 23 Aug 2009 09:45:39 +0000 (UTC)
commit c02933ccdb4fdde229166bf1a3b4078e238ec646
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Aug 23 11:42:37 2009 +0200
[rename dialog] use a better default value for the template
when renaming a single file use the filename as template and
exclude the extension from the selection
extensions/rename_series/dlg-rename-series.c | 22 +++++++++++++++++++++-
extensions/rename_series/dlg-rename-series.h | 2 +-
2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/extensions/rename_series/dlg-rename-series.c b/extensions/rename_series/dlg-rename-series.c
index 326ca5a..5b82d03 100644
--- a/extensions/rename_series/dlg-rename-series.c
+++ b/extensions/rename_series/dlg-rename-series.c
@@ -404,7 +404,13 @@ dlg_rename_series (GthBrowser *browser,
gtk_widget_show (data->list_view);
gtk_container_add (GTK_CONTAINER (GET_WIDGET ("preview_scrolledwindow")), data->list_view);
- gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("template_entry")), "####%E");
+ if (data->file_list->next == NULL) {
+ GthFileData *file_data = data->file_list->data;
+ gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("template_entry")), g_file_info_get_attribute_string (file_data->info, G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME));
+ }
+ else
+ gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("template_entry")), "####%E");
+
gtk_spin_button_set_value (GTK_SPIN_BUTTON (GET_WIDGET ("start_at_spinbutton")), 1.0);
/* sort by */
@@ -491,4 +497,18 @@ dlg_rename_series (GthBrowser *browser,
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);
+
+ if (data->file_list->next == NULL) {
+ const char *edit_name;
+ const char *end_pos;
+
+ edit_name = gtk_entry_get_text (GTK_ENTRY (GET_WIDGET ("template_entry")));
+ end_pos = g_utf8_strrchr (edit_name, -1, '.');
+ if (end_pos != NULL) {
+ glong nchars;
+
+ nchars = g_utf8_strlen (edit_name, (gssize) (end_pos - edit_name));
+ gtk_editable_select_region (GTK_EDITABLE (GET_WIDGET ("template_entry")), 0, nchars);
+ }
+ }
}
diff --git a/extensions/rename_series/dlg-rename-series.h b/extensions/rename_series/dlg-rename-series.h
index ce085d2..536537b 100644
--- a/extensions/rename_series/dlg-rename-series.h
+++ b/extensions/rename_series/dlg-rename-series.h
@@ -26,6 +26,6 @@
#include <gthumb.h>
void dlg_rename_series (GthBrowser *browser,
- GList *file_list);
+ GList *file_list /* GthFileData list */);
#endif /* DLG_RENAME_SERIES_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]