[caribou] Use stock icon for configuration



commit 4a5c6b78909d4950585a4c5dc7d7a808d1e3f807
Author: Eitan Isaacson <eitan monotonous org>
Date:   Wed Dec 2 11:09:01 2009 -0500

    Use stock icon for configuration

 src/config.svg  | 1080 -------------------------------------------------------
 src/keyboard.py |   28 +--
 2 files changed, 5 insertions(+), 1103 deletions(-)
---
diff --git a/src/keyboard.py b/src/keyboard.py
index 4d56d7d..47c8ccd 100644
--- a/src/keyboard.py
+++ b/src/keyboard.py
@@ -53,30 +53,12 @@ class CaribouKeyboard(gtk.Frame):
                     if isinstance(key, str):
                         if key == "cf":
                             # configuration key
-                            # FIXME scale based on size of other buttons
-                            scaleFactor = 0.5
-                            # FIXME catch "RuntimeError: unknown librsvg error" for file not found
-                            # FIXME use broken image when file not found
-                            svg = rsvg.Handle("config.svg")
-                            surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
-                                                         int(round(svg.props.width * scaleFactor)),
-                                                         int(round(svg.props.height * scaleFactor)))
-                            cr = cairo.Context(surface)
-                            cr.scale(scaleFactor, scaleFactor)
-                            svg.render_cairo(cr)
-                            cfg = gtk.Image()
-                            data = surface.get_data()
-	                    pixbuf = gtk.gdk.pixbuf_new_from_data(data,
-                                                                  gtk.gdk.COLORSPACE_RGB,
-                                                                  True,
-                                                                  8,
-                                                                  int(round(svg.props.width * scaleFactor)),
-                                                                  int(round(svg.props.height * scaleFactor)),
-                                                                  int(round(svg.props.width * scaleFactor * 4)))
-                            cfg.set_from_pixbuf(pixbuf)
                             button = gtk.Button()
-                            button.set_image(cfg)
-                            button.set_name("configuration")
+                            image = gtk.image_new_from_pixbuf(
+                                button.render_icon(gtk.STOCK_PREFERENCES,
+                                                   gtk.ICON_SIZE_BUTTON))
+                            button.set_image(image)
+                            button.set_name ("configuration")
                             switch_buttons.append(button)
                         else:
                             # single utf-8 character key



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]