Get the default type from env, clean stuff a bit

master
Marco Pesenti Gritti 18 years ago
parent ab3535e6fd
commit 99cce220cd

@ -125,7 +125,7 @@ class Activity(gtk.Window):
def get_default_type(self):
"""Gets the type of the default activity network service"""
return activity.get_default_type(self.get_type())
return env.get_bundle_default_type()
def get_shared(self):
"""Returns TRUE if the activity is shared on the mesh."""

@ -103,5 +103,6 @@ def start_factory(activity_class, bundle_path):
os.environ['SUGAR_BUNDLE_PATH'] = bundle_path
os.environ['SUGAR_BUNDLE_SERVICE_NAME'] = bundle.get_service_name()
os.environ['SUGAR_BUNDLE_DEFAULT_TYPE'] = bundle.get_default_type()
factory = ActivityFactory(bundle.get_service_name(), activity_class)

@ -7,12 +7,3 @@ settings = gtk.settings_get_default()
grid = Grid()
sizes = 'gtk-large-toolbar=%d, %d' % (grid.dimension(1), grid.dimension(1))
settings.set_string_property('gtk-icon-sizes', sizes, '')
def get_default_type(activity_type):
"""Get the activity default type.
It's the type of the main network service which tracks presence
and provides info about the activity, for example the title."""
splitted_id = activity_type.split('.')
splitted_id.reverse()
return '_' + '_'.join(splitted_id) + '._udp'

@ -69,6 +69,13 @@ class Bundle:
"""Get the activity service name"""
return self._service_name
def get_default_type(self):
"""Get the type of the main network service which tracks presence
and provides info about the activity, for example the title."""
splitted = self.get_service_name().split('.')
splitted.reverse()
return '_' + '_'.join(splitted) + '._udp'
def get_icon(self):
"""Get the activity icon name"""
return self._icon

@ -36,6 +36,12 @@ def get_bundle_service_name():
else:
return None
def get_bundle_default_type():
if os.environ.has_key('SUGAR_BUNDLE_DEFAULT_TYPE'):
return os.environ['SUGAR_BUNDLE_DEFAULT_TYPE']
else:
return None
def get_profile_path():
if os.environ.has_key('SUGAR_PROFILE'):
profile_id = os.environ['SUGAR_PROFILE']

Loading…
Cancel
Save