[gtk/wip/matthiasc/popup5: 127/139] widget: Improve warning messages



commit a78a579b61d06a3e06c89af2a00048270bd9cda4
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 4 18:15:03 2019 +0000

    widget: Improve warning messages
    
    When we print warnings about a widget, using
    gtk_widget_get_name() is slightly better than
    G_OBJECT_TYPE_NAME(), since it will give us
    the widgets unique name when available.

 gtk/gtkwidget.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 5a5022d3cb..695882ba32 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6742,17 +6742,17 @@ gtk_widget_verify_invariants (GtkWidget *widget)
 
       if (!priv->realized)
         g_warning ("%s %p is mapped but not realized",
-                   G_OBJECT_TYPE_NAME (widget), widget);
+                   gtk_widget_get_name (widget), widget);
 
       if (!priv->visible)
         g_warning ("%s %p is mapped but not visible",
-                   G_OBJECT_TYPE_NAME (widget), widget);
+                   gtk_widget_get_name (widget), widget);
 
       if (!GTK_IS_ROOT (widget))
         {
           if (!priv->child_visible)
             g_warning ("%s %p is mapped but not child_visible",
-                       G_OBJECT_TYPE_NAME (widget), widget);
+                       gtk_widget_get_name (widget), widget);
         }
     }
   else
@@ -6802,8 +6802,8 @@ gtk_widget_verify_invariants (GtkWidget *widget)
 
           if (priv->realized)
             g_warning ("%s %p is not realized but child %s %p is realized",
-                       parent ? G_OBJECT_TYPE_NAME (parent) : "no parent", parent,
-                       G_OBJECT_TYPE_NAME (widget), widget);
+                       parent ? gtk_widget_get_name (parent) : "no parent", parent,
+                       gtk_widget_get_name (widget), widget);
         }
 
       if (parent &&
@@ -6815,8 +6815,8 @@ gtk_widget_verify_invariants (GtkWidget *widget)
 
           if (!priv->mapped)
             g_warning ("%s %p is mapped but visible child %s %p is not mapped",
-                       G_OBJECT_TYPE_NAME (parent), parent,
-                       G_OBJECT_TYPE_NAME (widget), widget);
+                       gtk_widget_get_name (parent), parent,
+                       gtk_widget_get_name (widget), widget);
         }
       else if (!GTK_IS_ROOT (widget))
         {
@@ -6824,10 +6824,10 @@ gtk_widget_verify_invariants (GtkWidget *widget)
 
           if (priv->mapped)
             g_warning ("%s %p is mapped but visible=%d child_visible=%d parent %s %p mapped=%d",
-                       G_OBJECT_TYPE_NAME (widget), widget,
+                       gtk_widget_get_name (widget), widget,
                        priv->visible,
                        priv->child_visible,
-                       parent ? G_OBJECT_TYPE_NAME (parent) : "no parent", parent,
+                       parent ? gtk_widget_get_name (parent) : "no parent", parent,
                        parent ? parent->priv->mapped : FALSE);
         }
     }
@@ -12920,7 +12920,7 @@ gtk_widget_snapshot (GtkWidget   *widget,
 
   if (_gtk_widget_get_alloc_needed (widget))
     {
-      g_warning ("Trying to snapshot %s %p without a current allocation", G_OBJECT_TYPE_NAME (widget), 
widget);
+      g_warning ("Trying to snapshot %s %p without a current allocation", gtk_widget_get_name (widget), 
widget);
       return;
     }
 


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