[Sugar-devel] [PATCH sugar 4/7] Journal: set white background in the ExpandedEntry of the Detail View

Simon Schampijer simon at schampijer.de
Mon Aug 6 06:04:19 EDT 2012


Change the ExpandedEntry class to subclass gtk.EventBox because the
gtk.VBox doesn't have a gtk.gdk.Window associated and the background
can't be set otherwise.

Signed-off-by: Manuel Quiñones <manuq at laptop.org>
Acked-by: Simon Schampijer <simon at laptop.org>
---
 src/jarabe/journal/expandedentry.py | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/jarabe/journal/expandedentry.py b/src/jarabe/journal/expandedentry.py
index c2cd3b2..e0c603f 100644
--- a/src/jarabe/journal/expandedentry.py
+++ b/src/jarabe/journal/expandedentry.py
@@ -58,22 +58,26 @@ class BuddyList(gtk.Alignment):
         self.add(hbox)
 
 
-class ExpandedEntry(gtk.VBox):
+class ExpandedEntry(gtk.EventBox):
     def __init__(self):
-        gtk.VBox.__init__(self)
+        gtk.EventBox.__init__(self)
+        self._vbox = gtk.VBox()
+        self.add(self._vbox)
 
         self._metadata = None
         self._update_title_sid = None
 
+        self.modify_bg(gtk.STATE_NORMAL, style.COLOR_WHITE.get_gdk_color())
+
         # Create a header
         header = gtk.HBox()
-        self.pack_start(header, False, False, style.DEFAULT_SPACING * 2)
+        self._vbox.pack_start(header, False, False, style.DEFAULT_SPACING * 2)
 
         # Create a two-column body
         body_box = gtk.EventBox()
         body_box.set_border_width(style.DEFAULT_SPACING)
         body_box.modify_bg(gtk.STATE_NORMAL, style.COLOR_WHITE.get_gdk_color())
-        self.pack_start(body_box)
+        self._vbox.pack_start(body_box)
         body = gtk.HBox()
         body_box.add(body)
 
@@ -149,8 +153,10 @@ class ExpandedEntry(gtk.VBox):
         self._buddy_list.pack_start(self._create_buddy_list(), False, False,
                                     style.DEFAULT_SPACING)
 
-        self._description.get_buffer().set_text(metadata.get('description', ''))
-        self._tags.get_buffer().set_text(metadata.get('tags', ''))
+        description = metadata.get('description', '')
+        self._description.get_buffer().set_text(description)
+        tags = metadata.get('tags', '')
+        self._tags.get_buffer().set_text(tags)
 
     def _create_keep_icon(self):
         keep_icon = KeepIcon()
-- 
1.7.11.2



More information about the Sugar-devel mailing list