From 63d88df04012ee923cce24905f5f914cae3b9c31 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Tue, 30 Oct 2007 23:51:36 +0100 Subject: [PATCH] Fix distcheck --- po/POTFILES.in | 1 - po/sugar.pot | 28 +------ services/shell/objecttypeservice.py | 125 ---------------------------- 3 files changed, 2 insertions(+), 152 deletions(-) delete mode 100644 services/shell/objecttypeservice.py diff --git a/po/POTFILES.in b/po/POTFILES.in index f5e3c8f2..aafd1e87 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -14,6 +14,5 @@ shell/view/frame/zoomtoolbar.py lib/sugar/activity/activity.py lib/sugar/graphics/alert.py lib/sugar/graphics/objectchooser.py -services/shell/objecttypeservice.py shell/controlpanel/control.py shell/view/devices/network/mesh.py diff --git a/po/sugar.pot b/po/sugar.pot index b4590466..3cd5557e 100644 --- a/po/sugar.pot +++ b/po/sugar.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2007-10-30 21:23+0100\n" +"POT-Creation-Date: 2007-10-30 23:51+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -94,7 +94,7 @@ msgstr "" msgid "Stop" msgstr "" -#: ../shell/view/Shell.py:264 +#: ../shell/view/Shell.py:267 msgid "Screenshot" msgstr "" @@ -297,30 +297,6 @@ msgstr "" msgid ", " msgstr "" -#: ../services/shell/objecttypeservice.py:37 -msgid "Text" -msgstr "" - -#: ../services/shell/objecttypeservice.py:43 -msgid "Image" -msgstr "" - -#: ../services/shell/objecttypeservice.py:46 -msgid "Audio" -msgstr "" - -#: ../services/shell/objecttypeservice.py:49 -msgid "Video" -msgstr "" - -#: ../services/shell/objecttypeservice.py:52 -msgid "Etoys project" -msgstr "" - -#: ../services/shell/objecttypeservice.py:56 -msgid "Link" -msgstr "" - #: ../shell/controlpanel/control.py:254 msgid "Error in specified color modifiers." msgstr "" diff --git a/services/shell/objecttypeservice.py b/services/shell/objecttypeservice.py deleted file mode 100644 index c4910f78..00000000 --- a/services/shell/objecttypeservice.py +++ /dev/null @@ -1,125 +0,0 @@ -# Copyright (C) 2007, Red Hat, Inc. -# -# 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 gnomevfs -import gtk - -from gettext import gettext as _ - -import bundleregistry - -_REGISTRY_IFACE = "org.laptop.ObjectTypeRegistry" -_REGISTRY_PATH = "/org/laptop/ObjectTypeRegistry" - -class ObjectTypeRegistry(dbus.service.Object): - def __init__(self): - bus = dbus.SessionBus() - bus_name = dbus.service.BusName(_REGISTRY_IFACE, bus=bus) - dbus.service.Object.__init__(self, bus_name, _REGISTRY_PATH) - - self._types = {} - - self._add_primitive('Text', _('Text'), 'text-x-generic', - ['text/plain', 'text/rtf', 'application/pdf', - 'application/x-pdf', 'text/html', - 'application/vnd.oasis.opendocument.text', - 'application/rtf', 'text/rtf']) - - self._add_primitive('Image', _('Image'), 'image-x-generic', - ['image/png', 'image/gif', 'image/jpeg']) - - self._add_primitive('Audio', _('Audio'), 'audio-x-generic', - ['audio/ogg', 'audio/x-wav', 'audio/wav']) - - self._add_primitive('Video', _('Video'), 'video-x-generic', - ['video/ogg', 'application/ogg']) - - self._add_primitive('Etoys project', _('Etoys project'), - 'application-x-squeak-project', - ['application/x-squeak-project']) - - self._add_primitive('Link', _('Link'), - 'text-uri-list', - ['text/x-moz-url', 'text/uri-list']) - - self._activity_registry = bundleregistry.get_registry() - for bundle in self._activity_registry: - self._add_activity(self._activity_registry, bundle) - self._activity_registry.connect('bundle-added', self._add_activity) - - def _add_primitive(self, type_id, name, icon, mime_types): - object_type = {'type_id': type_id, - 'name': name, - 'icon': icon, - 'mime_types': mime_types} - self._types[type_id] = object_type - - def _add_activity(self, activity_registry, bundle): - mime_types = bundle.get_mime_types() - if mime_types is None: - return - - icon_theme = gtk.icon_theme_get_default() - for mime_type in mime_types: - if self._get_type_for_mime(mime_type) is not None: - continue - - name = gnomevfs.mime_get_description(mime_type) - if name is None: - continue - - icon = mime_type.replace('/', '-') - if icon_theme.lookup_icon(icon, gtk.ICON_SIZE_BUTTON, 0) is None: - continue - - object_type = {'type_id': mime_type, - 'name': name, - 'icon': icon, - 'mime_types': [mime_type]} - self._types[mime_type] = object_type - - def _get_type_for_mime(self, mime_type): - for object_type in self._types.values(): - if mime_type in object_type['mime_types']: - return object_type - return None - - @dbus.service.method(_REGISTRY_IFACE, - in_signature="s", out_signature="a{sv}") - def GetType(self, type_id): - if self._types.has_key(type_id): - return self._types[type_id] - else: - return {} - - @dbus.service.method(_REGISTRY_IFACE, - in_signature="s", out_signature="a{sv}") - def GetTypeForMIME(self, mime_type): - object_type = self._get_type_for_mime(mime_type) - if object_type: - return object_type - else: - return {} - -_instance = None - -def get_instance(): - global _instance - if not _instance: - _instance = ObjectTypeRegistry() - return _instance