[pygobject] [gi-overrides] override Gtk.stock_lookup to not return success
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] [gi-overrides] override Gtk.stock_lookup to not return success
- Date: Mon, 28 Feb 2011 23:22:32 +0000 (UTC)
commit 0461e05174637ae02f34029b85ba217d5ae48c53
Author: John (J5) Palmieri <johnp redhat com>
Date: Mon Feb 28 18:21:43 2011 -0500
[gi-overrides] override Gtk.stock_lookup to not return success
demos/gtk-demo/demos/combobox.py | 2 +-
gi/overrides/Gtk.py | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/demos/gtk-demo/demos/combobox.py b/demos/gtk-demo/demos/combobox.py
index ce24d65..381375c 100644
--- a/demos/gtk-demo/demos/combobox.py
+++ b/demos/gtk-demo/demos/combobox.py
@@ -156,7 +156,7 @@ class ComboboxApp:
for id in stock_id:
if id is not None:
pixbuf = cellview.render_icon(id, Gtk.IconSize.BUTTON, None)
- success, item = Gtk.stock_lookup(id)
+ item = Gtk.stock_lookup(id)
label = self.strip_underscore(item.label)
store.append((pixbuf, label))
else:
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index 31d1362..5c4d84d 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1218,6 +1218,15 @@ _Gtk_main_quit = Gtk.main_quit
def main_quit(*args):
_Gtk_main_quit()
+_Gtk_stock_lookup = Gtk.stock_lookup
+ override(Gtk.stock_lookup)
+def stock_lookup(*args):
+ success, item = _Gtk_stock_lookup(*args)
+ if not success:
+ return None
+
+ return item
+
initialized, argv = Gtk.init_check(sys.argv)
sys.argv = list(argv)
if not initialized:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]