[glade/glade-3-14] Fixed bug in GtkButton custom editor properties sensitivity bug #685816 "Widget attributes editing b
- From: Juan Pablo Ugarte <jpu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glade/glade-3-14] Fixed bug in GtkButton custom editor properties sensitivity bug #685816 "Widget attributes editing b
- Date: Sun, 14 Oct 2012 23:55:59 +0000 (UTC)
commit 1cf2c6beb2ba328d5a006ee7a6ddd1c800e324ec
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date: Sat Oct 13 12:00:05 2012 -0300
Fixed bug in GtkButton custom editor properties sensitivity
bug #685816 "Widget attributes editing broken"
plugins/gtk+/glade-gtk-activatable.c | 87 ++++++++++++++++++---------------
1 files changed, 47 insertions(+), 40 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-activatable.c b/plugins/gtk+/glade-gtk-activatable.c
index 31d538f..7cf9bf5 100644
--- a/plugins/gtk+/glade-gtk-activatable.c
+++ b/plugins/gtk+/glade-gtk-activatable.c
@@ -26,58 +26,65 @@
#include "glade-gtk-activatable.h"
/* ----------------------------- GtkActivatable ------------------------------ */
+static void
+update_use_action_appearance (GladeWidget *gwidget,
+ gboolean related_action,
+ gboolean use_appearance)
+{
+ gboolean sensitivity;
+ gchar *msg;
+
+ if (use_appearance)
+ {
+ sensitivity = FALSE;
+ msg = ACTION_APPEARANCE_MSG;
+ }
+ else
+ {
+ sensitivity = TRUE;
+ msg = NULL;
+ }
+
+ glade_widget_property_set_sensitive (gwidget, "label", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "use-underline", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "stock", sensitivity, msg);
+ //glade_widget_property_set_sensitive (gwidget, "use-stock", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "image", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "image-position", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "custom-child", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "stock-id", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "label-widget", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "icon-name", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "icon-widget", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "icon", sensitivity, msg);
+
+ if (related_action)
+ {
+ glade_widget_property_set_sensitive (gwidget, "visible", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "sensitive", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "accel-group", sensitivity, msg);
+ glade_widget_property_set_sensitive (gwidget, "use-action-appearance",
+ !sensitivity, sensitivity ? msg : NULL);
+ }
+}
+
void
glade_gtk_activatable_evaluate_property_sensitivity (GObject *object,
const gchar *id,
const GValue *value)
{
GladeWidget *gwidget = glade_widget_get_from_gobject (object);
- gboolean sensitivity;
- gchar *msg;
if (!strcmp (id, "related-action"))
{
- GtkAction *action = g_value_get_object (value);
-
- if (action)
- {
- sensitivity = FALSE;
- msg = ACTION_APPEARANCE_MSG;
- }
- else
- {
- sensitivity = TRUE;
- msg = NULL;
- }
-
- glade_widget_property_set_sensitive (gwidget, "visible", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "sensitive", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "accel-group", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "use-action-appearance", !sensitivity, sensitivity ? msg : NULL);
+ update_use_action_appearance (gwidget, TRUE,
+ g_value_get_object (value) != NULL);
}
else if (!strcmp (id, "use-action-appearance"))
{
- if (g_value_get_boolean (value))
- {
- sensitivity = FALSE;
- msg = ACTION_APPEARANCE_MSG;
- }
- else
- {
- sensitivity = TRUE;
- msg = NULL;
- }
+ GtkAction *action = gtk_activatable_get_related_action (GTK_ACTIVATABLE (object));
+ gboolean use_appearance = g_value_get_boolean (value);
- glade_widget_property_set_sensitive (gwidget, "label", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "use-underline", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "stock", sensitivity, msg);
- //glade_widget_property_set_sensitive (gwidget, "use-stock", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "image", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "custom-child", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "stock-id", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "label-widget", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "icon-name", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "icon-widget", sensitivity, msg);
- glade_widget_property_set_sensitive (gwidget, "icon", sensitivity, msg);
+ update_use_action_appearance (gwidget, FALSE, action && use_appearance);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]