diff --git a/services/datastore/.gitignore b/services/datastore/.gitignore new file mode 100644 index 00000000..c0ede5ed --- /dev/null +++ b/services/datastore/.gitignore @@ -0,0 +1 @@ +org.laptop.sugar.DataStore.service diff --git a/services/datastore/Makefile.am b/services/datastore/Makefile.am index ff8a4e5a..90e2b673 100644 --- a/services/datastore/Makefile.am +++ b/services/datastore/Makefile.am @@ -1,4 +1,11 @@ -sugardir = $(pkgdatadir)/services/data-store +servicedir = $(datadir)/dbus-1/services +service_in_files = org.laptop.sugar.DataStore.service.in +service_DATA = $(service_in_files:.service.in=.service) + +$(service_DATA): $(service_in_files) Makefile + @sed -e "s|\@bindir\@|$(bindir)|" $< > $@ + +sugardir = $(pkgdatadir)/services/datastore sugar_PYTHON = \ __init__.py \ datastore.py \ @@ -6,4 +13,4 @@ sugar_PYTHON = \ bin_SCRIPTS = sugar-data-store -EXTRA_DIST = $(bin_SCRIPTS) +EXTRA_DIST = $(bin_SCRIPTS) org.laptop.sugar.DataStore.service.in diff --git a/services/datastore/org.laptop.sugar.DataStore.service.in b/services/datastore/org.laptop.sugar.DataStore.service.in new file mode 100644 index 00000000..9523788f --- /dev/null +++ b/services/datastore/org.laptop.sugar.DataStore.service.in @@ -0,0 +1,4 @@ +[D-BUS Service] +Name = org.laptop.sugar.DataStore +Exec = @bindir@/sugar-data-store + diff --git a/shell/sugar-shell b/shell/sugar-shell index 1620aa32..67c80291 100755 --- a/shell/sugar-shell +++ b/shell/sugar-shell @@ -44,6 +44,15 @@ if not name or not len(name): dialog.run() profile.update() +# Save our DBus Session Bus address somewhere it can be found +# +# WARNING!!! this is going away at some near future point, do not rely on it +# +dsba_file = os.path.join(env.get_profile_path(), "session_bus_address") +f = open(dsba_file, "w") +f.write(os.environ["DBUS_SESSION_BUS_ADDRESS"]) +f.close() + model = ShellModel() shell = Shell(model) @@ -53,10 +62,11 @@ args = ["sugar-nm-applet"] flags = gobject.SPAWN_SEARCH_PATH result = gobject.spawn_async(args, flags=flags, standard_output=False) - tbh = TracebackUtils.TracebackHelper() try: gtk.main() except KeyboardInterrupt: print 'Ctrl+C pressed, exiting...' del tbh + +os.remove(dsba_file) diff --git a/shell/view/Shell.py b/shell/view/Shell.py index 15f1eee1..4637499e 100644 --- a/shell/view/Shell.py +++ b/shell/view/Shell.py @@ -14,9 +14,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import logging + import gtk import gobject import wnck +import dbus import view.stylesheet from sugar.graphics import style @@ -125,7 +128,14 @@ class Shell(gobject.GObject): def __window_opened_cb(self, screen, window): if window.get_window_type() == wnck.WINDOW_NORMAL: - activity_host = ActivityHost(self.get_model(), window) + try: + activity_host = ActivityHost(self.get_model(), window) + except dbus.DBusException: + logging.debug('Shell.__window_opened_cb: opened unknown window ' + + window.get_name() + ' with xid ' + + str(window.get_xid())) + return + self._hosts[activity_host.get_xid()] = activity_host self.emit('activity-opened', activity_host) diff --git a/sugar-emulator b/sugar-emulator index 6e829e14..b8c290c3 100755 --- a/sugar-emulator +++ b/sugar-emulator @@ -58,6 +58,11 @@ if sourcedir: util.write_service('org.laptop.Clipboard', bin, env.get_user_service_dir()) + bin = os.path.join(sourcedir, + 'services/datastore/sugar-data-store') + util.write_service('org.laptop.sugar.DataStore', bin, + env.get_user_service_dir()) + from sugar.emulator import Emulator program = 'sugar-shell'