[glade/wip/support-no-ids] GladeEditorProperty: Dont display unnamed names in treeviews



commit 4ef17651249273fc095020fdba619fdb7d33cfd1
Author: Tristan Van Berkom <tristan upstairslabs com>
Date:   Wed Jan 27 17:46:30 2016 +0100

    GladeEditorProperty: Dont display unnamed names in treeviews
    
    When selecting objects for reference in a treeview, show "(unnamed)"
    instead of __glade_unnamed_1 or such.

 gladeui/glade-editor-property.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 464ea4e..ae2fefc 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -2856,7 +2856,7 @@ glade_eprop_object_populate_view_real (GtkTreeStore *model,
     {
       GladeWidget *widget;
       GladeWidgetAdaptor *adaptor;
-
+      const gchar *widget_name;
       if ((widget = glade_widget_get_from_gobject (list->data)) != NULL)
         {
          adaptor = glade_widget_get_adaptor (widget);
@@ -2867,6 +2867,11 @@ glade_eprop_object_populate_view_real (GtkTreeStore *model,
           good_type = (glade_widget_adaptor_get_object_type (adaptor) == object_type ||
                        g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), object_type));
 
+         /* If it's an unnamed widget, dont show any name */
+         widget_name = glade_widget_get_name (widget);
+         if (!widget_name || strncmp (widget_name, GLADE_UNNAMED_PREFIX, strlen (GLADE_UNNAMED_PREFIX)) == 0)
+           widget_name = _("(unnamed)");
+
           if (parentless)
             good_type = good_type && !GWA_IS_TOPLEVEL (adaptor);
 
@@ -2877,7 +2882,7 @@ glade_eprop_object_populate_view_real (GtkTreeStore *model,
                   (model, &iter,
                    OBJ_COLUMN_WIDGET, widget,
                    OBJ_COLUMN_WIDGET_NAME,
-                   glade_eprop_object_name (glade_widget_get_name (widget), model, parent_iter),
+                   glade_eprop_object_name (widget_name, model, parent_iter),
                    OBJ_COLUMN_WIDGET_CLASS, glade_widget_adaptor_get_title (adaptor),
                    /* Selectable if its a compatible type and
                     * its not itself.


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