GtkBuilderWidget: Remove '_builder_expose' kwarg, add '_gtk_properties'
The '_builder_expose' argument to GtkBuilderWidget.__init__() allowed binding of names in the ui-file to objects defined outside of the ui-file. Glade does not allow setting properties to values which are not defined in the ui-file, so we set GTK/Gobject properties explicitly. This is made with a new kwarg '_gtk_properties' in GtkBuilderWidget.__init__() which is a dict with a (object_id, property_name) key.
This commit is contained in:
parent
0bda795a83
commit
222dba31be
|
@ -50,9 +50,6 @@ class GtkBuilderWidget(object):
|
|||
if parent is not None:
|
||||
self.builder.expose_object('parent_widget', parent)
|
||||
self.builder.set_translation_domain(textdomain)
|
||||
if hasattr(self, '_builder_expose'):
|
||||
for (key, value) in list(self._builder_expose.items()):
|
||||
self.builder.expose_object(key, value)
|
||||
|
||||
# print >>sys.stderr, 'Creating new from file', self.__class__.__name__
|
||||
|
||||
|
@ -67,6 +64,9 @@ class GtkBuilderWidget(object):
|
|||
|
||||
self.builder.connect_signals(self)
|
||||
self.set_attributes()
|
||||
if hasattr(self, '_gtk_properties'):
|
||||
for ((gobj, prop), val) in self._gtk_properties.items():
|
||||
getattr(self, gobj).set_property(prop, val)
|
||||
|
||||
self.new()
|
||||
|
||||
|
|
|
@ -89,7 +89,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
|
|||
self.extensions_actions = []
|
||||
self._search_podcasts = None
|
||||
self._search_episodes = None
|
||||
BuilderWidget.__init__(self, None, _builder_expose={'app': app})
|
||||
BuilderWidget.__init__(self, None,
|
||||
_gtk_properties={('gPodder', 'application'): app})
|
||||
|
||||
self.last_episode_date_refresh = None
|
||||
self.refresh_episode_dates()
|
||||
|
|
Loading…
Reference in a new issue