gnome-desktop r4960 - trunk/gnome-about
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-desktop r4960 - trunk/gnome-about
- Date: Tue, 8 Jan 2008 00:05:06 +0000 (GMT)
Author: vuntz
Date: Tue Jan 8 00:05:06 2008
New Revision: 4960
URL: http://svn.gnome.org/viewvc/gnome-desktop?rev=4960&view=rev
Log:
2008-01-08 Vincent Untz <vuntz gnome org>
* gnome-about.in: (GnomeLogo): repaint the logo when the style is set
Fix problem when the color of the logo is wrong when changing theme.
Patch by Guillaume Seguin <guillaume segu in>
Bug #496288
Modified:
trunk/gnome-about/ChangeLog
trunk/gnome-about/gnome-about.in
Modified: trunk/gnome-about/gnome-about.in
==============================================================================
--- trunk/gnome-about/gnome-about.in (original)
+++ trunk/gnome-about/gnome-about.in Tue Jan 8 00:05:06 2008
@@ -628,18 +628,20 @@
gobject.type_register (HyperLink)
class GnomeLogo (gtk.Widget):
+ '''Simple widget displaying a colored GNOME logo'''
+
+ _surface = None
+ _parent = None
+ _file = None
def __init__ (self, parent, file):
+ '''Initialize object and do the initial painting'''
gtk.Widget.__init__ (self)
- self._surface = cairo.ImageSurface.create_from_png (file)
-
- text_color = parent.get_style ().text[gtk.STATE_NORMAL]
+ self._parent = parent
+ self._file = file
- cr = cairo.Context (self._surface)
- cr.set_source_rgb (text_color.red, text_color.green, text_color.blue)
- cr.set_operator (cairo.OPERATOR_ATOP)
- cr.paint ()
+ self.paint_surface ()
width = self._surface.get_width ()
height = self._surface.get_height ()
@@ -647,13 +649,32 @@
self.set_flags(self.flags() | gtk.NO_WINDOW)
+ def paint_surface (self):
+ '''Paint image and color overlay'''
+ self._surface = cairo.ImageSurface.create_from_png (self._file)
+
+ text_color = self._parent.get_style ().fg[gtk.STATE_NORMAL]
+
+ cr = cairo.Context (self._surface)
+ cr.set_source_rgb (float (text_color.red) / 65535,
+ float (text_color.green) / 65535,
+ float (text_color.blue) / 65535)
+ cr.set_operator (cairo.OPERATOR_ATOP)
+ cr.paint ()
+
def do_expose_event (self, event):
+ '''Paint the saved surface to the widget context'''
cr = self.window.cairo_create ()
cr.set_operator (cairo.OPERATOR_OVER)
cr.set_source_surface (self._surface, 10, 10)
cr.paint ()
+ def do_style_set (self, *args):
+ '''Style changed, let's repaint image'''
+ self.paint_surface ()
+ self.queue_draw ()
+
gobject.type_register (GnomeLogo)
class GnomeAboutHeader (gtk.Layout):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]