[gthumb] rename series: added special code to add the filename without extension



commit 659398658b64d815b3eda09c32d84c937b0dace3
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Aug 10 09:14:53 2022 +0200

    rename series: added special code to add the filename without extension

 extensions/rename_series/dlg-rename-series.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/extensions/rename_series/dlg-rename-series.c b/extensions/rename_series/dlg-rename-series.c
index 7a9df805..a8c10e3a 100644
--- a/extensions/rename_series/dlg-rename-series.c
+++ b/extensions/rename_series/dlg-rename-series.c
@@ -54,6 +54,7 @@ static GthTemplateCode Rename_Special_Codes[] = {
        { GTH_TEMPLATE_CODE_TYPE_ENUMERATOR, N_("Enumerator") },
        { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("Original filename"), 'F', 0 },
        { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("Original extension"), 'E', 0 },
+       { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("File name, no extension"), 'G', 0 },
        { GTH_TEMPLATE_CODE_TYPE_SIMPLE, N_("Original enumerator"), 'N', 0 },
        { GTH_TEMPLATE_CODE_TYPE_DATE, N_("Modification date"), 'M', 0 },
        { GTH_TEMPLATE_CODE_TYPE_DATE, N_("Digitalization date"), 'D', 0 },
@@ -190,6 +191,12 @@ template_eval_cb (TemplateFlags   flags,
                g_free (path);
                break;
 
+       case 'G':
+               path = g_file_get_path (template_data->file_data->file);
+               text = _g_path_remove_extension (_g_path_get_basename (path));
+               g_free (path);
+               break;
+
        case 'N':
                text = get_original_enum (template_data->file_data);
                break;
@@ -753,6 +760,16 @@ template_dialog_preview_cb (TemplateFlags   flags,
                g_object_unref (file);
                break;
 
+       case 'G':
+               file = g_file_new_for_uri (PREVIEW_URI);
+               path = g_file_get_path (file);
+               text = _g_path_remove_extension (_g_path_get_basename (path));
+               g_string_append (result, text);
+               g_free (text);
+               g_free (path);
+               g_object_unref (file);
+               break;
+
        case 'N':
                g_string_append (result, "123");
                break;


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