Commit c73ab06e authored by Jody Goldberg's avatar Jody Goldberg Committed by Matthias Clasen

Adjust to the new connect_proxy signals.

Mon Jan 12 23:40:34 2004  Matthias Clasen  <maclas@gmx.de>

	* tests/testmerge.c: Adjust to the new connect_proxy signals.

	* gtk/gtkuimanager.c
	* gtk/gtkactiongroup.c
	* gtk/gtkaction.c: Move the connect_proxy and disconnect_proxy signals
	from GtkAction to GtkActionGroup and proxy it on GtkUIManager. This
	removes the confusion between the disconnect_/connect_proxy signals
	and the (unrelated) virtual functions of the same name and aligns
	the setup with the pre_/post_activate signals.

2004-01-12  Jody Goldberg <jody@gnome.org>

	* gtk/gtkaction.c (connect_proxy) : only connect activate for menus
	  with no submenus otherwise it looks like we activate every time a
	  submenu opens.

2004-01-10  Jody Goldberg <jody@gnome.org>

	* gtk/gtkuimanager.c (d) : Add a debug macro to quiet the spew.
	s/merge_signals/ui_manager_signals/ for readability.
	(gtk_ui_manager_class_init) : add pre_activate and post_activate
	  signals.
	(cb_proxy_pre_activate) : new.
	(cb_proxy_post_activate) : new.
	(gtk_ui_manager_insert_action_group) : connect the proxies for
	  GtkActionGroup::pre/post_activate
	(gtk_ui_manager_remove_action_group) : disconnect them.

	* gtk/gtkactiongroup.c (gtk_action_group_class_init) : add
	  'sensitive', and 'visible' properties.  Also add pre_activate and
	  post_activate signals to help deal with activations at a higher
	  level (eg GtkUIManager)
	(gtk_action_group_init) : init sensitive and visible
	(gtk_action_group_set_property) : add sensitive and visible
	(gtk_action_group_get_property) : add sensitive and visible
	(gtk_action_group_get_sensitive) : new.
	(gtk_action_group_get_visible) : new.
	(cb_set_action_sensitivity) : new with minor optimization that only
	  signals sensitivity changes if the action could possibly change.
	(cb_set_action_visiblility) : ditto.
	(gtk_action_group_set_sensitive) : new.  walk the actions directly
	  rather than using notify::sensitive because that is simpler, easier
	  to read, and more efficient.
	(gtk_action_group_set_visible) : ditto.
	(gtk_action_group_add_action) : Each action can only be in 1 group,
	  set GtkAction::action_group.
	(gtk_action_group_remove_action) : clear it.
	(gtk_action_group_add_toggle_actions_full) : warning suppression.
	(gtk_action_group_add_radio_actions_full) : warning suppression.
	(_gtk_action_group_emit_pre_activate) : new protected routine for use
	  by GtkAction.
	(_gtk_action_group_emit_post_activate) : ditto.

	* gtk/gtkaction.c (gtk_action_class_init) : add 'action_group' property.
	(gtk_action_init) : initialize it.
	(gtk_action_get_property) : get.
	(gtk_action_set_property) : set it via
	(gtk_action_set_action_group) : new function.
	(gtk_action_sync_sensitivity) : new routine to sync proxy sensitivity
	  with the logical sensitivity (action & group) rather than the simple
	  action::sensitivity.
	(gtk_action_sync_visible) : use gtk_action_is_visible to handle
	  logical visibility (action & group) rather than the simple
	  action::visible.  Use widget show/hide directly.
	(connect_proxy) : handle the custom sensitivity handler.
	  Make the TOOL_BUTTON signals more general and support TOOL_ITEM
	  directly, with special cases for TOOL_BUTTON.  Still not especially
	  good it might be useful to handle label/use_underline by parmspec
	  lookup.  Those are likely to be implemented by custom types, and are
	  assumed to exist in GtkToolItem.
	(disconnect_proxy) : disconnect the new sensitivity handler.
	(_gtk_action_emit_activate) : add pre/post signals.
	(gtk_action_activate) : use logical sensitivity.
	(gtk_action_is_sensitive) : logical sensitivity.
	(gtk_action_get_sensitive) : actual sensitivity.
	(closure_accel_activate) : use logical sensitivity.
