[glade] GladeStandarStock, GladeStandarStockImage: fix get_type() functions for introspection



commit dbad3f508d4bcce1b71af6f863abbfd989f27ede
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Fri Jun 19 18:10:35 2020 -0300

    GladeStandarStock, GladeStandarStockImage: fix get_type() functions for introspection
    
    Avoid trying to register stock icons when there is no default display like when
    running introspection scanner.
    
    This prevents some really annoying warnings and should help with
    https://gitlab.gnome.org/GNOME/glade/-/issues/432

 gladeui/glade-builtins.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gladeui/glade-builtins.c b/gladeui/glade-builtins.c
index 8dbe6a5c..beadc5cb 100644
--- a/gladeui/glade-builtins.c
+++ b/gladeui/glade-builtins.c
@@ -292,6 +292,9 @@ glade_standard_stock_get_type (void)
                                       (GEnumValue *) g_array_free (values,
                                                                    FALSE));
 
+      if (gdk_display_get_default () == NULL)
+        return etype;
+
       /* Register displayable by GType, i.e. after the types been created. */
       for (i = 0; i < n_values; i++)
         {
@@ -329,6 +332,9 @@ glade_standard_stock_image_get_type (void)
                                       (GEnumValue *) g_array_free (values,
                                                                    FALSE));
 
+      if (gdk_display_get_default () == NULL)
+        return etype;
+
       /* Register displayable by GType, i.e. after the types been created. */
       for (i = 0; i < n_values; i++)
         {


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