2003-08-24 19:58:30 +00:00
|
|
|
|
/*
|
2008-07-01 22:57:50 +00:00
|
|
|
|
* GTK - The GIMP Toolkit
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* Copyright (C) 1998, 1999 Red Hat, Inc.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* This Library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Library General Public License as
|
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This Library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Library General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Author: James Henstridge <james@daa.com.au>
|
|
|
|
|
*
|
|
|
|
|
* Modified by the GTK+ Team and others 2003. See the AUTHORS
|
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
2008-07-21 12:23:22 +00:00
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2013-06-28 15:27:19 +00:00
|
|
|
|
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
#include <string.h>
|
2009-11-29 01:00:07 +00:00
|
|
|
|
#include "gtkaccellabel.h"
|
2009-01-23 17:10:08 +00:00
|
|
|
|
#include "gtkactivatable.h"
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
#include "gtkbuildable.h"
|
2009-11-11 17:59:12 +00:00
|
|
|
|
#include "gtkimagemenuitem.h"
|
2003-09-23 23:42:39 +00:00
|
|
|
|
#include "gtkintl.h"
|
|
|
|
|
#include "gtkmarshalers.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
|
#include "gtkmenu.h"
|
2010-12-23 23:21:53 +00:00
|
|
|
|
#include "gtkmenushellprivate.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
|
#include "gtkmenubar.h"
|
2005-06-19 03:20:07 +00:00
|
|
|
|
#include "gtkmenutoolbutton.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
|
#include "gtkseparatormenuitem.h"
|
2003-09-23 23:42:39 +00:00
|
|
|
|
#include "gtkseparatortoolitem.h"
|
|
|
|
|
#include "gtktoolbar.h"
|
2008-06-17 09:58:09 +00:00
|
|
|
|
#include "gtkwindow.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2011-10-01 03:58:27 +00:00
|
|
|
|
#include "gtkuimanager.h"
|
2013-07-20 02:48:12 +00:00
|
|
|
|
#include "gtktearoffmenuitem.h"
|
2011-04-18 17:53:30 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SECTION:gtkuimanager
|
|
|
|
|
* @Short_description: Constructing menus and toolbars from an XML description
|
|
|
|
|
* @Title: GtkUIManager
|
|
|
|
|
* @See_also:#GtkBuilder
|
|
|
|
|
*
|
|
|
|
|
* A #GtkUIManager constructs a user interface (menus and toolbars) from
|
|
|
|
|
* one or more UI definitions, which reference actions from one or more
|
|
|
|
|
* action groups.
|
|
|
|
|
*
|
2014-02-04 20:42:30 +00:00
|
|
|
|
* # UI Definitions # {#XML-UI}
|
|
|
|
|
*
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* The UI definitions are specified in an XML format which can be
|
|
|
|
|
* roughly described by the following DTD.
|
|
|
|
|
*
|
2014-02-05 04:57:30 +00:00
|
|
|
|
* > Do not confuse the GtkUIManager UI Definitions described here with
|
2014-02-07 02:07:03 +00:00
|
|
|
|
* > the similarly named [GtkBuilder UI Definitions][BUILDER-UI].
|
2011-04-18 17:53:30 +00:00
|
|
|
|
*
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* |[
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* <!ELEMENT ui (menubar|toolbar|popup|accelerator)* >
|
|
|
|
|
* <!ELEMENT menubar (menuitem|separator|placeholder|menu)* >
|
|
|
|
|
* <!ELEMENT menu (menuitem|separator|placeholder|menu)* >
|
|
|
|
|
* <!ELEMENT popup (menuitem|separator|placeholder|menu)* >
|
|
|
|
|
* <!ELEMENT toolbar (toolitem|separator|placeholder)* >
|
|
|
|
|
* <!ELEMENT placeholder (menuitem|toolitem|separator|placeholder|menu)* >
|
|
|
|
|
* <!ELEMENT menuitem EMPTY >
|
|
|
|
|
* <!ELEMENT toolitem (menu?) >
|
|
|
|
|
* <!ELEMENT separator EMPTY >
|
|
|
|
|
* <!ELEMENT accelerator EMPTY >
|
|
|
|
|
* <!ATTLIST menubar name #IMPLIED
|
|
|
|
|
* action #IMPLIED >
|
|
|
|
|
* <!ATTLIST toolbar name #IMPLIED
|
|
|
|
|
* action #IMPLIED >
|
|
|
|
|
* <!ATTLIST popup name #IMPLIED
|
|
|
|
|
* action #IMPLIED
|
|
|
|
|
* accelerators (true|false) #IMPLIED >
|
|
|
|
|
* <!ATTLIST placeholder name #IMPLIED
|
|
|
|
|
* action #IMPLIED >
|
|
|
|
|
* <!ATTLIST separator name #IMPLIED
|
|
|
|
|
* action #IMPLIED
|
|
|
|
|
* expand (true|false) #IMPLIED >
|
|
|
|
|
* <!ATTLIST menu name #IMPLIED
|
|
|
|
|
* action #REQUIRED
|
|
|
|
|
* position (top|bot) #IMPLIED >
|
|
|
|
|
* <!ATTLIST menuitem name #IMPLIED
|
|
|
|
|
* action #REQUIRED
|
|
|
|
|
* position (top|bot) #IMPLIED
|
|
|
|
|
* always-show-image (true|false) #IMPLIED >
|
|
|
|
|
* <!ATTLIST toolitem name #IMPLIED
|
|
|
|
|
* action #REQUIRED
|
|
|
|
|
* position (top|bot) #IMPLIED >
|
|
|
|
|
* <!ATTLIST accelerator name #IMPLIED
|
|
|
|
|
* action #REQUIRED >
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* ]|
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* There are some additional restrictions beyond those specified in the
|
|
|
|
|
* DTD, e.g. every toolitem must have a toolbar in its anchestry and
|
|
|
|
|
* every menuitem must have a menubar or popup in its anchestry. Since
|
2014-01-21 21:53:57 +00:00
|
|
|
|
* a #GMarkupParser is used to parse the UI description, it must not only
|
|
|
|
|
* be valid XML, but valid markup.
|
2011-04-18 17:53:30 +00:00
|
|
|
|
*
|
|
|
|
|
* If a name is not specified, it defaults to the action. If an action is
|
|
|
|
|
* not specified either, the element name is used. The name and action
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* attributes must not contain “/” characters after parsing (since that
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* would mess up path lookup) and must be usable as XML attributes when
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* enclosed in doublequotes, thus they must not “"” characters or references
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* to the " entity.
|
|
|
|
|
*
|
2014-02-05 05:32:37 +00:00
|
|
|
|
* # A UI definition #
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* |[
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* <ui>
|
|
|
|
|
* <menubar>
|
|
|
|
|
* <menu name="FileMenu" action="FileMenuAction">
|
|
|
|
|
* <menuitem name="New" action="New2Action" />
|
|
|
|
|
* <placeholder name="FileMenuAdditions" />
|
|
|
|
|
* </menu>
|
|
|
|
|
* <menu name="JustifyMenu" action="JustifyMenuAction">
|
|
|
|
|
* <menuitem name="Left" action="justify-left"/>
|
|
|
|
|
* <menuitem name="Centre" action="justify-center"/>
|
|
|
|
|
* <menuitem name="Right" action="justify-right"/>
|
|
|
|
|
* <menuitem name="Fill" action="justify-fill"/>
|
|
|
|
|
* </menu>
|
|
|
|
|
* </menubar>
|
|
|
|
|
* <toolbar action="toolbar1">
|
|
|
|
|
* <placeholder name="JustifyToolItems">
|
|
|
|
|
* <separator/>
|
|
|
|
|
* <toolitem name="Left" action="justify-left"/>
|
|
|
|
|
* <toolitem name="Centre" action="justify-center"/>
|
|
|
|
|
* <toolitem name="Right" action="justify-right"/>
|
|
|
|
|
* <toolitem name="Fill" action="justify-fill"/>
|
|
|
|
|
* <separator/>
|
|
|
|
|
* </placeholder>
|
|
|
|
|
* </toolbar>
|
|
|
|
|
* </ui>
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* ]|
|
2011-04-18 17:53:30 +00:00
|
|
|
|
*
|
|
|
|
|
* The constructed widget hierarchy is very similar to the element tree
|
|
|
|
|
* of the XML, with the exception that placeholders are merged into their
|
|
|
|
|
* parents. The correspondence of XML elements to widgets should be
|
|
|
|
|
* almost obvious:
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
2014-02-05 00:40:34 +00:00
|
|
|
|
* - menubar
|
|
|
|
|
*
|
|
|
|
|
* a #GtkMenuBar
|
|
|
|
|
*
|
|
|
|
|
* - toolbar
|
|
|
|
|
*
|
|
|
|
|
* a #GtkToolbar
|
|
|
|
|
*
|
|
|
|
|
* - popup
|
|
|
|
|
*
|
|
|
|
|
* a toplevel #GtkMenu
|
|
|
|
|
*
|
|
|
|
|
* - menu
|
|
|
|
|
*
|
|
|
|
|
* a #GtkMenu attached to a menuitem
|
|
|
|
|
*
|
|
|
|
|
* - menuitem
|
|
|
|
|
*
|
|
|
|
|
* a #GtkMenuItem subclass, the exact type depends on the action
|
|
|
|
|
*
|
|
|
|
|
* - toolitem
|
|
|
|
|
*
|
|
|
|
|
* a #GtkToolItem subclass, the exact type depends on the
|
|
|
|
|
* action. Note that toolitem elements may contain a menu element,
|
|
|
|
|
* but only if their associated action specifies a
|
|
|
|
|
* #GtkMenuToolButton as proxy.
|
|
|
|
|
*
|
|
|
|
|
* - separator
|
|
|
|
|
*
|
|
|
|
|
* a #GtkSeparatorMenuItem or #GtkSeparatorToolItem
|
|
|
|
|
*
|
|
|
|
|
* - accelerator
|
|
|
|
|
*
|
|
|
|
|
* a keyboard accelerator
|
2011-04-18 17:53:30 +00:00
|
|
|
|
*
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* The “position” attribute determines where a constructed widget is positioned
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* wrt. to its siblings in the partially constructed tree. If it is
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* “top”, the widget is prepended, otherwise it is appended.
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
|
|
|
|
* # UI Merging # {#UI-Merging}
|
|
|
|
|
*
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* The most remarkable feature of #GtkUIManager is that it can overlay a set
|
|
|
|
|
* of menuitems and toolitems over another one, and demerge them later.
|
|
|
|
|
*
|
|
|
|
|
* Merging is done based on the names of the XML elements. Each element is
|
|
|
|
|
* identified by a path which consists of the names of its anchestors, separated
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* by slashes. For example, the menuitem named “Left” in the example above
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* has the path `/ui/menubar/JustifyMenu/Left` and the
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* toolitem with the same name has path
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* `/ui/toolbar1/JustifyToolItems/Left`.
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
|
|
|
|
* # Accelerators #
|
|
|
|
|
*
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* Every action has an accelerator path. Accelerators are installed together
|
|
|
|
|
* with menuitem proxies, but they can also be explicitly added with
|
|
|
|
|
* <accelerator> elements in the UI definition. This makes it possible to
|
|
|
|
|
* have accelerators for actions even if they have no visible proxies.
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
|
|
|
|
* # Smart Separators # {#Smart-Separators}
|
|
|
|
|
*
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* The separators created by #GtkUIManager are “smart”, i.e. they do not show up
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* in the UI unless they end up between two visible menu or tool items. Separators
|
|
|
|
|
* which are located at the very beginning or end of the menu or toolbar
|
|
|
|
|
* containing them, or multiple separators next to each other, are hidden. This
|
|
|
|
|
* is a useful feature, since the merging of UI elements from multiple sources
|
|
|
|
|
* can make it hard or impossible to determine in advance whether a separator
|
|
|
|
|
* will end up in such an unfortunate position.
|
|
|
|
|
*
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* For separators in toolbars, you can set `expand="true"` to
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* turn them from a small, visible separator to an expanding, invisible one.
|
|
|
|
|
* Toolitems following an expanding separator are effectively right-aligned.
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
|
|
|
|
* # Empty Menus
|
|
|
|
|
*
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* Submenus pose similar problems to separators inconnection with merging. It is
|
|
|
|
|
* impossible to know in advance whether they will end up empty after merging.
|
|
|
|
|
* #GtkUIManager offers two ways to treat empty submenus:
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
2014-02-07 18:37:09 +00:00
|
|
|
|
* - make them disappear by hiding the menu item they’re attached to
|
2014-02-05 00:33:43 +00:00
|
|
|
|
*
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* - add an insensitive “Empty” item
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* The behaviour is chosen based on the “hide_if_empty” property of the action
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* to which the submenu is associated.
|
2014-02-04 20:42:30 +00:00
|
|
|
|
*
|
|
|
|
|
* # GtkUIManager as GtkBuildable # {#GtkUIManager-BUILDER-UI}
|
|
|
|
|
*
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* The GtkUIManager implementation of the GtkBuildable interface accepts
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* GtkActionGroup objects as <child> elements in UI definitions.
|
2011-04-18 17:53:30 +00:00
|
|
|
|
*
|
|
|
|
|
* A GtkUIManager UI definition as described above can be embedded in
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* an GtkUIManager <object> element in a GtkBuilder UI definition.
|
2011-04-18 17:53:30 +00:00
|
|
|
|
*
|
|
|
|
|
* The widgets that are constructed by a GtkUIManager can be embedded in
|
|
|
|
|
* other parts of the constructed user interface with the help of the
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* “constructor” attribute. See the example below.
|
2011-04-18 17:53:30 +00:00
|
|
|
|
*
|
2014-02-04 20:42:30 +00:00
|
|
|
|
* ## An embedded GtkUIManager UI definition
|
|
|
|
|
*
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* |[
|
2011-04-18 17:53:30 +00:00
|
|
|
|
* <object class="GtkUIManager" id="uiman">
|
|
|
|
|
* <child>
|
|
|
|
|
* <object class="GtkActionGroup" id="actiongroup">
|
|
|
|
|
* <child>
|
|
|
|
|
* <object class="GtkAction" id="file">
|
|
|
|
|
* <property name="label">_File</property>
|
|
|
|
|
* </object>
|
|
|
|
|
* </child>
|
|
|
|
|
* </object>
|
|
|
|
|
* </child>
|
|
|
|
|
* <ui>
|
|
|
|
|
* <menubar name="menubar1">
|
|
|
|
|
* <menu action="file">
|
|
|
|
|
* </menu>
|
|
|
|
|
* </menubar>
|
|
|
|
|
* </ui>
|
|
|
|
|
* </object>
|
|
|
|
|
* <object class="GtkWindow" id="main-window">
|
|
|
|
|
* <child>
|
|
|
|
|
* <object class="GtkMenuBar" id="menubar1" constructor="uiman"/>
|
|
|
|
|
* </child>
|
|
|
|
|
* </object>
|
2014-01-27 17:12:55 +00:00
|
|
|
|
* ]|
|
2011-04-18 17:53:30 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2003-11-27 21:17:41 +00:00
|
|
|
|
#undef DEBUG_UI_MANAGER
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2008-07-21 12:23:22 +00:00
|
|
|
|
typedef enum
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_UNDECIDED,
|
|
|
|
|
NODE_TYPE_ROOT,
|
|
|
|
|
NODE_TYPE_MENUBAR,
|
|
|
|
|
NODE_TYPE_MENU,
|
|
|
|
|
NODE_TYPE_TOOLBAR,
|
|
|
|
|
NODE_TYPE_MENU_PLACEHOLDER,
|
|
|
|
|
NODE_TYPE_TOOLBAR_PLACEHOLDER,
|
|
|
|
|
NODE_TYPE_POPUP,
|
|
|
|
|
NODE_TYPE_MENUITEM,
|
|
|
|
|
NODE_TYPE_TOOLITEM,
|
|
|
|
|
NODE_TYPE_SEPARATOR,
|
2003-09-17 23:58:28 +00:00
|
|
|
|
NODE_TYPE_ACCELERATOR
|
2003-09-04 00:15:59 +00:00
|
|
|
|
} NodeType;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2003-09-30 20:55:24 +00:00
|
|
|
|
typedef struct _Node Node;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2003-09-04 00:15:59 +00:00
|
|
|
|
struct _Node {
|
|
|
|
|
NodeType type;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2003-09-11 21:02:24 +00:00
|
|
|
|
gchar *name;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
GQuark action_name;
|
|
|
|
|
GtkAction *action;
|
|
|
|
|
GtkWidget *proxy;
|
2003-09-30 20:55:24 +00:00
|
|
|
|
GtkWidget *extra; /* second separator for placeholders */
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
GList *uifiles;
|
|
|
|
|
|
|
|
|
|
guint dirty : 1;
|
2005-02-08 15:54:09 +00:00
|
|
|
|
guint expand : 1; /* used for separators */
|
2008-10-09 08:50:33 +00:00
|
|
|
|
guint popup_accels : 1;
|
2009-11-11 17:59:12 +00:00
|
|
|
|
guint always_show_image_set : 1; /* used for menu items */
|
|
|
|
|
guint always_show_image : 1; /* used for menu items */
|
2003-08-24 19:58:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2003-08-25 23:13:47 +00:00
|
|
|
|
struct _GtkUIManagerPrivate
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
GtkAccelGroup *accel_group;
|
|
|
|
|
|
|
|
|
|
GNode *root_node;
|
|
|
|
|
GList *action_groups;
|
|
|
|
|
|
|
|
|
|
guint last_merge_id;
|
|
|
|
|
|
|
|
|
|
guint update_tag;
|
2003-08-29 22:42:37 +00:00
|
|
|
|
|
|
|
|
|
gboolean add_tearoffs;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-09-04 00:15:59 +00:00
|
|
|
|
#define NODE_INFO(node) ((Node *)node->data)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
typedef struct _NodeUIReference NodeUIReference;
|
|
|
|
|
|
|
|
|
|
struct _NodeUIReference
|
|
|
|
|
{
|
|
|
|
|
guint merge_id;
|
|
|
|
|
GQuark action_quark;
|
|
|
|
|
};
|
|
|
|
|
|
2004-12-01 16:04:28 +00:00
|
|
|
|
static void gtk_ui_manager_finalize (GObject *object);
|
|
|
|
|
static void gtk_ui_manager_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static void gtk_ui_manager_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
|
|
|
|
static GtkWidget * gtk_ui_manager_real_get_widget (GtkUIManager *manager,
|
|
|
|
|
const gchar *path);
|
|
|
|
|
static GtkAction * gtk_ui_manager_real_get_action (GtkUIManager *manager,
|
|
|
|
|
const gchar *path);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
static void queue_update (GtkUIManager *manager);
|
|
|
|
|
static void dirty_all_nodes (GtkUIManager *manager);
|
2004-12-01 16:04:28 +00:00
|
|
|
|
static void mark_node_dirty (GNode *node);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
static GNode * get_child_node (GtkUIManager *manager,
|
2004-12-01 16:04:28 +00:00
|
|
|
|
GNode *parent,
|
2005-06-19 03:55:12 +00:00
|
|
|
|
GNode *sibling,
|
2004-12-01 16:04:28 +00:00
|
|
|
|
const gchar *childname,
|
|
|
|
|
gint childname_length,
|
|
|
|
|
NodeType node_type,
|
|
|
|
|
gboolean create,
|
|
|
|
|
gboolean top);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
static GNode * get_node (GtkUIManager *manager,
|
2004-12-01 16:04:28 +00:00
|
|
|
|
const gchar *path,
|
|
|
|
|
NodeType node_type,
|
|
|
|
|
gboolean create);
|
|
|
|
|
static gboolean free_node (GNode *node);
|
|
|
|
|
static void node_prepend_ui_reference (GNode *node,
|
|
|
|
|
guint merge_id,
|
|
|
|
|
GQuark action_quark);
|
|
|
|
|
static void node_remove_ui_reference (GNode *node,
|
|
|
|
|
guint merge_id);
|
2003-09-15 20:35:28 +00:00
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
/* GtkBuildable */
|
2007-06-19 12:23:36 +00:00
|
|
|
|
static void gtk_ui_manager_buildable_init (GtkBuildableIface *iface);
|
|
|
|
|
static void gtk_ui_manager_buildable_add_child (GtkBuildable *buildable,
|
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
GObject *child,
|
|
|
|
|
const gchar *type);
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
static GObject* gtk_ui_manager_buildable_construct_child (GtkBuildable *buildable,
|
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
const gchar *name);
|
|
|
|
|
static gboolean gtk_ui_manager_buildable_custom_tag_start (GtkBuildable *buildable,
|
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
GObject *child,
|
|
|
|
|
const gchar *tagname,
|
|
|
|
|
GMarkupParser *parser,
|
|
|
|
|
gpointer *data);
|
|
|
|
|
static void gtk_ui_manager_buildable_custom_tag_end (GtkBuildable *buildable,
|
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
GObject *child,
|
|
|
|
|
const gchar *tagname,
|
|
|
|
|
gpointer *data);
|
2011-11-10 04:45:58 +00:00
|
|
|
|
static void gtk_ui_manager_do_set_add_tearoffs (GtkUIManager *manager,
|
|
|
|
|
gboolean add_tearoffs);
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
ADD_WIDGET,
|
2003-09-21 22:04:48 +00:00
|
|
|
|
ACTIONS_CHANGED,
|
2004-01-12 22:45:45 +00:00
|
|
|
|
CONNECT_PROXY,
|
|
|
|
|
DISCONNECT_PROXY,
|
|
|
|
|
PRE_ACTIVATE,
|
|
|
|
|
POST_ACTIVATE,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
|
|
|
|
|
2003-08-29 22:42:37 +00:00
|
|
|
|
enum
|
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
2003-09-21 22:04:48 +00:00
|
|
|
|
PROP_ADD_TEAROFFS,
|
|
|
|
|
PROP_UI
|
2003-08-29 22:42:37 +00:00
|
|
|
|
};
|
|
|
|
|
|
2004-01-12 22:45:45 +00:00
|
|
|
|
static guint ui_manager_signals[LAST_SIGNAL] = { 0 };
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2007-06-15 21:48:32 +00:00
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GtkUIManager, gtk_ui_manager, G_TYPE_OBJECT,
|
2013-06-27 19:02:52 +00:00
|
|
|
|
G_ADD_PRIVATE (GtkUIManager)
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
|
|
|
|
|
gtk_ui_manager_buildable_init))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2003-08-25 23:13:47 +00:00
|
|
|
|
gtk_ui_manager_class_init (GtkUIManagerClass *klass)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
|
|
|
|
|
|
gobject_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
2003-08-31 22:29:42 +00:00
|
|
|
|
gobject_class->finalize = gtk_ui_manager_finalize;
|
2003-08-29 22:42:37 +00:00
|
|
|
|
gobject_class->set_property = gtk_ui_manager_set_property;
|
|
|
|
|
gobject_class->get_property = gtk_ui_manager_get_property;
|
2004-12-01 16:04:28 +00:00
|
|
|
|
klass->get_widget = gtk_ui_manager_real_get_widget;
|
|
|
|
|
klass->get_action = gtk_ui_manager_real_get_action;
|
|
|
|
|
|
2003-08-29 22:42:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkUIManager:add-tearoffs:
|
|
|
|
|
*
|
2003-09-01 22:15:16 +00:00
|
|
|
|
* The "add-tearoffs" property controls whether generated menus
|
2003-08-29 22:42:37 +00:00
|
|
|
|
* have tearoff menu items.
|
|
|
|
|
*
|
|
|
|
|
* Note that this only affects regular menus. Generated popup
|
|
|
|
|
* menus never have tearoff menu items.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2011-10-01 03:58:27 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.4: Tearoff menus are deprecated and should not
|
|
|
|
|
* be used in newly written code.
|
2003-08-29 22:42:37 +00:00
|
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_ADD_TEAROFFS,
|
2005-03-09 06:15:13 +00:00
|
|
|
|
g_param_spec_boolean ("add-tearoffs",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Add tearoffs to menus"),
|
|
|
|
|
P_("Whether tearoff menu items should be added to menus"),
|
2003-08-29 22:42:37 +00:00
|
|
|
|
FALSE,
|
2011-10-01 03:58:27 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED));
|
2003-09-21 22:04:48 +00:00
|
|
|
|
|
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
|
PROP_UI,
|
|
|
|
|
g_param_spec_string ("ui",
|
2004-01-16 23:10:05 +00:00
|
|
|
|
P_("Merged UI definition"),
|
|
|
|
|
P_("An XML string describing the merged UI"),
|
2005-08-30 14:11:50 +00:00
|
|
|
|
"<ui>\n</ui>\n",
|
2005-03-22 02:14:55 +00:00
|
|
|
|
GTK_PARAM_READABLE));
|
2003-09-21 22:04:48 +00:00
|
|
|
|
|
|
|
|
|
|
2003-08-29 22:42:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* GtkUIManager::add-widget:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-08-29 22:42:37 +00:00
|
|
|
|
* @widget: the added widget
|
|
|
|
|
*
|
2010-06-15 13:27:24 +00:00
|
|
|
|
* The ::add-widget signal is emitted for each generated menubar and toolbar.
|
2003-08-29 22:42:37 +00:00
|
|
|
|
* It is not emitted for generated popup menus, which can be obtained by
|
|
|
|
|
* gtk_ui_manager_get_widget().
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-29 22:42:37 +00:00
|
|
|
|
*/
|
2004-01-12 22:45:45 +00:00
|
|
|
|
ui_manager_signals[ADD_WIDGET] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_new (I_("add-widget"),
|
2003-08-24 19:58:30 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
2004-05-03 18:55:50 +00:00
|
|
|
|
G_STRUCT_OFFSET (GtkUIManagerClass, add_widget),
|
|
|
|
|
NULL, NULL,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_cclosure_marshal_VOID__OBJECT,
|
2003-08-29 23:33:54 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
GTK_TYPE_WIDGET);
|
2003-08-29 22:42:37 +00:00
|
|
|
|
|
2003-08-29 23:33:54 +00:00
|
|
|
|
/**
|
2003-09-21 22:04:48 +00:00
|
|
|
|
* GtkUIManager::actions-changed:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-08-29 23:33:54 +00:00
|
|
|
|
*
|
2010-06-15 13:27:24 +00:00
|
|
|
|
* The ::actions-changed signal is emitted whenever the set of actions
|
2003-09-21 22:04:48 +00:00
|
|
|
|
* changes.
|
2003-08-29 23:33:54 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-29 23:33:54 +00:00
|
|
|
|
*/
|
2004-01-12 22:45:45 +00:00
|
|
|
|
ui_manager_signals[ACTIONS_CHANGED] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_new (I_("actions-changed"),
|
2003-08-29 23:33:54 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
2003-09-21 22:04:48 +00:00
|
|
|
|
G_STRUCT_OFFSET (GtkUIManagerClass, actions_changed),
|
|
|
|
|
NULL, NULL,
|
2003-08-29 23:33:54 +00:00
|
|
|
|
g_cclosure_marshal_VOID__VOID,
|
|
|
|
|
G_TYPE_NONE, 0);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-01-12 22:45:45 +00:00
|
|
|
|
/**
|
2004-08-02 04:14:17 +00:00
|
|
|
|
* GtkUIManager::connect-proxy:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: the ui manager
|
2004-01-12 22:45:45 +00:00
|
|
|
|
* @action: the action
|
|
|
|
|
* @proxy: the proxy
|
|
|
|
|
*
|
2010-06-15 13:27:24 +00:00
|
|
|
|
* The ::connect-proxy signal is emitted after connecting a proxy to
|
2004-01-12 22:45:45 +00:00
|
|
|
|
* an action in the group.
|
|
|
|
|
*
|
|
|
|
|
* 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
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2004-01-12 22:45:45 +00:00
|
|
|
|
*/
|
|
|
|
|
ui_manager_signals[CONNECT_PROXY] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_new (I_("connect-proxy"),
|
2004-01-12 22:45:45 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
2004-05-03 18:55:50 +00:00
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
|
|
|
|
G_STRUCT_OFFSET (GtkUIManagerClass, connect_proxy),
|
2004-02-19 00:38:23 +00:00
|
|
|
|
NULL, NULL,
|
2004-01-12 22:45:45 +00:00
|
|
|
|
_gtk_marshal_VOID__OBJECT_OBJECT,
|
|
|
|
|
G_TYPE_NONE, 2,
|
2004-05-03 18:55:50 +00:00
|
|
|
|
GTK_TYPE_ACTION,
|
|
|
|
|
GTK_TYPE_WIDGET);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2004-08-02 04:14:17 +00:00
|
|
|
|
* GtkUIManager::disconnect-proxy:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: the ui manager
|
2004-01-12 22:45:45 +00:00
|
|
|
|
* @action: the action
|
|
|
|
|
* @proxy: the proxy
|
|
|
|
|
*
|
2010-06-15 13:27:24 +00:00
|
|
|
|
* The ::disconnect-proxy signal is emitted after disconnecting a proxy
|
2004-01-12 22:45:45 +00:00
|
|
|
|
* from an action in the group.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2004-01-12 22:45:45 +00:00
|
|
|
|
*/
|
|
|
|
|
ui_manager_signals[DISCONNECT_PROXY] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_new (I_("disconnect-proxy"),
|
2004-01-12 22:45:45 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
2004-05-03 18:55:50 +00:00
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
|
|
|
|
G_STRUCT_OFFSET (GtkUIManagerClass, disconnect_proxy),
|
|
|
|
|
NULL, NULL,
|
2004-01-12 22:45:45 +00:00
|
|
|
|
_gtk_marshal_VOID__OBJECT_OBJECT,
|
2004-05-03 18:55:50 +00:00
|
|
|
|
G_TYPE_NONE, 2,
|
|
|
|
|
GTK_TYPE_ACTION,
|
|
|
|
|
GTK_TYPE_WIDGET);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2004-08-02 04:14:17 +00:00
|
|
|
|
* GtkUIManager::pre-activate:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: the ui manager
|
2004-01-12 22:45:45 +00:00
|
|
|
|
* @action: the action
|
|
|
|
|
*
|
2010-06-15 13:27:24 +00:00
|
|
|
|
* The ::pre-activate signal is emitted just before the @action
|
2004-01-12 22:45:45 +00:00
|
|
|
|
* is activated.
|
|
|
|
|
*
|
|
|
|
|
* This is intended for applications to get notification
|
|
|
|
|
* just before any action is activated.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2004-01-12 22:45:45 +00:00
|
|
|
|
*/
|
|
|
|
|
ui_manager_signals[PRE_ACTIVATE] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_new (I_("pre-activate"),
|
2004-01-12 22:45:45 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
2004-05-03 18:55:50 +00:00
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
|
|
|
|
G_STRUCT_OFFSET (GtkUIManagerClass, pre_activate),
|
|
|
|
|
NULL, NULL,
|
2004-01-12 22:45:45 +00:00
|
|
|
|
_gtk_marshal_VOID__OBJECT,
|
2004-05-03 18:55:50 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
2004-01-12 22:45:45 +00:00
|
|
|
|
GTK_TYPE_ACTION);
|
|
|
|
|
|
|
|
|
|
/**
|
2004-08-02 04:14:17 +00:00
|
|
|
|
* GtkUIManager::post-activate:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: the ui manager
|
2004-01-12 22:45:45 +00:00
|
|
|
|
* @action: the action
|
|
|
|
|
*
|
2010-06-15 13:27:24 +00:00
|
|
|
|
* The ::post-activate signal is emitted just after the @action
|
2004-01-12 22:45:45 +00:00
|
|
|
|
* is activated.
|
|
|
|
|
*
|
|
|
|
|
* This is intended for applications to get notification
|
|
|
|
|
* just after any action is activated.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2004-01-12 22:45:45 +00:00
|
|
|
|
*/
|
|
|
|
|
ui_manager_signals[POST_ACTIVATE] =
|
2008-08-08 13:53:05 +00:00
|
|
|
|
g_signal_new (I_("post-activate"),
|
2004-01-12 22:45:45 +00:00
|
|
|
|
G_OBJECT_CLASS_TYPE (klass),
|
2004-05-03 18:55:50 +00:00
|
|
|
|
G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
|
|
|
|
|
G_STRUCT_OFFSET (GtkUIManagerClass, post_activate),
|
|
|
|
|
NULL, NULL,
|
2004-01-12 22:45:45 +00:00
|
|
|
|
_gtk_marshal_VOID__OBJECT,
|
2004-05-03 18:55:50 +00:00
|
|
|
|
G_TYPE_NONE, 1,
|
2004-01-12 22:45:45 +00:00
|
|
|
|
GTK_TYPE_ACTION);
|
|
|
|
|
|
2004-05-03 18:55:50 +00:00
|
|
|
|
klass->add_widget = NULL;
|
|
|
|
|
klass->actions_changed = NULL;
|
|
|
|
|
klass->connect_proxy = NULL;
|
|
|
|
|
klass->disconnect_proxy = NULL;
|
|
|
|
|
klass->pre_activate = NULL;
|
|
|
|
|
klass->post_activate = NULL;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_init (GtkUIManager *manager)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
guint merge_id;
|
|
|
|
|
GNode *node;
|
|
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
|
manager->private_data = gtk_ui_manager_get_instance_private (manager);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->accel_group = gtk_accel_group_new ();
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->root_node = NULL;
|
|
|
|
|
manager->private_data->action_groups = NULL;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->last_merge_id = 0;
|
|
|
|
|
manager->private_data->add_tearoffs = FALSE;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
merge_id = gtk_ui_manager_new_merge_id (manager);
|
|
|
|
|
node = get_child_node (manager, NULL, NULL, "ui", 2,
|
2003-09-11 21:02:24 +00:00
|
|
|
|
NODE_TYPE_ROOT, TRUE, FALSE);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (node, merge_id, 0);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-31 22:29:42 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_ui_manager_finalize (GObject *object)
|
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager = GTK_UI_MANAGER (object);
|
2003-08-31 22:29:42 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
if (manager->private_data->update_tag != 0)
|
2003-08-31 22:29:42 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_source_remove (manager->private_data->update_tag);
|
|
|
|
|
manager->private_data->update_tag = 0;
|
2003-08-31 22:29:42 +00:00
|
|
|
|
}
|
2003-09-11 21:02:24 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_node_traverse (manager->private_data->root_node,
|
2003-09-11 21:02:24 +00:00
|
|
|
|
G_POST_ORDER, G_TRAVERSE_ALL, -1,
|
2004-10-28 15:00:05 +00:00
|
|
|
|
(GNodeTraverseFunc)free_node, NULL);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_node_destroy (manager->private_data->root_node);
|
|
|
|
|
manager->private_data->root_node = NULL;
|
2003-09-11 21:02:24 +00:00
|
|
|
|
|
2012-01-02 03:20:59 +00:00
|
|
|
|
g_list_free_full (manager->private_data->action_groups, g_object_unref);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->action_groups = NULL;
|
2003-09-11 21:02:24 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_object_unref (manager->private_data->accel_group);
|
|
|
|
|
manager->private_data->accel_group = NULL;
|
2004-02-22 02:06:49 +00:00
|
|
|
|
|
2006-05-02 23:56:43 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_ui_manager_parent_class)->finalize (object);
|
2003-08-31 22:29:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_ui_manager_buildable_init (GtkBuildableIface *iface)
|
|
|
|
|
{
|
2007-06-19 12:23:36 +00:00
|
|
|
|
iface->add_child = gtk_ui_manager_buildable_add_child;
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
iface->construct_child = gtk_ui_manager_buildable_construct_child;
|
|
|
|
|
iface->custom_tag_start = gtk_ui_manager_buildable_custom_tag_start;
|
|
|
|
|
iface->custom_tag_end = gtk_ui_manager_buildable_custom_tag_end;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2007-06-19 12:23:36 +00:00
|
|
|
|
gtk_ui_manager_buildable_add_child (GtkBuildable *buildable,
|
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
GObject *child,
|
|
|
|
|
const gchar *type)
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager = GTK_UI_MANAGER (buildable);
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
guint pos;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ACTION_GROUP (child));
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
pos = g_list_length (manager->private_data->action_groups);
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_insert_action_group (manager,
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
GTK_ACTION_GROUP (child),
|
|
|
|
|
pos);
|
|
|
|
|
}
|
|
|
|
|
|
2007-07-09 13:40:10 +00:00
|
|
|
|
static void
|
|
|
|
|
child_hierarchy_changed_cb (GtkWidget *widget,
|
|
|
|
|
GtkWidget *unused,
|
|
|
|
|
GtkUIManager *uimgr)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *toplevel;
|
|
|
|
|
GtkAccelGroup *group;
|
|
|
|
|
GSList *groups;
|
|
|
|
|
|
|
|
|
|
toplevel = gtk_widget_get_toplevel (widget);
|
|
|
|
|
if (!toplevel || !GTK_IS_WINDOW (toplevel))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
group = gtk_ui_manager_get_accel_group (uimgr);
|
2008-01-09 17:02:50 +00:00
|
|
|
|
groups = gtk_accel_groups_from_object (G_OBJECT (toplevel));
|
2007-07-09 13:40:10 +00:00
|
|
|
|
if (g_slist_find (groups, group) == NULL)
|
|
|
|
|
gtk_window_add_accel_group (GTK_WINDOW (toplevel), group);
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (widget,
|
|
|
|
|
child_hierarchy_changed_cb,
|
|
|
|
|
uimgr);
|
|
|
|
|
}
|
|
|
|
|
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
static GObject *
|
|
|
|
|
gtk_ui_manager_buildable_construct_child (GtkBuildable *buildable,
|
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
const gchar *id)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *widget;
|
|
|
|
|
char *name;
|
|
|
|
|
|
|
|
|
|
name = g_strdup_printf ("ui/%s", id);
|
|
|
|
|
widget = gtk_ui_manager_get_widget (GTK_UI_MANAGER (buildable), name);
|
|
|
|
|
if (!widget)
|
2007-07-09 13:40:10 +00:00
|
|
|
|
{
|
|
|
|
|
g_error ("Unknown ui manager child: %s\n", name);
|
|
|
|
|
g_free (name);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
g_free (name);
|
|
|
|
|
|
2007-07-09 13:40:10 +00:00
|
|
|
|
g_signal_connect (widget, "hierarchy-changed",
|
|
|
|
|
G_CALLBACK (child_hierarchy_changed_cb),
|
|
|
|
|
GTK_UI_MANAGER (buildable));
|
2007-11-27 03:25:09 +00:00
|
|
|
|
return g_object_ref (widget);
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-29 22:42:37 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_ui_manager_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager = GTK_UI_MANAGER (object);
|
2003-08-29 22:42:37 +00:00
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_ADD_TEAROFFS:
|
2011-11-10 04:45:58 +00:00
|
|
|
|
gtk_ui_manager_do_set_add_tearoffs (manager, g_value_get_boolean (value));
|
2003-08-29 22:42:37 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_ui_manager_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager = GTK_UI_MANAGER (object);
|
2003-08-29 22:42:37 +00:00
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_ADD_TEAROFFS:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_value_set_boolean (value, manager->private_data->add_tearoffs);
|
2003-08-29 22:42:37 +00:00
|
|
|
|
break;
|
2003-09-21 22:04:48 +00:00
|
|
|
|
case PROP_UI:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_value_take_string (value, gtk_ui_manager_get_ui (manager));
|
2003-09-21 22:04:48 +00:00
|
|
|
|
break;
|
2003-08-29 22:42:37 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-01 16:04:28 +00:00
|
|
|
|
static GtkWidget *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_real_get_widget (GtkUIManager *manager,
|
2004-12-01 16:04:28 +00:00
|
|
|
|
const gchar *path)
|
|
|
|
|
{
|
|
|
|
|
GNode *node;
|
|
|
|
|
|
|
|
|
|
/* ensure that there are no pending updates before we get the
|
|
|
|
|
* widget */
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_ensure_update (manager);
|
2004-12-01 16:04:28 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
node = get_node (manager, path, NODE_TYPE_UNDECIDED, FALSE);
|
2004-12-01 16:04:28 +00:00
|
|
|
|
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
return NODE_INFO (node)->proxy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GtkAction *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_real_get_action (GtkUIManager *manager,
|
2004-12-01 16:04:28 +00:00
|
|
|
|
const gchar *path)
|
|
|
|
|
{
|
|
|
|
|
GNode *node;
|
|
|
|
|
|
|
|
|
|
/* ensure that there are no pending updates before we get
|
|
|
|
|
* the action */
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_ensure_update (manager);
|
2004-12-01 16:04:28 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
node = get_node (manager, path, NODE_TYPE_UNDECIDED, FALSE);
|
2004-12-01 16:04:28 +00:00
|
|
|
|
|
|
|
|
|
if (node == NULL)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
return NODE_INFO (node)->action;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_new:
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2003-08-31 00:27:15 +00:00
|
|
|
|
* Creates a new ui manager object.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: a new ui manager object.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
2003-08-25 23:13:47 +00:00
|
|
|
|
GtkUIManager*
|
|
|
|
|
gtk_ui_manager_new (void)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2003-08-25 23:13:47 +00:00
|
|
|
|
return g_object_new (GTK_TYPE_UI_MANAGER, NULL);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-08-29 22:42:37 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_ui_manager_get_add_tearoffs:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-08-29 22:42:37 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns whether menus generated by this #GtkUIManager
|
|
|
|
|
* will have tearoff menu items.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: whether tearoff menu items are added
|
2003-08-29 22:42:37 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2011-10-01 03:58:27 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.4: Tearoff menus are deprecated and should not
|
|
|
|
|
* be used in newly written code.
|
2003-08-29 22:42:37 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_get_add_tearoffs (GtkUIManager *manager)
|
2003-08-29 22:42:37 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), FALSE);
|
2003-08-29 22:42:37 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
return manager->private_data->add_tearoffs;
|
2003-08-29 22:42:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_ui_manager_set_add_tearoffs:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-08-29 22:42:37 +00:00
|
|
|
|
* @add_tearoffs: whether tearoff menu items are added
|
|
|
|
|
*
|
2014-02-05 18:07:34 +00:00
|
|
|
|
* Sets the “add_tearoffs” property, which controls whether menus
|
2003-08-29 22:42:37 +00:00
|
|
|
|
* generated by this #GtkUIManager will have tearoff menu items.
|
|
|
|
|
*
|
|
|
|
|
* Note that this only affects regular menus. Generated popup
|
|
|
|
|
* menus never have tearoff menu items.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2011-10-01 03:58:27 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.4: Tearoff menus are deprecated and should not
|
|
|
|
|
* be used in newly written code.
|
2003-08-29 22:42:37 +00:00
|
|
|
|
**/
|
2011-11-10 04:45:58 +00:00
|
|
|
|
void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_set_add_tearoffs (GtkUIManager *manager,
|
2011-11-10 04:45:58 +00:00
|
|
|
|
gboolean add_tearoffs)
|
2003-08-29 22:42:37 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_UI_MANAGER (manager));
|
2003-08-29 22:42:37 +00:00
|
|
|
|
|
2011-11-10 04:45:58 +00:00
|
|
|
|
gtk_ui_manager_do_set_add_tearoffs (manager, add_tearoffs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_ui_manager_do_set_add_tearoffs (GtkUIManager *manager,
|
|
|
|
|
gboolean add_tearoffs)
|
|
|
|
|
{
|
2003-08-29 22:42:37 +00:00
|
|
|
|
add_tearoffs = add_tearoffs != FALSE;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
if (add_tearoffs != manager->private_data->add_tearoffs)
|
2003-08-29 22:42:37 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->add_tearoffs = add_tearoffs;
|
2011-11-10 04:45:58 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
dirty_all_nodes (manager);
|
2003-08-29 22:42:37 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_object_notify (G_OBJECT (manager), "add-tearoffs");
|
2003-08-29 22:42:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-12 22:45:45 +00:00
|
|
|
|
static void
|
|
|
|
|
cb_proxy_connect_proxy (GtkActionGroup *group,
|
|
|
|
|
GtkAction *action,
|
|
|
|
|
GtkWidget *proxy,
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager)
|
2004-01-12 22:45:45 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_signal_emit (manager, ui_manager_signals[CONNECT_PROXY], 0, action, proxy);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
cb_proxy_disconnect_proxy (GtkActionGroup *group,
|
|
|
|
|
GtkAction *action,
|
|
|
|
|
GtkWidget *proxy,
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager)
|
2004-01-12 22:45:45 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_signal_emit (manager, ui_manager_signals[DISCONNECT_PROXY], 0, action, proxy);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
cb_proxy_pre_activate (GtkActionGroup *group,
|
|
|
|
|
GtkAction *action,
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager)
|
2004-01-12 22:45:45 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_signal_emit (manager, ui_manager_signals[PRE_ACTIVATE], 0, action);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
cb_proxy_post_activate (GtkActionGroup *group,
|
|
|
|
|
GtkAction *action,
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager)
|
2004-01-12 22:45:45 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_signal_emit (manager, ui_manager_signals[POST_ACTIVATE], 0, action);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_insert_action_group:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager object
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* @action_group: the action group to be inserted
|
2003-08-31 13:49:15 +00:00
|
|
|
|
* @pos: the position at which the group will be inserted.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2003-08-29 22:42:37 +00:00
|
|
|
|
* Inserts an action group into the list of action groups associated
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* with @manager. Actions in earlier groups hide actions with the same
|
2003-09-15 22:21:26 +00:00
|
|
|
|
* name in later groups.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2012-02-12 23:25:03 +00:00
|
|
|
|
* If @pos is larger than the number of action groups in @manager, or
|
|
|
|
|
* negative, @action_group will be inserted at the end of the internal
|
|
|
|
|
* list.
|
|
|
|
|
*
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_insert_action_group (GtkUIManager *manager,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
GtkActionGroup *action_group,
|
|
|
|
|
gint pos)
|
|
|
|
|
{
|
2008-02-16 03:43:38 +00:00
|
|
|
|
#ifdef G_ENABLE_DEBUG
|
|
|
|
|
GList *l;
|
|
|
|
|
const char *group_name;
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_UI_MANAGER (manager));
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_if_fail (g_list_find (manager->private_data->action_groups,
|
2003-08-29 22:42:37 +00:00
|
|
|
|
action_group) == NULL);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2008-02-16 03:43:38 +00:00
|
|
|
|
#ifdef G_ENABLE_DEBUG
|
|
|
|
|
group_name = gtk_action_group_get_name (action_group);
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
for (l = manager->private_data->action_groups; l; l = l->next)
|
2008-02-16 03:43:38 +00:00
|
|
|
|
{
|
|
|
|
|
GtkActionGroup *group = l->data;
|
|
|
|
|
|
|
|
|
|
if (strcmp (gtk_action_group_get_name (group), group_name) == 0)
|
|
|
|
|
{
|
|
|
|
|
g_warning ("Inserting action group '%s' into UI manager which "
|
|
|
|
|
"already has a group with this name\n", group_name);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif /* G_ENABLE_DEBUG */
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_object_ref (action_group);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->action_groups =
|
|
|
|
|
g_list_insert (manager->private_data->action_groups, action_group, pos);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
g_object_connect (action_group,
|
2010-09-21 04:18:11 +00:00
|
|
|
|
"object-signal::connect-proxy", G_CALLBACK (cb_proxy_connect_proxy), manager,
|
|
|
|
|
"object-signal::disconnect-proxy", G_CALLBACK (cb_proxy_disconnect_proxy), manager,
|
|
|
|
|
"object-signal::pre-activate", G_CALLBACK (cb_proxy_pre_activate), manager,
|
|
|
|
|
"object-signal::post-activate", G_CALLBACK (cb_proxy_post_activate), manager,
|
2004-04-09 13:43:52 +00:00
|
|
|
|
NULL);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
/* dirty all nodes, as action bindings may change */
|
2010-09-21 04:18:11 +00:00
|
|
|
|
dirty_all_nodes (manager);
|
2003-09-21 22:04:48 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_signal_emit (manager, ui_manager_signals[ACTIONS_CHANGED], 0);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_remove_action_group:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager object
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* @action_group: the action group to be removed
|
|
|
|
|
*
|
2003-08-29 22:42:37 +00:00
|
|
|
|
* Removes an action group from the list of action groups associated
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* with @manager.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_remove_action_group (GtkUIManager *manager,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
GtkActionGroup *action_group)
|
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_UI_MANAGER (manager));
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_ACTION_GROUP (action_group));
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_if_fail (g_list_find (manager->private_data->action_groups,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
action_group) != NULL);
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->action_groups =
|
|
|
|
|
g_list_remove (manager->private_data->action_groups, action_group);
|
2004-01-12 22:45:45 +00:00
|
|
|
|
|
|
|
|
|
g_object_disconnect (action_group,
|
2010-09-21 04:18:11 +00:00
|
|
|
|
"any-signal::connect-proxy", G_CALLBACK (cb_proxy_connect_proxy), manager,
|
|
|
|
|
"any-signal::disconnect-proxy", G_CALLBACK (cb_proxy_disconnect_proxy), manager,
|
|
|
|
|
"any-signal::pre-activate", G_CALLBACK (cb_proxy_pre_activate), manager,
|
|
|
|
|
"any-signal::post-activate", G_CALLBACK (cb_proxy_post_activate), manager,
|
2004-04-09 13:43:52 +00:00
|
|
|
|
NULL);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_object_unref (action_group);
|
|
|
|
|
|
|
|
|
|
/* dirty all nodes, as action bindings may change */
|
2010-09-21 04:18:11 +00:00
|
|
|
|
dirty_all_nodes (manager);
|
2003-09-21 22:04:48 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_signal_emit (manager, ui_manager_signals[ACTIONS_CHANGED], 0);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_get_action_groups:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager object
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* Returns the list of action groups associated with @manager.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (element-type GtkActionGroup) (transfer none): a #GList of
|
2009-12-10 10:23:40 +00:00
|
|
|
|
* action groups. The list is owned by GTK+
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* and should not be modified.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
|
|
|
|
GList *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_get_action_groups (GtkUIManager *manager)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), NULL);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
return manager->private_data->action_groups;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_get_accel_group:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager object
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* Returns the #GtkAccelGroup associated with @manager.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (transfer none): the #GtkAccelGroup.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
|
|
|
|
GtkAccelGroup *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_get_accel_group (GtkUIManager *manager)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), NULL);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
return manager->private_data->accel_group;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_get_widget:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* @path: a path
|
|
|
|
|
*
|
2003-09-04 00:00:14 +00:00
|
|
|
|
* Looks up a widget by following a path.
|
|
|
|
|
* The path consists of the names specified in the XML description of the UI.
|
2014-02-07 19:03:49 +00:00
|
|
|
|
* separated by “/”. Elements which don’t have a name or action attribute in
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* the XML (e.g. <popup>) can be addressed by their XML element name
|
2003-09-15 22:21:26 +00:00
|
|
|
|
* (e.g. "popup"). The root element ("/ui") can be omitted in the path.
|
2004-05-11 17:26:48 +00:00
|
|
|
|
*
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* Note that the widget found by following a path that ends in a <menu>;
|
|
|
|
|
* element is the menuitem to which the menu is attached, not the menu it
|
|
|
|
|
* manages.
|
2005-01-13 19:25:29 +00:00
|
|
|
|
*
|
|
|
|
|
* Also note that the widgets constructed by a ui manager are not tied to
|
|
|
|
|
* the lifecycle of the ui manager. If you add the widgets returned by this
|
|
|
|
|
* function to some container or explicitly ref them, they will survive the
|
|
|
|
|
* destruction of the ui manager.
|
2009-12-10 10:23:40 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (transfer none): the widget found by following the path,
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* or %NULL if no widget was found
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
|
|
|
|
GtkWidget *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_get_widget (GtkUIManager *manager,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
const gchar *path)
|
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), NULL);
|
2003-08-31 22:29:42 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
2003-08-30 21:18:43 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
return GTK_UI_MANAGER_GET_CLASS (manager)->get_widget (manager, path);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-01-04 15:32:05 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
GtkUIManagerItemType types;
|
|
|
|
|
GSList *list;
|
|
|
|
|
} ToplevelData;
|
|
|
|
|
|
2004-01-08 23:37:34 +00:00
|
|
|
|
static void
|
|
|
|
|
collect_toplevels (GNode *node,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
2006-01-04 15:32:05 +00:00
|
|
|
|
ToplevelData *data = user_data;
|
|
|
|
|
|
|
|
|
|
if (NODE_INFO (node)->proxy)
|
|
|
|
|
{
|
|
|
|
|
switch (NODE_INFO (node)->type)
|
|
|
|
|
{
|
|
|
|
|
case NODE_TYPE_MENUBAR:
|
|
|
|
|
if (data->types & GTK_UI_MANAGER_MENUBAR)
|
|
|
|
|
data->list = g_slist_prepend (data->list, NODE_INFO (node)->proxy);
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_TOOLBAR:
|
|
|
|
|
if (data->types & GTK_UI_MANAGER_TOOLBAR)
|
|
|
|
|
data->list = g_slist_prepend (data->list, NODE_INFO (node)->proxy);
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_POPUP:
|
|
|
|
|
if (data->types & GTK_UI_MANAGER_POPUP)
|
|
|
|
|
data->list = g_slist_prepend (data->list, NODE_INFO (node)->proxy);
|
|
|
|
|
break;
|
|
|
|
|
default: ;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-01-08 23:37:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_ui_manager_get_toplevels:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2004-01-08 23:37:34 +00:00
|
|
|
|
* @types: specifies the types of toplevel widgets to include. Allowed
|
|
|
|
|
* types are #GTK_UI_MANAGER_MENUBAR, #GTK_UI_MANAGER_TOOLBAR and
|
|
|
|
|
* #GTK_UI_MANAGER_POPUP.
|
|
|
|
|
*
|
|
|
|
|
* Obtains a list of all toplevel widgets of the requested types.
|
2009-12-10 10:23:40 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (element-type GtkWidget) (transfer container): a newly-allocated #GSList of
|
2009-12-10 10:23:40 +00:00
|
|
|
|
* all toplevel widgets of the requested types. Free the returned list with g_slist_free().
|
2004-01-08 23:37:34 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2004-01-08 23:37:34 +00:00
|
|
|
|
**/
|
|
|
|
|
GSList *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_get_toplevels (GtkUIManager *manager,
|
2004-01-08 23:37:34 +00:00
|
|
|
|
GtkUIManagerItemType types)
|
|
|
|
|
{
|
2006-01-04 15:32:05 +00:00
|
|
|
|
ToplevelData data;
|
2004-01-08 23:37:34 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), NULL);
|
2004-01-08 23:37:34 +00:00
|
|
|
|
g_return_val_if_fail ((~(GTK_UI_MANAGER_MENUBAR |
|
|
|
|
|
GTK_UI_MANAGER_TOOLBAR |
|
|
|
|
|
GTK_UI_MANAGER_POPUP) & types) == 0, NULL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.types = types;
|
|
|
|
|
data.list = NULL;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_node_children_foreach (manager->private_data->root_node,
|
2004-01-08 23:37:34 +00:00
|
|
|
|
G_TRAVERSE_ALL,
|
|
|
|
|
collect_toplevels, &data);
|
|
|
|
|
|
|
|
|
|
return data.list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-08-31 13:49:15 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_ui_manager_get_action:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-08-31 13:49:15 +00:00
|
|
|
|
* @path: a path
|
|
|
|
|
*
|
2003-09-04 00:00:14 +00:00
|
|
|
|
* Looks up an action by following a path. See gtk_ui_manager_get_widget()
|
|
|
|
|
* for more information about paths.
|
2003-08-31 13:49:15 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (transfer none): the action whose proxy widget is found by following the path,
|
2003-08-31 13:49:15 +00:00
|
|
|
|
* or %NULL if no widget was found.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-31 13:49:15 +00:00
|
|
|
|
**/
|
2004-12-01 16:04:28 +00:00
|
|
|
|
GtkAction *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_get_action (GtkUIManager *manager,
|
2003-09-11 21:02:24 +00:00
|
|
|
|
const gchar *path)
|
2003-08-31 13:49:15 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), NULL);
|
2003-08-31 22:29:42 +00:00
|
|
|
|
g_return_val_if_fail (path != NULL, NULL);
|
2003-08-31 13:49:15 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
return GTK_UI_MANAGER_GET_CLASS (manager)->get_action (manager, path);
|
2003-08-31 13:49:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-11-29 01:49:37 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
node_is_dead (GNode *node)
|
|
|
|
|
{
|
|
|
|
|
GNode *child;
|
|
|
|
|
|
|
|
|
|
if (NODE_INFO (node)->uifiles != NULL)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
for (child = node->children; child != NULL; child = child->next)
|
|
|
|
|
{
|
|
|
|
|
if (!node_is_dead (child))
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
static GNode *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
get_child_node (GtkUIManager *manager,
|
2003-09-11 21:02:24 +00:00
|
|
|
|
GNode *parent,
|
2005-06-19 03:55:12 +00:00
|
|
|
|
GNode *sibling,
|
2003-09-11 21:02:24 +00:00
|
|
|
|
const gchar *childname,
|
|
|
|
|
gint childname_length,
|
|
|
|
|
NodeType node_type,
|
|
|
|
|
gboolean create,
|
|
|
|
|
gboolean top)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
GNode *child = NULL;
|
|
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
|
{
|
|
|
|
|
if (childname)
|
|
|
|
|
{
|
|
|
|
|
for (child = parent->children; child != NULL; child = child->next)
|
|
|
|
|
{
|
2004-04-13 20:06:12 +00:00
|
|
|
|
if (NODE_INFO (child)->name &&
|
|
|
|
|
strlen (NODE_INFO (child)->name) == childname_length &&
|
2003-08-24 19:58:30 +00:00
|
|
|
|
!strncmp (NODE_INFO (child)->name, childname, childname_length))
|
|
|
|
|
{
|
|
|
|
|
/* if undecided about node type, set it */
|
2003-09-04 00:15:59 +00:00
|
|
|
|
if (NODE_INFO (child)->type == NODE_TYPE_UNDECIDED)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
NODE_INFO (child)->type = node_type;
|
|
|
|
|
|
|
|
|
|
/* warn about type mismatch */
|
2003-09-04 00:15:59 +00:00
|
|
|
|
if (NODE_INFO (child)->type != NODE_TYPE_UNDECIDED &&
|
|
|
|
|
node_type != NODE_TYPE_UNDECIDED &&
|
2003-08-24 19:58:30 +00:00
|
|
|
|
NODE_INFO (child)->type != node_type)
|
|
|
|
|
g_warning ("node type doesn't match %d (%s is type %d)",
|
|
|
|
|
node_type,
|
|
|
|
|
NODE_INFO (child)->name,
|
|
|
|
|
NODE_INFO (child)->type);
|
2009-11-29 01:49:37 +00:00
|
|
|
|
|
|
|
|
|
if (node_is_dead (child))
|
|
|
|
|
{
|
|
|
|
|
/* This node was removed but is still dirty so
|
|
|
|
|
* it is still in the tree. We want to treat this
|
|
|
|
|
* as if it didn't exist, which means we move it
|
|
|
|
|
* to the position it would have been created at.
|
|
|
|
|
*/
|
|
|
|
|
g_node_unlink (child);
|
|
|
|
|
goto insert_child;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
return child;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!child && create)
|
|
|
|
|
{
|
2003-09-04 00:15:59 +00:00
|
|
|
|
Node *mnode;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2005-12-05 21:28:32 +00:00
|
|
|
|
mnode = g_slice_new0 (Node);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
mnode->type = node_type;
|
|
|
|
|
mnode->name = g_strndup (childname, childname_length);
|
|
|
|
|
|
2009-11-29 01:49:37 +00:00
|
|
|
|
child = g_node_new (mnode);
|
|
|
|
|
insert_child:
|
2005-06-19 03:55:12 +00:00
|
|
|
|
if (sibling)
|
|
|
|
|
{
|
|
|
|
|
if (top)
|
2009-11-29 01:49:37 +00:00
|
|
|
|
g_node_insert_before (parent, sibling, child);
|
2005-06-19 03:55:12 +00:00
|
|
|
|
else
|
2009-11-29 01:49:37 +00:00
|
|
|
|
g_node_insert_after (parent, sibling, child);
|
2005-06-19 03:55:12 +00:00
|
|
|
|
}
|
2003-08-24 19:58:30 +00:00
|
|
|
|
else
|
2005-06-19 03:55:12 +00:00
|
|
|
|
{
|
|
|
|
|
if (top)
|
2009-11-29 01:49:37 +00:00
|
|
|
|
g_node_prepend (parent, child);
|
2005-06-19 03:55:12 +00:00
|
|
|
|
else
|
2009-11-29 01:49:37 +00:00
|
|
|
|
g_node_append (parent, child);
|
2005-06-19 03:55:12 +00:00
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
|
|
|
|
mark_node_dirty (child);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* handle root node */
|
2010-09-21 04:18:11 +00:00
|
|
|
|
if (manager->private_data->root_node)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
child = manager->private_data->root_node;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
if (strncmp (NODE_INFO (child)->name, childname, childname_length) != 0)
|
|
|
|
|
g_warning ("root node name '%s' doesn't match '%s'",
|
|
|
|
|
childname, NODE_INFO (child)->name);
|
2003-09-04 00:15:59 +00:00
|
|
|
|
if (NODE_INFO (child)->type != NODE_TYPE_ROOT)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_warning ("base element must be of type ROOT");
|
|
|
|
|
}
|
|
|
|
|
else if (create)
|
|
|
|
|
{
|
2003-09-04 00:15:59 +00:00
|
|
|
|
Node *mnode;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2005-12-05 21:28:32 +00:00
|
|
|
|
mnode = g_slice_new0 (Node);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
mnode->type = node_type;
|
|
|
|
|
mnode->name = g_strndup (childname, childname_length);
|
|
|
|
|
mnode->dirty = TRUE;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
child = manager->private_data->root_node = g_node_new (mnode);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return child;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GNode *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
get_node (GtkUIManager *manager,
|
2003-09-11 21:02:24 +00:00
|
|
|
|
const gchar *path,
|
|
|
|
|
NodeType node_type,
|
|
|
|
|
gboolean create)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
const gchar *pos, *end;
|
|
|
|
|
GNode *parent, *node;
|
|
|
|
|
|
2004-08-04 00:06:30 +00:00
|
|
|
|
if (strncmp ("/ui", path, 3) == 0)
|
|
|
|
|
path += 3;
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
end = path + strlen (path);
|
|
|
|
|
pos = path;
|
|
|
|
|
parent = node = NULL;
|
|
|
|
|
while (pos < end)
|
|
|
|
|
{
|
|
|
|
|
const gchar *slash;
|
|
|
|
|
gsize length;
|
|
|
|
|
|
|
|
|
|
slash = strchr (pos, '/');
|
|
|
|
|
if (slash)
|
|
|
|
|
length = slash - pos;
|
|
|
|
|
else
|
|
|
|
|
length = strlen (pos);
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
node = get_child_node (manager, parent, NULL, pos, length, NODE_TYPE_UNDECIDED,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
create, FALSE);
|
|
|
|
|
if (!node)
|
|
|
|
|
return NULL;
|
2004-05-09 04:03:59 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
pos += length + 1; /* move past the node name and the slash too */
|
|
|
|
|
parent = node;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-04 00:15:59 +00:00
|
|
|
|
if (node != NULL && NODE_INFO (node)->type == NODE_TYPE_UNDECIDED)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
NODE_INFO (node)->type = node_type;
|
2003-09-11 21:02:24 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
return node;
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-04 07:06:12 +00:00
|
|
|
|
static void
|
|
|
|
|
node_ui_reference_free (gpointer data)
|
|
|
|
|
{
|
|
|
|
|
g_slice_free (NodeUIReference, data);
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-11 21:02:24 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
free_node (GNode *node)
|
|
|
|
|
{
|
|
|
|
|
Node *info = NODE_INFO (node);
|
2012-05-16 01:49:24 +00:00
|
|
|
|
|
2012-01-02 03:20:59 +00:00
|
|
|
|
g_list_free_full (info->uifiles, node_ui_reference_free);
|
2012-05-16 01:49:24 +00:00
|
|
|
|
info->uifiles = NULL;
|
2003-09-11 21:02:24 +00:00
|
|
|
|
|
2012-05-16 01:49:24 +00:00
|
|
|
|
g_clear_object (&info->action);
|
|
|
|
|
g_clear_object (&info->proxy);
|
|
|
|
|
g_clear_object (&info->extra);
|
|
|
|
|
g_clear_pointer (&info->name, g_free);
|
2005-12-05 21:28:32 +00:00
|
|
|
|
g_slice_free (Node, info);
|
2012-05-16 01:49:24 +00:00
|
|
|
|
node->data = NULL;
|
2003-09-11 21:02:24 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-01 22:15:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_ui_manager_new_merge_id:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-09-01 22:15:16 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns an unused merge id, suitable for use with
|
|
|
|
|
* gtk_ui_manager_add_ui().
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: an unused merge id.
|
2003-09-01 22:15:16 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-09-01 22:15:16 +00:00
|
|
|
|
**/
|
|
|
|
|
guint
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_new_merge_id (GtkUIManager *manager)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->last_merge_id++;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
return manager->private_data->last_merge_id;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (GNode *gnode,
|
2003-09-11 21:02:24 +00:00
|
|
|
|
guint merge_id,
|
|
|
|
|
GQuark action_quark)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2004-11-11 18:13:19 +00:00
|
|
|
|
Node *node = NODE_INFO (gnode);
|
|
|
|
|
NodeUIReference *reference = NULL;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (node->uifiles &&
|
|
|
|
|
((NodeUIReference *)node->uifiles->data)->merge_id == merge_id)
|
|
|
|
|
reference = node->uifiles->data;
|
|
|
|
|
else
|
|
|
|
|
{
|
2006-01-04 07:06:12 +00:00
|
|
|
|
reference = g_slice_new (NodeUIReference);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node->uifiles = g_list_prepend (node->uifiles, reference);
|
|
|
|
|
}
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
reference->merge_id = merge_id;
|
|
|
|
|
reference->action_quark = action_quark;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
mark_node_dirty (gnode);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_remove_ui_reference (GNode *gnode,
|
2003-09-11 21:02:24 +00:00
|
|
|
|
guint merge_id)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2004-11-11 18:13:19 +00:00
|
|
|
|
Node *node = NODE_INFO (gnode);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
GList *p;
|
|
|
|
|
|
|
|
|
|
for (p = node->uifiles; p != NULL; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
NodeUIReference *reference = p->data;
|
|
|
|
|
|
|
|
|
|
if (reference->merge_id == merge_id)
|
|
|
|
|
{
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (p == node->uifiles)
|
|
|
|
|
mark_node_dirty (gnode);
|
2004-04-13 19:01:06 +00:00
|
|
|
|
node->uifiles = g_list_delete_link (node->uifiles, p);
|
2006-01-04 07:06:12 +00:00
|
|
|
|
g_slice_free (NodeUIReference, reference);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------- The UI file parser -------------------- */
|
|
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
STATE_START,
|
|
|
|
|
STATE_ROOT,
|
|
|
|
|
STATE_MENU,
|
|
|
|
|
STATE_TOOLBAR,
|
|
|
|
|
STATE_MENUITEM,
|
|
|
|
|
STATE_TOOLITEM,
|
2004-01-09 21:22:38 +00:00
|
|
|
|
STATE_ACCELERATOR,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
STATE_END
|
|
|
|
|
} ParseState;
|
|
|
|
|
|
|
|
|
|
typedef struct _ParseContext ParseContext;
|
|
|
|
|
struct _ParseContext
|
|
|
|
|
{
|
|
|
|
|
ParseState state;
|
|
|
|
|
ParseState prev_state;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
GNode *current;
|
|
|
|
|
|
|
|
|
|
guint merge_id;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
start_element_handler (GMarkupParseContext *context,
|
|
|
|
|
const gchar *element_name,
|
|
|
|
|
const gchar **attribute_names,
|
|
|
|
|
const gchar **attribute_values,
|
|
|
|
|
gpointer user_data,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
ParseContext *ctx = user_data;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
GtkUIManager *manager = ctx->manager;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
gint i;
|
|
|
|
|
const gchar *node_name;
|
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
|
|
|
|
const gchar *action;
|
2003-08-26 00:13:59 +00:00
|
|
|
|
GQuark action_quark;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
gboolean top;
|
2005-02-17 22:59:47 +00:00
|
|
|
|
gboolean expand = FALSE;
|
2008-10-09 08:50:33 +00:00
|
|
|
|
gboolean accelerators = FALSE;
|
2009-11-11 17:59:12 +00:00
|
|
|
|
gboolean always_show_image_set = FALSE, always_show_image = FALSE;
|
2008-10-09 08:50:33 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
gboolean raise_error = TRUE;
|
|
|
|
|
|
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
|
|
|
|
node_name = NULL;
|
|
|
|
|
action = NULL;
|
2003-08-26 00:13:59 +00:00
|
|
|
|
action_quark = 0;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
top = FALSE;
|
2003-09-30 20:55:24 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
for (i = 0; attribute_names[i] != NULL; i++)
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp (attribute_names[i], "name"))
|
|
|
|
|
{
|
|
|
|
|
node_name = attribute_values[i];
|
|
|
|
|
}
|
2003-08-26 00:13:59 +00:00
|
|
|
|
else if (!strcmp (attribute_names[i], "action"))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
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
|
|
|
|
action = attribute_values[i];
|
2003-08-26 00:13:59 +00:00
|
|
|
|
action_quark = g_quark_from_string (attribute_values[i]);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2003-09-04 09:07:23 +00:00
|
|
|
|
else if (!strcmp (attribute_names[i], "position"))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
top = !strcmp (attribute_values[i], "top");
|
|
|
|
|
}
|
2005-02-08 15:54:09 +00:00
|
|
|
|
else if (!strcmp (attribute_names[i], "expand"))
|
|
|
|
|
{
|
|
|
|
|
expand = !strcmp (attribute_values[i], "true");
|
|
|
|
|
}
|
2008-10-09 08:50:33 +00:00
|
|
|
|
else if (!strcmp (attribute_names[i], "accelerators"))
|
|
|
|
|
{
|
|
|
|
|
accelerators = !strcmp (attribute_values[i], "true");
|
|
|
|
|
}
|
2009-11-11 17:59:12 +00:00
|
|
|
|
else if (!strcmp (attribute_names[i], "always-show-image"))
|
|
|
|
|
{
|
|
|
|
|
always_show_image_set = TRUE;
|
|
|
|
|
always_show_image = !strcmp (attribute_values[i], "true");
|
|
|
|
|
}
|
2008-06-13 10:44:34 +00:00
|
|
|
|
/* else silently skip unknown attributes to be compatible with
|
|
|
|
|
* future additional attributes.
|
|
|
|
|
*/
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
|
/* Work out a name for this node. Either the name attribute, or
|
|
|
|
|
* the action, or the element name */
|
|
|
|
|
if (node_name == NULL)
|
|
|
|
|
{
|
|
|
|
|
if (action != NULL)
|
|
|
|
|
node_name = action;
|
|
|
|
|
else
|
|
|
|
|
node_name = element_name;
|
|
|
|
|
}
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
switch (element_name[0])
|
|
|
|
|
{
|
2003-09-17 23:58:28 +00:00
|
|
|
|
case 'a':
|
|
|
|
|
if (ctx->state == STATE_ROOT && !strcmp (element_name, "accelerator"))
|
|
|
|
|
{
|
2004-01-09 21:22:38 +00:00
|
|
|
|
ctx->state = STATE_ACCELERATOR;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = get_child_node (manager, ctx->current, NULL,
|
2003-09-17 23:58:28 +00:00
|
|
|
|
node_name, strlen (node_name),
|
|
|
|
|
NODE_TYPE_ACCELERATOR,
|
|
|
|
|
TRUE, FALSE);
|
|
|
|
|
if (NODE_INFO (ctx->current)->action_name == 0)
|
|
|
|
|
NODE_INFO (ctx->current)->action_name = action_quark;
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (ctx->current, ctx->merge_id, action_quark);
|
2003-09-17 23:58:28 +00:00
|
|
|
|
|
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2003-08-26 00:13:59 +00:00
|
|
|
|
case 'u':
|
|
|
|
|
if (ctx->state == STATE_START && !strcmp (element_name, "ui"))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
ctx->state = STATE_ROOT;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = manager->private_data->root_node;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (ctx->current, ctx->merge_id, action_quark);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'm':
|
2003-08-26 00:13:59 +00:00
|
|
|
|
if (ctx->state == STATE_ROOT && !strcmp (element_name, "menubar"))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
ctx->state = STATE_MENU;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = get_child_node (manager, ctx->current, NULL,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
node_name, strlen (node_name),
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_MENUBAR,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
TRUE, FALSE);
|
|
|
|
|
if (NODE_INFO (ctx->current)->action_name == 0)
|
2003-08-26 00:13:59 +00:00
|
|
|
|
NODE_INFO (ctx->current)->action_name = action_quark;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (ctx->current, ctx->merge_id, action_quark);
|
|
|
|
|
mark_node_dirty (ctx->current);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2003-08-26 00:13:59 +00:00
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
else if (ctx->state == STATE_MENU && !strcmp (element_name, "menu"))
|
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = get_child_node (manager, ctx->current, NULL,
|
2003-08-26 00:13:59 +00:00
|
|
|
|
node_name, strlen (node_name),
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_MENU,
|
2003-08-26 00:13:59 +00:00
|
|
|
|
TRUE, top);
|
|
|
|
|
if (NODE_INFO (ctx->current)->action_name == 0)
|
|
|
|
|
NODE_INFO (ctx->current)->action_name = action_quark;
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (ctx->current, ctx->merge_id, action_quark);
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
2005-06-19 03:20:07 +00:00
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
else if (ctx->state == STATE_TOOLITEM && !strcmp (element_name, "menu"))
|
|
|
|
|
{
|
|
|
|
|
ctx->state = STATE_MENU;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = get_child_node (manager, g_node_last_child (ctx->current), NULL,
|
2005-06-19 03:20:07 +00:00
|
|
|
|
node_name, strlen (node_name),
|
|
|
|
|
NODE_TYPE_MENU,
|
|
|
|
|
TRUE, top);
|
|
|
|
|
if (NODE_INFO (ctx->current)->action_name == 0)
|
|
|
|
|
NODE_INFO (ctx->current)->action_name = action_quark;
|
|
|
|
|
|
|
|
|
|
node_prepend_ui_reference (ctx->current, ctx->merge_id, action_quark);
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
else if (ctx->state == STATE_MENU && !strcmp (element_name, "menuitem"))
|
|
|
|
|
{
|
|
|
|
|
GNode *node;
|
|
|
|
|
|
|
|
|
|
ctx->state = STATE_MENUITEM;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
node = get_child_node (manager, ctx->current, NULL,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
node_name, strlen (node_name),
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_MENUITEM,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
TRUE, top);
|
|
|
|
|
if (NODE_INFO (node)->action_name == 0)
|
2003-08-26 00:13:59 +00:00
|
|
|
|
NODE_INFO (node)->action_name = action_quark;
|
2009-11-11 17:59:12 +00:00
|
|
|
|
|
|
|
|
|
NODE_INFO (node)->always_show_image_set = always_show_image_set;
|
|
|
|
|
NODE_INFO (node)->always_show_image = always_show_image;
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (node, ctx->merge_id, action_quark);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 'p':
|
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
|
|
|
|
if (ctx->state == STATE_ROOT && !strcmp (element_name, "popup"))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
ctx->state = STATE_MENU;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = get_child_node (manager, ctx->current, NULL,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
node_name, strlen (node_name),
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_POPUP,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
TRUE, FALSE);
|
2008-10-09 08:50:33 +00:00
|
|
|
|
|
|
|
|
|
NODE_INFO (ctx->current)->popup_accels = accelerators;
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
if (NODE_INFO (ctx->current)->action_name == 0)
|
2003-08-26 00:13:59 +00:00
|
|
|
|
NODE_INFO (ctx->current)->action_name = action_quark;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (ctx->current, ctx->merge_id, action_quark);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
else if ((ctx->state == STATE_MENU || ctx->state == STATE_TOOLBAR) &&
|
|
|
|
|
!strcmp (element_name, "placeholder"))
|
|
|
|
|
{
|
2003-08-29 22:42:37 +00:00
|
|
|
|
if (ctx->state == STATE_TOOLBAR)
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = get_child_node (manager, ctx->current, NULL,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
node_name, strlen (node_name),
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_TOOLBAR_PLACEHOLDER,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
TRUE, top);
|
|
|
|
|
else
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = get_child_node (manager, ctx->current, NULL,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
node_name, strlen (node_name),
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_MENU_PLACEHOLDER,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
TRUE, top);
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (ctx->current, ctx->merge_id, action_quark);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 's':
|
2003-08-26 00:13:59 +00:00
|
|
|
|
if ((ctx->state == STATE_MENU || ctx->state == STATE_TOOLBAR) &&
|
2003-08-29 22:42:37 +00:00
|
|
|
|
!strcmp (element_name, "separator"))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
GNode *node;
|
2004-04-13 20:06:12 +00:00
|
|
|
|
gint length;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2003-08-29 22:42:37 +00:00
|
|
|
|
if (ctx->state == STATE_TOOLBAR)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
ctx->state = STATE_TOOLITEM;
|
2003-08-29 22:42:37 +00:00
|
|
|
|
else
|
|
|
|
|
ctx->state = STATE_MENUITEM;
|
2004-04-13 20:06:12 +00:00
|
|
|
|
if (!strcmp (node_name, "separator"))
|
|
|
|
|
{
|
|
|
|
|
node_name = NULL;
|
2006-04-12 04:49:18 +00:00
|
|
|
|
length = 0;
|
2004-04-13 20:06:12 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
length = strlen (node_name);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
node = get_child_node (manager, ctx->current, NULL,
|
2004-04-13 20:06:12 +00:00
|
|
|
|
node_name, length,
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_SEPARATOR,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
TRUE, top);
|
2004-04-13 20:06:12 +00:00
|
|
|
|
|
2005-02-08 15:54:09 +00:00
|
|
|
|
NODE_INFO (node)->expand = expand;
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
if (NODE_INFO (node)->action_name == 0)
|
2003-08-26 00:13:59 +00:00
|
|
|
|
NODE_INFO (node)->action_name = action_quark;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (node, ctx->merge_id, action_quark);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case 't':
|
2003-08-26 00:13:59 +00:00
|
|
|
|
if (ctx->state == STATE_ROOT && !strcmp (element_name, "toolbar"))
|
|
|
|
|
{
|
|
|
|
|
ctx->state = STATE_TOOLBAR;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->current = get_child_node (manager, ctx->current, NULL,
|
2003-08-26 00:13:59 +00:00
|
|
|
|
node_name, strlen (node_name),
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_TOOLBAR,
|
2003-08-26 00:13:59 +00:00
|
|
|
|
TRUE, FALSE);
|
|
|
|
|
if (NODE_INFO (ctx->current)->action_name == 0)
|
|
|
|
|
NODE_INFO (ctx->current)->action_name = action_quark;
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (ctx->current, ctx->merge_id, action_quark);
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
else if (ctx->state == STATE_TOOLBAR && !strcmp (element_name, "toolitem"))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
GNode *node;
|
|
|
|
|
|
|
|
|
|
ctx->state = STATE_TOOLITEM;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
node = get_child_node (manager, ctx->current, NULL,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
node_name, strlen (node_name),
|
2003-09-04 00:15:59 +00:00
|
|
|
|
NODE_TYPE_TOOLITEM,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
TRUE, top);
|
|
|
|
|
if (NODE_INFO (node)->action_name == 0)
|
2003-08-26 00:13:59 +00:00
|
|
|
|
NODE_INFO (node)->action_name = action_quark;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (node, ctx->merge_id, action_quark);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
raise_error = FALSE;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (raise_error)
|
|
|
|
|
{
|
|
|
|
|
gint line_number, char_number;
|
|
|
|
|
|
|
|
|
|
g_markup_parse_context_get_position (context,
|
|
|
|
|
&line_number, &char_number);
|
2003-09-04 00:00:14 +00:00
|
|
|
|
g_set_error (error,
|
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
|
G_MARKUP_ERROR_UNKNOWN_ELEMENT,
|
|
|
|
|
_("Unexpected start tag '%s' on line %d char %d"),
|
|
|
|
|
element_name,
|
|
|
|
|
line_number, char_number);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
end_element_handler (GMarkupParseContext *context,
|
|
|
|
|
const gchar *element_name,
|
|
|
|
|
gpointer user_data,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
ParseContext *ctx = user_data;
|
|
|
|
|
|
|
|
|
|
switch (ctx->state)
|
|
|
|
|
{
|
|
|
|
|
case STATE_START:
|
2003-09-04 00:00:14 +00:00
|
|
|
|
case STATE_END:
|
|
|
|
|
/* no need to GError here, GMarkup already catches this */
|
2003-08-24 19:58:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case STATE_ROOT:
|
|
|
|
|
ctx->current = NULL;
|
|
|
|
|
ctx->state = STATE_END;
|
|
|
|
|
break;
|
|
|
|
|
case STATE_MENU:
|
2003-09-04 00:00:14 +00:00
|
|
|
|
case STATE_TOOLBAR:
|
2004-01-09 21:22:38 +00:00
|
|
|
|
case STATE_ACCELERATOR:
|
2003-08-24 19:58:30 +00:00
|
|
|
|
ctx->current = ctx->current->parent;
|
2003-09-04 00:15:59 +00:00
|
|
|
|
if (NODE_INFO (ctx->current)->type == NODE_TYPE_ROOT)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
ctx->state = STATE_ROOT;
|
2005-06-19 03:20:07 +00:00
|
|
|
|
else if (NODE_INFO (ctx->current)->type == NODE_TYPE_TOOLITEM)
|
|
|
|
|
{
|
|
|
|
|
ctx->current = ctx->current->parent;
|
|
|
|
|
ctx->state = STATE_TOOLITEM;
|
|
|
|
|
}
|
2003-08-29 22:42:37 +00:00
|
|
|
|
/* else, stay in same state */
|
2003-08-24 19:58:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case STATE_MENUITEM:
|
|
|
|
|
ctx->state = STATE_MENU;
|
|
|
|
|
break;
|
|
|
|
|
case STATE_TOOLITEM:
|
|
|
|
|
ctx->state = STATE_TOOLBAR;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
cleanup (GMarkupParseContext *context,
|
|
|
|
|
GError *error,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
ParseContext *ctx = user_data;
|
|
|
|
|
|
|
|
|
|
ctx->current = NULL;
|
|
|
|
|
/* should also walk through the tree and get rid of nodes related to
|
|
|
|
|
* this UI file's tag */
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_remove_ui (ctx->manager, ctx->merge_id);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-09-17 19:18:45 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
xml_isspace (char c)
|
|
|
|
|
{
|
|
|
|
|
return c == ' ' || c == '\t' || c == '\n' || c == '\r';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
text_handler (GMarkupParseContext *context,
|
|
|
|
|
const gchar *text,
|
|
|
|
|
gsize text_len,
|
|
|
|
|
gpointer user_data,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
const gchar *p;
|
|
|
|
|
const gchar *end;
|
|
|
|
|
|
|
|
|
|
p = text;
|
|
|
|
|
end = text + text_len;
|
|
|
|
|
while (p != end && xml_isspace (*p))
|
|
|
|
|
++p;
|
|
|
|
|
|
|
|
|
|
if (p != end)
|
|
|
|
|
{
|
|
|
|
|
gint line_number, char_number;
|
|
|
|
|
|
|
|
|
|
g_markup_parse_context_get_position (context,
|
|
|
|
|
&line_number, &char_number);
|
|
|
|
|
g_set_error (error,
|
|
|
|
|
G_MARKUP_ERROR,
|
|
|
|
|
G_MARKUP_ERROR_INVALID_CONTENT,
|
|
|
|
|
_("Unexpected character data on line %d char %d"),
|
|
|
|
|
line_number, char_number);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-04-03 15:50:30 +00:00
|
|
|
|
static const GMarkupParser ui_parser = {
|
2003-08-24 19:58:30 +00:00
|
|
|
|
start_element_handler,
|
|
|
|
|
end_element_handler,
|
2003-09-17 19:18:45 +00:00
|
|
|
|
text_handler,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
NULL,
|
|
|
|
|
cleanup
|
|
|
|
|
};
|
|
|
|
|
|
2003-08-26 00:13:59 +00:00
|
|
|
|
static guint
|
2010-09-21 04:18:11 +00:00
|
|
|
|
add_ui_from_string (GtkUIManager *manager,
|
2003-08-26 00:13:59 +00:00
|
|
|
|
const gchar *buffer,
|
|
|
|
|
gssize length,
|
|
|
|
|
gboolean needs_root,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
ParseContext ctx = { 0 };
|
|
|
|
|
GMarkupParseContext *context;
|
|
|
|
|
|
|
|
|
|
ctx.state = STATE_START;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx.manager = manager;
|
2003-08-26 00:13:59 +00:00
|
|
|
|
ctx.current = NULL;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx.merge_id = gtk_ui_manager_new_merge_id (manager);
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
|
|
|
|
context = g_markup_parse_context_new (&ui_parser, 0, &ctx, NULL);
|
|
|
|
|
|
|
|
|
|
if (needs_root)
|
|
|
|
|
if (!g_markup_parse_context_parse (context, "<ui>", -1, error))
|
2004-04-13 19:01:06 +00:00
|
|
|
|
goto out;
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
|
|
|
|
if (!g_markup_parse_context_parse (context, buffer, length, error))
|
2004-04-13 19:01:06 +00:00
|
|
|
|
goto out;
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
|
|
|
|
if (needs_root)
|
|
|
|
|
if (!g_markup_parse_context_parse (context, "</ui>", -1, error))
|
2004-04-13 19:01:06 +00:00
|
|
|
|
goto out;
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
|
|
|
|
if (!g_markup_parse_context_end_parse (context, error))
|
2004-04-13 19:01:06 +00:00
|
|
|
|
goto out;
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
|
|
|
|
g_markup_parse_context_free (context);
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
queue_update (manager);
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_object_notify (G_OBJECT (manager), "ui");
|
2003-08-29 23:33:54 +00:00
|
|
|
|
|
2003-08-26 00:13:59 +00:00
|
|
|
|
return ctx.merge_id;
|
|
|
|
|
|
2004-04-13 19:01:06 +00:00
|
|
|
|
out:
|
2003-08-26 00:13:59 +00:00
|
|
|
|
|
|
|
|
|
g_markup_parse_context_free (context);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_add_ui_from_string:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager object
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* @buffer: the string to parse
|
|
|
|
|
* @length: the length of @buffer (may be -1 if @buffer is nul-terminated)
|
|
|
|
|
* @error: return location for an error
|
|
|
|
|
*
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* Parses a string containing a [UI definition][XML-UI] and merges it with
|
|
|
|
|
* the current contents of @manager. An enclosing <ui> element is added if
|
|
|
|
|
* it is missing.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: The merge id for the merged UI. The merge id can be used
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* to unmerge the UI with gtk_ui_manager_remove_ui(). If an error occurred,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* the return value is 0.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
|
|
|
|
guint
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_add_ui_from_string (GtkUIManager *manager,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
const gchar *buffer,
|
2003-08-26 00:13:59 +00:00
|
|
|
|
gssize length,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
GError **error)
|
|
|
|
|
{
|
2003-08-26 00:13:59 +00:00
|
|
|
|
gboolean needs_root = TRUE;
|
|
|
|
|
const gchar *p;
|
|
|
|
|
const gchar *end;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), 0);
|
2003-09-17 23:58:28 +00:00
|
|
|
|
g_return_val_if_fail (buffer != NULL, 0);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
if (length < 0)
|
|
|
|
|
length = strlen (buffer);
|
|
|
|
|
|
2003-08-26 00:13:59 +00:00
|
|
|
|
p = buffer;
|
|
|
|
|
end = buffer + length;
|
|
|
|
|
while (p != end && xml_isspace (*p))
|
|
|
|
|
++p;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2003-08-26 00:13:59 +00:00
|
|
|
|
if (end - p >= 4 && strncmp (p, "<ui>", 4) == 0)
|
|
|
|
|
needs_root = FALSE;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
return add_ui_from_string (manager, buffer, length, needs_root, error);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_add_ui_from_file:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager object
|
2011-01-18 05:42:31 +00:00
|
|
|
|
* @filename: (type filename): the name of the file to parse
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* @error: return location for an error
|
|
|
|
|
*
|
2014-02-07 02:07:03 +00:00
|
|
|
|
* Parses a file containing a [UI definition][XML-UI] and
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* merges it with the current contents of @manager.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: The merge id for the merged UI. The merge id can be used
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* to unmerge the UI with gtk_ui_manager_remove_ui(). If an error occurred,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
* the return value is 0.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
|
|
|
|
guint
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_add_ui_from_file (GtkUIManager *manager,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
const gchar *filename,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
gchar *buffer;
|
2003-10-27 23:50:34 +00:00
|
|
|
|
gsize length;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
guint res;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), 0);
|
2003-09-17 23:58:28 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
if (!g_file_get_contents (filename, &buffer, &length, error))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
res = add_ui_from_string (manager, buffer, length, FALSE, error);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_free (buffer);
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-12 18:00:39 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_ui_manager_add_ui_from_resource:
|
|
|
|
|
* @manager: a #GtkUIManager object
|
|
|
|
|
* @resource_path: the resource path of the file to parse
|
|
|
|
|
* @error: return location for an error
|
|
|
|
|
*
|
2014-02-07 02:07:03 +00:00
|
|
|
|
* Parses a resource file containing a [UI definition][XML-UI] and
|
2012-01-12 18:00:39 +00:00
|
|
|
|
* merges it with the current contents of @manager.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: The merge id for the merged UI. The merge id can be used
|
2012-01-12 18:00:39 +00:00
|
|
|
|
* to unmerge the UI with gtk_ui_manager_remove_ui(). If an error occurred,
|
|
|
|
|
* the return value is 0.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2012-01-12 18:00:39 +00:00
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
gtk_ui_manager_add_ui_from_resource (GtkUIManager *manager,
|
|
|
|
|
const gchar *resource_path,
|
|
|
|
|
GError **error)
|
|
|
|
|
{
|
|
|
|
|
GBytes *data;
|
|
|
|
|
guint res;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_UI_MANAGER (manager), 0);
|
|
|
|
|
|
|
|
|
|
data = g_resources_lookup_data (resource_path, 0, error);
|
|
|
|
|
if (data == NULL)
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
res = add_ui_from_string (manager, g_bytes_get_data (data, NULL), g_bytes_get_size (data), FALSE, error);
|
|
|
|
|
g_bytes_unref (data);
|
|
|
|
|
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-01 22:15:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_ui_manager_add_ui:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-09-01 22:15:16 +00:00
|
|
|
|
* @merge_id: the merge id for the merged UI, see gtk_ui_manager_new_merge_id()
|
|
|
|
|
* @path: a path
|
|
|
|
|
* @name: the name for the added UI element
|
2009-12-10 10:23:40 +00:00
|
|
|
|
* @action: (allow-none): the name of the action to be proxied, or %NULL to add a separator
|
2003-09-04 20:39:15 +00:00
|
|
|
|
* @type: the type of UI element to add.
|
2009-12-10 10:23:40 +00:00
|
|
|
|
* @top: if %TRUE, the UI element is added before its siblings, otherwise it
|
2003-09-04 20:39:15 +00:00
|
|
|
|
* is added after its siblings.
|
2009-12-10 10:23:40 +00:00
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* Adds a UI element to the current contents of @manager.
|
2003-09-04 20:39:15 +00:00
|
|
|
|
*
|
|
|
|
|
* If @type is %GTK_UI_MANAGER_AUTO, GTK+ inserts a menuitem, toolitem or
|
|
|
|
|
* separator if such an element can be inserted at the place determined by
|
|
|
|
|
* @path. Otherwise @type must indicate an element that can be inserted at
|
|
|
|
|
* the place determined by @path.
|
2005-06-19 03:55:12 +00:00
|
|
|
|
*
|
|
|
|
|
* If @path points to a menuitem or toolitem, the new element will be inserted
|
|
|
|
|
* before or after this item, depending on @top.
|
2003-09-01 22:15:16 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-09-01 22:15:16 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_add_ui (GtkUIManager *manager,
|
2003-09-04 20:39:15 +00:00
|
|
|
|
guint merge_id,
|
|
|
|
|
const gchar *path,
|
|
|
|
|
const gchar *name,
|
|
|
|
|
const gchar *action,
|
|
|
|
|
GtkUIManagerItemType type,
|
|
|
|
|
gboolean top)
|
2003-09-01 22:15:16 +00:00
|
|
|
|
{
|
|
|
|
|
GNode *node;
|
2005-06-19 03:55:12 +00:00
|
|
|
|
GNode *sibling;
|
2003-09-01 22:15:16 +00:00
|
|
|
|
GNode *child;
|
2003-09-04 20:39:15 +00:00
|
|
|
|
NodeType node_type;
|
2003-09-01 22:15:16 +00:00
|
|
|
|
GQuark action_quark = 0;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_UI_MANAGER (manager));
|
2003-09-01 22:15:16 +00:00
|
|
|
|
g_return_if_fail (merge_id > 0);
|
2007-04-26 05:54:21 +00:00
|
|
|
|
g_return_if_fail (name != NULL || type == GTK_UI_MANAGER_SEPARATOR);
|
2003-09-01 22:15:16 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
node = get_node (manager, path, NODE_TYPE_UNDECIDED, FALSE);
|
2005-06-19 03:55:12 +00:00
|
|
|
|
sibling = NULL;
|
|
|
|
|
|
2003-09-01 22:15:16 +00:00
|
|
|
|
if (node == NULL)
|
|
|
|
|
return;
|
|
|
|
|
|
2003-09-04 20:39:15 +00:00
|
|
|
|
node_type = NODE_TYPE_UNDECIDED;
|
|
|
|
|
|
2005-06-19 03:55:12 +00:00
|
|
|
|
reswitch:
|
2003-09-01 22:15:16 +00:00
|
|
|
|
switch (NODE_INFO (node)->type)
|
|
|
|
|
{
|
2005-06-19 03:55:12 +00:00
|
|
|
|
case NODE_TYPE_SEPARATOR:
|
|
|
|
|
case NODE_TYPE_MENUITEM:
|
|
|
|
|
case NODE_TYPE_TOOLITEM:
|
|
|
|
|
sibling = node;
|
|
|
|
|
node = node->parent;
|
|
|
|
|
goto reswitch;
|
2003-09-04 20:39:15 +00:00
|
|
|
|
case NODE_TYPE_MENUBAR:
|
2003-09-04 00:15:59 +00:00
|
|
|
|
case NODE_TYPE_MENU:
|
|
|
|
|
case NODE_TYPE_POPUP:
|
|
|
|
|
case NODE_TYPE_MENU_PLACEHOLDER:
|
2003-09-04 20:39:15 +00:00
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case GTK_UI_MANAGER_AUTO:
|
|
|
|
|
if (action != NULL)
|
|
|
|
|
node_type = NODE_TYPE_MENUITEM;
|
|
|
|
|
else
|
|
|
|
|
node_type = NODE_TYPE_SEPARATOR;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_UI_MANAGER_MENU:
|
|
|
|
|
node_type = NODE_TYPE_MENU;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_UI_MANAGER_MENUITEM:
|
|
|
|
|
node_type = NODE_TYPE_MENUITEM;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_UI_MANAGER_SEPARATOR:
|
|
|
|
|
node_type = NODE_TYPE_SEPARATOR;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_UI_MANAGER_PLACEHOLDER:
|
|
|
|
|
node_type = NODE_TYPE_MENU_PLACEHOLDER;
|
|
|
|
|
break;
|
|
|
|
|
default: ;
|
|
|
|
|
/* do nothing */
|
|
|
|
|
}
|
2003-09-01 22:15:16 +00:00
|
|
|
|
break;
|
2003-09-04 00:15:59 +00:00
|
|
|
|
case NODE_TYPE_TOOLBAR:
|
|
|
|
|
case NODE_TYPE_TOOLBAR_PLACEHOLDER:
|
2003-09-04 20:39:15 +00:00
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case GTK_UI_MANAGER_AUTO:
|
|
|
|
|
if (action != NULL)
|
|
|
|
|
node_type = NODE_TYPE_TOOLITEM;
|
|
|
|
|
else
|
|
|
|
|
node_type = NODE_TYPE_SEPARATOR;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_UI_MANAGER_TOOLITEM:
|
|
|
|
|
node_type = NODE_TYPE_TOOLITEM;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_UI_MANAGER_SEPARATOR:
|
|
|
|
|
node_type = NODE_TYPE_SEPARATOR;
|
|
|
|
|
break;
|
|
|
|
|
case GTK_UI_MANAGER_PLACEHOLDER:
|
2004-09-07 17:33:07 +00:00
|
|
|
|
node_type = NODE_TYPE_TOOLBAR_PLACEHOLDER;
|
2003-09-04 20:39:15 +00:00
|
|
|
|
break;
|
|
|
|
|
default: ;
|
|
|
|
|
/* do nothing */
|
|
|
|
|
}
|
2003-09-01 22:15:16 +00:00
|
|
|
|
break;
|
2003-09-04 20:39:15 +00:00
|
|
|
|
case NODE_TYPE_ROOT:
|
|
|
|
|
switch (type)
|
2003-09-01 22:15:16 +00:00
|
|
|
|
{
|
2003-09-04 20:39:15 +00:00
|
|
|
|
case GTK_UI_MANAGER_MENUBAR:
|
|
|
|
|
node_type = NODE_TYPE_MENUBAR;
|
2003-09-01 22:15:16 +00:00
|
|
|
|
break;
|
2003-09-04 20:39:15 +00:00
|
|
|
|
case GTK_UI_MANAGER_TOOLBAR:
|
|
|
|
|
node_type = NODE_TYPE_TOOLBAR;
|
2003-09-01 22:15:16 +00:00
|
|
|
|
break;
|
2003-09-04 20:39:15 +00:00
|
|
|
|
case GTK_UI_MANAGER_POPUP:
|
2008-10-09 08:50:33 +00:00
|
|
|
|
case GTK_UI_MANAGER_POPUP_WITH_ACCELS:
|
2003-09-04 20:39:15 +00:00
|
|
|
|
node_type = NODE_TYPE_POPUP;
|
2003-09-01 22:15:16 +00:00
|
|
|
|
break;
|
2003-09-17 23:58:28 +00:00
|
|
|
|
case GTK_UI_MANAGER_ACCELERATOR:
|
|
|
|
|
node_type = NODE_TYPE_ACCELERATOR;
|
|
|
|
|
break;
|
2003-09-04 20:39:15 +00:00
|
|
|
|
default: ;
|
|
|
|
|
/* do nothing */
|
2003-09-01 22:15:16 +00:00
|
|
|
|
}
|
2003-09-04 20:39:15 +00:00
|
|
|
|
break;
|
|
|
|
|
default: ;
|
|
|
|
|
/* do nothing */
|
2003-09-01 22:15:16 +00:00
|
|
|
|
}
|
2003-09-04 20:39:15 +00:00
|
|
|
|
|
|
|
|
|
if (node_type == NODE_TYPE_UNDECIDED)
|
2005-06-19 03:55:12 +00:00
|
|
|
|
{
|
2005-06-19 04:44:44 +00:00
|
|
|
|
g_warning ("item type %d not suitable for adding at '%s'",
|
2005-06-19 03:55:12 +00:00
|
|
|
|
type, path);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2003-09-04 20:39:15 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
child = get_child_node (manager, node, sibling,
|
2007-04-26 05:54:21 +00:00
|
|
|
|
name, name ? strlen (name) : 0,
|
2003-09-04 20:39:15 +00:00
|
|
|
|
node_type, TRUE, top);
|
2003-09-01 22:15:16 +00:00
|
|
|
|
|
2008-10-09 08:50:33 +00:00
|
|
|
|
if (type == GTK_UI_MANAGER_POPUP_WITH_ACCELS)
|
|
|
|
|
NODE_INFO (child)->popup_accels = TRUE;
|
|
|
|
|
|
2003-09-01 22:15:16 +00:00
|
|
|
|
if (action != NULL)
|
|
|
|
|
action_quark = g_quark_from_string (action);
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_prepend_ui_reference (child, merge_id, action_quark);
|
2003-09-01 22:15:16 +00:00
|
|
|
|
|
2004-10-05 14:12:24 +00:00
|
|
|
|
if (NODE_INFO (child)->action_name == 0)
|
2003-09-01 22:15:16 +00:00
|
|
|
|
NODE_INFO (child)->action_name = action_quark;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
queue_update (manager);
|
2003-09-04 20:39:15 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_object_notify (G_OBJECT (manager), "ui");
|
2003-09-01 22:15:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
remove_ui (GNode *node,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
guint merge_id = GPOINTER_TO_UINT (user_data);
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
node_remove_ui_reference (node, merge_id);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
return FALSE; /* continue */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_remove_ui:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager object
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* @merge_id: a merge id as returned by gtk_ui_manager_add_ui_from_string()
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* Unmerges the part of @manager<!-- -->s content identified by @merge_id.
|
2003-08-24 20:48:27 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_remove_ui (GtkUIManager *manager,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
guint merge_id)
|
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_return_if_fail (GTK_IS_UI_MANAGER (manager));
|
2008-01-25 00:19:18 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_node_traverse (manager->private_data->root_node,
|
2003-09-01 22:15:16 +00:00
|
|
|
|
G_POST_ORDER, G_TRAVERSE_ALL, -1,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
remove_ui, GUINT_TO_POINTER (merge_id));
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
queue_update (manager);
|
2003-08-29 23:33:54 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_object_notify (G_OBJECT (manager), "ui");
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------------- Updates -------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static GtkAction *
|
2003-08-25 23:13:47 +00:00
|
|
|
|
get_action_by_name (GtkUIManager *merge,
|
2003-09-21 22:04:48 +00:00
|
|
|
|
const gchar *action_name)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
GList *tmp;
|
|
|
|
|
|
|
|
|
|
if (!action_name)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
/* lookup name */
|
|
|
|
|
for (tmp = merge->private_data->action_groups; tmp != NULL; tmp = tmp->next)
|
|
|
|
|
{
|
|
|
|
|
GtkActionGroup *action_group = tmp->data;
|
|
|
|
|
GtkAction *action;
|
|
|
|
|
|
|
|
|
|
action = gtk_action_group_get_action (action_group, action_name);
|
|
|
|
|
|
|
|
|
|
if (action)
|
|
|
|
|
return action;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
static gboolean
|
2010-12-23 23:21:53 +00:00
|
|
|
|
find_menu_position (GNode *node,
|
|
|
|
|
GtkWidget **menushell_p,
|
|
|
|
|
gint *pos_p)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
GtkWidget *menushell;
|
2006-12-28 21:23:17 +00:00
|
|
|
|
gint pos = 0;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
g_return_val_if_fail (node != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (NODE_INFO (node)->type == NODE_TYPE_MENU ||
|
|
|
|
|
NODE_INFO (node)->type == NODE_TYPE_POPUP ||
|
|
|
|
|
NODE_INFO (node)->type == NODE_TYPE_MENU_PLACEHOLDER ||
|
|
|
|
|
NODE_INFO (node)->type == NODE_TYPE_MENUITEM ||
|
|
|
|
|
NODE_INFO (node)->type == NODE_TYPE_SEPARATOR,
|
|
|
|
|
FALSE);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
/* first sibling -- look at parent */
|
|
|
|
|
if (node->prev == NULL)
|
|
|
|
|
{
|
|
|
|
|
GNode *parent;
|
2003-08-29 22:42:37 +00:00
|
|
|
|
GList *siblings;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
parent = node->parent;
|
|
|
|
|
switch (NODE_INFO (parent)->type)
|
|
|
|
|
{
|
2003-09-04 00:15:59 +00:00
|
|
|
|
case NODE_TYPE_MENUBAR:
|
|
|
|
|
case NODE_TYPE_POPUP:
|
2003-08-24 19:58:30 +00:00
|
|
|
|
menushell = NODE_INFO (parent)->proxy;
|
|
|
|
|
pos = 0;
|
|
|
|
|
break;
|
2003-09-04 00:15:59 +00:00
|
|
|
|
case NODE_TYPE_MENU:
|
2003-08-24 19:58:30 +00:00
|
|
|
|
menushell = NODE_INFO (parent)->proxy;
|
|
|
|
|
if (GTK_IS_MENU_ITEM (menushell))
|
|
|
|
|
menushell = gtk_menu_item_get_submenu (GTK_MENU_ITEM (menushell));
|
2003-08-29 22:42:37 +00:00
|
|
|
|
siblings = gtk_container_get_children (GTK_CONTAINER (menushell));
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2003-08-29 22:42:37 +00:00
|
|
|
|
if (siblings != NULL && GTK_IS_TEAROFF_MENU_ITEM (siblings->data))
|
|
|
|
|
pos = 1;
|
|
|
|
|
else
|
|
|
|
|
pos = 0;
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2003-12-21 22:28:14 +00:00
|
|
|
|
g_list_free (siblings);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
break;
|
2003-09-04 00:15:59 +00:00
|
|
|
|
case NODE_TYPE_MENU_PLACEHOLDER:
|
2003-08-24 19:58:30 +00:00
|
|
|
|
menushell = gtk_widget_get_parent (NODE_INFO (parent)->proxy);
|
2006-12-28 21:23:17 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_MENU_SHELL (menushell), FALSE);
|
2010-12-23 23:21:53 +00:00
|
|
|
|
pos = g_list_index (GTK_MENU_SHELL (menushell)->priv->children,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
NODE_INFO (parent)->proxy) + 1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2006-12-28 21:23:17 +00:00
|
|
|
|
g_warning ("%s: bad parent node type %d", G_STRLOC,
|
|
|
|
|
NODE_INFO (parent)->type);
|
|
|
|
|
return FALSE;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *prev_child;
|
|
|
|
|
GNode *sibling;
|
|
|
|
|
|
|
|
|
|
sibling = node->prev;
|
2003-09-04 00:15:59 +00:00
|
|
|
|
if (NODE_INFO (sibling)->type == NODE_TYPE_MENU_PLACEHOLDER)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
prev_child = NODE_INFO (sibling)->extra; /* second Separator */
|
|
|
|
|
else
|
|
|
|
|
prev_child = NODE_INFO (sibling)->proxy;
|
|
|
|
|
|
2007-01-14 05:31:46 +00:00
|
|
|
|
if (!GTK_IS_WIDGET (prev_child))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
menushell = gtk_widget_get_parent (prev_child);
|
2007-01-14 05:31:46 +00:00
|
|
|
|
if (!GTK_IS_MENU_SHELL (menushell))
|
|
|
|
|
return FALSE;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-12-23 23:21:53 +00:00
|
|
|
|
pos = g_list_index (GTK_MENU_SHELL (menushell)->priv->children, prev_child) + 1;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (menushell_p)
|
|
|
|
|
*menushell_p = menushell;
|
|
|
|
|
if (pos_p)
|
|
|
|
|
*pos_p = pos;
|
2006-12-28 21:23:17 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
static gboolean
|
2003-08-24 19:58:30 +00:00
|
|
|
|
find_toolbar_position (GNode *node,
|
|
|
|
|
GtkWidget **toolbar_p,
|
|
|
|
|
gint *pos_p)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *toolbar;
|
|
|
|
|
gint pos;
|
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
g_return_val_if_fail (node != NULL, FALSE);
|
|
|
|
|
g_return_val_if_fail (NODE_INFO (node)->type == NODE_TYPE_TOOLBAR ||
|
|
|
|
|
NODE_INFO (node)->type == NODE_TYPE_TOOLBAR_PLACEHOLDER ||
|
|
|
|
|
NODE_INFO (node)->type == NODE_TYPE_TOOLITEM ||
|
|
|
|
|
NODE_INFO (node)->type == NODE_TYPE_SEPARATOR,
|
|
|
|
|
FALSE);
|
2006-04-12 04:49:18 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
/* first sibling -- look at parent */
|
|
|
|
|
if (node->prev == NULL)
|
|
|
|
|
{
|
|
|
|
|
GNode *parent;
|
|
|
|
|
|
|
|
|
|
parent = node->parent;
|
|
|
|
|
switch (NODE_INFO (parent)->type)
|
|
|
|
|
{
|
2003-09-04 00:15:59 +00:00
|
|
|
|
case NODE_TYPE_TOOLBAR:
|
2003-08-24 19:58:30 +00:00
|
|
|
|
toolbar = NODE_INFO (parent)->proxy;
|
|
|
|
|
pos = 0;
|
|
|
|
|
break;
|
2003-09-04 00:15:59 +00:00
|
|
|
|
case NODE_TYPE_TOOLBAR_PLACEHOLDER:
|
2003-08-24 19:58:30 +00:00
|
|
|
|
toolbar = gtk_widget_get_parent (NODE_INFO (parent)->proxy);
|
2006-12-28 21:23:17 +00:00
|
|
|
|
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), FALSE);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolbar),
|
|
|
|
|
GTK_TOOL_ITEM (NODE_INFO (parent)->proxy)) + 1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
g_warning ("%s: bad parent node type %d", G_STRLOC,
|
|
|
|
|
NODE_INFO (parent)->type);
|
2006-12-28 21:23:17 +00:00
|
|
|
|
return FALSE;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *prev_child;
|
|
|
|
|
GNode *sibling;
|
|
|
|
|
|
|
|
|
|
sibling = node->prev;
|
2003-09-04 00:15:59 +00:00
|
|
|
|
if (NODE_INFO (sibling)->type == NODE_TYPE_TOOLBAR_PLACEHOLDER)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
prev_child = NODE_INFO (sibling)->extra; /* second Separator */
|
|
|
|
|
else
|
|
|
|
|
prev_child = NODE_INFO (sibling)->proxy;
|
|
|
|
|
|
2007-01-14 05:31:46 +00:00
|
|
|
|
if (!GTK_IS_WIDGET (prev_child))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
toolbar = gtk_widget_get_parent (prev_child);
|
2007-01-14 05:31:46 +00:00
|
|
|
|
if (!GTK_IS_TOOLBAR (toolbar))
|
|
|
|
|
return FALSE;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
pos = gtk_toolbar_get_item_index (GTK_TOOLBAR (toolbar),
|
|
|
|
|
GTK_TOOL_ITEM (prev_child)) + 1;
|
|
|
|
|
}
|
2006-04-12 04:49:18 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
if (toolbar_p)
|
|
|
|
|
*toolbar_p = toolbar;
|
|
|
|
|
if (pos_p)
|
|
|
|
|
*pos_p = pos;
|
2006-12-28 21:23:17 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-09-15 20:35:28 +00:00
|
|
|
|
enum {
|
|
|
|
|
SEPARATOR_MODE_SMART,
|
|
|
|
|
SEPARATOR_MODE_VISIBLE,
|
|
|
|
|
SEPARATOR_MODE_HIDDEN
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
update_smart_separators (GtkWidget *proxy)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *parent = NULL;
|
2004-01-08 23:37:34 +00:00
|
|
|
|
|
2003-09-15 20:35:28 +00:00
|
|
|
|
if (GTK_IS_MENU (proxy) || GTK_IS_TOOLBAR (proxy))
|
|
|
|
|
parent = proxy;
|
|
|
|
|
else if (GTK_IS_MENU_ITEM (proxy) || GTK_IS_TOOL_ITEM (proxy))
|
|
|
|
|
parent = gtk_widget_get_parent (proxy);
|
|
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
|
{
|
|
|
|
|
gboolean visible;
|
2003-09-30 20:55:24 +00:00
|
|
|
|
gboolean empty;
|
2003-09-15 20:35:28 +00:00
|
|
|
|
GList *children, *cur, *last;
|
2003-09-30 20:55:24 +00:00
|
|
|
|
GtkWidget *filler;
|
2003-09-15 20:35:28 +00:00
|
|
|
|
|
|
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (parent));
|
|
|
|
|
|
|
|
|
|
visible = FALSE;
|
|
|
|
|
last = NULL;
|
2003-09-30 20:55:24 +00:00
|
|
|
|
empty = TRUE;
|
|
|
|
|
filler = NULL;
|
|
|
|
|
|
2003-09-15 20:35:28 +00:00
|
|
|
|
cur = children;
|
|
|
|
|
while (cur)
|
|
|
|
|
{
|
2003-09-30 20:55:24 +00:00
|
|
|
|
if (g_object_get_data (cur->data, "gtk-empty-menu-item"))
|
2004-12-13 05:35:17 +00:00
|
|
|
|
{
|
|
|
|
|
filler = cur->data;
|
|
|
|
|
}
|
|
|
|
|
else if (GTK_IS_SEPARATOR_MENU_ITEM (cur->data) ||
|
|
|
|
|
GTK_IS_SEPARATOR_TOOL_ITEM (cur->data))
|
2003-09-15 20:35:28 +00:00
|
|
|
|
{
|
|
|
|
|
gint mode =
|
|
|
|
|
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cur->data),
|
|
|
|
|
"gtk-separator-mode"));
|
|
|
|
|
switch (mode)
|
|
|
|
|
{
|
|
|
|
|
case SEPARATOR_MODE_VISIBLE:
|
|
|
|
|
gtk_widget_show (GTK_WIDGET (cur->data));
|
|
|
|
|
last = NULL;
|
|
|
|
|
visible = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
case SEPARATOR_MODE_HIDDEN:
|
|
|
|
|
gtk_widget_hide (GTK_WIDGET (cur->data));
|
|
|
|
|
break;
|
|
|
|
|
case SEPARATOR_MODE_SMART:
|
|
|
|
|
if (visible)
|
|
|
|
|
{
|
|
|
|
|
gtk_widget_show (GTK_WIDGET (cur->data));
|
|
|
|
|
last = cur;
|
|
|
|
|
visible = FALSE;
|
|
|
|
|
}
|
2004-01-09 21:22:38 +00:00
|
|
|
|
else
|
2004-01-11 23:08:13 +00:00
|
|
|
|
gtk_widget_hide (GTK_WIDGET (cur->data));
|
2003-09-15 20:35:28 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-03-01 06:47:38 +00:00
|
|
|
|
else if (gtk_widget_get_visible (cur->data))
|
2003-09-15 20:35:28 +00:00
|
|
|
|
{
|
|
|
|
|
last = NULL;
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2003-09-30 20:55:24 +00:00
|
|
|
|
if (GTK_IS_TEAROFF_MENU_ITEM (cur->data) || cur->data == filler)
|
2003-09-15 20:35:28 +00:00
|
|
|
|
visible = FALSE;
|
2013-05-05 14:31:08 +00:00
|
|
|
|
else
|
2003-09-30 20:55:24 +00:00
|
|
|
|
{
|
|
|
|
|
visible = TRUE;
|
|
|
|
|
empty = FALSE;
|
|
|
|
|
}
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2003-09-15 20:35:28 +00:00
|
|
|
|
}
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
2003-09-15 20:35:28 +00:00
|
|
|
|
cur = cur->next;
|
|
|
|
|
}
|
|
|
|
|
|
2004-01-11 23:08:13 +00:00
|
|
|
|
if (last)
|
2003-09-15 20:35:28 +00:00
|
|
|
|
gtk_widget_hide (GTK_WIDGET (last->data));
|
2003-09-30 20:55:24 +00:00
|
|
|
|
|
|
|
|
|
if (GTK_IS_MENU (parent))
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *item;
|
|
|
|
|
|
|
|
|
|
item = gtk_menu_get_attach_widget (GTK_MENU (parent));
|
2003-11-16 21:54:37 +00:00
|
|
|
|
if (GTK_IS_MENU_ITEM (item))
|
|
|
|
|
_gtk_action_sync_menu_visible (NULL, item, empty);
|
|
|
|
|
if (GTK_IS_WIDGET (filler))
|
2004-11-11 18:13:19 +00:00
|
|
|
|
{
|
|
|
|
|
if (empty)
|
|
|
|
|
gtk_widget_show (filler);
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_hide (filler);
|
|
|
|
|
}
|
2003-09-30 20:55:24 +00:00
|
|
|
|
}
|
2003-12-21 22:28:14 +00:00
|
|
|
|
|
|
|
|
|
g_list_free (children);
|
2003-09-15 20:35:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
static void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
update_node (GtkUIManager *manager,
|
2003-08-29 22:42:37 +00:00
|
|
|
|
GNode *node,
|
2008-10-09 08:50:33 +00:00
|
|
|
|
gboolean in_popup,
|
|
|
|
|
gboolean popup_accels)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2003-09-04 00:15:59 +00:00
|
|
|
|
Node *info;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
GNode *child;
|
|
|
|
|
GtkAction *action;
|
2004-11-11 21:18:18 +00:00
|
|
|
|
const gchar *action_name;
|
|
|
|
|
NodeUIReference *ref;
|
|
|
|
|
|
2003-08-25 23:13:47 +00:00
|
|
|
|
#ifdef DEBUG_UI_MANAGER
|
2003-08-24 19:58:30 +00:00
|
|
|
|
GList *tmp;
|
|
|
|
|
#endif
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_return_if_fail (node != NULL);
|
|
|
|
|
g_return_if_fail (NODE_INFO (node) != NULL);
|
|
|
|
|
|
|
|
|
|
info = NODE_INFO (node);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
|
|
|
|
if (!info->dirty)
|
|
|
|
|
return;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2008-10-09 08:50:33 +00:00
|
|
|
|
if (info->type == NODE_TYPE_POPUP)
|
|
|
|
|
{
|
|
|
|
|
in_popup = TRUE;
|
|
|
|
|
popup_accels = info->popup_accels;
|
|
|
|
|
}
|
2003-11-24 23:24:40 +00:00
|
|
|
|
|
2003-08-25 23:13:47 +00:00
|
|
|
|
#ifdef DEBUG_UI_MANAGER
|
2003-11-24 23:24:40 +00:00
|
|
|
|
g_print ("update_node name=%s dirty=%d popup %d (",
|
|
|
|
|
info->name, info->dirty, in_popup);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
for (tmp = info->uifiles; tmp != NULL; tmp = tmp->next)
|
|
|
|
|
{
|
|
|
|
|
NodeUIReference *ref = tmp->data;
|
|
|
|
|
g_print("%s:%u", g_quark_to_string (ref->action_quark), ref->merge_id);
|
|
|
|
|
if (tmp->next)
|
|
|
|
|
g_print (", ");
|
|
|
|
|
}
|
|
|
|
|
g_print (")\n");
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (info->uifiles == NULL) {
|
|
|
|
|
/* We may need to remove this node.
|
|
|
|
|
* This must be done in post order
|
|
|
|
|
*/
|
|
|
|
|
goto recurse_children;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ref = info->uifiles->data;
|
|
|
|
|
action_name = g_quark_to_string (ref->action_quark);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
action = get_action_by_name (manager, action_name);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
|
|
|
|
info->dirty = FALSE;
|
|
|
|
|
|
|
|
|
|
/* Check if the node doesn't have an action and must have an action */
|
|
|
|
|
if (action == NULL &&
|
|
|
|
|
info->type != NODE_TYPE_ROOT &&
|
|
|
|
|
info->type != NODE_TYPE_MENUBAR &&
|
|
|
|
|
info->type != NODE_TYPE_TOOLBAR &&
|
|
|
|
|
info->type != NODE_TYPE_POPUP &&
|
|
|
|
|
info->type != NODE_TYPE_SEPARATOR &&
|
|
|
|
|
info->type != NODE_TYPE_MENU_PLACEHOLDER &&
|
|
|
|
|
info->type != NODE_TYPE_TOOLBAR_PLACEHOLDER)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2006-12-27 06:37:18 +00:00
|
|
|
|
g_warning ("%s: missing action %s", info->name, action_name);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
2006-12-27 06:37:18 +00:00
|
|
|
|
return;
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (action)
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_action_set_accel_group (action, manager->private_data->accel_group);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
|
|
|
|
/* If the widget already has a proxy and the action hasn't changed, then
|
|
|
|
|
* we only have to update the tearoff menu items.
|
|
|
|
|
*/
|
|
|
|
|
if (info->proxy != NULL && action == info->action)
|
|
|
|
|
{
|
2013-05-05 14:31:08 +00:00
|
|
|
|
if (info->type == NODE_TYPE_MENU)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2004-11-11 18:13:19 +00:00
|
|
|
|
GtkWidget *menu;
|
|
|
|
|
GList *siblings;
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
2005-06-19 03:20:07 +00:00
|
|
|
|
if (GTK_IS_MENU (info->proxy))
|
|
|
|
|
menu = info->proxy;
|
|
|
|
|
else
|
|
|
|
|
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy));
|
2004-11-11 18:13:19 +00:00
|
|
|
|
siblings = gtk_container_get_children (GTK_CONTAINER (menu));
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (siblings != NULL && GTK_IS_TEAROFF_MENU_ITEM (siblings->data))
|
2004-11-11 19:57:41 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
if (manager->private_data->add_tearoffs && !in_popup)
|
2004-11-11 19:57:41 +00:00
|
|
|
|
gtk_widget_show (GTK_WIDGET (siblings->data));
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_hide (GTK_WIDGET (siblings->data));
|
|
|
|
|
}
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
g_list_free (siblings);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
goto recurse_children;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (info->type)
|
|
|
|
|
{
|
|
|
|
|
case NODE_TYPE_MENUBAR:
|
|
|
|
|
if (info->proxy == NULL)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2004-11-11 18:13:19 +00:00
|
|
|
|
info->proxy = gtk_menu_bar_new ();
|
2005-11-23 18:06:58 +00:00
|
|
|
|
g_object_ref_sink (info->proxy);
|
2004-01-09 21:22:38 +00:00
|
|
|
|
gtk_widget_set_name (info->proxy, info->name);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
gtk_widget_show (info->proxy);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_signal_emit (manager, ui_manager_signals[ADD_WIDGET], 0, info->proxy);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_POPUP:
|
|
|
|
|
if (info->proxy == NULL)
|
|
|
|
|
{
|
|
|
|
|
info->proxy = gtk_menu_new ();
|
2005-11-23 18:06:58 +00:00
|
|
|
|
g_object_ref_sink (info->proxy);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
gtk_widget_set_name (info->proxy, info->name);
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_MENU:
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *prev_submenu = NULL;
|
2007-03-15 19:33:57 +00:00
|
|
|
|
GtkWidget *menu = NULL;
|
2004-11-11 18:13:19 +00:00
|
|
|
|
GList *siblings;
|
2007-03-15 19:33:57 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
/* remove the proxy if it is of the wrong type ... */
|
|
|
|
|
if (info->proxy &&
|
|
|
|
|
G_OBJECT_TYPE (info->proxy) != GTK_ACTION_GET_CLASS (action)->menu_item_type)
|
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
|
|
|
|
{
|
2005-06-19 03:20:07 +00:00
|
|
|
|
if (GTK_IS_MENU_ITEM (info->proxy))
|
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
|
|
|
|
{
|
2005-06-19 03:20:07 +00:00
|
|
|
|
prev_submenu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy));
|
|
|
|
|
if (prev_submenu)
|
|
|
|
|
{
|
|
|
|
|
g_object_ref (prev_submenu);
|
|
|
|
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), NULL);
|
|
|
|
|
}
|
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
|
|
|
|
}
|
2005-06-19 03:20:07 +00:00
|
|
|
|
|
2009-01-23 17:10:08 +00:00
|
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (info->proxy), NULL);
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->proxy)),
|
2004-11-11 18:13:19 +00:00
|
|
|
|
info->proxy);
|
|
|
|
|
g_object_unref (info->proxy);
|
|
|
|
|
info->proxy = NULL;
|
|
|
|
|
}
|
2007-03-15 19:33:57 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
/* create proxy if needed ... */
|
|
|
|
|
if (info->proxy == NULL)
|
|
|
|
|
{
|
2007-03-15 19:33:57 +00:00
|
|
|
|
/* ... if the action already provides a menu, then use
|
|
|
|
|
* that menu instead of creating an empty one
|
|
|
|
|
*/
|
2007-03-16 20:04:57 +00:00
|
|
|
|
if ((NODE_INFO (node->parent)->type == NODE_TYPE_TOOLITEM ||
|
|
|
|
|
NODE_INFO (node->parent)->type == NODE_TYPE_MENUITEM) &&
|
|
|
|
|
GTK_ACTION_GET_CLASS (action)->create_menu)
|
2007-03-15 19:33:57 +00:00
|
|
|
|
{
|
2007-03-16 20:04:57 +00:00
|
|
|
|
menu = gtk_action_create_menu (action);
|
2007-03-15 19:33:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!menu)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *tearoff;
|
|
|
|
|
GtkWidget *filler;
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
2007-03-15 19:33:57 +00:00
|
|
|
|
menu = gtk_menu_new ();
|
|
|
|
|
gtk_widget_set_name (menu, info->name);
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
2007-03-15 19:33:57 +00:00
|
|
|
|
tearoff = gtk_tearoff_menu_item_new ();
|
2013-05-05 14:31:08 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2007-03-15 19:33:57 +00:00
|
|
|
|
gtk_widget_set_no_show_all (tearoff, TRUE);
|
|
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), tearoff);
|
|
|
|
|
filler = gtk_menu_item_new_with_label (_("Empty"));
|
|
|
|
|
g_object_set_data (G_OBJECT (filler),
|
|
|
|
|
I_("gtk-empty-menu-item"),
|
|
|
|
|
GINT_TO_POINTER (TRUE));
|
|
|
|
|
gtk_widget_set_sensitive (filler, FALSE);
|
|
|
|
|
gtk_widget_set_no_show_all (filler, TRUE);
|
|
|
|
|
gtk_menu_shell_append (GTK_MENU_SHELL (menu), filler);
|
|
|
|
|
}
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
2007-03-15 19:33:57 +00:00
|
|
|
|
if (NODE_INFO (node->parent)->type == NODE_TYPE_TOOLITEM)
|
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
|
|
|
|
{
|
2006-04-12 13:32:47 +00:00
|
|
|
|
info->proxy = menu;
|
|
|
|
|
g_object_ref_sink (info->proxy);
|
|
|
|
|
gtk_menu_tool_button_set_menu (GTK_MENU_TOOL_BUTTON (NODE_INFO (node->parent)->proxy),
|
|
|
|
|
menu);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *menushell;
|
|
|
|
|
gint pos;
|
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
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
if (find_menu_position (node, &menushell, &pos))
|
|
|
|
|
{
|
|
|
|
|
info->proxy = gtk_action_create_menu_item (action);
|
|
|
|
|
g_object_ref_sink (info->proxy);
|
|
|
|
|
g_signal_connect (info->proxy, "notify::visible",
|
|
|
|
|
G_CALLBACK (update_smart_separators), NULL);
|
|
|
|
|
gtk_widget_set_name (info->proxy, info->name);
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), menu);
|
|
|
|
|
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell), info->proxy, pos);
|
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
else
|
2009-01-23 17:10:08 +00:00
|
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (info->proxy), action);
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (prev_submenu)
|
|
|
|
|
{
|
|
|
|
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy),
|
|
|
|
|
prev_submenu);
|
|
|
|
|
g_object_unref (prev_submenu);
|
|
|
|
|
}
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
2005-06-19 03:20:07 +00:00
|
|
|
|
if (GTK_IS_MENU (info->proxy))
|
|
|
|
|
menu = info->proxy;
|
|
|
|
|
else
|
|
|
|
|
menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy));
|
2007-03-15 19:33:57 +00:00
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
siblings = gtk_container_get_children (GTK_CONTAINER (menu));
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (siblings != NULL && GTK_IS_TEAROFF_MENU_ITEM (siblings->data))
|
2004-11-11 19:57:41 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
if (manager->private_data->add_tearoffs && !in_popup)
|
2004-11-11 19:57:41 +00:00
|
|
|
|
gtk_widget_show (GTK_WIDGET (siblings->data));
|
|
|
|
|
else
|
|
|
|
|
gtk_widget_hide (GTK_WIDGET (siblings->data));
|
|
|
|
|
}
|
2013-05-05 14:31:08 +00:00
|
|
|
|
|
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
g_list_free (siblings);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_UNDECIDED:
|
|
|
|
|
g_warning ("found undecided node!");
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_ROOT:
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_TOOLBAR:
|
|
|
|
|
if (info->proxy == NULL)
|
|
|
|
|
{
|
|
|
|
|
info->proxy = gtk_toolbar_new ();
|
2005-11-23 18:06:58 +00:00
|
|
|
|
g_object_ref_sink (info->proxy);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
gtk_widget_set_name (info->proxy, info->name);
|
|
|
|
|
gtk_widget_show (info->proxy);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_signal_emit (manager, ui_manager_signals[ADD_WIDGET], 0, info->proxy);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_MENU_PLACEHOLDER:
|
|
|
|
|
/* create menu items for placeholders if necessary ... */
|
|
|
|
|
if (!GTK_IS_SEPARATOR_MENU_ITEM (info->proxy) ||
|
|
|
|
|
!GTK_IS_SEPARATOR_MENU_ITEM (info->extra))
|
|
|
|
|
{
|
|
|
|
|
if (info->proxy)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->proxy)),
|
2004-11-11 18:13:19 +00:00
|
|
|
|
info->proxy);
|
|
|
|
|
g_object_unref (info->proxy);
|
|
|
|
|
info->proxy = NULL;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (info->extra)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->extra)),
|
2004-11-11 18:13:19 +00:00
|
|
|
|
info->extra);
|
|
|
|
|
g_object_unref (info->extra);
|
|
|
|
|
info->extra = NULL;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
if (info->proxy == NULL)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *menushell;
|
|
|
|
|
gint pos;
|
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
if (find_menu_position (node, &menushell, &pos))
|
|
|
|
|
{
|
|
|
|
|
info->proxy = gtk_separator_menu_item_new ();
|
|
|
|
|
g_object_ref_sink (info->proxy);
|
|
|
|
|
g_object_set_data (G_OBJECT (info->proxy),
|
|
|
|
|
I_("gtk-separator-mode"),
|
|
|
|
|
GINT_TO_POINTER (SEPARATOR_MODE_HIDDEN));
|
|
|
|
|
gtk_widget_set_no_show_all (info->proxy, TRUE);
|
|
|
|
|
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
|
|
|
|
|
NODE_INFO (node)->proxy, pos);
|
2006-04-12 13:32:47 +00:00
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
info->extra = gtk_separator_menu_item_new ();
|
|
|
|
|
g_object_ref_sink (info->extra);
|
|
|
|
|
g_object_set_data (G_OBJECT (info->extra),
|
|
|
|
|
I_("gtk-separator-mode"),
|
|
|
|
|
GINT_TO_POINTER (SEPARATOR_MODE_HIDDEN));
|
|
|
|
|
gtk_widget_set_no_show_all (info->extra, TRUE);
|
|
|
|
|
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
|
|
|
|
|
NODE_INFO (node)->extra, pos + 1);
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_TOOLBAR_PLACEHOLDER:
|
|
|
|
|
/* create toolbar items for placeholders if necessary ... */
|
|
|
|
|
if (!GTK_IS_SEPARATOR_TOOL_ITEM (info->proxy) ||
|
|
|
|
|
!GTK_IS_SEPARATOR_TOOL_ITEM (info->extra))
|
|
|
|
|
{
|
|
|
|
|
if (info->proxy)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->proxy)),
|
2003-08-24 19:58:30 +00:00
|
|
|
|
info->proxy);
|
2004-07-20 17:10:24 +00:00
|
|
|
|
g_object_unref (info->proxy);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
info->proxy = NULL;
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (info->extra)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->extra)),
|
2004-11-11 18:13:19 +00:00
|
|
|
|
info->extra);
|
|
|
|
|
g_object_unref (info->extra);
|
|
|
|
|
info->extra = NULL;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
if (info->proxy == NULL)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *toolbar;
|
|
|
|
|
gint pos;
|
2006-04-12 13:32:47 +00:00
|
|
|
|
GtkToolItem *item;
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
if (find_toolbar_position (node, &toolbar, &pos))
|
|
|
|
|
{
|
|
|
|
|
item = gtk_separator_tool_item_new ();
|
|
|
|
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, pos);
|
|
|
|
|
info->proxy = GTK_WIDGET (item);
|
|
|
|
|
g_object_ref_sink (info->proxy);
|
|
|
|
|
g_object_set_data (G_OBJECT (info->proxy),
|
|
|
|
|
I_("gtk-separator-mode"),
|
|
|
|
|
GINT_TO_POINTER (SEPARATOR_MODE_HIDDEN));
|
|
|
|
|
gtk_widget_set_no_show_all (info->proxy, TRUE);
|
2006-04-12 13:32:47 +00:00
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
item = gtk_separator_tool_item_new ();
|
|
|
|
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, pos+1);
|
|
|
|
|
info->extra = GTK_WIDGET (item);
|
|
|
|
|
g_object_ref_sink (info->extra);
|
|
|
|
|
g_object_set_data (G_OBJECT (info->extra),
|
|
|
|
|
I_("gtk-separator-mode"),
|
|
|
|
|
GINT_TO_POINTER (SEPARATOR_MODE_HIDDEN));
|
|
|
|
|
gtk_widget_set_no_show_all (info->extra, TRUE);
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_MENUITEM:
|
|
|
|
|
/* remove the proxy if it is of the wrong type ... */
|
|
|
|
|
if (info->proxy &&
|
|
|
|
|
G_OBJECT_TYPE (info->proxy) != GTK_ACTION_GET_CLASS (action)->menu_item_type)
|
|
|
|
|
{
|
|
|
|
|
g_signal_handlers_disconnect_by_func (info->proxy,
|
|
|
|
|
G_CALLBACK (update_smart_separators),
|
|
|
|
|
NULL);
|
2009-01-23 17:10:08 +00:00
|
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (info->proxy), NULL);
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->proxy)),
|
2004-11-11 18:13:19 +00:00
|
|
|
|
info->proxy);
|
|
|
|
|
g_object_unref (info->proxy);
|
|
|
|
|
info->proxy = NULL;
|
|
|
|
|
}
|
|
|
|
|
/* create proxy if needed ... */
|
|
|
|
|
if (info->proxy == NULL)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *menushell;
|
|
|
|
|
gint pos;
|
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
if (find_menu_position (node, &menushell, &pos))
|
|
|
|
|
{
|
|
|
|
|
info->proxy = gtk_action_create_menu_item (action);
|
|
|
|
|
g_object_ref_sink (info->proxy);
|
|
|
|
|
gtk_widget_set_name (info->proxy, info->name);
|
2009-11-11 17:59:12 +00:00
|
|
|
|
|
2013-06-27 22:48:46 +00:00
|
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
|
|
|
|
|
2009-11-11 17:59:12 +00:00
|
|
|
|
if (info->always_show_image_set &&
|
|
|
|
|
GTK_IS_IMAGE_MENU_ITEM (info->proxy))
|
|
|
|
|
gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (info->proxy),
|
|
|
|
|
info->always_show_image);
|
|
|
|
|
|
2013-06-27 22:48:46 +00:00
|
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS;
|
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
|
|
|
|
|
info->proxy, pos);
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_signal_handlers_disconnect_by_func (info->proxy,
|
|
|
|
|
G_CALLBACK (update_smart_separators),
|
|
|
|
|
NULL);
|
|
|
|
|
gtk_menu_item_set_submenu (GTK_MENU_ITEM (info->proxy), NULL);
|
2009-01-23 17:10:08 +00:00
|
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (info->proxy), action);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
2007-01-14 05:31:46 +00:00
|
|
|
|
|
|
|
|
|
if (info->proxy)
|
|
|
|
|
{
|
|
|
|
|
g_signal_connect (info->proxy, "notify::visible",
|
|
|
|
|
G_CALLBACK (update_smart_separators), NULL);
|
2008-10-09 08:50:33 +00:00
|
|
|
|
if (in_popup && !popup_accels)
|
2007-01-14 05:31:46 +00:00
|
|
|
|
{
|
|
|
|
|
/* don't show accels in popups */
|
2009-11-29 01:00:07 +00:00
|
|
|
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (info->proxy));
|
|
|
|
|
if (GTK_IS_ACCEL_LABEL (child))
|
|
|
|
|
g_object_set (child, "accel-closure", NULL, NULL);
|
2007-01-14 05:31:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_TOOLITEM:
|
|
|
|
|
/* remove the proxy if it is of the wrong type ... */
|
2005-06-19 03:20:07 +00:00
|
|
|
|
if (info->proxy &&
|
2004-11-11 18:13:19 +00:00
|
|
|
|
G_OBJECT_TYPE (info->proxy) != GTK_ACTION_GET_CLASS (action)->toolbar_item_type)
|
|
|
|
|
{
|
|
|
|
|
g_signal_handlers_disconnect_by_func (info->proxy,
|
|
|
|
|
G_CALLBACK (update_smart_separators),
|
|
|
|
|
NULL);
|
2009-01-23 17:10:08 +00:00
|
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (info->proxy), NULL);
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->proxy)),
|
2004-11-11 18:13:19 +00:00
|
|
|
|
info->proxy);
|
|
|
|
|
g_object_unref (info->proxy);
|
|
|
|
|
info->proxy = NULL;
|
|
|
|
|
}
|
|
|
|
|
/* create proxy if needed ... */
|
|
|
|
|
if (info->proxy == NULL)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *toolbar;
|
|
|
|
|
gint pos;
|
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
if (find_toolbar_position (node, &toolbar, &pos))
|
|
|
|
|
{
|
|
|
|
|
info->proxy = gtk_action_create_tool_item (action);
|
|
|
|
|
g_object_ref_sink (info->proxy);
|
|
|
|
|
gtk_widget_set_name (info->proxy, info->name);
|
|
|
|
|
|
|
|
|
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
|
|
|
|
|
GTK_TOOL_ITEM (info->proxy), pos);
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_signal_handlers_disconnect_by_func (info->proxy,
|
|
|
|
|
G_CALLBACK (update_smart_separators),
|
|
|
|
|
NULL);
|
2009-01-23 17:10:08 +00:00
|
|
|
|
gtk_activatable_set_related_action (GTK_ACTIVATABLE (info->proxy), action);
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
2005-08-01 16:24:30 +00:00
|
|
|
|
|
2007-01-14 05:31:46 +00:00
|
|
|
|
if (info->proxy)
|
|
|
|
|
{
|
|
|
|
|
g_signal_connect (info->proxy, "notify::visible",
|
|
|
|
|
G_CALLBACK (update_smart_separators), NULL);
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_SEPARATOR:
|
|
|
|
|
if (NODE_INFO (node->parent)->type == NODE_TYPE_TOOLBAR ||
|
|
|
|
|
NODE_INFO (node->parent)->type == NODE_TYPE_TOOLBAR_PLACEHOLDER)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *toolbar;
|
|
|
|
|
gint pos;
|
2005-02-08 15:54:09 +00:00
|
|
|
|
gint separator_mode;
|
2006-04-12 13:32:47 +00:00
|
|
|
|
GtkToolItem *item;
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
if (GTK_IS_SEPARATOR_TOOL_ITEM (info->proxy))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->proxy)),
|
2003-08-24 19:58:30 +00:00
|
|
|
|
info->proxy);
|
2004-07-20 17:10:24 +00:00
|
|
|
|
g_object_unref (info->proxy);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
info->proxy = NULL;
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
if (find_toolbar_position (node, &toolbar, &pos))
|
|
|
|
|
{
|
|
|
|
|
item = gtk_separator_tool_item_new ();
|
|
|
|
|
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, pos);
|
|
|
|
|
info->proxy = GTK_WIDGET (item);
|
|
|
|
|
g_object_ref_sink (info->proxy);
|
|
|
|
|
gtk_widget_set_no_show_all (info->proxy, TRUE);
|
|
|
|
|
if (info->expand)
|
|
|
|
|
{
|
|
|
|
|
gtk_tool_item_set_expand (GTK_TOOL_ITEM (item), TRUE);
|
|
|
|
|
gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (item), FALSE);
|
|
|
|
|
separator_mode = SEPARATOR_MODE_VISIBLE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
separator_mode = SEPARATOR_MODE_SMART;
|
2006-04-12 13:32:47 +00:00
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
g_object_set_data (G_OBJECT (info->proxy),
|
|
|
|
|
I_("gtk-separator-mode"),
|
|
|
|
|
GINT_TO_POINTER (separator_mode));
|
|
|
|
|
gtk_widget_show (info->proxy);
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *menushell;
|
|
|
|
|
gint pos;
|
|
|
|
|
|
|
|
|
|
if (GTK_IS_SEPARATOR_MENU_ITEM (info->proxy))
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-08-11 20:06:02 +00:00
|
|
|
|
gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (info->proxy)),
|
2004-11-11 18:13:19 +00:00
|
|
|
|
info->proxy);
|
|
|
|
|
g_object_unref (info->proxy);
|
|
|
|
|
info->proxy = NULL;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
2006-12-28 21:23:17 +00:00
|
|
|
|
if (find_menu_position (node, &menushell, &pos))
|
|
|
|
|
{
|
|
|
|
|
info->proxy = gtk_separator_menu_item_new ();
|
|
|
|
|
g_object_ref_sink (info->proxy);
|
|
|
|
|
gtk_widget_set_no_show_all (info->proxy, TRUE);
|
|
|
|
|
g_object_set_data (G_OBJECT (info->proxy),
|
|
|
|
|
I_("gtk-separator-mode"),
|
|
|
|
|
GINT_TO_POINTER (SEPARATOR_MODE_SMART));
|
|
|
|
|
gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
|
|
|
|
|
info->proxy, pos);
|
|
|
|
|
gtk_widget_show (info->proxy);
|
|
|
|
|
}
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
break;
|
|
|
|
|
case NODE_TYPE_ACCELERATOR:
|
|
|
|
|
gtk_action_connect_accelerator (action);
|
|
|
|
|
break;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
|
|
|
|
if (action)
|
|
|
|
|
g_object_ref (action);
|
|
|
|
|
if (info->action)
|
|
|
|
|
g_object_unref (info->action);
|
|
|
|
|
info->action = action;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
recurse_children:
|
|
|
|
|
/* process children */
|
|
|
|
|
child = node->children;
|
|
|
|
|
while (child)
|
|
|
|
|
{
|
|
|
|
|
GNode *current;
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
current = child;
|
|
|
|
|
child = current->next;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
update_node (manager, current, in_popup, popup_accels);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
2003-09-17 23:58:28 +00:00
|
|
|
|
if (info->proxy)
|
2003-09-17 22:44:01 +00:00
|
|
|
|
{
|
2005-06-19 03:20:07 +00:00
|
|
|
|
if (info->type == NODE_TYPE_MENU && GTK_IS_MENU_ITEM (info->proxy))
|
2003-09-17 22:44:01 +00:00
|
|
|
|
update_smart_separators (gtk_menu_item_get_submenu (GTK_MENU_ITEM (info->proxy)));
|
2005-06-19 03:20:07 +00:00
|
|
|
|
else if (info->type == NODE_TYPE_MENU ||
|
|
|
|
|
info->type == NODE_TYPE_TOOLBAR ||
|
|
|
|
|
info->type == NODE_TYPE_POPUP)
|
2003-09-17 22:44:01 +00:00
|
|
|
|
update_smart_separators (info->proxy);
|
|
|
|
|
}
|
2004-11-11 18:13:19 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
/* handle cleanup of dead nodes */
|
2003-08-29 23:33:54 +00:00
|
|
|
|
if (node->children == NULL && info->uifiles == NULL)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2003-08-29 23:33:54 +00:00
|
|
|
|
if (info->proxy)
|
|
|
|
|
gtk_widget_destroy (info->proxy);
|
2003-09-11 21:02:24 +00:00
|
|
|
|
if (info->extra)
|
2003-08-29 23:33:54 +00:00
|
|
|
|
gtk_widget_destroy (info->extra);
|
2008-07-07 23:17:40 +00:00
|
|
|
|
if (info->type == NODE_TYPE_ACCELERATOR && info->action != NULL)
|
2003-09-17 23:58:28 +00:00
|
|
|
|
gtk_action_disconnect_accelerator (info->action);
|
2003-09-11 21:02:24 +00:00
|
|
|
|
free_node (node);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
g_node_destroy (node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-06 04:33:40 +00:00
|
|
|
|
static gboolean
|
2010-09-21 04:18:11 +00:00
|
|
|
|
do_updates (GtkUIManager *manager)
|
2004-07-06 04:33:40 +00:00
|
|
|
|
{
|
2003-08-24 19:58:30 +00:00
|
|
|
|
/* this function needs to check through the tree for dirty nodes.
|
|
|
|
|
* For such nodes, it needs to do the following:
|
|
|
|
|
*
|
|
|
|
|
* 1) check if they are referenced by any loaded UI files anymore.
|
|
|
|
|
* In which case, the proxy widget should be destroyed, unless
|
|
|
|
|
* there are any subnodes.
|
|
|
|
|
*
|
|
|
|
|
* 2) lookup the action for this node again. If it is different to
|
|
|
|
|
* the current one (or if no previous action has been looked up),
|
|
|
|
|
* the proxy is reconnected to the new action (or a new proxy widget
|
|
|
|
|
* is created and added to the parent container).
|
|
|
|
|
*/
|
2010-09-21 04:18:11 +00:00
|
|
|
|
update_node (manager, manager->private_data->root_node, FALSE, FALSE);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->update_tag = 0;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-28 15:30:16 +00:00
|
|
|
|
static gboolean
|
2010-09-21 04:18:11 +00:00
|
|
|
|
do_updates_idle (GtkUIManager *manager)
|
2004-07-28 15:30:16 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
do_updates (manager);
|
2004-07-28 15:30:16 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
static void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
queue_update (GtkUIManager *manager)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
if (manager->private_data->update_tag != 0)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager->private_data->update_tag = gdk_threads_add_idle (
|
2006-12-22 19:10:43 +00:00
|
|
|
|
(GSourceFunc)do_updates_idle,
|
2010-09-21 04:18:11 +00:00
|
|
|
|
manager);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-31 23:36:37 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_ui_manager_ensure_update:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-08-31 23:36:37 +00:00
|
|
|
|
*
|
|
|
|
|
* Makes sure that all pending updates to the UI have been completed.
|
|
|
|
|
*
|
|
|
|
|
* This may occasionally be necessary, since #GtkUIManager updates the
|
|
|
|
|
* UI in an idle function. A typical example where this function is
|
|
|
|
|
* useful is to enforce that the menubar and toolbar have been added to
|
|
|
|
|
* the main window before showing it:
|
2014-01-27 19:55:18 +00:00
|
|
|
|
* |[<!-- language="C" -->
|
2003-08-31 23:36:37 +00:00
|
|
|
|
* gtk_container_add (GTK_CONTAINER (window), vbox);
|
2008-08-08 13:53:05 +00:00
|
|
|
|
* g_signal_connect (merge, "add-widget",
|
2003-08-31 23:36:37 +00:00
|
|
|
|
* G_CALLBACK (add_widget), vbox);
|
|
|
|
|
* gtk_ui_manager_add_ui_from_file (merge, "my-menus");
|
|
|
|
|
* gtk_ui_manager_add_ui_from_file (merge, "my-toolbars");
|
|
|
|
|
* gtk_ui_manager_ensure_update (merge);
|
|
|
|
|
* gtk_widget_show (window);
|
2007-11-25 06:51:19 +00:00
|
|
|
|
* ]|
|
2003-08-31 23:36:37 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-31 23:36:37 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_ensure_update (GtkUIManager *manager)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
if (manager->private_data->update_tag != 0)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_source_remove (manager->private_data->update_tag);
|
|
|
|
|
do_updates (manager);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2004-05-05 16:44:52 +00:00
|
|
|
|
dirty_traverse_func (GNode *node,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
gpointer data)
|
|
|
|
|
{
|
|
|
|
|
NODE_INFO (node)->dirty = TRUE;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
dirty_all_nodes (GtkUIManager *manager)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
2010-09-21 04:18:11 +00:00
|
|
|
|
g_node_traverse (manager->private_data->root_node,
|
2003-09-01 22:15:16 +00:00
|
|
|
|
G_PRE_ORDER, G_TRAVERSE_ALL, -1,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
dirty_traverse_func, NULL);
|
2010-09-21 04:18:11 +00:00
|
|
|
|
queue_update (manager);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-11-11 18:13:19 +00:00
|
|
|
|
static void
|
|
|
|
|
mark_node_dirty (GNode *node)
|
|
|
|
|
{
|
|
|
|
|
GNode *p;
|
|
|
|
|
|
|
|
|
|
/* FIXME could optimize this */
|
|
|
|
|
for (p = node; p; p = p->parent)
|
|
|
|
|
NODE_INFO (p)->dirty = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-03 05:19:42 +00:00
|
|
|
|
static const gchar *
|
|
|
|
|
open_tag_format (NodeType type)
|
|
|
|
|
{
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case NODE_TYPE_UNDECIDED: return "%*s<UNDECIDED";
|
|
|
|
|
case NODE_TYPE_ROOT: return "%*s<ui";
|
|
|
|
|
case NODE_TYPE_MENUBAR: return "%*s<menubar";
|
|
|
|
|
case NODE_TYPE_MENU: return "%*s<menu";
|
|
|
|
|
case NODE_TYPE_TOOLBAR: return "%*s<toolbar";
|
|
|
|
|
case NODE_TYPE_MENU_PLACEHOLDER:
|
|
|
|
|
case NODE_TYPE_TOOLBAR_PLACEHOLDER: return "%*s<placeholder";
|
|
|
|
|
case NODE_TYPE_POPUP: return "%*s<popup";
|
|
|
|
|
case NODE_TYPE_MENUITEM: return "%*s<menuitem";
|
|
|
|
|
case NODE_TYPE_TOOLITEM: return "%*s<toolitem";
|
|
|
|
|
case NODE_TYPE_SEPARATOR: return "%*s<separator";
|
|
|
|
|
case NODE_TYPE_ACCELERATOR: return "%*s<accelerator";
|
|
|
|
|
default: return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2006-04-03 05:19:42 +00:00
|
|
|
|
static const gchar *
|
|
|
|
|
close_tag_format (NodeType type)
|
|
|
|
|
{
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
case NODE_TYPE_UNDECIDED: return "%*s</UNDECIDED>\n";
|
|
|
|
|
case NODE_TYPE_ROOT: return "%*s</ui>\n";
|
|
|
|
|
case NODE_TYPE_MENUBAR: return "%*s</menubar>\n";
|
|
|
|
|
case NODE_TYPE_MENU: return "%*s</menu>\n";
|
|
|
|
|
case NODE_TYPE_TOOLBAR: return "%*s</toolbar>\n";
|
|
|
|
|
case NODE_TYPE_MENU_PLACEHOLDER:
|
|
|
|
|
case NODE_TYPE_TOOLBAR_PLACEHOLDER: return "%*s</placeholder>\n";
|
|
|
|
|
case NODE_TYPE_POPUP: return "%*s</popup>\n";
|
|
|
|
|
default: return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2010-09-21 04:18:11 +00:00
|
|
|
|
print_node (GtkUIManager *manager,
|
2004-05-05 16:44:52 +00:00
|
|
|
|
GNode *node,
|
2003-08-24 19:58:30 +00:00
|
|
|
|
gint indent_level,
|
|
|
|
|
GString *buffer)
|
|
|
|
|
{
|
2004-05-05 16:44:52 +00:00
|
|
|
|
Node *mnode;
|
2003-08-24 19:58:30 +00:00
|
|
|
|
GNode *child;
|
2006-04-03 05:19:42 +00:00
|
|
|
|
const gchar *open_fmt;
|
|
|
|
|
const gchar *close_fmt;
|
2003-08-29 22:42:37 +00:00
|
|
|
|
|
2003-08-24 19:58:30 +00:00
|
|
|
|
mnode = node->data;
|
|
|
|
|
|
2006-04-03 05:19:42 +00:00
|
|
|
|
open_fmt = open_tag_format (mnode->type);
|
|
|
|
|
close_fmt = close_tag_format (mnode->type);
|
|
|
|
|
|
|
|
|
|
g_string_append_printf (buffer, open_fmt, indent_level, "");
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2004-09-04 02:55:13 +00:00
|
|
|
|
if (mnode->type != NODE_TYPE_ROOT)
|
|
|
|
|
{
|
|
|
|
|
if (mnode->name)
|
|
|
|
|
g_string_append_printf (buffer, " name=\"%s\"", mnode->name);
|
|
|
|
|
|
|
|
|
|
if (mnode->action_name)
|
|
|
|
|
g_string_append_printf (buffer, " action=\"%s\"",
|
|
|
|
|
g_quark_to_string (mnode->action_name));
|
|
|
|
|
}
|
2004-05-05 16:44:52 +00:00
|
|
|
|
|
2006-04-03 05:19:42 +00:00
|
|
|
|
g_string_append (buffer, close_fmt ? ">\n" : "/>\n");
|
2004-05-05 16:44:52 +00:00
|
|
|
|
|
|
|
|
|
for (child = node->children; child != NULL; child = child->next)
|
2010-09-21 04:18:11 +00:00
|
|
|
|
print_node (manager, child, indent_level + 2, buffer);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2006-04-03 05:19:42 +00:00
|
|
|
|
if (close_fmt)
|
|
|
|
|
g_string_append_printf (buffer, close_fmt, indent_level, "");
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gtk_ui_manager_buildable_custom_tag_start (GtkBuildable *buildable,
|
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
GObject *child,
|
|
|
|
|
const gchar *tagname,
|
|
|
|
|
GMarkupParser *parser,
|
|
|
|
|
gpointer *data)
|
|
|
|
|
{
|
|
|
|
|
if (child)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (strcmp (tagname, "ui") == 0)
|
|
|
|
|
{
|
|
|
|
|
ParseContext *ctx;
|
|
|
|
|
|
|
|
|
|
ctx = g_new0 (ParseContext, 1);
|
|
|
|
|
ctx->state = STATE_START;
|
2010-09-21 04:18:11 +00:00
|
|
|
|
ctx->manager = GTK_UI_MANAGER (buildable);
|
Add GtkBuilder, fixes #172535
2007-06-15 Johan Dahlin <jdahlin@async.com.br>
* demos/gtk-demo/Makefile.am:
* demos/gtk-demo/builder.c: (quit_activate), (about_activate),
(do_builder):
* demos/gtk-demo/demo.ui:
* docs/reference/gtk/gtk-docs.sgml:
* docs/reference/gtk/gtk-sections.txt:
* docs/reference/gtk/gtk.types:
* docs/reference/gtk/tmpl/gtkbuildable.sgml:
* docs/reference/gtk/tmpl/gtkbuilder.sgml:
* gtk/Makefile.am:
* gtk/gtk.h:
* gtk/gtk.symbols:
* gtk/gtkaction.c: (gtk_action_buildable_init),
(gtk_action_buildable_set_name), (gtk_action_buildable_get_name):
* gtk/gtkactiongroup.c: (gtk_action_group_get_type),
(gtk_action_group_buildable_init),
(gtk_action_group_buildable_add),
(gtk_action_group_buildable_set_name),
(gtk_action_group_buildable_get_name):
* gtk/gtkbuildable.c: (gtk_buildable_get_type),
(gtk_buildable_set_name), (gtk_buildable_get_name),
(gtk_buildable_add), (gtk_buildable_set_property),
(gtk_buildable_parser_finished), (gtk_buildable_construct_child),
(gtk_buildable_custom_tag_start), (gtk_buildable_custom_tag_end),
(gtk_buildable_custom_finished),
(gtk_buildable_get_internal_child):
* gtk/gtkbuildable.h:
* gtk/gtkbuilder.c: (gtk_builder_class_init), (gtk_builder_init),
(gtk_builder_finalize), (gtk_builder_set_property),
(gtk_builder_get_property), (_gtk_builder_resolve_type_lazily),
(gtk_builder_real_get_type_from_name),
(gtk_builder_get_parameters), (gtk_builder_get_internal_child),
(_gtk_builder_construct), (_gtk_builder_add),
(apply_delayed_properties), (_gtk_builder_finish),
(gtk_builder_new), (gtk_builder_add_from_file),
(gtk_builder_add_from_string), (gtk_builder_get_object),
(object_add_to_list), (gtk_builder_get_objects),
(gtk_builder_set_translation_domain),
(gtk_builder_get_translation_domain),
(gtk_builder_connect_signals_default),
(gtk_builder_connect_signals), (gtk_builder_connect_signals_full),
(gtk_builder_value_from_string),
(gtk_builder_value_from_string_type),
(_gtk_builder_enum_from_string), (_gtk_builder_flags_from_string),
(gtk_builder_get_type_from_name), (gtk_builder_error_quark):
* gtk/gtkbuilder.h:
* gtk/gtkbuilderparser.c: (state_push), (state_peek), (state_pop),
(error_missing_attribute), (error_invalid_attribute),
(error_invalid_tag), (builder_construct), (parse_object),
(free_object_info), (_get_type_by_symbol), (parse_child),
(free_child_info), (parse_property), (free_property_info),
(parse_signal), (_free_signal_info), (parse_interface),
(create_subparser), (free_subparser), (subparser_start),
(subparser_end), (parse_custom), (start_element), (end_element),
(text), (_gtk_builder_parser_parse_buffer):
* gtk/gtkbuilderprivate.h:
* gtk/gtkcelllayout.c: (attributes_start_element),
(attributes_text_element),
(_gtk_cell_layout_buildable_custom_tag_start),
(_gtk_cell_layout_buildable_custom_tag_end),
(_gtk_cell_layout_buildable_add):
* gtk/gtkcelllayout.h:
* gtk/gtkcellview.c: (gtk_cell_view_buildable_init),
(gtk_cell_view_buildable_custom_tag_start),
(gtk_cell_view_buildable_custom_tag_end):
* gtk/gtkcolorseldialog.c:
(gtk_color_selection_dialog_buildable_interface_init),
(gtk_color_selection_dialog_buildable_get_internal_child):
* gtk/gtkcombobox.c: (gtk_combo_box_buildable_init),
(gtk_combo_box_buildable_custom_tag_start),
(gtk_combo_box_buildable_custom_tag_end):
* gtk/gtkcomboboxentry.c:
(gtk_combo_box_entry_buildable_interface_init),
(gtk_combo_box_entry_buildable_get_internal_child):
* gtk/gtkcontainer.c: (gtk_container_get_type),
(gtk_container_buildable_init), (gtk_container_buildable_add),
(gtk_container_buildable_set_child_property),
(attributes_start_element), (attributes_text_element),
(gtk_container_buildable_custom_tag_start),
(gtk_container_buildable_custom_tag_end):
* gtk/gtkdebug.h:
* gtk/gtkdialog.c: (gtk_dialog_buildable_interface_init),
(gtk_dialog_buildable_get_internal_child),
(attributes_start_element), (attributes_text_element),
(gtk_dialog_buildable_custom_tag_start),
(gtk_dialog_buildable_custom_finished):
* gtk/gtkentrycompletion.c: (gtk_entry_completion_buildable_init):
* gtk/gtkexpander.c: (gtk_expander_buildable_add),
(gtk_expander_buildable_init):
* gtk/gtkfontsel.c:
(gtk_font_selection_dialog_buildable_interface_init),
(gtk_font_selection_dialog_buildable_get_internal_child):
* gtk/gtkframe.c: (gtk_frame_buildable_init),
(gtk_frame_buildable_add):
* gtk/gtkiconview.c: (gtk_icon_view_buildable_init),
(gtk_icon_view_buildable_custom_tag_start),
(gtk_icon_view_buildable_custom_tag_end):
* gtk/gtkliststore.c: (gtk_list_store_buildable_init),
(list_store_start_element), (list_store_end_element),
(list_store_text), (gtk_list_store_buildable_custom_tag_start),
(gtk_list_store_buildable_custom_tag_end):
* gtk/gtkmain.c:
* gtk/gtknotebook.c: (gtk_notebook_buildable_init),
(gtk_notebook_buildable_add):
* gtk/gtksizegroup.c: (gtk_size_group_buildable_init),
(size_group_start_element),
(gtk_size_group_buildable_custom_tag_start),
(gtk_size_group_buildable_custom_finished):
* gtk/gtktreestore.c: (gtk_tree_store_buildable_init),
(tree_model_start_element),
(gtk_tree_store_buildable_custom_tag_start),
(gtk_tree_store_buildable_custom_finished):
* gtk/gtktreeview.c: (gtk_tree_view_buildable_init),
(gtk_tree_view_buildable_add):
* gtk/gtktreeviewcolumn.c: (gtk_tree_view_column_buildable_init):
* gtk/gtkuimanager.c: (gtk_ui_manager_buildable_init),
(gtk_ui_manager_buildable_add),
(gtk_ui_manager_buildable_construct_child),
(gtk_ui_manager_buildable_custom_tag_start),
(gtk_ui_manager_buildable_custom_tag_end):
* gtk/gtkwidget.c: (gtk_widget_get_type),
(gtk_widget_buildable_interface_init),
(gtk_widget_buildable_set_name), (gtk_widget_buildable_get_name),
(gtk_widget_buildable_set_property),
(gtk_widget_buildable_parser_finshed), (accel_group_start_element),
(gtk_widget_buildable_custom_tag_start),
(gtk_widget_buildable_custom_finshed):
* gtk/gtkwindow.c: (gtk_window_buildable_interface_init),
(gtk_window_buildable_set_property),
(gtk_window_buildable_parser_finished):
* tests/Makefile.am:
* tests/buildertest.c: (builder_new_from_string), (test_parser),
(signal_normal), (signal_after), (signal_object),
(signal_object_after), (signal_first), (signal_second),
(signal_extra), (signal_extra2), (test_connect_signals),
(test_uimanager_simple), (test_domain), (test_translation),
(test_sizegroup), (test_list_store), (test_tree_store),
(test_types), (test_spin_button), (test_notebook),
(test_construct_only_property), (test_children),
(test_child_properties), (test_treeview_column), (test_icon_view),
(test_combo_box), (test_combo_box_entry), (test_cell_view),
(test_dialog), (test_accelerators), (test_widget), (main):
Add GtkBuilder, fixes #172535
svn path=/trunk/; revision=18141
2007-06-15 17:53:46 +00:00
|
|
|
|
ctx->current = NULL;
|
|
|
|
|
ctx->merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (buildable));
|
|
|
|
|
|
|
|
|
|
*data = ctx;
|
|
|
|
|
*parser = ui_parser;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gtk_ui_manager_buildable_custom_tag_end (GtkBuildable *buildable,
|
|
|
|
|
GtkBuilder *builder,
|
|
|
|
|
GObject *child,
|
|
|
|
|
const gchar *tagname,
|
|
|
|
|
gpointer *data)
|
|
|
|
|
{
|
|
|
|
|
queue_update (GTK_UI_MANAGER (buildable));
|
|
|
|
|
g_object_notify (G_OBJECT (buildable), "ui");
|
|
|
|
|
g_free (data);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2003-08-25 23:13:47 +00:00
|
|
|
|
* gtk_ui_manager_get_ui:
|
2010-09-21 04:18:11 +00:00
|
|
|
|
* @manager: a #GtkUIManager
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2014-02-07 02:07:03 +00:00
|
|
|
|
* Creates a [UI definition][XML-UI] of the merged UI.
|
2003-08-24 19:58:30 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: A newly allocated string containing an XML representation of
|
2003-09-01 22:15:16 +00:00
|
|
|
|
* the merged UI.
|
2003-08-24 20:48:27 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
2013-06-28 15:27:19 +00:00
|
|
|
|
*
|
|
|
|
|
* Deprecated: 3.10
|
2003-08-24 19:58:30 +00:00
|
|
|
|
**/
|
2003-09-11 21:02:24 +00:00
|
|
|
|
gchar *
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_get_ui (GtkUIManager *manager)
|
2003-08-24 19:58:30 +00:00
|
|
|
|
{
|
|
|
|
|
GString *buffer;
|
|
|
|
|
|
|
|
|
|
buffer = g_string_new (NULL);
|
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
gtk_ui_manager_ensure_update (manager);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
2010-09-21 04:18:11 +00:00
|
|
|
|
print_node (manager, manager->private_data->root_node, 0, buffer);
|
2003-08-24 19:58:30 +00:00
|
|
|
|
|
|
|
|
|
return g_string_free (buffer, FALSE);
|
|
|
|
|
}
|