Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar
diff options
context:
space:
mode:
authorBenjamin Berg <benjamin@sipsolutions.net>2009-01-12 14:38:49 (GMT)
committer Benjamin Berg <benjamin@sipsolutions.net>2009-01-12 14:38:49 (GMT)
commita496b1dbf32932d12364e6d1b97b8619d8c0a491 (patch)
treeca590f73004e204ad2e1b10d317f26b873865fa5 /src/sugar
parent3cde35ef31bd6efe8f0797dbbc2b4f57bc05e43f (diff)
parentbbd8c14cf11a7b5e26e6d344b2f79ba6b6726c29 (diff)
Merge branch 'master' of git://git.sugarlabs.org/sugar-toolkit/mainline
Diffstat (limited to 'src/sugar')
-rw-r--r--src/sugar/graphics/menuitem.py14
-rw-r--r--src/sugar/graphics/objectchooser.py12
2 files changed, 21 insertions, 5 deletions
diff --git a/src/sugar/graphics/menuitem.py b/src/sugar/graphics/menuitem.py
index 954df1b..a357d78 100644
--- a/src/sugar/graphics/menuitem.py
+++ b/src/sugar/graphics/menuitem.py
@@ -29,7 +29,7 @@ from sugar.graphics.icon import Icon
class MenuItem(gtk.ImageMenuItem):
def __init__(self, text_label=None, icon_name=None, text_maxlen=0,
- xo_color=None):
+ xo_color=None, file_name=None):
gobject.GObject.__init__(self)
self._accelerator = None
@@ -42,8 +42,16 @@ class MenuItem(gtk.ImageMenuItem):
self.add(label)
label.show()
- if icon_name:
- icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_MENU)
+ if icon_name is not None:
+ icon = Icon(icon_name=icon_name,
+ icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR)
+ if xo_color is not None:
+ icon.props.xo_color = xo_color
+ self.set_image(icon)
+ icon.show()
+
+ elif file_name is not None:
+ icon = Icon(file=file_name, icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR)
if xo_color is not None:
icon.props.xo_color = xo_color
self.set_image(icon)
diff --git a/src/sugar/graphics/objectchooser.py b/src/sugar/graphics/objectchooser.py
index 1188b04..fb3703d 100644
--- a/src/sugar/graphics/objectchooser.py
+++ b/src/sugar/graphics/objectchooser.py
@@ -32,7 +32,8 @@ J_DBUS_INTERFACE = 'org.laptop.Journal'
J_DBUS_PATH = '/org/laptop/Journal'
class ObjectChooser(object):
- def __init__(self, title=None, parent=None, flags=None, buttons=None):
+ def __init__(self, title=None, parent=None, flags=None, buttons=None,
+ what_filter=None):
# For backwards compatibility:
# - We ignore title, flags and buttons.
# - 'parent' can be a xid or a gtk.Window
@@ -54,6 +55,7 @@ class ObjectChooser(object):
self._bus = None
self._chooser_id = None
self._response_code = gtk.RESPONSE_NONE
+ self._what_filter = what_filter
def run(self):
self._object_id = None
@@ -73,7 +75,13 @@ class ObjectChooser(object):
self.__chooser_response_cb)
journal.connect_to_signal('ObjectChooserCancelled',
self.__chooser_cancelled_cb)
- self._chooser_id = journal.ChooseObject(self._parent_xid)
+
+ if self._what_filter is None:
+ what_filter = ''
+ else:
+ what_filter = self._what_filter
+
+ self._chooser_id = journal.ChooseObject(self._parent_xid, what_filter)
gtk.gdk.threads_leave()
try: