[Dextrose] [PATCH] Show register gconf value

Martin Abente martin.abente.lahaye at gmail.com
Thu Feb 3 11:13:15 EST 2011


Add a new gconf show_register value in the sugar scheme. This value
determines whether or not the Register option will be displayed at
the buddy icon palette.

This is a request from Abhishek Singh at Nepal.
---
 data/sugar.schemas.in               |   12 ++++++++++++
 src/jarabe/desktop/favoritesview.py |   10 ++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/data/sugar.schemas.in b/data/sugar.schemas.in
index 880c9d1..b79c5d1 100644
--- a/data/sugar.schemas.in
+++ b/data/sugar.schemas.in
@@ -260,6 +260,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/desktop/sugar/show_register</key>
+      <applyto>/desktop/sugar/show_register</applyto>
+      <owner>sugar</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+        <short>Show Register</short>
+        <long>If TRUE, Sugar will show a "Register" option.</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/desktop/sugar/peripherals/keyboard/layouts</key>
       <applyto>/desktop/sugar/peripherals/keyboard/layouts</applyto>
       <owner>sugar</owner>
diff --git a/src/jarabe/desktop/favoritesview.py b/src/jarabe/desktop/favoritesview.py
index 2219be3..bab8cc9 100644
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -630,6 +630,14 @@ class _MyIcon(MyIcon):
         palette = BuddyMenu(owner)
 
         client = gconf.client_get_default()
+        show_register = client.get_bool('/desktop/sugar/show_register')
+
+        if show_register:
+            self._create_register_menu(palette, client)
+
+        return palette
+
+    def _create_register_menu(self, palette, client):
         backup_url = client.get_string('/desktop/sugar/backup_url')
 
         if not backup_url:
@@ -641,8 +649,6 @@ class _MyIcon(MyIcon):
         palette.menu.append(self._register_menu)
         self._register_menu.show()
 
-        return palette
-
     def get_toplevel(self):
         return hippo.get_canvas_for_item(self).get_toplevel()
 
-- 
1.7.1



More information about the Dextrose mailing list