Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webtoolbar.py
diff options
context:
space:
mode:
Diffstat (limited to 'webtoolbar.py')
-rw-r--r--webtoolbar.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/webtoolbar.py b/webtoolbar.py
index 2e7794e..c936d27 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -28,6 +28,8 @@ from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.menuitem import MenuItem
from sugar._sugarext import AddressEntry
from sugar.graphics.toolbarbox import ToolbarBox
+from sugar.graphics.alert import Alert
+from sugar.graphics.icon import Icon
from sugar.activity.widgets import ActivityToolbarButton
from sugar.activity.widgets import StopButton
from sugar.activity import activity
@@ -313,10 +315,32 @@ class PrimaryToolbar(ToolbarBox):
def __keep_offline_cb(self, button):
self.emit('keep-offline')
- def __create_ssb_cb(self, button):
+ def __create_ssb_cb(self, button):
+ title = self._activity.current_title
+ uri = self._activity.current_uri
+
+ #favicon = self._activity.get_favicon()
+
+ pattern = re.compile(r'''
+ (\w+) # first word
+ [ _-]* # any amount and type of spacing
+ (\w+)? # second word, may be absent
+ ''', re.VERBOSE)
+ first, second = re.search(pattern, title).groups()
+
+ # CamelCase the two words
+ first = first.capitalize()
+ if second is not None:
+ second = second.capitalize()
+ name = first + ' ' + second
+ else:
+ name = first
+
+ self._ssb = ssb.SSBCreator(name, uri)
+
# alert to show after creation
alert = Alert()
- alert.props.title = _('Activity Creation')
+ alert.props.title = _('Activity Creation')
cancel_icon = Icon(icon_name='dialog-cancel')
alert.add_button(gtk.RESPONSE_CANCEL, _('Cancel'), cancel_icon)