(GtkBuilderConverter._convert_menuitem): Add support for CheckMenuItems

and do not set name and action on separators


svn path=/trunk/; revision=18394
This commit is contained in:
Johan Dahlin 2007-07-07 16:14:30 +00:00
parent 1acfcddb68
commit ac6ba4de7b
2 changed files with 18 additions and 3 deletions

View File

@ -10,6 +10,8 @@
<interface>
(GtkBuilderConverter._parse): Remove unsupported atkrelation and atkproperty
tags
(GtkBuilderConverter._convert_menuitem): Add support for CheckMenuItems
and do not set name and action on separators
2007-07-06 Richard Hult <richard@imendio.com>

View File

@ -281,15 +281,20 @@ class GtkBuilderConverter(object):
name = 'menu'
object_class = obj_node.getAttribute('class')
if object_class in ['GtkMenuItem', 'GtkImageMenuItem']:
if object_class in ['GtkMenuItem',
'GtkImageMenuItem',
'GtkCheckMenuItem']:
menu = self._dom.createElement(name)
menubar.appendChild(menu)
elif object_class == 'GtkSeparatorMenuItem':
menu = self._dom.createElement('sep')
sep = self._dom.createElement('separator')
menubar.appendChild(sep)
return
else:
raise NotImplementedError(object_class)
menu.setAttribute('name', obj_node.getAttribute('id'))
menu.setAttribute('action', obj_node.getAttribute('id'))
menubar.appendChild(menu)
self._add_action_from_menuitem(uimgr, obj_node)
if children:
for child in get_child_nodes(menu_node):
@ -316,6 +321,14 @@ class GtkBuilderConverter(object):
properties['label'] = label
elif object_class == 'GtkSeparatorMenuItem':
return
elif object_class == 'GtkCheckMenuItem':
name = 'GtkToggleAction'
label = get_property(node, 'label')
if label is not None:
properties['label'] = label
active = get_property(node, 'active')
if active is not None:
properties['active'] = active
else:
raise NotImplementedError(object_class)