[network-manager-applet: 3/7] build: fix -Wformat-nonliteral build warnings



commit b5743cac11a144cc8108e5be136e9734e7d14c78
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Jun 3 18:42:25 2016 +0200

    build: fix -Wformat-nonliteral build warnings
    
    https://bugzilla.gnome.org/show_bug.cgi?id=767208

 src/applet-dialogs.c             |    6 ++++--
 src/applet-dialogs.h             |    2 +-
 src/connection-editor/ce-page.c  |    3 +++
 src/connection-editor/page-dcb.c |    3 +++
 src/ethernet-dialog.c            |    4 ++--
 5 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c
index a3281bb..55d97bc 100644
--- a/src/applet-dialogs.c
+++ b/src/applet-dialogs.c
@@ -27,6 +27,7 @@
 #include <arpa/inet.h>
 
 #include <NetworkManager.h>
+#include <glib/gi18n.h>
 
 #include "applet-dialogs.h"
 #include "utils.h"
@@ -993,11 +994,12 @@ applet_about_dialog_show (NMApplet *applet)
 }
 
 GtkWidget *
-applet_warning_dialog_show (const char *message)
+applet_missing_ui_warning_dialog_show (void)
 {
        GtkWidget *dialog;
 
-       dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, message, 
NULL);
+       dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+                                        _("The NetworkManager Applet could not find some required resources 
(the .ui file was not found)."));
 
        /* Bash focus-stealing prevention in the face */
        gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS);
diff --git a/src/applet-dialogs.h b/src/applet-dialogs.h
index f197f13..d3b5437 100644
--- a/src/applet-dialogs.h
+++ b/src/applet-dialogs.h
@@ -31,7 +31,7 @@ void applet_info_dialog_show (NMApplet *applet);
 
 void applet_about_dialog_show (NMApplet *applet);
 
-GtkWidget *applet_warning_dialog_show (const char *message);
+GtkWidget *applet_missing_ui_warning_dialog_show (void);
 
 GtkWidget *applet_mobile_password_dialog_new (NMConnection *connection,
                                               GtkEntry **out_secret_entry);
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index 7e34143..f113eba 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -509,7 +509,10 @@ ce_page_get_next_available_name (const GPtrArray *connections, const char *forma
                char *temp;
                gboolean found = FALSE;
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
                temp = g_strdup_printf (format, i);
+#pragma GCC diagnostic pop
                for (iter = names; iter; iter = g_slist_next (iter)) {
                        if (!strcmp (iter->data, temp)) {
                                found = TRUE;
diff --git a/src/connection-editor/page-dcb.c b/src/connection-editor/page-dcb.c
index 05ba431..e7d64bd 100644
--- a/src/connection-editor/page-dcb.c
+++ b/src/connection-editor/page-dcb.c
@@ -93,6 +93,8 @@ pfc_dialog_show (CEPageDcb *self)
        ce_page_changed (CE_PAGE (self));
 }
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
 static gboolean
 uint_entries_validate (GtkBuilder *builder, const char *fmt, gint max, gboolean sum)
 {
@@ -268,6 +270,7 @@ bool_entries_handle (GtkBuilder *builder,
                        g_assert_not_reached ();
        }
 }
+#pragma GCC diagnostic pop
 
 static void
 pg_dialog_show (CEPageDcb *self)
diff --git a/src/ethernet-dialog.c b/src/ethernet-dialog.c
index 6cbe455..e5aaa84 100644
--- a/src/ethernet-dialog.c
+++ b/src/ethernet-dialog.c
@@ -83,7 +83,7 @@ nma_ethernet_dialog_new (NMConnection *connection)
        if (!gtk_builder_add_from_file (builder, UIDIR "/8021x.ui", &error)) {
                g_warning ("Couldn't load builder file: %s", error->message);
                g_error_free (error);
-               applet_warning_dialog_show (_("The NetworkManager Applet could not find some required 
resources (the .ui file was not found)."));
+               applet_missing_ui_warning_dialog_show ();
                g_object_unref (builder);
                return NULL;
        }
@@ -91,7 +91,7 @@ nma_ethernet_dialog_new (NMConnection *connection)
        dialog = (GtkWidget *) gtk_builder_get_object (builder, "8021x_dialog");
        if (!dialog) {
                g_warning ("Couldn't find wireless_dialog widget.");
-               applet_warning_dialog_show (_("The NetworkManager Applet could not find some required 
resources (the .ui file was not found)."));
+               applet_missing_ui_warning_dialog_show ();
                g_object_unref (builder);
                return NULL;
        }


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