Commits

Yuki KODAMA committed 867bd8f

gtklib: support stock icons in get_icon_pixbuf() function

Comments (0)

Files changed (1)

tortoisehg/hgtk/gtklib.py

     selection.select_iter(selected)
     treeview.set_cursor(model.get_path(selected))
 
+_renderer = gtk.HBox()
 def get_icon_pixbuf(name, size=gtk.ICON_SIZE_MENU):
-    path = paths.get_tortoise_icon(name)
-    if path:
-        try:
-            w, h = gtk.icon_size_lookup(size)
-            return gtk.gdk.pixbuf_new_from_file_at_size(path, w, h)
-        except:
-            pass
+    if name.startswith('gtk'):
+        return _renderer.render_icon(name, size)
+    else:
+        path = paths.get_tortoise_icon(name)
+        if path:
+            try:
+                w, h = gtk.icon_size_lookup(size)
+                return gtk.gdk.pixbuf_new_from_file_at_size(path, w, h)
+            except:
+                pass
     return None
 
 def get_icon_image(name):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.