[glade] GladeGtkNotebook: Fix "format not a string literal" warning



commit 7ae104ef82584e91ab3abe720c0a06e0b74eb3c9
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Apr 26 15:27:36 2016 +0200

    GladeGtkNotebook: Fix "format not a string literal" warning
    
    glade-gtk-notebook.c: In function ‘glade_gtk_box_notebook_child_insert_remove_action’:
    glade-gtk-notebook.c:988:3: error: format not a string literal, argument types not checked 
[-Werror=format-nonliteral]
       glade_command_push_group (group_format, glade_widget_get_name (parent));
       ^~~~~~~~~~~~~~~~~~~~~~~~
    
    https://bugzilla.gnome.org/show_bug.cgi?id=765612

 plugins/gtk+/glade-gtk-box.c      |    9 +++------
 plugins/gtk+/glade-gtk-notebook.c |   25 +++++++++++++++++++------
 plugins/gtk+/glade-gtk-notebook.h |    3 ++-
 3 files changed, 24 insertions(+), 13 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-box.c b/plugins/gtk+/glade-gtk-box.c
index f7e032d..e2bb222 100644
--- a/plugins/gtk+/glade-gtk-box.c
+++ b/plugins/gtk+/glade-gtk-box.c
@@ -611,24 +611,21 @@ glade_gtk_box_child_action_activate (GladeWidgetAdaptor * adaptor,
     {
       glade_gtk_box_notebook_child_insert_remove_action (adaptor, container,
                                                          object, "size",
-                                                         _
-                                                         ("Insert placeholder to %s"),
+                                                         FALSE, TRUE,
                                                          FALSE, TRUE);
     }
   else if (strcmp (action_path, "insert_before") == 0)
     {
       glade_gtk_box_notebook_child_insert_remove_action (adaptor, container,
                                                          object, "size",
-                                                         _
-                                                         ("Insert placeholder to %s"),
+                                                         FALSE, TRUE,
                                                          FALSE, FALSE);
     }
   else if (strcmp (action_path, "remove_slot") == 0)
     {
       glade_gtk_box_notebook_child_insert_remove_action (adaptor, container,
                                                          object, "size",
-                                                         _
-                                                         ("Remove placeholder from %s"),
+                                                         FALSE, FALSE,
                                                          TRUE, FALSE);
     }
   else
diff --git a/plugins/gtk+/glade-gtk-notebook.c b/plugins/gtk+/glade-gtk-notebook.c
index b685d0c..8393bb2 100644
--- a/plugins/gtk+/glade-gtk-notebook.c
+++ b/plugins/gtk+/glade-gtk-notebook.c
@@ -936,22 +936,21 @@ glade_gtk_notebook_child_action_activate (GladeWidgetAdaptor * adaptor,
     {
       glade_gtk_box_notebook_child_insert_remove_action (adaptor, container,
                                                          object, "pages",
-                                                         _("Insert page on %s"),
+                                                         TRUE, TRUE,
                                                          FALSE, TRUE);
     }
   else if (strcmp (action_path, "insert_page_before") == 0)
     {
       glade_gtk_box_notebook_child_insert_remove_action (adaptor, container,
                                                          object, "pages",
-                                                         _("Insert page on %s"),
+                                                         TRUE, TRUE,
                                                          FALSE, FALSE);
     }
   else if (strcmp (action_path, "remove_page") == 0)
     {
       glade_gtk_box_notebook_child_insert_remove_action (adaptor, container,
                                                          object, "pages",
-                                                         _
-                                                         ("Remove page from %s"),
+                                                         TRUE, FALSE,
                                                          TRUE, TRUE);
     }
   else
@@ -967,7 +966,8 @@ glade_gtk_box_notebook_child_insert_remove_action (GladeWidgetAdaptor * adaptor,
                                                    GObject * container,
                                                    GObject * object,
                                                    const gchar * size_prop,
-                                                   const gchar * group_format,
+                                                   gboolean is_notebook,
+                                                   gboolean is_insert,
                                                    gboolean remove,
                                                    gboolean after)
 {
@@ -985,7 +985,20 @@ glade_gtk_box_notebook_child_insert_remove_action (GladeWidgetAdaptor * adaptor,
                              GTK_WIDGET (object), "position", &child_pos, NULL);
 
   parent = glade_widget_get_from_gobject (container);
-  glade_command_push_group (group_format, glade_widget_get_name (parent));
+  if (is_notebook)
+    {
+      if (is_insert)
+        glade_command_push_group (_("Insert page on %s"), glade_widget_get_name (parent));
+      else
+        glade_command_push_group (_("Remove page from %s"), glade_widget_get_name (parent));
+    }
+  else
+    {
+      if (is_insert)
+        glade_command_push_group (_("Insert placeholder to %s"), glade_widget_get_name (parent));
+      else
+        glade_command_push_group (_("Remove placeholder from %s"), glade_widget_get_name (parent));
+    }
 
   /* Make sure widgets does not get destroyed */
   children = glade_widget_adaptor_get_children (adaptor, container);
diff --git a/plugins/gtk+/glade-gtk-notebook.h b/plugins/gtk+/glade-gtk-notebook.h
index bb5e835..90b0aa1 100644
--- a/plugins/gtk+/glade-gtk-notebook.h
+++ b/plugins/gtk+/glade-gtk-notebook.h
@@ -30,7 +30,8 @@ void glade_gtk_box_notebook_child_insert_remove_action (GladeWidgetAdaptor * ada
                                                        GObject * container,
                                                        GObject * object,
                                                        const gchar * size_prop,
-                                                       const gchar * group_format,
+                                                       gboolean is_notebook,
+                                                       gboolean is_insert,
                                                        gboolean remove,
                                                        gboolean after);
 


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