[gimp] Issue #1371 - Add title printf-like expando for export-clean and export-dirty



commit 2e4b3ae05a8d48f2dace1cf01c1595bf1ab97d34
Author: Liam Quin <liam w3 org>
Date:   Sat Oct 20 11:20:16 2018 +0200

    Issue #1371 - Add title printf-like expando for export-clean and export-dirty
    
    Add %Ex to print 'x' as export-clean indicator and %Nx for 'x' as
    export-dirty indicator.

 app/config/gimpconfig-dump.c         |  2 ++
 app/display/gimpdisplayshell-title.c | 24 ++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
---
diff --git a/app/config/gimpconfig-dump.c b/app/config/gimpconfig-dump.c
index bc9cc03537..1c1d44463a 100644
--- a/app/config/gimpconfig-dump.c
+++ b/app/config/gimpconfig-dump.c
@@ -402,6 +402,8 @@ static const gchar display_format_description[] =
 "%Cx expands to x if the image is clean, the empty string otherwise\n"
 "%B  expands to (modified) if the image is dirty, the empty string otherwise\n"
 "%A  expands to (clean) if the image is clean, the empty string otherwise\n"
+"%Nx expands to x if the image is export-dirty, the empty string otherwise\n"
+"%Ex expands to x if the image is export-clean, the empty string otherwise\n"
 "%l  the number of layers\n"
 "%L  the number of layers (long form)\n"
 "%m  memory used by the image\n"
diff --git a/app/display/gimpdisplayshell-title.c b/app/display/gimpdisplayshell-title.c
index 9c51216f34..6078222f3c 100644
--- a/app/display/gimpdisplayshell-title.c
+++ b/app/display/gimpdisplayshell-title.c
@@ -295,6 +295,30 @@ gimp_display_shell_format_title (GimpDisplayShell *shell,
                 i += print (title, title_len, i, "%s", _("(clean)"));
               break;
 
+            case 'N': /* not-exported flag */
+              if (format[1] == 0)
+                {
+                  /* format string ends within %E-sequence, print literal '%E' */
+                  i += print (title, title_len, i, "%%N");
+                  break;
+                }
+              if (gimp_image_is_export_dirty (image))
+                title[i++] = format[1];
+              format++;
+              break;
+
+            case 'E': /* exported flag */
+              if (format[1] == 0)
+                {
+                  /* format string ends within %E-sequence, print literal '%E' */
+                  i += print (title, title_len, i, "%%E");
+                  break;
+                }
+              if (! gimp_image_is_export_dirty (image))
+                title[i++] = format[1];
+              format++;
+              break;
+
             case 'm': /* memory used by image */
               {
                 GimpObject *object = GIMP_OBJECT (image);


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