[gedit/wip/3.14-osx: 1/9] Do not use non-literal format strings



commit 4261e8a6ac019e8484939042c18be618e7c6c1c4
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Wed Aug 20 13:55:47 2014 +0200

    Do not use non-literal format strings

 gedit/gedit-commands-file.c |   28 ++++++++++++++++++----------
 gedit/gedit-utils.c         |    2 ++
 2 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index 3e8d99e..bb8d5ba 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -591,7 +591,6 @@ change_compression (GtkWindow *parent,
        gchar *parse_name;
        gchar *name_for_display;
        const gchar *primary_message;
-       const gchar *secondary_message;
        const gchar *button_label;
 
        gedit_debug (DEBUG_COMMANDS);
@@ -608,16 +607,10 @@ change_compression (GtkWindow *parent,
        if (compressed)
        {
                primary_message = _("Save the file using compression?");
-               secondary_message = _("The file \"%s\" was previously saved as plain "
-                                     "text and will now be saved using compression.");
-               button_label = _("_Save Using Compression");
        }
        else
        {
                primary_message = _("Save the file as plain text?");
-               secondary_message = _("The file \"%s\" was previously saved "
-                                     "using compression and will now be saved as plain text.");
-               button_label = _("_Save As Plain Text");
        }
 
        dialog = gtk_message_dialog_new (parent,
@@ -627,9 +620,24 @@ change_compression (GtkWindow *parent,
                                         "%s",
                                         primary_message);
 
-       gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
-                                                 secondary_message,
-                                                 name_for_display);
+       if (compressed)
+       {
+               gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                                         _("The file \"%s\" was previously saved as plain "
+                                     "text and will now be saved using compression."),
+                                                         name_for_display);
+
+               button_label = _("_Save Using Compression");
+       }
+       else
+       {
+               gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                                                         _("The file \"%s\" was previously saved "
+                                     "using compression and will now be saved as plain text."),
+                                                         name_for_display);
+               button_label = _("_Save As Plain Text");
+       }
+
 
        g_free (name_for_display);
 
diff --git a/gedit/gedit-utils.c b/gedit/gedit-utils.c
index 58efe7b..b709dcf 100644
--- a/gedit/gedit-utils.c
+++ b/gedit/gedit-utils.c
@@ -826,6 +826,8 @@ gedit_utils_is_valid_location (GFile *location)
        return is_valid;
 }
 
+static GtkWidget *handle_builder_error (const gchar *message, ...) G_GNUC_PRINTF (1, 2);
+
 static GtkWidget *
 handle_builder_error (const gchar *message, ...)
 {


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