Add a show_launcher property. Show only the web activity
This commit is contained in:
parent
a06d75bd56
commit
2a28ea38b1
@ -3,3 +3,4 @@ name = Web
|
|||||||
id = com.redhat.Sugar.BrowserActivity
|
id = com.redhat.Sugar.BrowserActivity
|
||||||
python_module = BrowserActivity.BrowserActivity
|
python_module = BrowserActivity.BrowserActivity
|
||||||
default_type = _web_olpc._udp
|
default_type = _web_olpc._udp
|
||||||
|
show_launcher = yes
|
||||||
|
@ -13,7 +13,8 @@ class ActivityModule:
|
|||||||
self._id = activity_id
|
self._id = activity_id
|
||||||
self._directory = directory
|
self._directory = directory
|
||||||
self._exec = activity_exec
|
self._exec = activity_exec
|
||||||
|
self._show_launcher = False
|
||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
"""Get the activity user visible name."""
|
"""Get the activity user visible name."""
|
||||||
return self._name
|
return self._name
|
||||||
@ -38,6 +39,14 @@ class ActivityModule:
|
|||||||
"""Set the the type of the default activity service."""
|
"""Set the the type of the default activity service."""
|
||||||
self._default_type = default_type
|
self._default_type = default_type
|
||||||
|
|
||||||
|
def get_show_launcher(self):
|
||||||
|
"""Get whether there should be a visible launcher for the activity"""
|
||||||
|
return self._show_launcher
|
||||||
|
|
||||||
|
def set_show_launcher(self, show_launcher):
|
||||||
|
"""Set whether there should be a visible launcher for the activity"""
|
||||||
|
self._show_launcher = show_launcher
|
||||||
|
|
||||||
class ActivityRegistry:
|
class ActivityRegistry:
|
||||||
"""Service that tracks the available activities"""
|
"""Service that tracks the available activities"""
|
||||||
|
|
||||||
@ -102,6 +111,9 @@ class ActivityRegistry:
|
|||||||
module = ActivityModule(name, activity_id, activity_exec, directory)
|
module = ActivityModule(name, activity_id, activity_exec, directory)
|
||||||
self._activities.append(module)
|
self._activities.append(module)
|
||||||
|
|
||||||
|
if cp.has_option('Activity', 'show_launcher'):
|
||||||
|
module.set_show_launcher(True)
|
||||||
|
|
||||||
module.set_default_type(default_type)
|
module.set_default_type(default_type)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -19,11 +19,13 @@ class NewActivityButton(gtk.MenuToolButton):
|
|||||||
menu = gtk.Menu()
|
menu = gtk.Menu()
|
||||||
|
|
||||||
for module in self._home.list_activities():
|
for module in self._home.list_activities():
|
||||||
item = gtk.MenuItem(module.get_name(), False)
|
if module.get_show_launcher():
|
||||||
activity_id = module.get_id()
|
item = gtk.MenuItem(module.get_name(), False)
|
||||||
item.connect('activate', self.__menu_item_activate_cb, activity_id)
|
activity_id = module.get_id()
|
||||||
menu.append(item)
|
item.connect('activate',
|
||||||
item.show()
|
self.__menu_item_activate_cb, activity_id)
|
||||||
|
menu.append(item)
|
||||||
|
item.show()
|
||||||
|
|
||||||
self.set_menu(menu)
|
self.set_menu(menu)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user