Commit 583e024e authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte Committed by Juan Pablo Ugarte

GladeWidgetAdaptor: add glade_widget_adaptor_get_display_name()

parent 4b3c2080
Pipeline #22984 passed with stages
in 3 minutes and 55 seconds
......@@ -170,7 +170,7 @@ normalize_name (const gchar *name)
static inline void
store_append_adaptor (GtkListStore *store, GladeWidgetAdaptor *adaptor)
{
gchar *normalized_name = normalize_name (_glade_widget_adaptor_get_real_name (adaptor));
gchar *normalized_name = normalize_name (glade_widget_adaptor_get_display_name (adaptor));
gtk_list_store_insert_with_values (store, NULL, -1,
COLUMN_ADAPTOR, adaptor,
......@@ -383,7 +383,7 @@ adaptor_text_cell_data_func (GtkTreeViewColumn *tree_column,
if (adaptor)
g_object_set (cell,
"sensitive", TRUE,
"text", _glade_widget_adaptor_get_real_name (adaptor),
"text", glade_widget_adaptor_get_display_name (adaptor),
"style", PANGO_STYLE_NORMAL,
NULL);
else
......@@ -412,7 +412,7 @@ glade_adaptor_chooser_widget_drag_begin (GtkWidget *widget,
gtk_tree_model_get (model, &iter, COLUMN_ADAPTOR, &adaptor, -1);
_glade_dnd_set_icon_widget (context,
glade_widget_adaptor_get_icon_name (adaptor),
glade_widget_adaptor_get_name (adaptor));
glade_widget_adaptor_get_display_name (adaptor));
}
}
......
......@@ -291,7 +291,7 @@ glade_adaptor_chooser_update_adaptor (GladeAdaptorChooser *chooser)
glade_widget_adaptor_get_icon_name (adaptor),
GTK_ICON_SIZE_BUTTON);
gtk_label_set_label (priv->class_label,
glade_widget_adaptor_get_name (adaptor));
glade_widget_adaptor_get_display_name (adaptor));
}
else
{
......
......@@ -954,7 +954,7 @@ update_widget_name (GladeDesignLayout *layout, GladeWidget *gwidget)
else
{
GladeWidgetAdaptor *adaptor = glade_widget_get_adaptor (gwidget);
pango_layout_set_text (priv->widget_name, _glade_widget_adaptor_get_real_name (adaptor), -1);
pango_layout_set_text (priv->widget_name, glade_widget_adaptor_get_display_name (adaptor), -1);
}
gtk_widget_queue_resize (GTK_WIDGET (layout));
......@@ -1973,7 +1973,7 @@ glade_design_layout_drag_begin (GtkWidget *widget, GdkDragContext *context)
gwidget = glade_widget_get_from_gobject (priv->drag_source);
adaptor = glade_widget_get_adaptor (gwidget);
description = g_strdup_printf ("%s [%s]",
glade_widget_adaptor_get_name (adaptor),
glade_widget_adaptor_get_display_name (adaptor),
glade_widget_get_name (gwidget));
_glade_dnd_set_icon_widget (context,
......
......@@ -3429,7 +3429,7 @@ glade_eprop_object_show_dialog (GladeEditorProperty *eprop)
/* translators: Creating 'a widget' for 'a property' of 'a widget' */
glade_command_push_group (_("Creating %s for %s of %s"),
glade_widget_adaptor_get_name (create_adaptor),
glade_widget_adaptor_get_display_name (create_adaptor),
glade_property_class_get_name (eprop->priv->klass),
glade_widget_get_name (widget));
......
......@@ -390,7 +390,7 @@ glade_editor_table_load (GladeEditable *editable, GladeWidget *widget)
gtk_widget_set_sensitive (table->priv->composite_check,
!g_str_has_prefix (glade_widget_adaptor_get_name (adaptor),
GLADE_WIDGET_INSTANTIABLE_PREFIX));
GWA_INSTANTIABLE_PREFIX));
}
if (table->priv->name_entry)
......
......@@ -324,7 +324,7 @@ glade_editor_update_class_field (GladeEditor *editor)
*/
text = g_strdup_printf (_("%s Properties - %s [%s]"),
glade_widget_adaptor_get_title (priv->loaded_adaptor),
glade_widget_adaptor_get_name (priv->loaded_adaptor),
glade_widget_adaptor_get_display_name (priv->loaded_adaptor),
glade_widget_get_display_name (widget));
}
else
......@@ -334,7 +334,7 @@ glade_editor_update_class_field (GladeEditor *editor)
*/
text = g_strdup_printf (_("%s Properties - %s"),
glade_widget_adaptor_get_title (priv->loaded_adaptor),
glade_widget_adaptor_get_name (priv->loaded_adaptor));
glade_widget_adaptor_get_display_name (priv->loaded_adaptor));
}
gtk_label_set_text (GTK_LABEL (priv->class_label), text);
......@@ -772,7 +772,7 @@ glade_editor_query_dialog (GladeWidget *widget)
adaptor = glade_widget_get_adaptor (widget);
title = g_strdup_printf (_("Create a %s"), glade_widget_adaptor_get_name (adaptor));
title = g_strdup_printf (_("Create a %s"), glade_widget_adaptor_get_display_name (adaptor));
dialog = gtk_dialog_new_with_buttons (title, NULL,
GTK_DIALOG_MODAL |
GTK_DIALOG_DESTROY_WITH_PARENT,
......
......@@ -272,7 +272,7 @@ glade_palette_drag_begin (GtkWidget *widget,
{
_glade_dnd_set_icon_widget (context,
glade_widget_adaptor_get_icon_name (adaptor),
glade_widget_adaptor_get_name (adaptor));
glade_widget_adaptor_get_display_name (adaptor));
}
static void
......
......@@ -42,7 +42,7 @@ glade_popup_docs_cb (GtkMenuItem *item, GladeWidgetAdaptor *adaptor)
g_return_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor));
glade_app_search_docs (glade_widget_adaptor_get_book (adaptor),
glade_widget_adaptor_get_name (adaptor),
glade_widget_adaptor_get_display_name (adaptor),
NULL);
}
......
......@@ -33,16 +33,12 @@
G_BEGIN_DECLS
#define GLADE_WIDGET_INSTANTIABLE_PREFIX "GladeInstantiable"
#define GLADE_WIDGET_INSTANTIABLE_PREFIX_LEN 17
#define GWA_INSTANTIABLE_PREFIX_LEN 17
/* glade-widget.c */
GList *_glade_widget_peek_prop_refs (GladeWidget *widget);
/* glade-widget-adaptor.c */
G_CONST_RETURN gchar *_glade_widget_adaptor_get_real_name (GladeWidgetAdaptor *adaptor);
/* glade-catalog.c */
GladeCatalog *_glade_catalog_get_catalog (const gchar *name);
......
......@@ -1110,7 +1110,7 @@ glade_project_model_get_value (GtkTreeModel *model,
case GLADE_PROJECT_MODEL_COLUMN_TYPE_NAME:
{
GladeWidgetAdaptor *adaptor = glade_widget_get_adaptor (widget);
g_value_set_static_string (value, _glade_widget_adaptor_get_real_name (adaptor));
g_value_set_static_string (value, glade_widget_adaptor_get_display_name (adaptor));
break;
}
case GLADE_PROJECT_MODEL_COLUMN_OBJECT:
......
......@@ -629,7 +629,7 @@ glade_signal_editor_devhelp (GtkCellRenderer *cell,
search = g_strdup_printf ("The %s signal", glade_signal_get_name (signal));
glade_app_search_docs (book, glade_widget_adaptor_get_name (adaptor), search);
glade_app_search_docs (book, glade_widget_adaptor_get_display_name (adaptor), search);
g_free (search);
g_free (book);
......
......@@ -1787,13 +1787,19 @@ glade_widget_adaptor_get_name (GladeWidgetAdaptor *adaptor)
return adaptor->priv->name;
}
/**
* glade_widget_adaptor_get_display_name
* @adaptor: a #GladeWidgetAdaptor
*
* Returns the name of the adaptor without GWA_INSTANTIABLE_PREFIX
*/
G_CONST_RETURN gchar *
_glade_widget_adaptor_get_real_name (GladeWidgetAdaptor *adaptor)
glade_widget_adaptor_get_display_name (GladeWidgetAdaptor *adaptor)
{
g_return_val_if_fail (GLADE_IS_WIDGET_ADAPTOR (adaptor), NULL);
if (g_str_has_prefix (adaptor->priv->name, GLADE_WIDGET_INSTANTIABLE_PREFIX))
return &adaptor->priv->name[GLADE_WIDGET_INSTANTIABLE_PREFIX_LEN];
if (g_str_has_prefix (adaptor->priv->name, GWA_INSTANTIABLE_PREFIX))
return &adaptor->priv->name[GWA_INSTANTIABLE_PREFIX_LEN];
return adaptor->priv->name;
}
......
......@@ -176,6 +176,13 @@ typedef struct _GladeWidgetAdaptorClass GladeWidgetAdaptorClass;
#define GLADE_VALID_CREATE_REASON(reason) (reason >= 0 && reason < GLADE_CREATE_REASONS)
/**
* GWA_INSTANTIABLE_PREFIX:
*
* Class prefix used for abstract classes (ie GtkBin -> GladeInstantiableGtkBin)
*/
#define GWA_INSTANTIABLE_PREFIX "GladeInstantiable"
/**
* GladeCreateReason:
* @GLADE_CREATE_USER: Was created at the user's request
......@@ -735,6 +742,7 @@ GType glade_widget_adaptor_get_type (void) G_GNUC_CONST;
GType glade_widget_adaptor_get_object_type (GladeWidgetAdaptor *adaptor);
G_CONST_RETURN gchar *glade_widget_adaptor_get_name (GladeWidgetAdaptor *adaptor);
G_CONST_RETURN gchar *glade_widget_adaptor_get_generic_name (GladeWidgetAdaptor *adaptor);
G_CONST_RETURN gchar *glade_widget_adaptor_get_display_name (GladeWidgetAdaptor *adaptor);
G_CONST_RETURN gchar *glade_widget_adaptor_get_title (GladeWidgetAdaptor *adaptor);
G_CONST_RETURN gchar *glade_widget_adaptor_get_icon_name (GladeWidgetAdaptor *adaptor);
G_CONST_RETURN gchar *glade_widget_adaptor_get_missing_icon (GladeWidgetAdaptor *adaptor);
......
......@@ -947,7 +947,7 @@ glade_widget_constructor (GType type,
glade_widget_verify (gwidget);
if (g_str_has_prefix (glade_widget_adaptor_get_name (gwidget->priv->adaptor),
GLADE_WIDGET_INSTANTIABLE_PREFIX))
GWA_INSTANTIABLE_PREFIX))
glade_widget_set_is_composite (gwidget, TRUE);
return ret_obj;
......@@ -4078,7 +4078,7 @@ glade_widget_read (GladeProject *project,
/* Check if there is an instantiable version for this abstract class */
if (G_TYPE_IS_ABSTRACT (template_type))
{
gchar *instantiable = g_strconcat (GLADE_WIDGET_INSTANTIABLE_PREFIX,
gchar *instantiable = g_strconcat (GWA_INSTANTIABLE_PREFIX,
template_parent,
NULL);
if (glade_util_get_type_from_name (instantiable, FALSE))
......@@ -4363,7 +4363,7 @@ glade_widget_write (GladeWidget *widget,
glade_xml_node_set_property_string (widget_node,
GLADE_TAG_PARENT,
_glade_widget_adaptor_get_real_name (widget->priv->adaptor));
glade_widget_adaptor_get_display_name (widget->priv->adaptor));
}
else
{
......
......@@ -979,7 +979,7 @@ glade_gtk_widget_action_activate (GladeWidgetAdaptor * adaptor,
else if (strcmp (action_path, "read_documentation") == 0)
{
glade_app_search_docs (glade_widget_adaptor_get_book (adaptor),
glade_widget_adaptor_get_name (adaptor),
glade_widget_adaptor_get_display_name (adaptor),
NULL);
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment