diff options
author | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-08-07 19:56:46 -0300 |
---|---|---|
committer | Juan Pablo Ugarte <juanpablougarte@gmail.com> | 2020-08-07 19:56:46 -0300 |
commit | e4b1d68311f34502a552fddca2c5ff1839600f16 (patch) | |
tree | b96779f4099cd4df20199de892b772382a1a4b22 /gladeui | |
parent | e48e603b663f20231e5984486c077ab0f7c86383 (diff) | |
download | glade-e4b1d68311f34502a552fddca2c5ff1839600f16.tar.gz |
GladeWidget: improve glade_widget_get_name() and glade_widget_generate_path_name()
Make sure object type is used intead of __glade_unnamed_ prefix.
Diffstat (limited to 'gladeui')
-rw-r--r-- | gladeui/glade-widget.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c index 93076ea5..019e1b1c 100644 --- a/gladeui/glade-widget.c +++ b/gladeui/glade-widget.c @@ -2762,10 +2762,8 @@ glade_widget_get_name (GladeWidget *widget) * * Returns: a pointer to @widget's displayable name * - * This should be used to display the widget's ID in - * the UI, it will automatically return an "(unnamed)" - * string if the widget is not intended to be serialized - * with an ID (i.e. the user did not provide a name). + * This should be used to display the widget's ID in the UI, + * it will automatically return the class name if the widget has no name. */ const gchar * glade_widget_get_display_name (GladeWidget *widget) @@ -2773,7 +2771,7 @@ glade_widget_get_display_name (GladeWidget *widget) g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL); if (g_str_has_prefix (widget->priv->name, GLADE_UNNAMED_PREFIX)) - return _("(unnamed)"); + return G_OBJECT_TYPE_NAME (widget->priv->object); return widget->priv->name; } @@ -4844,13 +4842,12 @@ glade_widget_generate_path_name (GladeWidget *widget) g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL); - string = g_string_new (widget->priv->name); + string = g_string_new (glade_widget_get_display_name (widget)); for (iter = widget->priv->parent; iter; iter = iter->priv->parent) { - gchar *str = g_strdup_printf ("%s:", iter->priv->name); - g_string_prepend (string, str); - g_free (str); + g_string_prepend (string, " > "); + g_string_prepend (string, glade_widget_get_display_name (iter)); } return g_string_free (string, FALSE); |