Commit Graph

5 Commits

Author SHA1 Message Date
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
c77b0caab1 New function which implements "smart" separators by iterating once over
* gtk/gtkuimanager.c (update_smart_separators): New function which
	implements "smart" separators by iterating once over the entries of a
	menu, hiding and showing separators as necessary.
	(update_node): Mark separators used as fences of placeholders as
	hidden. Explicitly added separators are marked as smart. Call
	update_smart_separators after updating a menu or toolbar node.
	Connect update_smart_separators to "notify::visible" signal on menu
	and tool items.

	* tests/merge-[12].ui: Test smart separators.

	* gtk/tmpl/gtkuimanager.sgml: Add a paragraph about smart separators.
2003-09-15 20:35:28 +00:00
Matthias Clasen
cbc20c4dde Change the XML format: <Root> element is replaced by <ui>, <menu> element
2003-08-28  Matthias Clasen  <maclas@gmx.de>

	* gtk/gtkuimanager.c: Change the XML format:
	<Root> element is replaced by <ui>,
	<menu> element is replaced by <menubar>,
	<submenu> element is replaced by <menu>,
	<dockitem> element is replaced by <toolbar>,
	<popups> element is gone,
	verb attribute is replaced by action,
	name defaults to action or the element name.

	* gtk/gtkactiongroup.[hc]: Replace GtkActionGroupEntry by GtkActionEntry
	and GtkRadioActionEntry. GtkActionEntry is simplified by removing
	the user_data, entry_type and extra_data fields, GtkRadioActionEntry is
	further simplified by removing the callback. The user_data can now be
	specified as an argument to gtk_action_group_add_actions(). There is
	a new method gtk_action_group_add_radio_actions(), which is similar
	to gtk_action_group_add_actions(), but takes GtkRadioActionEntrys
	and a callback parameter in addition to the user_data. The callback
	is connected to the ::changed signal of the first group member.
	There are _full() variants taking a GDestroyNotify of
	gtk_action_group_add_[radio_]actions().

	* gtk/gtkradioaction.[hc]: Add a ::changed signal which gets emitted
	on every member of the radio group when the active member is changed.
	Add an integer property "value", and a getter for the value of "value"
	on the currently active group member.

	* tests/testactions.c:
	* tests/testmerge.c:
	* tests/merge-[123].ui:
	* demos/gtk-demo/appwindow.c: Adjust to these changes.

	* gtk/gtktoolbar.c (gtk_toolbar_append_element): Trivial doc fix.
2003-08-27 22:22:28 +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