Commit Graph

22 Commits

Author SHA1 Message Date
Matthias Clasen
a18431078a Fix #131869:
Wed Jan 21 23:27:14 2004  Matthias Clasen  <maclas@gmx.de>

	Fix #131869:

	* gtk/gtkaction.c (_gtk_action_emit_activate): Hold
	a reference to the group while emitting the signals.

	* gtk/gtkactiongroup.c (gtk_action_group_init): Use a
	destroy notify which does not only unref, but also resets
	the action_group property of the action.
2004-01-21 22:26:53 +00:00
Matthias Clasen
07d4d314b6 The first part of the fix for #114351 (see also gdk-pixbuf/ChangeLog and
Fri Jan 16 23:59:01 2004  Matthias Clasen  <maclas@gmx.de>

	The first part of the fix for #114351 (see also
	gdk-pixbuf/ChangeLog and po/ChangeLog):

	* gtk/gtkintl.h:
	* gdk-pixbuf/gdk-pixbuf-i18n.h:
	* gdk/gdkintl.h: Define P_() for property blurbs and nicks.

	* gdk/gdkdisplaymanager.c:
	* gdk-pixbuf/gdk-pixbuf.c:
	* modules/input/gtkimcontextxim.c:
	* gtk/*.c:  Mark property blurbs and nicks with P_().

	* po/Makefile.in.in: Add --keyword=P_ to the xgettext
	invocation, since property blurbs and nicks are
	now marked with P_().
2004-01-16 23:10:05 +00:00
Jody Goldberg
c73ab06ef5 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.
2004-01-12 22:45:45 +00:00
Matthias Clasen
a11e45a1eb Add creation functions for actions.
Wed Jan  7 22:20:20 2004  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.h:
	* gtk/gtkaction.c (gtk_action_new):
	* gtk/gtktoggleaction.h:
	* gtk/gtktoggleaction.c (gtk_toggle_action_new):
	* gtk/gtkradioaction.h:
	* gtk/gtkradioaction.c (gtk_radio_action_new): Add creation
	functions for actions.

	* gtk/gtkactiongroup.c (gtk_action_group_add_actions_full):
	(gtk_action_group_add_toggle_actions_full):
	(gtk_action_group_add_radio_actions_full): and use the
	new functions here.  (#125322, Patch by Jeff Frank)
2004-01-07 21:54:33 +00:00
Jody Goldberg
9acc941959 add visible_horizontal, visible_vertical. (gtk_action_class_init) : here.
2004-01-01  Jody Goldberg <jody@gnome.org>

	* gtk/gtkaction.c (_GtkActionPrivate) : add visible_horizontal,
	  visible_vertical.
	(gtk_action_class_init) : here.
	(gtk_action_init) : here.
	(gtk_action_set_property) : here.
	(gtk_action_get_property) : here.
	(connect_proxy) : and here.

2003-12-30  Jody Goldberg <jody@gnome.org>

	* gtk/gtkactiongroup.c (gtk_action_group_add_action_with_accel) :  new
	  utility routine for use in derived GtkActions with the replicated code
	  from.
	(gtk_action_group_add_actions_full) : here.
	(gtk_action_group_add_toggle_actions_full) : here.
	(gtk_action_group_add_radio_actions_full) : and here.

2003-12-24  Jody Goldberg <jody@gnome.org>

	* gtk/gtkactiongroup.h : Add some const to the char * in
	  GtkActionEntry*.  We're reccomending people pass static strings to
	  them, and not freeing them.  This stems to flood of warnings that
	  result.
	* gtk/gtkactiongroup.c (gtk_action_group_add_actions_full) : change
	  temp vars to const to match above.
	(gtk_action_group_add_toggle_actions_full) : ditto.
	(gtk_action_group_add_radio_actions_full) : ditto.
2004-01-02 23:14:28 +00:00
Matthias Clasen
bc5d7efe97 Fix the behaviour of insensitive actions, which was broken when
Fri Dec 19 01:35:34 2003  Matthias Clasen  <maclas@gmx.de>

	Fix the behaviour of insensitive actions, which was broken
	when gtk_action_activate() was changed to pay attention to
	sensitivity  (#129557, Christian Persch)

	* gtk/gtkaction.h:
	* gtk/gtkaction.c (_gtk_action_emit_activate): New auxiliary
	function to emit an activate signal without regard to sensitivity.

	* gtk/gtkradioaction.c:
	* gtk/gtktoggleaction.c: Always use _gtk_action_emit_activate()
	instead of gtk_action_activate().
2003-12-19 00:39:10 +00:00
Matthias Clasen
eda4f1134f Only activate if the action is sensitive. (#127187, Christian Persch)
Mon Nov 17 23:36:02 2003  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.c (gtk_action_activate): Only activate if
	the action is sensitive.  (#127187, Christian Persch)
2003-11-17 22:36:27 +00:00
Matthias Clasen
6e87629f1a Introduce a separate "hide_if_empty" property for empty menu handling.
2003-10-01  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.c (gtk_action_class_init):
	(gtk_action_[gs]et_property): Introduce a separate
	"hide_if_empty" property for empty menu handling.
	(_gtk_action_sync_menu_visible): ...and use it here.

	* tests/testmerge.c (main): ...and here.
2003-10-01 19:07:36 +00:00
Matthias Clasen
57f13d815d Test handling of empty menus.
2003-09-30  Matthias Clasen  <maclas@gmx.de>

	* tests/merge-*.ui:
	* tests/testmerge.c: Test handling of empty menus.

	* gtk/gtkuimanager.c (_gtk_menu_is_empty): New function to determine
	whether a menu is empty. Used in gtkaction.c.
	(update_smart_separators): Also update the visibility of empty menus.
	(update_node): When creating a new menu proxy, insert an "Empty" menu
	item which only gets shown if the menu is empty.

	* gtk/gtkaction.c (gtk_action_class_init): Document the meaning of
	"is_important" for menu proxies.
	(_gtk_action_sync_menu_visible): New function to sync the visibility
	of menu proxies. Used in gtkuimanager.c.
	(gtk_action_sync_visible): New function to sync the visibility of
	proxies.
2003-09-30 20:55:24 +00:00
Matthias Clasen
eeed9d1890 Demonstrate the use of the connect-proxy signal.
2003-09-27  Matthias Clasen  <maclas@gmx.de>

	* tests/testmerge.c: Demonstrate the use of the
	connect-proxy signal.

	* gtk/gtkaction.c (connect_proxy): Add connect-proxy and
	disconnect-proxy signals to do small customizations
	like displaying tooltips in the statusbar without
	custom actions.  (#122894, Philip Langdale)

	* gtk/gtkuimanager.c (update_node): Don't leak tooltip.
2003-09-26 23:01:32 +00:00
Matthias Clasen
a93cee89c2 Sync tooltips on toolitems.
2003-09-24  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.c (connect_proxy): Sync tooltips on toolitems.

	* gtk/gtkuimanager.c (update_node): Don't complain about missing
	actions on popups. Re-set "tooltip" property on toolitems after
	adding them to parent to trigger proxy update.
2003-09-23 23:42:39 +00:00
Matthias Clasen
d381967d5c Changes to make cross-process merging feasible:
2003-09-21  Matthias Clasen  <maclas@gmx.de>

	Changes to make cross-process merging feasible:

	* gtk/gtkuimanager.[hc]: Add a readonly "ui" property which holds the
	merged UI definition. Remove the "changed" signal, since its role
	is now filled by "notify::ui". Instead add a "actions-changed" signal
	which gets emitted when the set of actions changes.

	* gtk/gtktoggleactionprivate.h:
	* gtk/gtktoggleaction.[hc] (gtk_toggle_action_[sg]et_draw_as_radio):
	Add a "draw_as_radio" property to toggle actions so that they can be
	used as proxies for radio actions much like the "draw_as_radio"
	property on check menu items enables them to operate as proxies for
	radio actions.

	Prevent the "show_all" trap for action-based menus (see
	http://mail.gnome.org/archives/gtk-devel-list/2003-September/
	msg00260.html):

	* gtk/gtkmenu.c (gtk_menu_{hide,show}_all): Remove g_return_if_fail()
	calls from static functions.

	* gtk/gtkuimanager.c (update_node):
	* gtk/gtkaction.c (connect_proxy): Set "no_show_all" on constructed
	widgets whose visibility is externally controlled.

	* gtk/gtkwidget.[hc] (gtk_widget_[gs]et_no_show_all): Add a boolean
	"no_show_all" property with setter and getter. When TRUE, it keeps
	gtk_widget_{hide,show}_all() from modifying the visibility of the
	widget and its children.
2003-09-21 22:04:48 +00:00
Matthias Clasen
8a72d4b383 Call g_closure_unref() to unref a closure, not g_object_unref(). (#122637,
2003-09-18  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.c (gtk_action_finalize): Call g_closure_unref() to
	unref a closure, not g_object_unref().  (#122637, Marco Pesenti Gritti)
2003-09-18 19:04:42 +00:00
Matthias Clasen
0ceb0db081 Install accelerators on actions, not on proxies, support accelerator-only
2003-09-18  Matthias Clasen  <maclas@gmx.de>

	Install accelerators on actions, not on proxies, support
	accelerator-only actions:

	* gtk/gtkmenu.c (get_accel_path): New function to get the accel path
	and its lock status either via _gtk_widget_get_accel_path() or by
	looking at the accel_path stored in the menu item itself and determining
	its lock status by peeking into the contained accel label. This was
	already (accidentally) committed a week ago.

	* gtk/gtkaction.h (gtk_action_set_accel_group):
	(gtk_action_[dis]connect_accelerator): New functions.

	* gtk/gtkaction.c (struct _GtkActionPrivate): Add accel_group,
	accel_closure and accel_count. We must have a reference to the accel_group,
	since we need it in connect_proxy. The count is necessary to ensure
	that the accelerator isn't removed before the last proxy requesting
	it has been unmerged.
	(connect_proxy): Connect the accelerator to the
	action now, only set the accel_path on the menuitem.
	(remove_proxy): Disconnect the accelerator from the action, not from
	the menuitem.
	(gtk_action_set_accel_group): Set the accel group.
	(gtk_action_[dis]connect_accelerator): Count the number of times
	this functions have been called and install/remove the accelerator if
	the count leaves/reaches zero.

	* gtk/gtkuimanager.h (GtkUIManagerItemType): Add
	GTK_UI_MANAGER_ACCELERATOR.

	* gtk/gtkuimanager.c (NodeType): Add NODE_TYPE_ACCELERATOR.
	(start_element_handler): Create NODE_TYPE_ACCELERATOR nodes from
	<accelerator> elements.
	(gtk_ui_manager_add_ui): Create NODE_TYPE_ACCELERATOR nodes when
	type is GTK_UI_MANAGER_ACCELERATOR.
	(update_node): Set the accel group on actions before creating their
	proxies. Don't set the accel group on created menus. For
	NODE_TYPE_ACCELERATOR nodes, [dis]connect the actions' accelerator.
	(print_node): Also emit <accelerator> elements.

	* tests/testmerge.c (dump_accels): Add a "Dump Accels" button.
2003-09-17 23:58:28 +00:00
Matthias Clasen
e8c93d56a0 Fix a C99ism. (#121640, Josh Beam)
2003-09-07  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkuimanager.c (update_node): Fix a C99ism.  (#121640,
	Josh Beam)

	Fixes for accelerator handling during (un)merging:

	* gtk/gtkuimanager.c (update_node): Move setting info-action
	after the switch, since the old action is needed in some cases.
	In cases of proxy type mismatch, disconnect the old proxy from
	the old action.

	* gtk/gtkaction.c (remove_proxy): Renamed from
	gtk_action_remove_proxy(). Move unsetting of the accelerator
	here from disconnect_proxy() in order to catch all cases of
	removing a proxy.
	(gtk_action_disconnect_proxy): Fix logic in g_return_if_fail()
	to fail if proxy isn't a proxy of action.
2003-09-06 23:52:00 +00:00
Matthias Clasen
0a79e5e3be Make disconnect work for toolitems.
2003-09-07  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.c (disconnect_proxy): Make disconnect work
	for toolitems.
2003-09-06 22:13:20 +00:00
Matthias Clasen
7db084ec5b Disconnect from prev_action, not from action. (Fix by David Hampton)
2003-09-06  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.c (gtk_action_connect_proxy): Disconnect from
	prev_action, not from action.  (Fix by David Hampton)
2003-09-06 21:04:01 +00:00
Matthias Clasen
9ae676b06b Test buttons and toggle buttons as proxies.
2003-09-04  Matthias Clasen  <maclas@gmx.de>

	* tests/testmerge.c: Test buttons and toggle buttons as proxies.

	* gtk/gtktoggleaction.c (connect_proxy):
	(gtk_toggle_action_real_toggled): Support toggle buttons as proxies. Note
	that a "draw_as_radio" property is needed for check buttons similar to
	check menu items, in order to fully support button proxies for radio actions.

	* gtk/gtkaction.c (connect_proxy): Allow buttons as proxies.
2003-09-04 21:34:15 +00:00
Matthias Clasen
7cddc693b0 Make this public again, since it's occasionally useful. (#121128, Marco
2003-09-01  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkuimanager.[ch] (gtk_ui_manager_ensure_update): Make
	this public again, since it's occasionally useful.  (#121128,
	Marco Pesenti Gritti)

	* gtk/gtkaction.c: Add an "is_important" property and propagate
	it to toolitem proxies.  (#121058, Marco Pesenti Gritti)
2003-08-31 23:36:37 +00:00
Matthias Clasen
320bba9f37 Additions.
2003-08-31  Matthias Clasen  <maclas@gmx.de>

	* gtk/tmpl/gtkuimanager.sgml:
	* gtk/tmpl/gtkactiongroup.sgml:
	* gtk/tmpl/gtkaction.sgml:
	* gtk/tmpl/gtktoggleaction.sgml:
	* gtk/tmpl/gtkradioaction.sgml: Additions.

	* gtk/gtk-sections.txt: Updates.

	* gtk/gtk.types: Add GtkAction, GtkActionGroup, GtkToggleAction,
	GtkRadioAction and GtkUIManager.

	* gtk/gtkaction.c:
	* gtk/gtkactiongroup.c: Some doc tweaks.

	* gtk/gtkuimanager.[hc]: Get rid of the remove_widget signal. It
	wasn't emitted anyway. Some doc tweaks.
2003-08-31 00:27:15 +00:00
Matthias Clasen
720bdb8daf Use gssize for length, not gsize.
2003-08-26  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkuimanager.[hc] (gtk_ui_manager_add_ui_from_string): Use gssize
	for length, not gsize.

	* gtk/gtkuimanager.c: Refactor the XML format a bit: rename <Root> to
	<ui> and make it optional in strings. Rename verb to action, <dockitem>
	to <toolbar>, <menu> to <menubar>, <submenu> to <menu>.

	* demos/gtk-demo/appwindow.c:
	* tests/testactions.c:
	* tests/testmerge.c:
	* tests/merge-1.ui:
	* tests/merge-2.ui:
	* tests/merge-3.ui: Adjust to the new XML format.
2003-08-26 00:13:59 +00:00
Matthias Clasen
e7e395652c A model-view separation for menus and toolbars, using the EggMenu code by
2003-08-24  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkaction.[ch]:
	* gtk/gtktoggleaction.[ch]:
	* gtk/gtktoggleactionprivate.h:
	* gtk/gtkradioaction.[ch]:
	* gtk/gtkactiongroup.[ch]:
	* gtk/gtkmenumerge.[ch]: A model-view separation for menus and
	toolbars, using the EggMenu code by James Henstridge.

	* gtk/gtk.h: Include new headers.
	* gtk/Makefile.am: Add new files.

	* tests/testactions.c: Test for actions.
	* tests/testmerge.c: Test for menu merging.
	* tests/merge-[123].ui: Test data for testmerge.
	* tests/Makefile.am: Add testactions and testmerge.

	* demos/gtk-demo/appwindow.c: Use GtkMenuMerge to construct the
	menubar and toolbar.
2003-08-24 19:58:30 +00:00