Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/rpms/sugar/0155-sdxo-1592-PART-2-Incorporating-Age-Page-at-boot-up.patch
diff options
context:
space:
mode:
Diffstat (limited to 'rpms/sugar/0155-sdxo-1592-PART-2-Incorporating-Age-Page-at-boot-up.patch')
-rw-r--r--rpms/sugar/0155-sdxo-1592-PART-2-Incorporating-Age-Page-at-boot-up.patch155
1 files changed, 155 insertions, 0 deletions
diff --git a/rpms/sugar/0155-sdxo-1592-PART-2-Incorporating-Age-Page-at-boot-up.patch b/rpms/sugar/0155-sdxo-1592-PART-2-Incorporating-Age-Page-at-boot-up.patch
new file mode 100644
index 0000000..44d58d5
--- /dev/null
+++ b/rpms/sugar/0155-sdxo-1592-PART-2-Incorporating-Age-Page-at-boot-up.patch
@@ -0,0 +1,155 @@
+From bc0718f0b8e089bf344e98f789e6d7a68c39e97a Mon Sep 17 00:00:00 2001
+From: Ajay Garg <ajay@activitycentral.com>
+Date: Thu, 20 Sep 2012 00:56:53 +0530
+Subject: [PATCH 2/2] sdxo#1592 [PART-2]: Incorporating "Age"-Page-at-boot-up.
+Organization: Sugar Labs Foundation
+Signed-off-by: Ajay Garg <ajay@activitycentral.com>
+---
+ src/jarabe/intro/window.py | 75 +++++++++++++++++++++++++++++++++++++++-----
+ 1 files changed, 67 insertions(+), 8 deletions(-)
+
+diff --git a/src/jarabe/intro/window.py b/src/jarabe/intro/window.py
+index a6a2a29..daa0c72 100644
+--- a/src/jarabe/intro/window.py
++++ b/src/jarabe/intro/window.py
+@@ -36,12 +36,29 @@ from jarabe.intro import colorpicker
+ _BACKGROUND_COLOR = style.COLOR_WHITE
+
+
+-def create_profile(name, color=None):
++def create_profile(name, age, color=None):
+ if not color:
+ color = XoColor()
+
+ client = gconf.client_get_default()
+ client.set_string('/desktop/sugar/user/nick', name)
++
++ # Algorithm to generate the timestamp of the birthday of the
++ # XO-user ::
++ #
++ # timestamp = current_timestamp - [age * (365 * 24 * 60 * 60)]
++ #
++ # Note that, this timestamp may actually (in worst-case) be
++ # off-target by 1 year, but that is ok, since we want an
++ # "approximate" age of the XO-user (for statistics-collection).
++ import time
++ current_timestamp = time.time()
++ xo_user_age_as_timestamp = int(age) * 365 * 24 * 60 * 60
++
++ approx_timestamp_at_user_birthday = current_timestamp - xo_user_age_as_timestamp
++ client.set_int('/desktop/sugar/user/birth_timestamp', int(approx_timestamp_at_user_birthday))
++ # Done.
++
+ client.set_string('/desktop/sugar/user/color', color.to_string())
+ client.suggest_sync()
+
+@@ -89,6 +106,42 @@ class _Page(gtk.VBox):
+ pass
+
+
++class _AgePage(_Page):
++ def __init__(self, intro):
++ _Page.__init__(self)
++ self._intro = intro
++
++ alignment = gtk.Alignment(0.5, 0.5, 0, 0)
++ self.pack_start(alignment, expand=True, fill=True)
++
++ hbox = gtk.HBox(spacing=style.DEFAULT_SPACING)
++ alignment.add(hbox)
++
++ label = gtk.Label(_('Age:'))
++ hbox.pack_start(label, expand=False)
++
++ adjustment = gtk.Adjustment(0, 0, 1000, 1, 0, 0)
++ self._entry = gtk.SpinButton(adjustment)
++ self._entry.props.editable = False
++ self._entry.connect('notify::text', self._text_changed_cb)
++ self._entry.set_max_length(15)
++ hbox.pack_start(self._entry, expand=False)
++
++ label = gtk.Label(_('years'))
++ hbox.pack_start(label, expand=False)
++
++
++ def _text_changed_cb(self, entry, pspec):
++ valid = int(entry.props.text) > 0
++ self.set_valid(valid)
++
++ def get_age(self):
++ return self._entry.props.text
++
++ def activate(self):
++ self._entry.grab_focus()
++
++
+ class _NamePage(_Page):
+ def __init__(self, intro):
+ _Page.__init__(self)
+@@ -146,13 +199,15 @@ class _ColorPage(_Page):
+ class _IntroBox(gtk.VBox):
+ __gsignals__ = {
+ 'done': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
+- ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])),
++ ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])),
+ }
+
+ PAGE_NAME = 0
+- PAGE_COLOR = 1
++ PAGE_AGE = 1
++ PAGE_COLOR = 2
+
+ PAGE_FIRST = PAGE_NAME
++ PAGE_SECOND = PAGE_AGE
+ PAGE_LAST = PAGE_COLOR
+
+ def __init__(self):
+@@ -161,6 +216,7 @@ class _IntroBox(gtk.VBox):
+
+ self._page = self.PAGE_NAME
+ self._name_page = _NamePage(self)
++ self._age_page = _AgePage(self)
+ self._color_page = _ColorPage()
+ self._current_page = None
+ self._next_button = None
+@@ -183,6 +239,8 @@ class _IntroBox(gtk.VBox):
+
+ if self._page == self.PAGE_NAME:
+ self._current_page = self._name_page
++ if self._page == self.PAGE_AGE:
++ self._current_page = self._age_page
+ elif self._page == self.PAGE_COLOR:
+ self._current_page = self._color_page
+
+@@ -251,9 +309,10 @@ class _IntroBox(gtk.VBox):
+
+ def done(self):
+ name = self._name_page.get_name()
++ age = self._age_page.get_age()
+ color = self._color_page.get_color()
+
+- self.emit('done', name, color)
++ self.emit('done', name, age, color)
+
+
+ class IntroWindow(gtk.Window):
+@@ -272,12 +331,12 @@ class IntroWindow(gtk.Window):
+ self._intro_box.show()
+ self.connect('key-press-event', self.__key_press_cb)
+
+- def _done_cb(self, box, name, color):
++ def _done_cb(self, box, name, age, color):
+ self.hide()
+- gobject.idle_add(self._create_profile_cb, name, color)
++ gobject.idle_add(self._create_profile_cb, name, age, color)
+
+- def _create_profile_cb(self, name, color):
+- create_profile(name, color)
++ def _create_profile_cb(self, name, age, color):
++ create_profile(name, age, color)
+ gtk.main_quit()
+
+ return False
+--
+1.7.4.4
+