From 1e24ba320b66fa4ed8548a71cbaa036413a93ea6 Mon Sep 17 00:00:00 2001 From: René Stadler Date: Sat, 28 Nov 2009 00:11:06 +0200 Subject: DetailsPage: Safe-guard GtkLinkButton adjustment hack This breaks with recent gtk versions, where the button's child widget is None. --- GstInspector/GUI/pages.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/GstInspector/GUI/pages.py b/GstInspector/GUI/pages.py index 08f8f98..3fbea4e 100644 --- a/GstInspector/GUI/pages.py +++ b/GstInspector/GUI/pages.py @@ -114,21 +114,22 @@ class DetailsPage (Page): self.link_button.connect ("clicked", self.handle_link_button_clicked) self.link_button.show () - # Little hack to make the label inside the LinkButton align with all - # the others. The LinkButton has a margin around the label. A shadow - # (border) is drawn there on mouse over only, so it looks totally odd - # without this little adjustment. - button_req_width = self.link_button.size_request ()[0] - child_req_width = self.link_button.child.size_request ()[0] - extra_pad = (button_req_width - child_req_width) / 2 - children = [label] - children += iter_container (self.widgets.element_details_table, - left_attach = 1, right_attach = 2) - children += iter_container (self.widgets.plugin_details_table, - left_attach = 1, right_attach = 2) - for child in children: - if child != box: - child.props.xpad = extra_pad + if self.link_button.child is not None: + # Little hack to make the label inside the LinkButton align with all + # the others. The LinkButton has a margin around the label. A shadow + # (border) is drawn there on mouse over only, so it looks totally odd + # without this little adjustment. + button_req_width = self.link_button.size_request ()[0] + child_req_width = self.link_button.child.size_request ()[0] + extra_pad = (button_req_width - child_req_width) / 2 + children = [label] + children += iter_container (self.widgets.element_details_table, + left_attach = 1, right_attach = 2) + children += iter_container (self.widgets.plugin_details_table, + left_attach = 1, right_attach = 2) + for child in children: + if child != box: + child.props.xpad = extra_pad box.pack_start (self.link_button, False, False) -- cgit v1.2.3