[gthumb] rename series: added ability to specify the current time
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] rename series: added ability to specify the current time
- Date: Wed, 10 Aug 2022 07:24:04 +0000 (UTC)
commit 77226ff6808982c97a4e98437d68cbcf60a7756c
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Aug 10 09:20:53 2022 +0200
rename series: added ability to specify the current time
extensions/rename_series/dlg-rename-series.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/extensions/rename_series/dlg-rename-series.c b/extensions/rename_series/dlg-rename-series.c
index e508cf11..c634b1a1 100644
--- a/extensions/rename_series/dlg-rename-series.c
+++ b/extensions/rename_series/dlg-rename-series.c
@@ -58,6 +58,7 @@ static GthTemplateCode Rename_Special_Codes[] = {
{ 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 },
+ { GTH_TEMPLATE_CODE_TYPE_DATE, N_("Current date"), 'T', 0 },
{ GTH_TEMPLATE_CODE_TYPE_FILE_ATTRIBUTE, N_("File attribute"), 'A', 0 }
};
@@ -164,7 +165,7 @@ template_eval_cb (TemplateFlags flags,
char *path;
GTimeVal timeval;
- if ((parent_code == 'D') || (parent_code == 'M')) {
+ if ((parent_code == 'D') || (parent_code == 'M') || (parent_code == 'T')) {
/* strftime code, return the code itself. */
_g_string_append_template_code (result, code, args);
return FALSE;
@@ -210,6 +211,11 @@ template_eval_cb (TemplateFlags flags,
timeval = *gth_file_data_get_modification_time (template_data->file_data);
text = _g_time_val_strftime (&timeval, (args[0] != NULL) ? args[0] : DEFAULT_STRFTIME_FORMAT);
break;
+
+ case 'T':
+ g_get_current_time (&timeval);
+ text = _g_time_val_strftime (&timeval, (args[0] != NULL) ? args[0] : DEFAULT_STRFTIME_FORMAT);
+ break;
}
if (text != NULL) {
@@ -724,7 +730,7 @@ template_dialog_preview_cb (TemplateFlags flags,
char *path;
GTimeVal timeval;
- if ((parent_code == 'D') || (parent_code == 'M')) {
+ if ((parent_code == 'D') || (parent_code == 'M') || (parent_code == 'T')) {
/* strftime code, return the code itself. */
_g_string_append_template_code (result, code, args);
return FALSE;
@@ -787,6 +793,13 @@ template_dialog_preview_cb (TemplateFlags flags,
g_string_append (result, text);
g_free (text);
break;
+
+ case 'T':
+ g_get_current_time (&timeval);
+ text = _g_time_val_strftime (&timeval, (args[0] != NULL) ? args[0] : DEFAULT_STRFTIME_FORMAT);
+ g_string_append (result, text);
+ g_free (text);
+ break;
}
if (code != 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]