summaryrefslogtreecommitdiff
path: root/gladeui
diff options
context:
space:
mode:
authorTristan Van Berkom <tvb@src.gnome.org>2007-07-23 14:59:18 +0000
committerTristan Van Berkom <tvb@src.gnome.org>2007-07-23 14:59:18 +0000
commit174a98bdf562bff813a646dde7e9e2d06d9902e7 (patch)
tree14e1b0c507dfd095d06b1a91d2b74bddb8c26eac /gladeui
parent659dd595208cf81d27c7bbe8c7b5105fd48b97ce (diff)
downloadglade-174a98bdf562bff813a646dde7e9e2d06d9902e7.tar.gz
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
Diffstat (limited to 'gladeui')
-rw-r--r--gladeui/glade-widget.c73
-rw-r--r--gladeui/glade-widget.h9
2 files changed, 82 insertions, 0 deletions
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 7ebbe98d..b7ed8cd1 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -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:
diff --git a/gladeui/glade-widget.h b/gladeui/glade-widget.h
index 9d2f1a04..57b206b4 100644
--- a/gladeui/glade-widget.h
+++ b/gladeui/glade-widget.h
@@ -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
*******************************************************************************/