[gimp] app: show file:// uris as filename in the close and quit dialogs



commit beb184e3953bc77553c6fb0c723792ac919ba1a9
Author: Michael Natterer <mitch gimp org>
Date:   Thu Nov 7 19:12:07 2013 +0100

    app: show file:// uris as filename in the close and quit dialogs
    
    and make the quit dialog's "Exported to foo" string easier to
    translate by constructing the markup in a separate step.

 app/dialogs/quit-dialog.c            |   21 +++++++++++++++------
 app/display/gimpdisplayshell-close.c |   17 +++++++++++------
 2 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/app/dialogs/quit-dialog.c b/app/dialogs/quit-dialog.c
index 8cbea5f..cb2c963 100644
--- a/app/dialogs/quit-dialog.c
+++ b/app/dialogs/quit-dialog.c
@@ -33,6 +33,8 @@
 #include "core/gimpcontext.h"
 #include "core/gimpimage.h"
 
+#include "file/file-utils.h"
+
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplay-foreach.h"
 #include "display/gimpdisplayshell.h"
@@ -305,22 +307,29 @@ quit_close_all_dialog_name_cell_func (GtkTreeViewColumn *tree_column,
   else
     {
       const gchar *uri;
+      gchar       *filename;
       gchar       *escaped_name;
-      gchar       *escaped_uri;
+      gchar       *escaped_filename;
+      gchar       *exported;
       gchar       *markup;
 
       uri = gimp_image_get_exported_uri (image);
       if (! uri)
         uri = gimp_image_get_imported_uri (image);
 
-      escaped_name = g_markup_escape_text (name, -1);
-      escaped_uri  = g_markup_escape_text (uri, -1);
+      filename = file_utils_uri_to_utf8_filename (uri);
+
+      escaped_name     = g_markup_escape_text (name, -1);
+      escaped_filename = g_markup_escape_text (filename, -1);
+
+      g_free (filename);
 
-      markup = g_strdup_printf (_("%s\n<i>Exported to %s</i>"),
-                                escaped_name, escaped_uri);
+      exported = g_strdup_printf (_("Exported to %s"), escaped_filename);
+      markup = g_strdup_printf ("%s\n<i>%s</i>", escaped_name, exported);
+      g_free (exported);
 
       g_free (escaped_name);
-      g_free (escaped_uri);
+      g_free (escaped_filename);
 
       g_object_set (cell,
                     "text",   NULL,
diff --git a/app/display/gimpdisplayshell-close.c b/app/display/gimpdisplayshell-close.c
index 6836b0a..93cd351 100644
--- a/app/display/gimpdisplayshell-close.c
+++ b/app/display/gimpdisplayshell-close.c
@@ -301,14 +301,19 @@ gimp_display_shell_close_time_changed (GimpMessageBox *box)
 
   if (! gimp_image_is_export_dirty (image))
     {
-      const gchar *exported_uri = gimp_image_get_exported_uri (image);
+      const gchar *uri;
+      gchar       *filename;
 
-      if (! exported_uri)
-        exported_uri = gimp_image_get_imported_uri (image);
+      uri = gimp_image_get_exported_uri (image);
+      if (! uri)
+        uri = gimp_image_get_imported_uri (image);
 
-      export_text =
-        g_strdup_printf (_("The image has been exported to '%s'."),
-                         exported_uri);
+      filename = file_utils_uri_to_utf8_filename (uri);
+
+      export_text = g_strdup_printf (_("The image has been exported to '%s'."),
+                                     filename);
+
+      g_free (filename);
     }
 
   if (time_text && export_text)


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