Commit 174a98bd authored by Tristan Van Berkom's avatar Tristan Van Berkom

Adding convenience funcs that help with debugging property values in


	* gladeui/glade-widget.[ch]: Adding convenience funcs that help with
	  debugging property values in plugins: glade_widget_property_string(),
	  glade_widget_pack_property_string().

	* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Reset label/markup/use-underline 
	  properties at realize time, this fixes load time glitches with markup 
	  and mnemonics (bug 396446).


svn path=/trunk/; revision=1500
parent 659dd595
2006-07-23 Tristan Van Berkom <tvb@gnome.org>
* gladeui/glade-widget.[ch]: Adding convenience funcs that help with
debugging property values in plugins: glade_widget_property_string(),
glade_widget_pack_property_string().
* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Reset label/markup/use-underline
properties at realize time, this fixes load time glitches with markup
and mnemonics (bug 396446).
2007-07-20 Vincent Geddes <vgeddes@gnome.org>
* gladeui/glade-design-layout.c:
......
......@@ -98,8 +98,6 @@ and undo those items; each #GladeProject has its own Undo/Redo stack.
</para>
@widgets:
@return_placeholders:
@Returns:
<!-- ##### STRUCT GCSetPropData ##### -->
......
......@@ -2724,6 +2724,7 @@ glade_widget_property_get (GladeWidget *widget,
va_list vl;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
{
......@@ -2754,6 +2755,7 @@ glade_widget_property_set (GladeWidget *widget,
va_list vl;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
{
......@@ -2784,6 +2786,7 @@ glade_widget_pack_property_get (GladeWidget *widget,
va_list vl;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
{
......@@ -2814,6 +2817,7 @@ glade_widget_pack_property_set (GladeWidget *widget,
va_list vl;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
{
......@@ -2846,6 +2850,7 @@ glade_widget_property_set_sensitive (GladeWidget *widget,
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
{
......@@ -2876,6 +2881,7 @@ glade_widget_pack_property_set_sensitive (GladeWidget *widget,
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
{
......@@ -2905,6 +2911,7 @@ glade_widget_property_set_enabled (GladeWidget *widget,
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
{
......@@ -2933,6 +2940,7 @@ glade_widget_pack_property_set_enabled (GladeWidget *widget,
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
{
......@@ -2964,6 +2972,7 @@ glade_widget_property_set_save_always (GladeWidget *widget,
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
{
......@@ -2995,6 +3004,7 @@ glade_widget_pack_property_set_save_always (GladeWidget *widget,
GladeProperty *property;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), FALSE);
g_return_val_if_fail (id_property != NULL, FALSE);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
{
......@@ -3004,6 +3014,69 @@ glade_widget_pack_property_set_save_always (GladeWidget *widget,
return FALSE;
}
/**
* glade_widget_property_string:
* @widget: a #GladeWidget
* @id_property: a string naming a #GladeProperty
* @value: the #GValue to print or %NULL
*
* Creates a printable string representing @id_property in
* @widget, if @value is specified it will be used in place
* of @id_property's real value (this is a convinience
* function to print/debug properties usually from plugin
* backends).
*
* Returns: A newly allocated string representing @id_property
*/
gchar *
glade_widget_property_string (GladeWidget *widget,
const gchar *id_property,
const GValue *value)
{
GladeProperty *property;
gchar *ret_string = NULL;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (id_property != NULL, NULL);
if ((property = glade_widget_get_property (widget, id_property)) != NULL)
ret_string =
glade_property_class_make_string_from_gvalue (property->klass,
value ? value : property->value);
return ret_string;
}
/**
* glade_widget_pack_property_string:
* @widget: a #GladeWidget
* @id_property: a string naming a #GladeProperty
* @value: the #GValue to print or %NULL
*
* Same as glade_widget_property_string() but for packing
* properties.
*
* Returns: A newly allocated string representing @id_property
*/
gchar *
glade_widget_pack_property_string (GladeWidget *widget,
const gchar *id_property,
const GValue *value)
{
GladeProperty *property;
gchar *ret_string = NULL;
g_return_val_if_fail (GLADE_IS_WIDGET (widget), NULL);
g_return_val_if_fail (id_property != NULL, NULL);
if ((property = glade_widget_get_pack_property (widget, id_property)) != NULL)
ret_string =
glade_property_class_make_string_from_gvalue (property->klass,
value ? value : property->value);
return ret_string;
}
/**
* glade_widget_property_reset:
......
......@@ -316,6 +316,15 @@ gboolean glade_widget_pack_property_set_save_always (GladeWidget
const gchar *id_property,
gboolean setting);
gchar *glade_widget_property_string (GladeWidget *widget,
const gchar *id_property,
const GValue *value);
gchar *glade_widget_pack_property_string (GladeWidget *widget,
const gchar *id_property,
const GValue *value);
/*******************************************************************************
Accessors
*******************************************************************************/
......
......@@ -5753,7 +5753,7 @@ glade_gtk_label_set_label (GObject *object, const GValue *value)
{
GladeWidget *glabel;
gboolean use_markup = FALSE, use_underline = FALSE;
g_return_if_fail (GTK_IS_LABEL (object));
glabel = glade_widget_get_from_gobject (object);
g_return_if_fail (GLADE_IS_WIDGET (glabel));
......@@ -5770,6 +5770,29 @@ glade_gtk_label_set_label (GObject *object, const GValue *value)
gtk_label_set_use_underline (GTK_LABEL (object), use_underline);
}
static void
ensure_label_props (GObject *label,
GladeWidgetAdaptor *adaptor)
{
GladeWidget *gwidget = glade_widget_get_from_gobject (label);
GladeProperty *prop = glade_widget_get_property (gwidget, "label");
glade_gtk_label_set_label (label, prop->value);
}
void
glade_gtk_label_post_create (GladeWidgetAdaptor *adaptor,
GObject *object,
GladeCreateReason reason)
{
/* For some reason labels dont show up with markup
* and mnemonic underlines in the runtime at load time,
* resetting them at realize time fixes this glitch.
*/
g_signal_connect_after (G_OBJECT (object), "realize",
G_CALLBACK (ensure_label_props), adaptor);
}
void
glade_gtk_label_set_property (GladeWidgetAdaptor *adaptor,
GObject *object,
......
......@@ -549,6 +549,7 @@ embedded in another object</_tooltip>
</glade-widget-class>
<glade-widget-class name="GtkLabel" generic-name="label" _title="Label">
<post-create-function>glade_gtk_label_post_create</post-create-function>
<set-property-function>glade_gtk_label_set_property</set-property-function>
<properties>
......
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