[glade] GladePropertyLabel: Added an option to append the ':' colon to the property name
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade] GladePropertyLabel: Added an option to append the ':' colon to the property name
- Date: Sun, 14 Apr 2013 09:40:08 +0000 (UTC)
commit 3be34fa3ce8c9a6df8d50c1bbac2bd5fc97fbc6e
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date: Sun Apr 14 17:55:48 2013 +0900
GladePropertyLabel: Added an option to append the ':' colon to the property name
Now we don't do it by default, allowing the check button property editor
to use no colon appended.
gladeui/glade-property-label.c | 56 +++++++++++++++++++++++++++++++++++++++---
gladeui/glade-property-label.h | 3 +++
2 files changed, 56 insertions(+), 3 deletions(-)
---
diff --git a/gladeui/glade-property-label.c b/gladeui/glade-property-label.c
index 0522a42..268d4ab 100644
--- a/gladeui/glade-property-label.c
+++ b/gladeui/glade-property-label.c
@@ -68,12 +68,14 @@ struct _GladePropertyLabelPrivate
guint packing : 1;
guint custom_text : 1;
guint custom_tooltip : 1;
+ guint append_colon : 1;
};
enum {
PROP_0,
PROP_PROPERTY,
PROP_PROPERTY_NAME,
+ PROP_APPEND_COLON,
PROP_PACKING,
PROP_CUSTOM_TEXT,
PROP_CUSTOM_TOOLTIP,
@@ -93,8 +95,10 @@ glade_property_label_init (GladePropertyLabel *label)
GLADE_TYPE_PROPERTY_LABEL,
GladePropertyLabelPrivate);
+ label->priv->packing = FALSE;
label->priv->custom_text = FALSE;
label->priv->custom_tooltip = FALSE;
+ label->priv->append_colon = TRUE;
gtk_widget_init_template (GTK_WIDGET (label));
}
@@ -125,6 +129,12 @@ glade_property_label_class_init (GladePropertyLabelClass *class)
NULL, G_PARAM_READWRITE));
g_object_class_install_property
+ (gobject_class, PROP_APPEND_COLON,
+ g_param_spec_boolean ("append-colon", _("Append Colon"),
+ _("Whether to append a colon ':' to the property name"),
+ TRUE, G_PARAM_READWRITE));
+
+ g_object_class_install_property
(gobject_class, PROP_PACKING,
g_param_spec_boolean ("packing", _("Packing"),
_("Whether the property to load is a packing property or not"),
@@ -191,6 +201,9 @@ glade_property_label_set_real_property (GObject *object,
case PROP_PROPERTY_NAME:
glade_property_label_set_property_name (label, g_value_get_string (value));
break;
+ case PROP_APPEND_COLON:
+ glade_property_label_set_append_colon (label, g_value_get_boolean (value));
+ break;
case PROP_PACKING:
glade_property_label_set_packing (label, g_value_get_boolean (value));
break;
@@ -225,6 +238,9 @@ glade_property_label_get_real_property (GObject *object,
case PROP_PACKING:
g_value_set_boolean (value, glade_property_label_get_packing (label));
break;
+ case PROP_APPEND_COLON:
+ g_value_set_boolean (value, glade_property_label_get_append_colon (label));
+ break;
case PROP_CUSTOM_TEXT:
g_value_set_string (value, glade_property_label_get_custom_text (label));
break;
@@ -429,6 +445,32 @@ glade_property_label_get_property_name (GladePropertyLabel *label)
}
void
+glade_property_label_set_append_colon (GladePropertyLabel *label,
+ gboolean append_colon)
+{
+ GladePropertyLabelPrivate *priv;
+
+ g_return_if_fail (GLADE_IS_PROPERTY_LABEL (label));
+
+ priv = label->priv;
+
+ if (priv->append_colon != append_colon)
+ {
+ priv->append_colon = append_colon;
+
+ g_object_notify (G_OBJECT (label), "append-colon");
+ }
+}
+
+gboolean
+glade_property_label_get_append_colon (GladePropertyLabel *label)
+{
+ g_return_val_if_fail (GLADE_IS_PROPERTY_LABEL (label), FALSE);
+
+ return label->priv->append_colon;
+}
+
+void
glade_property_label_set_packing (GladePropertyLabel *label,
gboolean packing)
{
@@ -643,9 +685,17 @@ glade_property_label_set_property (GladePropertyLabel *label,
if (!priv->custom_text)
{
- gchar *text = g_strdup_printf ("%s:", glade_property_class_get_name (pclass));
- gtk_label_set_text (GTK_LABEL (priv->label), text);
- g_free (text);
+ if (priv->append_colon)
+ {
+ gchar *text = g_strdup_printf ("%s:", glade_property_class_get_name (pclass));
+ gtk_label_set_text (GTK_LABEL (priv->label), text);
+ g_free (text);
+ }
+ else
+ {
+ gtk_label_set_text (GTK_LABEL (priv->label),
+ glade_property_class_get_name (pclass));
+ }
}
}
diff --git a/gladeui/glade-property-label.h b/gladeui/glade-property-label.h
index 04ab2f2..09b786c 100644
--- a/gladeui/glade-property-label.h
+++ b/gladeui/glade-property-label.h
@@ -59,6 +59,9 @@ GtkWidget *glade_property_label_new (void);
void glade_property_label_set_property_name (GladePropertyLabel *label,
const gchar *property_name);
const gchar *glade_property_label_get_property_name (GladePropertyLabel *label);
+void glade_property_label_set_append_colon (GladePropertyLabel *label,
+ gboolean append_colon);
+gboolean glade_property_label_get_append_colon (GladePropertyLabel *label);
void glade_property_label_set_packing (GladePropertyLabel *label,
gboolean packing);
gboolean glade_property_label_get_packing (GladePropertyLabel *label);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]