]> saetta.ns0.it Git - zakform/gtk/commitdiff
Overrided parent class functions in ZakFormGtkFormElement.
authorAndrea Zagli <azagli@libero.it>
Wed, 25 Nov 2015 20:58:57 +0000 (21:58 +0100)
committerAndrea Zagli <azagli@libero.it>
Wed, 25 Nov 2015 20:58:57 +0000 (21:58 +0100)
src/formelement.c

index ed6312177500bc8a5d79e9c8a0549c5f35fc4743..997bc95683d8e964a23997939ea96cb57b299cd0 100644 (file)
@@ -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);
+}