diff options
author | Daniel Drake <dsd@laptop.org> | 2011-12-10 02:26:33 (GMT) |
---|---|---|
committer | Sascha Silbe <silbe@activitycentral.com> | 2011-12-20 18:44:43 (GMT) |
commit | 172d31b3acf0116fa2e8e0676b35722369084136 (patch) | |
tree | 849a6cdc7fd52be513bade4ba39e02c26eee7cba /src/sugar/activity/activity.py | |
parent | 6fe94b95725ab72d2f15a16ce18ee92295b72686 (diff) |
Restructure for new /usr/bin/sugar-activity behaviour
This patch accompanies a sugar patch titled
"sugar-activity: make independent of sugar-toolkit GTK versions"
The core Activity-instantiating functionality of main.py has been moved
into the sugar-activity binary and can be removed from here.
The remaining functionality (and everything that is GTK-specific) is moved
into the Activity class in this commit.
This is needed to make /usr/bin/sugar-activity independent of sugar/sugar3
and GTK2/GTK3, which is a crucial step for GTK3 activity support.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Sascha Silbe <silbe@activitycentral.com>
Diffstat (limited to 'src/sugar/activity/activity.py')
-rw-r--r-- | src/sugar/activity/activity.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sugar/activity/activity.py b/src/sugar/activity/activity.py index 6548b61..5844506 100644 --- a/src/sugar/activity/activity.py +++ b/src/sugar/activity/activity.py @@ -70,8 +70,10 @@ from telepathy.interfaces import CHANNEL, \ from telepathy.constants import CONNECTION_HANDLE_TYPE_CONTACT from telepathy.constants import CONNECTION_HANDLE_TYPE_ROOM +import sugar from sugar import util from sugar.presence import presenceservice +from sugar.activity import i18n from sugar.activity.activityservice import ActivityService from sugar.activity.namingalert import NamingAlert from sugar.graphics import style @@ -258,6 +260,23 @@ class Activity(Window, gtk.Container): the base class __init()__ before doing Activity specific things. """ + + # Stuff that needs to be done early + + locale_path = i18n.get_locale_path(self.get_bundle_id()) + gettext.bindtextdomain(self.get_bundle_id(), locale_path) + gettext.bindtextdomain('sugar-toolkit', sugar.locale_path) + gettext.textdomain(self.get_bundle_id()) + + icons_path = os.path.join(get_bundle_path(), 'icons') + gtk.icon_theme_get_default().append_search_path(icons_path) + + # This code can be removed when we grow an xsettings daemon (the GTK+ + # init routines will then automatically figure out the font settings) + settings = gtk.settings_get_default() + settings.set_property('gtk-font-name', + '%s %f' % (style.FONT_FACE, style.FONT_SIZE)) + Window.__init__(self) if 'SUGAR_ACTIVITY_ROOT' in os.environ: @@ -348,6 +367,9 @@ class Activity(Window, gtk.Container): self.__jobject_updated_cb) self.set_title(self._jobject.metadata['title']) + def run_main_loop(self): + gtk.main() + def _initialize_journal_object(self): title = _('%s Activity') % get_bundle_name() client = gconf.client_get_default() |