Allow to run activities without Sugar shell.

- Handle lack of GSettings gracefully.
- Still requires sugar-datastore.
- Supports avoiding X11 docks/panels.
- Provides icons for Activity windows.

Try it outside Sugar. Go to an Activity directory and run 'sugar-activity'.
Tested it with Terminal, Finance, Write, Browse, Memorize under XFCE4.
Tested in Gnome under OLPC-OS.
Also works from Sugar Terminal Activity.
Does not affect regular Sugar operation.

This is patch v.2 -
    Addresses most concerns:
    - Removed commented code, sorry.
    - Changed code to use profile.get_nickname and get_color where possible.

    Couldn't the launcher just pass this info?
    Maybe the launcher could set the activity root as well?
        - It is intended to be usable from the command line also.
    Should put sugar version in the environment
        - It is intended to work even without Sugar Shell installed.
    Why don't we always set the icon?
        - On XO it might use some memory. I was concerned to degrade
        performance.
    Also, imports should be at the top of the file?
        - Also a concern about performance on XO.
        This way it is only loaded in this use case.
        Maybe it is insignificant -moved as requested.
    It would be nice if the changes to the POT for sugar-toolkit-gtk3
    could be incorporated in this pull request, please.
        - There were no changes to POT files as part of this patch. Maybe
        it is worth translating low level command line tools, not sure.
    Suggest packaged activities might also provide .desktop files.
        - Intriguing but not sure within scope of this patch. You mean generate
        a .desktop file automatically as an option? Sounds nice!
    Suggest sugar-activity might also accept path to unpacked bundle.
        - Implemented!
This commit is contained in:
Sebastian Silva
2016-04-17 00:57:07 -05:00
parent ab0f5a18aa
commit 2f2b2d20d8
7 changed files with 91 additions and 36 deletions
+4 -4
View File
@@ -24,7 +24,6 @@ STABLE.
import logging
from gi.repository import GObject
from gi.repository import Gio
import dbus
from telepathy.interfaces import CONNECTION, \
CONNECTION_INTERFACE_ALIASING, \
@@ -32,6 +31,7 @@ from telepathy.interfaces import CONNECTION, \
from telepathy.constants import HANDLE_TYPE_CONTACT
from sugar3.presence.connectionmanager import get_connection_manager
from sugar3.profile import get_color, get_nick_name
ACCOUNT_MANAGER_SERVICE = 'org.freedesktop.Telepathy.AccountManager'
CONN_INTERFACE_BUDDY_INFO = 'org.laptop.Telepathy.BuddyInfo'
@@ -243,6 +243,6 @@ class Owner(BaseBuddy):
def __init__(self):
BaseBuddy.__init__(self)
settings = Gio.Settings('org.sugarlabs.user')
self.props.nick = settings.get_string('nick')
self.props.color = settings.get_string('color')
self.props.nick = get_nick_name()
self.props.color = get_color().to_string()