parent 93bc689c
Mon Jan 12 00:10:20 2004 Matthias Clasen <maclas@gmx.de>
Mon Jan 12 23:40:34 2004 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c: Adjust to the new connect_proxy signals.
* gtk/gtkuimanager.c
* gtk/gtkactiongroup.c
* gtk/gtkaction.c: Move the connect_proxy and disconnect_proxy signals
from GtkAction to GtkActionGroup and proxy it on GtkUIManager. This
removes the confusion between the disconnect_/connect_proxy signals
and the (unrelated) virtual functions of the same name and aligns
the setup with the pre_/post_activate signals.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkaction.c (connect_proxy) : only connect activate for menus
with no submenus otherwise it looks like we activate every time a
submenu opens.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c: Remove accidentially committed debug spew.
......@@ -10,6 +28,67 @@ Sun Jan 11 01:55:07 2004 Matthias Clasen <maclas@gmx.de>
entry is silently created during lock_path(), and treated as an error
during unlock_path(). These changes have been requested by Tim Janik.
2004-01-10 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c (d) : Add a debug macro to quiet the spew.
s/merge_signals/ui_manager_signals/ for readability.
(gtk_ui_manager_class_init) : add pre_activate and post_activate
signals.
(cb_proxy_pre_activate) : new.
(cb_proxy_post_activate) : new.
(gtk_ui_manager_insert_action_group) : connect the proxies for
GtkActionGroup::pre/post_activate
(gtk_ui_manager_remove_action_group) : disconnect them.
* gtk/gtkactiongroup.c (gtk_action_group_class_init) : add
'sensitive', and 'visible' properties. Also add pre_activate and
post_activate signals to help deal with activations at a higher
level (eg GtkUIManager)
(gtk_action_group_init) : init sensitive and visible
(gtk_action_group_set_property) : add sensitive and visible
(gtk_action_group_get_property) : add sensitive and visible
(gtk_action_group_get_sensitive) : new.
(gtk_action_group_get_visible) : new.
(cb_set_action_sensitivity) : new with minor optimization that only
signals sensitivity changes if the action could possibly change.
(cb_set_action_visiblility) : ditto.
(gtk_action_group_set_sensitive) : new. walk the actions directly
rather than using notify::sensitive because that is simpler, easier
to read, and more efficient.
(gtk_action_group_set_visible) : ditto.
(gtk_action_group_add_action) : Each action can only be in 1 group,
set GtkAction::action_group.
(gtk_action_group_remove_action) : clear it.
(gtk_action_group_add_toggle_actions_full) : warning suppression.
(gtk_action_group_add_radio_actions_full) : warning suppression.
(_gtk_action_group_emit_pre_activate) : new protected routine for use
by GtkAction.
(_gtk_action_group_emit_post_activate) : ditto.
* gtk/gtkaction.c (gtk_action_class_init) : add 'action_group' property.
(gtk_action_init) : initialize it.
(gtk_action_get_property) : get.
(gtk_action_set_property) : set it via
(gtk_action_set_action_group) : new function.
(gtk_action_sync_sensitivity) : new routine to sync proxy sensitivity
with the logical sensitivity (action & group) rather than the simple
action::sensitivity.
(gtk_action_sync_visible) : use gtk_action_is_visible to handle
logical visibility (action & group) rather than the simple
action::visible. Use widget show/hide directly.
(connect_proxy) : handle the custom sensitivity handler.
Make the TOOL_BUTTON signals more general and support TOOL_ITEM
directly, with special cases for TOOL_BUTTON. Still not especially
good it might be useful to handle label/use_underline by parmspec
lookup. Those are likely to be implemented by custom types, and are
assumed to exist in GtkToolItem.
(disconnect_proxy) : disconnect the new sensitivity handler.
(_gtk_action_emit_activate) : add pre/post signals.
(gtk_action_activate) : use logical sensitivity.
(gtk_action_is_sensitive) : logical sensitivity.
(gtk_action_get_sensitive) : actual sensitivity.
(closure_accel_activate) : use logical sensitivity.
Fri Jan 9 22:23:45 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Introduce a new parser state for
......
Mon Jan 12 00:10:20 2004 Matthias Clasen <maclas@gmx.de>
Mon Jan 12 23:40:34 2004 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c: Adjust to the new connect_proxy signals.
* gtk/gtkuimanager.c
* gtk/gtkactiongroup.c
* gtk/gtkaction.c: Move the connect_proxy and disconnect_proxy signals
from GtkAction to GtkActionGroup and proxy it on GtkUIManager. This
removes the confusion between the disconnect_/connect_proxy signals
and the (unrelated) virtual functions of the same name and aligns
the setup with the pre_/post_activate signals.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkaction.c (connect_proxy) : only connect activate for menus
with no submenus otherwise it looks like we activate every time a
submenu opens.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c: Remove accidentially committed debug spew.
......@@ -10,6 +28,67 @@ Sun Jan 11 01:55:07 2004 Matthias Clasen <maclas@gmx.de>
entry is silently created during lock_path(), and treated as an error
during unlock_path(). These changes have been requested by Tim Janik.
2004-01-10 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c (d) : Add a debug macro to quiet the spew.
s/merge_signals/ui_manager_signals/ for readability.
(gtk_ui_manager_class_init) : add pre_activate and post_activate
signals.
(cb_proxy_pre_activate) : new.
(cb_proxy_post_activate) : new.
(gtk_ui_manager_insert_action_group) : connect the proxies for
GtkActionGroup::pre/post_activate
(gtk_ui_manager_remove_action_group) : disconnect them.
* gtk/gtkactiongroup.c (gtk_action_group_class_init) : add
'sensitive', and 'visible' properties. Also add pre_activate and
post_activate signals to help deal with activations at a higher
level (eg GtkUIManager)
(gtk_action_group_init) : init sensitive and visible
(gtk_action_group_set_property) : add sensitive and visible
(gtk_action_group_get_property) : add sensitive and visible
(gtk_action_group_get_sensitive) : new.
(gtk_action_group_get_visible) : new.
(cb_set_action_sensitivity) : new with minor optimization that only
signals sensitivity changes if the action could possibly change.
(cb_set_action_visiblility) : ditto.
(gtk_action_group_set_sensitive) : new. walk the actions directly
rather than using notify::sensitive because that is simpler, easier
to read, and more efficient.
(gtk_action_group_set_visible) : ditto.
(gtk_action_group_add_action) : Each action can only be in 1 group,
set GtkAction::action_group.
(gtk_action_group_remove_action) : clear it.
(gtk_action_group_add_toggle_actions_full) : warning suppression.
(gtk_action_group_add_radio_actions_full) : warning suppression.
(_gtk_action_group_emit_pre_activate) : new protected routine for use
by GtkAction.
(_gtk_action_group_emit_post_activate) : ditto.
* gtk/gtkaction.c (gtk_action_class_init) : add 'action_group' property.
(gtk_action_init) : initialize it.
(gtk_action_get_property) : get.
(gtk_action_set_property) : set it via
(gtk_action_set_action_group) : new function.
(gtk_action_sync_sensitivity) : new routine to sync proxy sensitivity
with the logical sensitivity (action & group) rather than the simple
action::sensitivity.
(gtk_action_sync_visible) : use gtk_action_is_visible to handle
logical visibility (action & group) rather than the simple
action::visible. Use widget show/hide directly.
(connect_proxy) : handle the custom sensitivity handler.
Make the TOOL_BUTTON signals more general and support TOOL_ITEM
directly, with special cases for TOOL_BUTTON. Still not especially
good it might be useful to handle label/use_underline by parmspec
lookup. Those are likely to be implemented by custom types, and are
assumed to exist in GtkToolItem.
(disconnect_proxy) : disconnect the new sensitivity handler.
(_gtk_action_emit_activate) : add pre/post signals.
(gtk_action_activate) : use logical sensitivity.
(gtk_action_is_sensitive) : logical sensitivity.
(gtk_action_get_sensitive) : actual sensitivity.
(closure_accel_activate) : use logical sensitivity.
Fri Jan 9 22:23:45 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Introduce a new parser state for
......
Mon Jan 12 00:10:20 2004 Matthias Clasen <maclas@gmx.de>
Mon Jan 12 23:40:34 2004 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c: Adjust to the new connect_proxy signals.
* gtk/gtkuimanager.c
* gtk/gtkactiongroup.c
* gtk/gtkaction.c: Move the connect_proxy and disconnect_proxy signals
from GtkAction to GtkActionGroup and proxy it on GtkUIManager. This
removes the confusion between the disconnect_/connect_proxy signals
and the (unrelated) virtual functions of the same name and aligns
the setup with the pre_/post_activate signals.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkaction.c (connect_proxy) : only connect activate for menus
with no submenus otherwise it looks like we activate every time a
submenu opens.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c: Remove accidentially committed debug spew.
......@@ -10,6 +28,67 @@ Sun Jan 11 01:55:07 2004 Matthias Clasen <maclas@gmx.de>
entry is silently created during lock_path(), and treated as an error
during unlock_path(). These changes have been requested by Tim Janik.
2004-01-10 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c (d) : Add a debug macro to quiet the spew.
s/merge_signals/ui_manager_signals/ for readability.
(gtk_ui_manager_class_init) : add pre_activate and post_activate
signals.
(cb_proxy_pre_activate) : new.
(cb_proxy_post_activate) : new.
(gtk_ui_manager_insert_action_group) : connect the proxies for
GtkActionGroup::pre/post_activate
(gtk_ui_manager_remove_action_group) : disconnect them.
* gtk/gtkactiongroup.c (gtk_action_group_class_init) : add
'sensitive', and 'visible' properties. Also add pre_activate and
post_activate signals to help deal with activations at a higher
level (eg GtkUIManager)
(gtk_action_group_init) : init sensitive and visible
(gtk_action_group_set_property) : add sensitive and visible
(gtk_action_group_get_property) : add sensitive and visible
(gtk_action_group_get_sensitive) : new.
(gtk_action_group_get_visible) : new.
(cb_set_action_sensitivity) : new with minor optimization that only
signals sensitivity changes if the action could possibly change.
(cb_set_action_visiblility) : ditto.
(gtk_action_group_set_sensitive) : new. walk the actions directly
rather than using notify::sensitive because that is simpler, easier
to read, and more efficient.
(gtk_action_group_set_visible) : ditto.
(gtk_action_group_add_action) : Each action can only be in 1 group,
set GtkAction::action_group.
(gtk_action_group_remove_action) : clear it.
(gtk_action_group_add_toggle_actions_full) : warning suppression.
(gtk_action_group_add_radio_actions_full) : warning suppression.
(_gtk_action_group_emit_pre_activate) : new protected routine for use
by GtkAction.
(_gtk_action_group_emit_post_activate) : ditto.
* gtk/gtkaction.c (gtk_action_class_init) : add 'action_group' property.
(gtk_action_init) : initialize it.
(gtk_action_get_property) : get.
(gtk_action_set_property) : set it via
(gtk_action_set_action_group) : new function.
(gtk_action_sync_sensitivity) : new routine to sync proxy sensitivity
with the logical sensitivity (action & group) rather than the simple
action::sensitivity.
(gtk_action_sync_visible) : use gtk_action_is_visible to handle
logical visibility (action & group) rather than the simple
action::visible. Use widget show/hide directly.
(connect_proxy) : handle the custom sensitivity handler.
Make the TOOL_BUTTON signals more general and support TOOL_ITEM
directly, with special cases for TOOL_BUTTON. Still not especially
good it might be useful to handle label/use_underline by parmspec
lookup. Those are likely to be implemented by custom types, and are
assumed to exist in GtkToolItem.
(disconnect_proxy) : disconnect the new sensitivity handler.
(_gtk_action_emit_activate) : add pre/post signals.
(gtk_action_activate) : use logical sensitivity.
(gtk_action_is_sensitive) : logical sensitivity.
(gtk_action_get_sensitive) : actual sensitivity.
(closure_accel_activate) : use logical sensitivity.
Fri Jan 9 22:23:45 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Introduce a new parser state for
......
Mon Jan 12 00:10:20 2004 Matthias Clasen <maclas@gmx.de>
Mon Jan 12 23:40:34 2004 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c: Adjust to the new connect_proxy signals.
* gtk/gtkuimanager.c
* gtk/gtkactiongroup.c
* gtk/gtkaction.c: Move the connect_proxy and disconnect_proxy signals
from GtkAction to GtkActionGroup and proxy it on GtkUIManager. This
removes the confusion between the disconnect_/connect_proxy signals
and the (unrelated) virtual functions of the same name and aligns
the setup with the pre_/post_activate signals.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkaction.c (connect_proxy) : only connect activate for menus
with no submenus otherwise it looks like we activate every time a
submenu opens.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c: Remove accidentially committed debug spew.
......@@ -10,6 +28,67 @@ Sun Jan 11 01:55:07 2004 Matthias Clasen <maclas@gmx.de>
entry is silently created during lock_path(), and treated as an error
during unlock_path(). These changes have been requested by Tim Janik.
2004-01-10 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c (d) : Add a debug macro to quiet the spew.
s/merge_signals/ui_manager_signals/ for readability.
(gtk_ui_manager_class_init) : add pre_activate and post_activate
signals.
(cb_proxy_pre_activate) : new.
(cb_proxy_post_activate) : new.
(gtk_ui_manager_insert_action_group) : connect the proxies for
GtkActionGroup::pre/post_activate
(gtk_ui_manager_remove_action_group) : disconnect them.
* gtk/gtkactiongroup.c (gtk_action_group_class_init) : add
'sensitive', and 'visible' properties. Also add pre_activate and
post_activate signals to help deal with activations at a higher
level (eg GtkUIManager)
(gtk_action_group_init) : init sensitive and visible
(gtk_action_group_set_property) : add sensitive and visible
(gtk_action_group_get_property) : add sensitive and visible
(gtk_action_group_get_sensitive) : new.
(gtk_action_group_get_visible) : new.
(cb_set_action_sensitivity) : new with minor optimization that only
signals sensitivity changes if the action could possibly change.
(cb_set_action_visiblility) : ditto.
(gtk_action_group_set_sensitive) : new. walk the actions directly
rather than using notify::sensitive because that is simpler, easier
to read, and more efficient.
(gtk_action_group_set_visible) : ditto.
(gtk_action_group_add_action) : Each action can only be in 1 group,
set GtkAction::action_group.
(gtk_action_group_remove_action) : clear it.
(gtk_action_group_add_toggle_actions_full) : warning suppression.
(gtk_action_group_add_radio_actions_full) : warning suppression.
(_gtk_action_group_emit_pre_activate) : new protected routine for use
by GtkAction.
(_gtk_action_group_emit_post_activate) : ditto.
* gtk/gtkaction.c (gtk_action_class_init) : add 'action_group' property.
(gtk_action_init) : initialize it.
(gtk_action_get_property) : get.
(gtk_action_set_property) : set it via
(gtk_action_set_action_group) : new function.
(gtk_action_sync_sensitivity) : new routine to sync proxy sensitivity
with the logical sensitivity (action & group) rather than the simple
action::sensitivity.
(gtk_action_sync_visible) : use gtk_action_is_visible to handle
logical visibility (action & group) rather than the simple
action::visible. Use widget show/hide directly.
(connect_proxy) : handle the custom sensitivity handler.
Make the TOOL_BUTTON signals more general and support TOOL_ITEM
directly, with special cases for TOOL_BUTTON. Still not especially
good it might be useful to handle label/use_underline by parmspec
lookup. Those are likely to be implemented by custom types, and are
assumed to exist in GtkToolItem.
(disconnect_proxy) : disconnect the new sensitivity handler.
(_gtk_action_emit_activate) : add pre/post signals.
(gtk_action_activate) : use logical sensitivity.
(gtk_action_is_sensitive) : logical sensitivity.
(gtk_action_get_sensitive) : actual sensitivity.
(closure_accel_activate) : use logical sensitivity.
Fri Jan 9 22:23:45 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Introduce a new parser state for
......
Mon Jan 12 00:10:20 2004 Matthias Clasen <maclas@gmx.de>
Mon Jan 12 23:40:34 2004 Matthias Clasen <maclas@gmx.de>
* tests/testmerge.c: Adjust to the new connect_proxy signals.
* gtk/gtkuimanager.c
* gtk/gtkactiongroup.c
* gtk/gtkaction.c: Move the connect_proxy and disconnect_proxy signals
from GtkAction to GtkActionGroup and proxy it on GtkUIManager. This
removes the confusion between the disconnect_/connect_proxy signals
and the (unrelated) virtual functions of the same name and aligns
the setup with the pre_/post_activate signals.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkaction.c (connect_proxy) : only connect activate for menus
with no submenus otherwise it looks like we activate every time a
submenu opens.
2004-01-12 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c: Remove accidentially committed debug spew.
......@@ -10,6 +28,67 @@ Sun Jan 11 01:55:07 2004 Matthias Clasen <maclas@gmx.de>
entry is silently created during lock_path(), and treated as an error
during unlock_path(). These changes have been requested by Tim Janik.
2004-01-10 Jody Goldberg <jody@gnome.org>
* gtk/gtkuimanager.c (d) : Add a debug macro to quiet the spew.
s/merge_signals/ui_manager_signals/ for readability.
(gtk_ui_manager_class_init) : add pre_activate and post_activate
signals.
(cb_proxy_pre_activate) : new.
(cb_proxy_post_activate) : new.
(gtk_ui_manager_insert_action_group) : connect the proxies for
GtkActionGroup::pre/post_activate
(gtk_ui_manager_remove_action_group) : disconnect them.
* gtk/gtkactiongroup.c (gtk_action_group_class_init) : add
'sensitive', and 'visible' properties. Also add pre_activate and
post_activate signals to help deal with activations at a higher
level (eg GtkUIManager)
(gtk_action_group_init) : init sensitive and visible
(gtk_action_group_set_property) : add sensitive and visible
(gtk_action_group_get_property) : add sensitive and visible
(gtk_action_group_get_sensitive) : new.
(gtk_action_group_get_visible) : new.
(cb_set_action_sensitivity) : new with minor optimization that only
signals sensitivity changes if the action could possibly change.
(cb_set_action_visiblility) : ditto.
(gtk_action_group_set_sensitive) : new. walk the actions directly
rather than using notify::sensitive because that is simpler, easier
to read, and more efficient.
(gtk_action_group_set_visible) : ditto.
(gtk_action_group_add_action) : Each action can only be in 1 group,
set GtkAction::action_group.
(gtk_action_group_remove_action) : clear it.
(gtk_action_group_add_toggle_actions_full) : warning suppression.
(gtk_action_group_add_radio_actions_full) : warning suppression.
(_gtk_action_group_emit_pre_activate) : new protected routine for use
by GtkAction.
(_gtk_action_group_emit_post_activate) : ditto.
* gtk/gtkaction.c (gtk_action_class_init) : add 'action_group' property.
(gtk_action_init) : initialize it.
(gtk_action_get_property) : get.
(gtk_action_set_property) : set it via
(gtk_action_set_action_group) : new function.
(gtk_action_sync_sensitivity) : new routine to sync proxy sensitivity
with the logical sensitivity (action & group) rather than the simple
action::sensitivity.
(gtk_action_sync_visible) : use gtk_action_is_visible to handle
logical visibility (action & group) rather than the simple
action::visible. Use widget show/hide directly.
(connect_proxy) : handle the custom sensitivity handler.
Make the TOOL_BUTTON signals more general and support TOOL_ITEM
directly, with special cases for TOOL_BUTTON. Still not especially
good it might be useful to handle label/use_underline by parmspec
lookup. Those are likely to be implemented by custom types, and are
assumed to exist in GtkToolItem.
(disconnect_proxy) : disconnect the new sensitivity handler.
(_gtk_action_emit_activate) : add pre/post signals.
(gtk_action_activate) : use logical sensitivity.
(gtk_action_is_sensitive) : logical sensitivity.
(gtk_action_get_sensitive) : actual sensitivity.
(closure_accel_activate) : use logical sensitivity.
Fri Jan 9 22:23:45 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkuimanager.c: Introduce a new parser state for
......
......@@ -104,6 +104,10 @@ gtk_accessible_get_type
GtkAction
gtk_action_new
gtk_action_get_name
gtk_action_is_sensitive
gtk_action_get_sensitive
gtk_action_is_visible
gtk_action_get_visible
gtk_action_activate
gtk_action_create_icon
gtk_action_create_menu_item
......@@ -136,6 +140,10 @@ GtkActionPrivate
GtkActionGroup
gtk_action_group_new
gtk_action_group_get_name
gtk_action_group_get_sensitive
gtk_action_group_set_sensitive
gtk_action_group_get_visible
gtk_action_group_set_visible
gtk_action_group_get_action
gtk_action_group_list_actions
gtk_action_group_add_action
......
......@@ -31,6 +31,7 @@
#include <config.h>
#include "gtkaction.h"
#include "gtkactiongroup.h"
#include "gtkaccellabel.h"
#include "gtkbutton.h"
#include "gtkimage.h"
......@@ -70,14 +71,14 @@ struct _GtkActionPrivate
GClosure *accel_closure;
GQuark accel_quark;
GtkActionGroup *action_group;
/* list of proxy widgets */
GSList *proxies;
};
enum
{
CONNECT_PROXY,
DISCONNECT_PROXY,
ACTIVATE,
LAST_SIGNAL
};
......@@ -95,7 +96,8 @@ enum
PROP_IS_IMPORTANT,
PROP_HIDE_IF_EMPTY,
PROP_SENSITIVE,
PROP_VISIBLE
PROP_VISIBLE,
PROP_ACTION_GROUP
};
static void gtk_action_init (GtkAction *action);
......@@ -141,6 +143,8 @@ static void gtk_action_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
static void gtk_action_set_action_group (GtkAction *action,
GtkActionGroup *action_group);
static GtkWidget *create_menu_item (GtkAction *action);
static GtkWidget *create_tool_item (GtkAction *action);
......@@ -261,6 +265,13 @@ gtk_action_class_init (GtkActionClass *klass)
_("Whether the action is visible."),
TRUE,
G_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
PROP_ACTION_GROUP,
g_param_spec_object ("action_group",
_("Action Group"),
_("The GtkActionGroup this GtkAction is associated with, or NULL (for internal use)."),
GTK_TYPE_ACTION_GROUP,
G_PARAM_READWRITE));
/**
* GtkAction::activate:
......@@ -278,47 +289,6 @@ gtk_action_class_init (GtkActionClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* GtkAction::connect-proxy:
* @action: the action
* @proxy: the proxy
*
* The connect_proxy signal is emitted after connecting a proxy to
* an action. Note that the proxy may have been connected to a different
* action before.
*
* This is intended for simple customizations for which a custom action
* class would be too clumsy, e.g. showing tooltips for menuitems in the
* statusbar.
*
* Since: 2.4
*/
action_signals[CONNECT_PROXY] =
g_signal_new ("connect_proxy",
G_OBJECT_CLASS_TYPE (klass),
0, 0, NULL, NULL,
_gtk_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GTK_TYPE_WIDGET);
/**
* GtkAction::disconnect-proxy:
* @action: the action
* @proxy: the proxy
*
* The disconnect_proxy signal is emitted after disconnecting a proxy
* from an action.
*
* Since: 2.4
*/
action_signals[DISCONNECT_PROXY] =
g_signal_new ("disconnect_proxy",
G_OBJECT_CLASS_TYPE (klass),
0, 0, NULL, NULL,
_gtk_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GTK_TYPE_WIDGET);
g_type_class_add_private (gobject_class, sizeof (GtkActionPrivate));
}
......@@ -356,6 +326,8 @@ gtk_action_init (GtkAction *action)
action->private_data->accel_count = 0;
action->private_data->accel_group = NULL;
action->private_data->action_group = NULL;
action->private_data->proxies = NULL;
}
......@@ -507,6 +479,9 @@ gtk_action_set_property (GObject *object,
case PROP_VISIBLE:
action->private_data->visible = g_value_get_boolean (value);
break;
case PROP_ACTION_GROUP:
gtk_action_set_action_group (action, g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -558,6 +533,9 @@ gtk_action_get_property (GObject *object,
case PROP_VISIBLE:
g_value_set_boolean (value, action->private_data->visible);
break;
case PROP_ACTION_GROUP:
g_value_set_object (value, action->private_data->action_group);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -594,6 +572,14 @@ remove_proxy (GtkWidget *proxy,
action->private_data->proxies = g_slist_remove (action->private_data->proxies, proxy);
}
static void
gtk_action_sync_sensitivity (GtkAction *action,
GParamSpec *pspec,
GtkWidget *proxy)
{
gtk_widget_set_sensitive (proxy, gtk_action_is_sensitive (action));
}
static void
gtk_action_sync_property (GtkAction *action,
GParamSpec *pspec,
......@@ -642,7 +628,7 @@ _gtk_action_sync_menu_visible (GtkAction *action,
if (action == NULL)
action = g_object_get_data (G_OBJECT (proxy), "gtk-action");
visible = action->private_data->visible;
visible = gtk_action_is_visible (action);
hide_if_empty = action->private_data->hide_if_empty;
g_object_set (G_OBJECT (proxy),
......@@ -664,7 +650,12 @@ gtk_action_sync_visible (GtkAction *action,
_gtk_action_sync_menu_visible (action, proxy, _gtk_menu_is_empty (menu));
}
else
gtk_action_sync_property (action, pspec, proxy);
{
if (gtk_action_is_visible (action))
gtk_widget_show (proxy);
else
gtk_widget_hide (proxy);
}
}
static void
......@@ -750,6 +741,8 @@ static void
connect_proxy (GtkAction *action,
GtkWidget *proxy)
{
GtkActionGroup *group = action->private_data->action_group;
g_object_ref (action);
g_object_set_data_full (G_OBJECT (proxy), "gtk-action", action,
g_object_unref);
......@@ -760,12 +753,12 @@ connect_proxy (GtkAction *action,
G_CALLBACK (remove_proxy), action);
g_signal_connect_object (action, "notify::sensitive",
G_CALLBACK (gtk_action_sync_property), proxy, 0);
gtk_widget_set_sensitive (proxy, action->private_data->sensitive);
G_CALLBACK (gtk_action_sync_sensitivity), proxy, 0);
gtk_widget_set_sensitive (proxy, gtk_action_is_sensitive (action));
g_signal_connect_object (action, "notify::visible",
G_CALLBACK (gtk_action_sync_visible), proxy, 0);
if (action->private_data->visible)
if (gtk_action_is_visible (action))
gtk_widget_show (proxy);
else
gtk_widget_hide (proxy);
......@@ -834,19 +827,17 @@ connect_proxy (GtkAction *action,
proxy, 0);
}
if (gtk_menu_item_get_submenu (GTK_MENU_ITEM (proxy)) == NULL)
g_signal_connect_object (proxy, "activate",
G_CALLBACK (gtk_action_activate), action,
G_CONNECT_SWAPPED);
}
else if (GTK_IS_TOOL_BUTTON (proxy))
else if (GTK_IS_TOOL_ITEM (proxy))
{
/* toolbar button specific synchronisers ... */
/* toolbar item specific synchronisers ... */
g_object_set (G_OBJECT (proxy),
"label", action->private_data->short_label,
"use_underline", TRUE,
"stock_id", action->private_data->stock_id,
"visible_horizontal", action->private_data->visible_horizontal,
"visible_vertical", action->private_data->visible_vertical,
"is_important", action->private_data->is_important,
......@@ -854,12 +845,6 @@ connect_proxy (GtkAction *action,
/* FIXME: we should set the tooltip here, but the current api
* doesn't allow it before the item is added to a toolbar.
*/
g_signal_connect_object (action, "notify::short_label",
G_CALLBACK (gtk_action_sync_short_label),
proxy, 0);
g_signal_connect_object (action, "notify::stock_id",
G_CALLBACK (gtk_action_sync_property),
proxy, 0);
g_signal_connect_object (action, "notify::visible_horizontal",
G_CALLBACK (gtk_action_sync_property),
proxy, 0);
......@@ -877,10 +862,28 @@ connect_proxy (GtkAction *action,
G_CALLBACK (gtk_action_create_menu_proxy),
action, 0);
/* toolbar button specific synchronisers ... */
if (GTK_IS_TOOL_BUTTON (proxy))
{
g_object_set (G_OBJECT (proxy),
"label", action->private_data->short_label,
"use_underline", TRUE,