[gnome-control-center/printers-correct-argument-gtk-builder-add-obj-from-resource] printers: Pass correct argument to gtk_builder_add_objects_from_resource




commit 4ea4f41e2059c7cb6399369d136f7ee404e92200
Author: Felipe Borges <felipeborges gnome org>
Date:   Thu Aug 18 15:33:38 2022 +0200

    printers: Pass correct argument to gtk_builder_add_objects_from_resource
    
    This is detectable with -Wincompatible-pointer-types and warns with
    [1/7] Compiling C object panels/printers/libprinters.a.p/cc-printers-panel.c.o
    ../panels/printers/cc-printers-panel.c: In function ‘cc_printers_panel_init’:
    ../panels/printers/cc-printers-panel.c:1228:59: warning: passing argument 3 of 
‘gtk_builder_add_objects_from_resource’ from incompatible pointer type [-Wincompatible-pointer-types]
     1228 |                                                           objects, &error);
          |                                                           ^~~~~~~
          |                                                           |
          |                                                           gchar ** {aka char **}
    In file included from /usr/include/gtk-4.0/gtk/gtkbuildable.h:26,
                     from /usr/include/gtk-4.0/gtk/gtk.h:56,
                     from /usr/local/include/libadwaita-1/adwaita.h:9,
                     from ../shell/cc-panel.h:25,
                     from ../panels/printers/cc-printers-panel.h:21,
                     from ../panels/printers/cc-printers-panel.c:23:
    /usr/include/gtk-4.0/gtk/gtkbuilder.h:122:66: note: expected ‘const char **’ but argument is of type 
‘gchar **’ {aka ‘char **’}
      122 |                                                   const char   **object_ids,
          |                                                   ~~~~~~~~~~~~~~~^~~~~~~~~~
    [7/7] Linking target tests/network/test-wifi-panel-text

 panels/printers/cc-printers-panel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/panels/printers/cc-printers-panel.c b/panels/printers/cc-printers-panel.c
index 1749358af..f102c0592 100644
--- a/panels/printers/cc-printers-panel.c
+++ b/panels/printers/cc-printers-panel.c
@@ -1203,7 +1203,7 @@ cc_printers_panel_init (CcPrintersPanel *self)
   GtkWidget              *top_widget;
   GtkWidget              *widget;
   g_autoptr(GError)       error = NULL;
-  gchar                  *objects[] = { "overlay", "permission-infobar", "top-right-buttons", 
"printer-add-button", "search-button", NULL };
+  const gchar            *objects[] = { "overlay", "permission-infobar", "top-right-buttons", 
"printer-add-button", "search-button", NULL };
   guint                   builder_result;
 
   g_resources_register (cc_printers_get_resource ());


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