From: Andrea Zagli Date: Wed, 25 Nov 2015 20:58:57 +0000 (+0100) Subject: Overrided parent class functions in ZakFormGtkFormElement. X-Git-Tag: v0.1.0~18 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=cec1f99ad7b1a6f23a542ab94652b27b5927a554;p=zakform%2Fgtk Overrided parent class functions in ZakFormGtkFormElement. --- diff --git a/src/formelement.c b/src/formelement.c index ed63121..997bc95 100644 --- a/src/formelement.c +++ b/src/formelement.c @@ -45,6 +45,12 @@ static void zak_form_gtk_form_element_get_property (GObject *object, static void zak_form_gtk_form_element_dispose (GObject *gobject); static void zak_form_gtk_form_element_finalize (GObject *gobject); +static gboolean zak_form_gtk_form_element_get_visible (ZakFormGtkFormElement *element); +static void zak_form_gtk_form_element_set_visible (ZakFormGtkFormElement *element, gboolean visible); + +static gboolean zak_form_gtk_form_element_get_editable (ZakFormGtkFormElement *element); +static void zak_form_gtk_form_element_set_editable (ZakFormGtkFormElement *element, gboolean visible); + #define ZAK_FORM_GTK_FORM_ELEMENT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ZAK_FORM_GTK_TYPE_FORM_ELEMENT, ZakFormGtkFormElementPrivate)) typedef struct _ZakFormGtkFormElementPrivate ZakFormGtkFormElementPrivate; @@ -62,12 +68,18 @@ static void zak_form_gtk_form_element_class_init (ZakFormGtkFormElementClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); + ZakFormElementClass *parent_class = ZAK_FORM_ELEMENT_CLASS (class); object_class->set_property = zak_form_gtk_form_element_set_property; object_class->get_property = zak_form_gtk_form_element_get_property; object_class->dispose = zak_form_gtk_form_element_dispose; object_class->finalize = zak_form_gtk_form_element_finalize; + parent_class->get_visible = zak_form_gtk_form_element_get_visible; + parent_class->set_visible = zak_form_gtk_form_element_set_visible; + parent_class->get_editable = zak_form_gtk_form_element_get_editable; + parent_class->set_editable = zak_form_gtk_form_element_set_editable; + g_type_class_add_private (object_class, sizeof (ZakFormGtkFormElementPrivate)); g_object_class_install_property (object_class, PROP_WIDGET, @@ -294,3 +306,40 @@ zak_form_gtk_form_element_finalize (GObject *gobject) GObjectClass *parent_class = g_type_class_peek_parent (G_OBJECT_GET_CLASS (gobject)); parent_class->finalize (gobject); } + +static gboolean +zak_form_gtk_form_element_get_visible (ZakFormGtkFormElement *element) +{ + ZakFormGtkFormElementPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_GET_PRIVATE (element); + + return gtk_widget_get_visible (priv->widget); +} + +static void +zak_form_gtk_form_element_set_visible (ZakFormGtkFormElement *element, gboolean visible) +{ + ZakFormGtkFormElementPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_GET_PRIVATE (element); + + gtk_widget_set_visible (priv->widget, visible); + + if (GTK_IS_WIDGET (priv->label)) + { + gtk_widget_set_visible (priv->label, visible); + } +} + +static gboolean +zak_form_gtk_form_element_get_editable (ZakFormGtkFormElement *element) +{ + ZakFormGtkFormElementPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_GET_PRIVATE (element); + + return gtk_widget_get_sensitive (priv->widget); +} + +static void +zak_form_gtk_form_element_set_editable (ZakFormGtkFormElement *element, gboolean editable) +{ + ZakFormGtkFormElementPrivate *priv = ZAK_FORM_GTK_FORM_ELEMENT_GET_PRIVATE (element); + + gtk_widget_set_sensitive (priv->widget, editable); +}