Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-11-04 08:30:01 (GMT)
committer Sascha Silbe <silbe@activitycentral.com>2011-12-05 23:03:28 (GMT)
commiteef4ae2b8f4b44c335922c4e95b4da7ede273fa6 (patch)
tree11bd988542e6792239b1eca5fafc912f7be8021d
parentd4654181fd0779c73a2c75c6d254266746c7353c (diff)
Adapt to Gtk.icon_size_lookup*() API changes
In PyGTK, icon_size_lookup*() returned just the icon size as a 2-tuple [1]. In GTK3+pygi, an additional boolean value indicating whether the passed-in value was valid is returned. [3,4] [1] http://developer.gnome.org/pygtk/stable/class-gtkiconsource.html#function-gtk--icon-size-lookup [2] http://developer.gnome.org/pygtk/stable/class-gtkiconsource.html#function-gtk--icon-size-lookup-for-settings [3] http://developer.gnome.org/gtk/stable/gtk-Themeable-Stock-Images.html#gtk-icon-size-lookup [4] http://developer.gnome.org/gtk/stable/gtk-Themeable-Stock-Images.html#gtk-icon-size-lookup-for-settings [marked unused local variables, fixed overlong line] Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
-rw-r--r--src/sugar3/graphics/combobox.py8
-rw-r--r--src/sugar3/graphics/icon.py2
-rw-r--r--src/sugar3/graphics/notebook.py3
3 files changed, 7 insertions, 6 deletions
diff --git a/src/sugar3/graphics/combobox.py b/src/sugar3/graphics/combobox.py
index 32700d1..3b70f11 100644
--- a/src/sugar3/graphics/combobox.py
+++ b/src/sugar3/graphics/combobox.py
@@ -62,7 +62,7 @@ class ComboBox(Gtk.ComboBox):
def _get_real_name_from_theme(self, name, size):
icon_theme = Gtk.IconTheme.get_default()
- width, height = Gtk.icon_size_lookup(size)
+ valid_, width, height = Gtk.icon_size_lookup(size)
info = icon_theme.lookup_icon(name, max(width, height), 0)
if not info:
raise ValueError('Icon %r not found.' % name)
@@ -91,8 +91,8 @@ class ComboBox(Gtk.ComboBox):
self._icon_renderer = Gtk.CellRendererPixbuf()
settings = self.get_settings()
- w, h = Gtk.icon_size_lookup_for_settings(
- settings, Gtk.IconSize.MENU)
+ valid_, w, h = Gtk.icon_size_lookup_for_settings(
+ settings, Gtk.IconSize.MENU)
self._icon_renderer.props.stock_size = max(w, h)
self.pack_start(self._icon_renderer, False)
@@ -108,7 +108,7 @@ class ComboBox(Gtk.ComboBox):
size = Gtk.IconSize.MENU
else:
size = Gtk.IconSize.LARGE_TOOLBAR
- width, height = Gtk.icon_size_lookup(size)
+ valid_, width, height = Gtk.icon_size_lookup(size)
if icon_name:
file_name = self._get_real_name_from_theme(icon_name, size)
diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py
index 65e576f..04c1e89 100644
--- a/src/sugar3/graphics/icon.py
+++ b/src/sugar3/graphics/icon.py
@@ -346,7 +346,7 @@ class Icon(Gtk.Image):
self._buffer.file_name = self.props.file
if self.props.pixel_size == -1:
- width, height = Gtk.icon_size_lookup(self.props.icon_size)
+ valid_, width, height = Gtk.icon_size_lookup(self.props.icon_size)
else:
width = height = self.props.pixel_size
if self._buffer.width != width or self._buffer.height != height:
diff --git a/src/sugar3/graphics/notebook.py b/src/sugar3/graphics/notebook.py
index 6e96fba..e14bf0e 100644
--- a/src/sugar3/graphics/notebook.py
+++ b/src/sugar3/graphics/notebook.py
@@ -80,7 +80,8 @@ class Notebook(Gtk.Notebook):
Gtk.Button.set_relief(button, Gtk.ReliefStyle.NONE)
settings = Gtk.Widget.get_settings(button)
- w, h = Gtk.icon_size_lookup_for_settings(settings, Gtk.IconSize.MENU)
+ valid_, w, h = Gtk.icon_size_lookup_for_settings(settings,
+ Gtk.IconSize.MENU)
Gtk.Widget.set_size_request(button, w + 4, h + 4)
image.show()
icon_box.pack_start(image, True, False, 0)