+2006-01-07 Matthias Clasen <mclasen@redhat.com>
+
+ Fix actiongroup-action interaction that relied on
+ actions connecting to notify on themselves:
+
+ * gtk/gtkaction.[hc]: Factor out the code updating the
+ visibility/sensitivity of proxies into _gtk_action_sync_visible()
+ and _gtk_action_sync_sensible().
+
+ * gtk/gtkactiongroup.c: Call the new functions when the
+ group visibility/sensitivity changes.
+
2006-01-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkactiongroup.c (gtk_action_group_set_sensitive)
+2006-01-07 Matthias Clasen <mclasen@redhat.com>
+
+ Fix actiongroup-action interaction that relied on
+ actions connecting to notify on themselves:
+
+ * gtk/gtkaction.[hc]: Factor out the code updating the
+ visibility/sensitivity of proxies into _gtk_action_sync_visible()
+ and _gtk_action_sync_sensible().
+
+ * gtk/gtkactiongroup.c: Call the new functions when the
+ group visibility/sensitivity changes.
+
2006-01-06 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkactiongroup.c (gtk_action_group_set_sensitive)
g_return_if_fail (GTK_IS_MENU_ITEM (proxy));
g_return_if_fail (action == NULL || GTK_IS_ACTION (action));
-
+
if (action == NULL)
action = g_object_get_qdata (G_OBJECT (proxy), quark_gtk_action_proxy);
return action->private_data->sensitive;
}
+void
+_gtk_action_sync_sensitive (GtkAction *action)
+{
+ GSList *p;
+ GtkWidget *proxy;
+ gboolean sensitive;
+
+ sensitive = gtk_action_is_sensitive (action);
+
+ for (p = action->private_data->proxies; p; p = p->next)
+ {
+ proxy = (GtkWidget *)p->data;
+ gtk_widget_set_sensitive (proxy, sensitive);
+ }
+}
+
/**
* gtk_action_set_sensitive:
* @action: the action object
gtk_action_set_sensitive (GtkAction *action,
gboolean sensitive)
{
- GSList *p;
- GtkWidget *proxy;
-
g_return_if_fail (GTK_IS_ACTION (action));
sensitive = sensitive != FALSE;
{
action->private_data->sensitive = sensitive;
- for (p = action->private_data->proxies; p; p = p->next)
- {
- proxy = (GtkWidget *)p->data;
- gtk_widget_set_sensitive (proxy, sensitive);
- }
-
+ _gtk_action_sync_sensitive (action);
+
g_object_notify (G_OBJECT (action), "sensitive");
}
}
return action->private_data->visible;
}
+void
+_gtk_action_sync_visible (GtkAction *action)
+{
+ GSList *p;
+ GtkWidget *proxy;
+ GtkWidget *menu;
+ gboolean visible;
+
+ visible = gtk_action_is_visible (action);
+
+ for (p = action->private_data->proxies; p; p = p->next)
+ {
+ proxy = (GtkWidget *)p->data;
+
+ if (GTK_IS_MENU_ITEM (proxy))
+ {
+ menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy));
+
+ _gtk_action_sync_menu_visible (action, proxy, _gtk_menu_is_empty (menu));
+ }
+ else
+ {
+ if (visible)
+ gtk_widget_show (proxy);
+ else
+ gtk_widget_hide (proxy);
+ }
+ }
+}
+
/**
* gtk_action_set_visible:
* @action: the action object
gtk_action_set_visible (GtkAction *action,
gboolean visible)
{
- GSList *p;
- GtkWidget *proxy;
-
g_return_if_fail (GTK_IS_ACTION (action));
visible = visible != FALSE;
{
action->private_data->visible = visible;
- for (p = action->private_data->proxies; p; p = p->next)
- {
- proxy = (GtkWidget *)p->data;
+ _gtk_action_sync_visible (action);
- if (GTK_IS_MENU_ITEM (proxy))
- {
- GtkWidget *menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy));
-
- _gtk_action_sync_menu_visible (action, proxy, _gtk_menu_is_empty (menu));
- }
- else
- {
- if (visible)
- gtk_widget_show (proxy);
- else
- gtk_widget_hide (proxy);
- }
- }
-
g_object_notify (G_OBJECT (action), "visible");
}
}
cb_set_action_sensitivity (const gchar *name,
GtkAction *action)
{
- /* Minor optimization, the action_groups state only affects actions that are
- * themselves sensitive */
+ /* Minor optimization, the action_groups state only affects actions
+ * that are themselves sensitive */
if (gtk_action_get_sensitive (action))
- g_object_notify (G_OBJECT (action), "sensitive");
+ _gtk_action_sync_sensitive (action);
}
/**
cb_set_action_visiblity (const gchar *name,
GtkAction *action)
{
- /* Minor optimization, the action_groups state only affects actions that are
- * themselves sensitive */
+ /* Minor optimization, the action_groups state only affects actions
+ * that are themselves visible */
if (gtk_action_get_visible (action))
- g_object_notify (G_OBJECT (action), "visible");
+ _gtk_action_sync_visible (action);
}
/**