Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2007-05-29 12:16:49 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2007-05-29 12:16:49 (GMT)
commit53d64a053682d1739326e28f0fe76e940a8f78ec (patch)
tree54b0a4e30c61fdf785201a930ddec7073149092e
parent0c77275ba7a5a7e30b685ba847f7b39ca29803a4 (diff)
Use the commit id for the snapshot name
-rw-r--r--.gitignore4
-rwxr-xr-xbuild-snapshot.sh10
-rw-r--r--configure.ac2
-rw-r--r--services/clipboard/objecttypeservice.py62
-rw-r--r--services/clipboard/org.laptop.ObjectTypeRegistry.service.in4
-rw-r--r--sugar/objects/objecttype.py43
6 files changed, 115 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index 8701f96..1820275 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ Makefile.in
*.lo
*.loT
.*.sw?
+*.service
# Absolute
@@ -51,9 +52,6 @@ browser/sugar-marshal.c
browser/sugar-marshal.h
browser/stamp-sugar-marshal.c
browser/stamp-sugar-marshal.h
-services/clipboard/org.laptop.Clipboard.service
-services/console/org.laptop.sugar.Console.service
-services/presence/org.laptop.Sugar.Presence.service
bin/sugar
shell/extensions/_extensions.c
data/sugar.gtkrc
diff --git a/build-snapshot.sh b/build-snapshot.sh
index 9606dc0..b0624f3 100755
--- a/build-snapshot.sh
+++ b/build-snapshot.sh
@@ -1,12 +1,10 @@
-VERSION=0.63
-DATE=`date +%Y%m%d`
-RELEASE=2.87
-TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2
+VERSION=0.64
+ALPHATAG=`git-show-ref --hash=10 refs/heads/master`
+TARBALL=sugar-$VERSION-git$ALPHATAG.tar.bz2
rm sugar-$VERSION.tar.bz2
-XUL_SDK=/home/marco/sugar-jhbuild/build/lib/xulrunner-1.9a5pre-dev
-DISTCHECK_CONFIGURE_FLAGS="--with-libxul-sdk=$XUL_SDK" make distcheck
+make distcheck
mv sugar-$VERSION.tar.bz2 $TARBALL
scp $TARBALL mpg@devserv.devel.redhat.com:~
diff --git a/configure.ac b/configure.ac
index 3966d46..e346316 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([Sugar],[0.63],[],[sugar])
+AC_INIT([Sugar],[0.64],[],[sugar])
AC_PREREQ([2.59])
diff --git a/services/clipboard/objecttypeservice.py b/services/clipboard/objecttypeservice.py
new file mode 100644
index 0000000..bf9083f
--- /dev/null
+++ b/services/clipboard/objecttypeservice.py
@@ -0,0 +1,62 @@
+# 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
+
+from sugar.objects.objecttype import ObjectType
+
+_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(self._REGISTRY_IFACE, bus=bus)
+ dbus.service.Object.__init__(self, bus_name, self._REGISTRY_PATH)
+
+ self._types = {}
+
+ self._add_primitive('Text', _('Text'), 'object-text',
+ [ 'text/rtf' ])
+ self._add_primitive('Image', _('Image'), 'object-image',
+ [ 'image/png' ])
+
+ def _add_primitive(self, type_id, name, icon, mime_types):
+ object_type = ObjectType(type_id, name, icon, mime_types)
+ self._types.add(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
+
+ @dbus.service.method(_CLIPBOARD_DBUS_INTERFACE,
+ in_signature="s", out_signature="a{sv}")
+ def GetType(self, type_id):
+ if self._types.has_key(type_id):
+ return self._types[type_id].to_dict()
+ else:
+ return []
+
+ @dbus.service.method(_CLIPBOARD_DBUS_INTERFACE,
+ 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.to_dict()
+ else:
+ return []
diff --git a/services/clipboard/org.laptop.ObjectTypeRegistry.service.in b/services/clipboard/org.laptop.ObjectTypeRegistry.service.in
new file mode 100644
index 0000000..66477eb
--- /dev/null
+++ b/services/clipboard/org.laptop.ObjectTypeRegistry.service.in
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name = org.laptop.ObjectTypeRegistry
+Exec = @bindir@/sugar-clipboard
+
diff --git a/sugar/objects/objecttype.py b/sugar/objects/objecttype.py
new file mode 100644
index 0000000..81b8ec1
--- /dev/null
+++ b/sugar/objects/objecttype.py
@@ -0,0 +1,43 @@
+_SERVICE = "org.laptop.ObjectTypeRegistry"
+_PATH = "/org/laptop/ObjectTypeRegistry"
+_IFACE = "org.laptop.ObjectTypeRegistry"
+
+def _object_type_from_dict(info_dict):
+ if info_dict:
+ return ObjectType(info_dict['type_id'],
+ info_dict['name'],
+ info_dict['icon'])
+ else:
+ return None
+
+class ObjectType(object):
+ def __init__(self, type_id, name, icon, mime_types):
+ self.type_id = type_id
+ self.name = name
+ self.icon = icon
+ self.mime_types = []
+
+ def to_dict(self):
+ return { 'type_id' : self.type_id,
+ 'name' : self.name,
+ 'icon' : self.icon
+ }
+
+class ObjectTypeRegistry(object):
+ def __init__(self):
+ bus = dbus.SessionBus()
+ bus_object = bus.get_object(_SERVICE, _PATH)
+ self._registry = dbus.Interface(bus_object, _IFACE)
+
+ def get_type(type_id):
+ type_dict = self._registry.GetType(type_id)
+ return _object_type_from_dict(type_dict)
+
+ def get_type_for_mime(mime_type):
+ type_dict = self._registry.GetTypeForMime(type_id)
+ return _object_type_from_dict(type_dict)
+
+_registry = ObjectRegistry()
+
+def get_registry():
+ return _registry