From fa8bcd2ba58fca8605bc2fea72478a23f9bd9998 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 8 Aug 2007 18:08:07 +0200 Subject: [PATCH 1/3] Move the activity register to the clipboard service. --- services/clipboard/Makefile.am | 14 ++- services/clipboard/activityregistryservice.py | 104 ++++++++++++++++++ .../clipboard}/bundleregistry.py | 7 ++ services/clipboard/clipboardobject.py | 25 +---- services/clipboard/clipboardservice.py | 2 +- .../org.laptop.ActivityRegistry.service.in | 4 + services/clipboard/sugar-clipboard | 3 + shell/model/Makefile.am | 1 - shell/shellservice.py | 69 ------------ sugar/activity/registry.py | 12 +- 10 files changed, 140 insertions(+), 101 deletions(-) create mode 100644 services/clipboard/activityregistryservice.py rename {shell/model => services/clipboard}/bundleregistry.py (94%) create mode 100644 services/clipboard/org.laptop.ActivityRegistry.service.in diff --git a/services/clipboard/Makefile.am b/services/clipboard/Makefile.am index e5a03e43..6d2cd9c9 100644 --- a/services/clipboard/Makefile.am +++ b/services/clipboard/Makefile.am @@ -1,13 +1,18 @@ servicedir = $(datadir)/dbus-1/services service_in_files = \ + org.laptop.ActivityRegistry.service.in \ org.laptop.Clipboard.service.in \ org.laptop.ObjectTypeRegistry.service.in service_DATA = \ + org.laptop.ActivityRegistry.service \ org.laptop.Clipboard.service \ org.laptop.ObjectTypeRegistry.service +org.laptop.ActivityRegistry.service: org.laptop.ActivityRegistry.service.in Makefile + @sed -e "s|\@bindir\@|$(bindir)|" $< > $@ + org.laptop.Clipboard.service: org.laptop.Clipboard.service.in Makefile @sed -e "s|\@bindir\@|$(bindir)|" $< > $@ @@ -16,10 +21,11 @@ org.laptop.ObjectTypeRegistry.service: org.laptop.ObjectTypeRegistry.service.in sugardir = $(pkgdatadir)/services/clipboard -sugar_PYTHON = \ - __init__.py \ - clipboardobject.py \ - clipboardservice.py \ +sugar_PYTHON = \ + __init__.py \ + activityregistryservice.py \ + clipboardobject.py \ + clipboardservice.py \ objecttypeservice.py bin_SCRIPTS = sugar-clipboard diff --git a/services/clipboard/activityregistryservice.py b/services/clipboard/activityregistryservice.py new file mode 100644 index 00000000..60293d47 --- /dev/null +++ b/services/clipboard/activityregistryservice.py @@ -0,0 +1,104 @@ +# Copyright (C) 2006-2007 Red Hat, Inc. +# Copyright (C) 2007 One Laptop Per Child +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +import dbus +import dbus.service + +import bundleregistry + +_ACTIVITY_REGISTRY_SERVICE_NAME = 'org.laptop.ActivityRegistry' +_ACTIVITY_REGISTRY_IFACE = 'org.laptop.ActivityRegistry' +_ACTIVITY_REGISTRY_PATH = '/org/laptop/ActivityRegistry' + +class ActivityRegistry(dbus.service.Object): + def __init__(self): + bus = dbus.SessionBus() + bus_name = dbus.service.BusName(_ACTIVITY_REGISTRY_SERVICE_NAME, bus=bus) + dbus.service.Object.__init__(self, bus_name, _ACTIVITY_REGISTRY_PATH) + + bundle_registry = bundleregistry.get_registry() + bundle_registry.connect('bundle-added', self._bundle_added_cb) + + @dbus.service.method(_ACTIVITY_REGISTRY_IFACE, + in_signature='s', out_signature='b') + def AddBundle(self, bundle_path): + '''Register the activity bundle with the global registry + + bundle_path -- path to the activity bundle's root directory, + that is, the directory with activity/activity.info as a + child of the directory. + + The bundleregistry.BundleRegistry is responsible for setting + up a set of d-bus service mappings for each available activity. + ''' + registry = bundleregistry.get_registry() + return registry.add_bundle(bundle_path) + + @dbus.service.method(_ACTIVITY_REGISTRY_IFACE, + in_signature='s', out_signature='a{sv}') + def GetActivity(self, service_name): + registry = bundleregistry.get_registry() + bundle = registry.get_bundle(service_name) + if not bundle: + return {} + + return self._bundle_to_dict(bundle) + + @dbus.service.method(_ACTIVITY_REGISTRY_IFACE, + in_signature='s', out_signature='aa{sv}') + def FindActivity(self, name): + result = [] + key = name.lower() + + for bundle in bundleregistry.get_registry(): + name = bundle.get_name().lower() + service_name = bundle.get_service_name().lower() + if name.find(key) != -1 or service_name.find(key) != -1: + result.append(self._bundle_to_dict(bundle)) + + return result + + @dbus.service.method(_ACTIVITY_REGISTRY_IFACE, + in_signature='s', out_signature='aa{sv}') + def GetActivitiesForType(self, mime_type): + result = [] + registry = bundleregistry.get_registry() + for bundle in registry.get_activities_for_type(mime_type): + result.append(self._bundle_to_dict(bundle)) + return result + + @dbus.service.signal(_ACTIVITY_REGISTRY_IFACE, signature='a{sv}') + def ActivityAdded(self, activity_info): + pass + + def _bundle_to_dict(self, bundle): + return {'name': bundle.get_name(), + 'icon': bundle.get_icon(), + 'service_name': bundle.get_service_name(), + 'path': bundle.get_path()} + + def _bundle_added_cb(self, bundle_registry, bundle): + self.ActivityAdded(self._bundle_to_dict(bundle)) + +_instance = None + +def get_instance(): + global _instance + if not _instance: + _instance = ActivityRegistry() + return _instance + diff --git a/shell/model/bundleregistry.py b/services/clipboard/bundleregistry.py similarity index 94% rename from shell/model/bundleregistry.py rename to services/clipboard/bundleregistry.py index bc8eec93..65a23483 100644 --- a/shell/model/bundleregistry.py +++ b/services/clipboard/bundleregistry.py @@ -106,6 +106,13 @@ class BundleRegistry(gobject.GObject): else: return False + def get_activities_for_type(self, mime_type): + result = [] + for bundle in self._bundles.values(): + if bundle.get_mime_types() and mime_type in bundle.get_mime_types(): + result.append(bundle) + return result + def get_registry(): return _bundle_registry diff --git a/services/clipboard/clipboardobject.py b/services/clipboard/clipboardobject.py index d7512747..bc51f472 100644 --- a/services/clipboard/clipboardobject.py +++ b/services/clipboard/clipboardobject.py @@ -19,9 +19,9 @@ import logging import urlparse from sugar.objects import mime -from sugar import activity import objecttypeservice +import bundleregistry class ClipboardObject: @@ -66,30 +66,15 @@ class ClipboardObject: return '' def get_activity(self): - logging.debug('get_activity') - mapping = {'text/html' : 'org.laptop.WebActivity', - 'image/jpeg' : 'org.laptop.WebActivity', - 'image/gif' : 'org.laptop.WebActivity', - 'image/png' : 'org.laptop.WebActivity', - 'text/plain' : 'org.laptop.AbiWordActivity', - 'text/rtf' : 'org.laptop.AbiWordActivity', - 'text/richtext' : 'org.laptop.AbiWordActivity', - 'application/pdf' : 'org.laptop.sugar.ReadActivity', - 'application/x-squeak-project' : 'org.vpri.EtoysActivity'} mime = self.get_mime_type() if not mime: return '' - """ - registry = activity.get_registry() + + registry = bundleregistry.get_registry() activities = registry.get_activities_for_type(self.get_mime_type()) # TODO: should we return several activities? if activities: - return activities[0] - else: - return '' - """ - if mapping.has_key(mime): - return mapping[mime] + return activities[0].get_service_name() else: return '' @@ -101,8 +86,6 @@ class ClipboardObject: def add_format(self, format): self._formats[format.get_type()] = format - # We want to get the activity early in order to prevent a DBus lockup. - activity = self.get_activity() def get_formats(self): return self._formats diff --git a/services/clipboard/clipboardservice.py b/services/clipboard/clipboardservice.py index 639f29c6..19958a7c 100644 --- a/services/clipboard/clipboardservice.py +++ b/services/clipboard/clipboardservice.py @@ -74,7 +74,7 @@ class ClipboardService(dbus.service.Object): def add_object_format(self, object_path, format_type, data, on_disk): logging.debug('ClipboardService.add_object_format') cb_object = self._objects[str(object_path)] - + if on_disk and cb_object.get_percent() == 100: new_uri = self._copy_file(data) cb_object.add_format(Format(format_type, new_uri, on_disk)) diff --git a/services/clipboard/org.laptop.ActivityRegistry.service.in b/services/clipboard/org.laptop.ActivityRegistry.service.in new file mode 100644 index 00000000..051ab006 --- /dev/null +++ b/services/clipboard/org.laptop.ActivityRegistry.service.in @@ -0,0 +1,4 @@ +[D-BUS Service] +Name = org.laptop.ActivityRegistry +Exec = @bindir@/sugar-clipboard + diff --git a/services/clipboard/sugar-clipboard b/services/clipboard/sugar-clipboard index 4cffa33b..9531e94b 100755 --- a/services/clipboard/sugar-clipboard +++ b/services/clipboard/sugar-clipboard @@ -34,6 +34,7 @@ sys.path.append(env.get_service_path('clipboard')) import clipboardservice import objecttypeservice +import activityregistryservice logging.info('Starting clipboard service.') @@ -42,9 +43,11 @@ dbus.glib.threads_init() clipboard_service = clipboardservice.get_instance() object_type_registry = objecttypeservice.get_instance() +activity_registry = activityregistryservice.get_instance() loop = gobject.MainLoop() try: loop.run() except KeyboardInterrupt: print 'Ctrl+C pressed, exiting...' + diff --git a/shell/model/Makefile.am b/shell/model/Makefile.am index 486ad091..0b7d14cd 100644 --- a/shell/model/Makefile.am +++ b/shell/model/Makefile.am @@ -4,7 +4,6 @@ sugardir = $(pkgdatadir)/shell/model sugar_PYTHON = \ __init__.py \ accesspointmodel.py \ - bundleregistry.py \ BuddyModel.py \ Friends.py \ Invites.py \ diff --git a/shell/shellservice.py b/shell/shellservice.py index 5728e449..d577a447 100644 --- a/shell/shellservice.py +++ b/shell/shellservice.py @@ -17,10 +17,7 @@ """D-bus service providing access to the shell's functionality""" import dbus -from model import bundleregistry - _DBUS_SERVICE = "org.laptop.Shell" -_DBUS_ACTIVITY_REGISTRY_IFACE = "org.laptop.Shell.ActivityRegistry" _DBUS_SHELL_IFACE = "org.laptop.Shell" _DBUS_OWNER_IFACE = "org.laptop.Shell.Owner" _DBUS_PATH = "/org/laptop/Shell" @@ -56,9 +53,6 @@ class ShellService(dbus.service.Object): self._home_model.connect('active-activity-changed', self._cur_activity_changed_cb) - bundle_registry = bundleregistry.get_registry() - bundle_registry.connect('bundle-added', self._bundle_added_cb) - bus = dbus.SessionBus() bus_name = dbus.service.BusName(_DBUS_SERVICE, bus=bus) dbus.service.Object.__init__(self, bus_name, _DBUS_PATH) @@ -83,60 +77,6 @@ class ShellService(dbus.service.Object): def NotifyLaunchFailure(self, activity_id): self._shell.notify_launch_failure(activity_id) - @dbus.service.method(_DBUS_ACTIVITY_REGISTRY_IFACE, - in_signature="s", out_signature="b") - def AddBundle(self, bundle_path): - """Register the activity bundle with the global registry - - bundle_path -- path to the activity bundle's root directory, - that is, the directory with activity/activity.info as a - child of the directory. - - The bundleregistry.BundleRegistry is responsible for setting - up a set of d-bus service mappings for each available activity. - """ - registry = bundleregistry.get_registry() - return registry.add_bundle(bundle_path) - - @dbus.service.method(_DBUS_ACTIVITY_REGISTRY_IFACE, - in_signature="s", out_signature="a{sv}") - def GetActivity(self, service_name): - registry = bundleregistry.get_registry() - bundle = registry.get_bundle(service_name) - if not bundle: - return {} - - return self._bundle_to_dict(bundle) - - @dbus.service.method(_DBUS_ACTIVITY_REGISTRY_IFACE, - in_signature="s", out_signature="aa{sv}") - def FindActivity(self, name): - result = [] - key = name.lower() - - for bundle in bundleregistry.get_registry(): - name = bundle.get_name().lower() - service_name = bundle.get_service_name().lower() - if name.find(key) != -1 or service_name.find(key) != -1: - result.append(self._bundle_to_dict(bundle)) - - return result - - @dbus.service.method(_DBUS_ACTIVITY_REGISTRY_IFACE, - in_signature="s", out_signature="aa{sv}") - def GetActivitiesForType(self, mime_type): - result = [] - - for bundle in bundleregistry.get_registry(): - if bundle.get_mime_types() and mime_type in bundle.get_mime_types(): - result.append(self._bundle_to_dict(bundle)) - - return result - - @dbus.service.signal(_DBUS_ACTIVITY_REGISTRY_IFACE, signature="a{sv}") - def ActivityAdded(self, activity_info): - pass - @dbus.service.signal(_DBUS_OWNER_IFACE, signature="s") def ColorChanged(self, color): pass @@ -169,12 +109,3 @@ class ShellService(dbus.service.Object): if new_id: self.CurrentActivityChanged(new_id) - def _bundle_to_dict(self, bundle): - return {'name': bundle.get_name(), - 'icon': bundle.get_icon(), - 'service_name': bundle.get_service_name(), - 'path': bundle.get_path()} - - def _bundle_added_cb(self, bundle_registry, bundle): - self.ActivityAdded(self._bundle_to_dict(bundle)) - diff --git a/sugar/activity/registry.py b/sugar/activity/registry.py index b19abee6..430a2df2 100644 --- a/sugar/activity/registry.py +++ b/sugar/activity/registry.py @@ -1,4 +1,5 @@ # Copyright (C) 2006-2007 Red Hat, Inc. +# Copyright (C) 2007 One Laptop Per Child # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,9 +20,9 @@ import logging import dbus -_SHELL_SERVICE = "org.laptop.Shell" -_SHELL_PATH = "/org/laptop/Shell" -_REGISTRY_IFACE = "org.laptop.Shell.ActivityRegistry" +_ACTIVITY_REGISTRY_SERVICE_NAME = 'org.laptop.ActivityRegistry' +_ACTIVITY_REGISTRY_IFACE = 'org.laptop.ActivityRegistry' +_ACTIVITY_REGISTRY_PATH = '/org/laptop/ActivityRegistry' def _activity_info_from_dict(info_dict): if not info_dict: @@ -39,8 +40,9 @@ class ActivityInfo(object): class ActivityRegistry(object): def __init__(self): bus = dbus.SessionBus() - bus_object = bus.get_object(_SHELL_SERVICE, _SHELL_PATH) - self._registry = dbus.Interface(bus_object, _REGISTRY_IFACE) + bus_object = bus.get_object(_ACTIVITY_REGISTRY_SERVICE_NAME, + _ACTIVITY_REGISTRY_PATH) + self._registry = dbus.Interface(bus_object, _ACTIVITY_REGISTRY_IFACE) self._registry.connect_to_signal('ActivityAdded', self._activity_added_cb) # Two caches fo saving some travel across dbus. From cac6038665239aa037bcab475038bb5f33b34533 Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 8 Aug 2007 18:33:10 +0200 Subject: [PATCH 2/3] Rename the clipboard service as shell service. --- configure.ac | 2 +- services/Makefile.am | 2 +- services/{clipboard => shell}/Makefile.am | 6 ++++-- services/{clipboard => shell}/__init__.py | 0 services/{clipboard => shell}/activityregistryservice.py | 0 services/{clipboard => shell}/bundleregistry.py | 0 services/{clipboard => shell}/clipboardobject.py | 0 services/{clipboard => shell}/clipboardservice.py | 0 services/{clipboard => shell}/objecttypeservice.py | 0 .../org.laptop.ActivityRegistry.service.in | 2 +- .../{clipboard => shell}/org.laptop.Clipboard.service.in | 2 +- .../org.laptop.ObjectTypeRegistry.service.in | 2 +- .../sugar-clipboard => shell/sugar-shell-service} | 6 +++--- 13 files changed, 12 insertions(+), 10 deletions(-) rename services/{clipboard => shell}/Makefile.am (91%) rename services/{clipboard => shell}/__init__.py (100%) rename services/{clipboard => shell}/activityregistryservice.py (100%) rename services/{clipboard => shell}/bundleregistry.py (100%) rename services/{clipboard => shell}/clipboardobject.py (100%) rename services/{clipboard => shell}/clipboardservice.py (100%) rename services/{clipboard => shell}/objecttypeservice.py (100%) rename services/{clipboard => shell}/org.laptop.ActivityRegistry.service.in (59%) rename services/{clipboard => shell}/org.laptop.Clipboard.service.in (55%) rename services/{clipboard => shell}/org.laptop.ObjectTypeRegistry.service.in (60%) rename services/{clipboard/sugar-clipboard => shell/sugar-shell-service} (91%) diff --git a/configure.ac b/configure.ac index f6626693..e0acaf19 100644 --- a/configure.ac +++ b/configure.ac @@ -45,7 +45,7 @@ data/Makefile lib/Makefile lib/ui/Makefile services/Makefile -services/clipboard/Makefile +services/shell/Makefile shell/Makefile shell/intro/Makefile shell/hardware/Makefile diff --git a/services/Makefile.am b/services/Makefile.am index 7d8e3516..e230030d 100644 --- a/services/Makefile.am +++ b/services/Makefile.am @@ -1 +1 @@ -SUBDIRS = clipboard console +SUBDIRS = shell console diff --git a/services/clipboard/Makefile.am b/services/shell/Makefile.am similarity index 91% rename from services/clipboard/Makefile.am rename to services/shell/Makefile.am index 6d2cd9c9..b34b974c 100644 --- a/services/clipboard/Makefile.am +++ b/services/shell/Makefile.am @@ -19,17 +19,19 @@ org.laptop.Clipboard.service: org.laptop.Clipboard.service.in Makefile org.laptop.ObjectTypeRegistry.service: org.laptop.ObjectTypeRegistry.service.in Makefile @sed -e "s|\@bindir\@|$(bindir)|" $< > $@ -sugardir = $(pkgdatadir)/services/clipboard +sugardir = $(pkgdatadir)/services/shell sugar_PYTHON = \ __init__.py \ activityregistryservice.py \ + bundleregistry.py \ clipboardobject.py \ clipboardservice.py \ objecttypeservice.py -bin_SCRIPTS = sugar-clipboard +bin_SCRIPTS = sugar-shell-service DISTCLEANFILES = $(service_DATA) EXTRA_DIST = $(service_in_files) $(bin_SCRIPTS) + diff --git a/services/clipboard/__init__.py b/services/shell/__init__.py similarity index 100% rename from services/clipboard/__init__.py rename to services/shell/__init__.py diff --git a/services/clipboard/activityregistryservice.py b/services/shell/activityregistryservice.py similarity index 100% rename from services/clipboard/activityregistryservice.py rename to services/shell/activityregistryservice.py diff --git a/services/clipboard/bundleregistry.py b/services/shell/bundleregistry.py similarity index 100% rename from services/clipboard/bundleregistry.py rename to services/shell/bundleregistry.py diff --git a/services/clipboard/clipboardobject.py b/services/shell/clipboardobject.py similarity index 100% rename from services/clipboard/clipboardobject.py rename to services/shell/clipboardobject.py diff --git a/services/clipboard/clipboardservice.py b/services/shell/clipboardservice.py similarity index 100% rename from services/clipboard/clipboardservice.py rename to services/shell/clipboardservice.py diff --git a/services/clipboard/objecttypeservice.py b/services/shell/objecttypeservice.py similarity index 100% rename from services/clipboard/objecttypeservice.py rename to services/shell/objecttypeservice.py diff --git a/services/clipboard/org.laptop.ActivityRegistry.service.in b/services/shell/org.laptop.ActivityRegistry.service.in similarity index 59% rename from services/clipboard/org.laptop.ActivityRegistry.service.in rename to services/shell/org.laptop.ActivityRegistry.service.in index 051ab006..ab6647c9 100644 --- a/services/clipboard/org.laptop.ActivityRegistry.service.in +++ b/services/shell/org.laptop.ActivityRegistry.service.in @@ -1,4 +1,4 @@ [D-BUS Service] Name = org.laptop.ActivityRegistry -Exec = @bindir@/sugar-clipboard +Exec = @bindir@/sugar-shell-service diff --git a/services/clipboard/org.laptop.Clipboard.service.in b/services/shell/org.laptop.Clipboard.service.in similarity index 55% rename from services/clipboard/org.laptop.Clipboard.service.in rename to services/shell/org.laptop.Clipboard.service.in index b38bf2b1..7ce3f6ef 100644 --- a/services/clipboard/org.laptop.Clipboard.service.in +++ b/services/shell/org.laptop.Clipboard.service.in @@ -1,4 +1,4 @@ [D-BUS Service] Name = org.laptop.Clipboard -Exec = @bindir@/sugar-clipboard +Exec = @bindir@/sugar-shell-service diff --git a/services/clipboard/org.laptop.ObjectTypeRegistry.service.in b/services/shell/org.laptop.ObjectTypeRegistry.service.in similarity index 60% rename from services/clipboard/org.laptop.ObjectTypeRegistry.service.in rename to services/shell/org.laptop.ObjectTypeRegistry.service.in index 66477eb6..563a600d 100644 --- a/services/clipboard/org.laptop.ObjectTypeRegistry.service.in +++ b/services/shell/org.laptop.ObjectTypeRegistry.service.in @@ -1,4 +1,4 @@ [D-BUS Service] Name = org.laptop.ObjectTypeRegistry -Exec = @bindir@/sugar-clipboard +Exec = @bindir@/sugar-shell-service diff --git a/services/clipboard/sugar-clipboard b/services/shell/sugar-shell-service similarity index 91% rename from services/clipboard/sugar-clipboard rename to services/shell/sugar-shell-service index 9531e94b..370c2ea4 100755 --- a/services/clipboard/sugar-clipboard +++ b/services/shell/sugar-shell-service @@ -23,20 +23,20 @@ import os import logging from sugar import logger -logger.start('clipboard') +logger.start('shellservice') import gobject import dbus.glib from sugar import env -sys.path.append(env.get_service_path('clipboard')) +sys.path.append(env.get_service_path('shell')) import clipboardservice import objecttypeservice import activityregistryservice -logging.info('Starting clipboard service.') +logging.info('Starting shell service.') gobject.threads_init() dbus.glib.threads_init() From 77094c961ac30c71788eaa4e43458854da4cdbbc Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 8 Aug 2007 18:39:39 +0200 Subject: [PATCH 3/3] Adapt to new palette API. --- shell/view/clipboardmenu.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/shell/view/clipboardmenu.py b/shell/view/clipboardmenu.py index 35802dcb..1d9f85c0 100644 --- a/shell/view/clipboardmenu.py +++ b/shell/view/clipboardmenu.py @@ -64,11 +64,13 @@ class ClipboardMenu(Palette): self._remove_item = MenuItem(_('Remove'), 'stock-remove') self._remove_item.connect('activate', self._remove_item_activate_cb) - self.append_menu_item(self._remove_item) + self.menu.append(self._remove_item) + self._remove_item.show() self._open_item = MenuItem(_('Open'), 'stock-keep') self._open_item.connect('activate', self._open_item_activate_cb) - self.append_menu_item(self._open_item) + self.menu.append(self._open_item) + self._open_item.show() #self._stop_item = MenuItem(_('Stop download'), 'stock-close') # TODO: Implement stopping downloads @@ -77,7 +79,8 @@ class ClipboardMenu(Palette): self._journal_item = MenuItem(_('Add to journal'), 'document-save') self._journal_item.connect('activate', self._journal_item_activate_cb) - self.append_menu_item(self._journal_item) + self.menu.append(self._journal_item) + self._journal_item.show() self._update_items_visibility(installable)