Commit ab0b1d40 authored by Juan Pablo Ugarte's avatar Juan Pablo Ugarte
Browse files

Fixed bug in GtkButton custom editor properties sensitivity

bug #685816 "Widget attributes editing broken"
parent d56c804f
......@@ -26,58 +26,67 @@
#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"))
{
gboolean use_appearance = gtk_activatable_get_use_action_appearance (GTK_ACTIVATABLE (object));
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, action);
}
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);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment