]> saetta.ns0.it Git - libgtkform/commitdiff
Added GtkForm::set_sensitive_by_name.
authorAndrea Zagli <azagli@libero.it>
Tue, 1 Sep 2009 13:50:40 +0000 (15:50 +0200)
committerAndrea Zagli <azagli@libero.it>
Tue, 1 Sep 2009 13:50:40 +0000 (15:50 +0200)
src/form.c
src/form.h

index f6faca15c2d28fcccca10542e3d1a095c3f17327..646e057900bafe124dcc5f0ca0bc24153b0b37a3 100644 (file)
@@ -929,7 +929,7 @@ gtk_form_is_changed (GtkForm *form)
 /**
  * gtk_form_set_sensitive:
  * @form: a #GtkForm object.
- * @sensitive: whether to set every #GtkForm's widget sensitive or not.
+ * @sensitive: whether to set every #GtkFormWidget's sensitive or not.
  *
  */
 void
@@ -953,10 +953,51 @@ gtk_form_set_sensitive (GtkForm *form, gboolean sensitive)
                }
 }
 
+/**
+ * gtk_form_set_sensitive_by_name:
+ * @form: a #GtkForm object.
+ * @sensitive: whether to set #GtkWidget's sensitive or not.
+ * @...:
+ *
+ */
+void
+gtk_form_set_sensitive_by_name (GtkForm *form, gboolean sensitive, ...)
+{
+       GtkFormPrivate *priv;
+
+       va_list vargs;
+       gchar *object_name;
+
+       GObject *object;
+
+       g_return_val_if_fail (IS_GTK_FORM (form), NULL);
+
+       priv = GTK_FORM_GET_PRIVATE (form);
+
+       g_return_val_if_fail (GTK_IS_BUILDER (priv->gtkbuilder), NULL);
+
+       va_start (vargs, form);
+
+       while ((object_name = va_arg (vargs, gchar *)) != NULL)
+               {
+                       object = gtk_builder_get_object (priv->gtkbuilder, object_name);
+                       if (GTK_IS_WIDGET (object))
+                               {
+                                       gtk_widget_set_sensitive (GTK_WIDGET (object), sensitive);
+                               }
+                       else
+                               {
+                                       g_warning ("Object «%s» not found.", object_name);
+                               }
+               }
+
+       va_end (vargs);
+}
+
 /**
  * gtk_form_set_editable:
  * @form: a #GtkForm object.
- * @editable: whether to set every #GtkForm's widget editable or not.
+ * @editable: whether to set every #GtkFormWidget's editable or not.
  *
  */
 void
index 63b632068466f8b33deabad447a4b031ddc006ba..31d63e306a958e8dfbdad14168f486875dabcaf8 100644 (file)
@@ -87,6 +87,8 @@ gboolean gtk_form_check (GtkForm *form, gboolean with_key,
 gboolean gtk_form_is_changed (GtkForm *form);
 
 void gtk_form_set_sensitive (GtkForm *form, gboolean sensitive);
+void gtk_form_set_sensitive_by_name (GtkForm *form, gboolean sensitive, ...);
+
 void gtk_form_set_editable (GtkForm *form, gboolean editable);
 
 typedef enum