(GtkBuilderConverter._add_action_from_menuitem): Only set stock_id

on the action if the menuitem had a stock or label property set


svn path=/trunk/; revision=18395
This commit is contained in:
Johan Dahlin 2007-07-07 16:18:38 +00:00
parent ac6ba4de7b
commit 98b4985ada
2 changed files with 9 additions and 2 deletions

View File

@ -12,6 +12,8 @@
tags
(GtkBuilderConverter._convert_menuitem): Add support for CheckMenuItems
and do not set name and action on separators
(GtkBuilderConverter._add_action_from_menuitem): Only set stock_id
on the action if the menuitem had a stock or label property set
2007-07-06 Richard Hult <richard@imendio.com>

View File

@ -313,7 +313,9 @@ class GtkBuilderConverter(object):
if (children and
children[0].getAttribute('internal-child') == 'image'):
image = get_object_node(children[0])
properties['stock_id'] = get_property(image, 'stock')
stock_id = get_property(node, 'stock')
if stock_id is not None:
properties['stock_id'] = stock_id
elif object_class == 'GtkMenuItem':
name = 'GtkAction'
label = get_property(node, 'label')
@ -333,7 +335,10 @@ class GtkBuilderConverter(object):
raise NotImplementedError(object_class)
if get_property(node, 'use_stock') == 'True':
properties['stock_id'] = get_property(node, 'label')
stock_id = get_property(node, 'label')
if stock_id is not None:
properties['stock_id'] = stock_id
properties['name'] = object_id
action = self._create_object(name,
object_id,