From 1ac82f4471a6077a8fd3ae0d302a53eb89c3abf9 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Fri, 16 Mar 2012 09:18:10 +0000 Subject: Make the LinkInfo that is displayed at the bottom left themable Add a gtype_name to make it easily accessible from the theme. We have to do the same for the overlay as well in order to be able to set the 'background-color' of the label. Labels don't create their own window to render themselves into. Instead, they draw themselves directly onto their parents window, so we have to set the background-color of the parent in order to set the labels' background color [1]. The patch does adjust the gtype_names to be consistent. [1] http://developer.gnome.org/gtk-faq/stable/x810.html Signed-off-by: Simon Schampijer Acked-by: Manuel QuiƱones --- diff --git a/browser.py b/browser.py index 5dea721..0886580 100644 --- a/browser.py +++ b/browser.py @@ -286,7 +286,18 @@ Gtk.rc_parse_string(''' widget "*browse-tab-close" style "browse-tab-close"''') +class LinkInfo(Gtk.Label): + __gtype_name__ = 'BrowseLinkInfo' + + def __init__(self): + GObject.GObject.__init__(self) + self.set_halign(Gtk.Align.START) + self.set_valign(Gtk.Align.END) + + class TabPage(Gtk.Overlay): + __gtype_name__ = 'BrowseTabPage' + def __init__(self, browser): GObject.GObject.__init__(self) @@ -294,9 +305,7 @@ class TabPage(Gtk.Overlay): self._showing_load_status = False self._requested_uri = None - link_info = Gtk.Label() - link_info.set_halign(Gtk.Align.START) - link_info.set_valign(Gtk.Align.END) + link_info = LinkInfo() self.add_overlay(link_info) link_info.show() @@ -351,7 +360,7 @@ class TabPage(Gtk.Overlay): class TabLabel(Gtk.HBox): - __gtype_name__ = 'TabLabel' + __gtype_name__ = 'BrowseTabLabel' __gsignals__ = { 'tab-close': (GObject.SignalFlags.RUN_FIRST, diff --git a/widgets.py b/widgets.py index d1de3ee..df5bdb0 100644 --- a/widgets.py +++ b/widgets.py @@ -23,7 +23,7 @@ from sugar3.graphics.icon import Icon class TabAdd(Gtk.HBox): - __gtype_name__ = 'TabAdd' + __gtype_name__ = 'BrowseTabAdd' __gsignals__ = { 'tab-added': (GObject.SignalFlags.RUN_FIRST, @@ -53,7 +53,7 @@ class TabAdd(Gtk.HBox): class BrowserNotebook(Gtk.Notebook): - __gtype_name__ = 'BrowserNotebook' + __gtype_name__ = 'BrowseNotebook' """Handle an extra tab at the end with an Add Tab button.""" -- cgit v0.9.1