[gtk+/wip/action-helper] gtkactionhelper: disable widgets with unknown action name
- From: Lars Uebernickel <larsu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/action-helper] gtkactionhelper: disable widgets with unknown action name
- Date: Thu, 16 Aug 2012 19:11:48 +0000 (UTC)
commit 6ab8e1ad5881db4a917761b851f0900e9a62a72c
Author: Lars Uebernickel <lars uebernickel canonical com>
Date: Sun Aug 12 23:10:54 2012 +0200
gtkactionhelper: disable widgets with unknown action name
gtk/gtkactionhelper.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkactionhelper.c b/gtk/gtkactionhelper.c
index eac1c62..f03f2f7 100644
--- a/gtk/gtkactionhelper.c
+++ b/gtk/gtkactionhelper.c
@@ -378,6 +378,21 @@ gtk_action_helper_new (GtkActionable *widget)
helper->widget = GTK_WIDGET (widget);
+ if (helper->widget)
+ {
+ GParamSpec *pspec;
+
+ helper->enabled = gtk_widget_get_sensitive (GTK_WIDGET (helper->widget));
+
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (helper->widget), "active");
+ if (pspec && G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_BOOLEAN)
+ g_object_get (G_OBJECT (helper->widget), "active", &helper->active, NULL);
+
+ pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (helper->widget), "action-role");
+ if (pspec && G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_UINT)
+ g_object_get (G_OBJECT (helper->widget), "action-role", &helper->role, NULL);
+ }
+
helper->action_context = _gtk_widget_get_action_muxer (GTK_WIDGET (widget));
return helper;
@@ -458,6 +473,10 @@ gtk_action_helper_set_action_name (GtkActionHelper *helper,
if (state)
g_variant_unref (state);
}
+ else
+ {
+ helper->enabled = FALSE;
+ }
/* Send the notifies for the properties that changed.
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]