[PATCH] Adds-JournalVolumePalette

Esteban Arias earias at plan.ceibal.edu.uy
Wed Jun 2 11:32:59 EDT 2010


---
 src/jarabe/journal/volumestoolbar.py |   42
+++++++++++++++++++++++++++++++++-
 1 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/journal/volumestoolbar.py
b/src/jarabe/journal/volumestoolbar.py
index 74b974c..cc7ae38 100644
--- a/src/jarabe/journal/volumestoolbar.py
+++ b/src/jarabe/journal/volumestoolbar.py
@@ -1,4 +1,6 @@
 # Copyright (C) 2007, One Laptop Per Child
+# Copyright (C) 2010, Plan Ceibal <comunidad at plan.ceibal.edu.uy>
+# Copyright (C) 2010, Paraguay Educa <tecnologia at paraguayeduca.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,13 +24,17 @@ import gio
 import gtk
 import gconf

+from sugar.graphics.icon import Icon
 from sugar.graphics.radiotoolbutton import RadioToolButton
 from sugar.graphics.palette import Palette
 from sugar.graphics.xocolor import XoColor
+from sugar.graphics.menuitem import MenuItem

 from jarabe.journal import model
+from jarabe.journal.backup import Backup
 from jarabe.view.palettes import VolumePalette

+
 class VolumesToolbar(gtk.Toolbar):
     __gtype_name__ =3D 'VolumesToolbar'

@@ -164,7 +170,7 @@ class VolumeButton(BaseButton):
         self.props.xo_color =3D color

     def create_palette(self):
-        palette =3D VolumePalette(self._mount)
+        palette =3D JournalVolumePalette(self._mount)
         #palette.props.invoker =3D FrameWidgetInvoker(self)
         #palette.set_group_id('frame')
         return palette
@@ -179,3 +185,37 @@ class JournalButton(BaseButton):
         color =3D XoColor(client.get_string('/desktop/sugar/user/color'))
         self.props.xo_color =3D color

+class JournalVolumePalette(VolumePalette):
+
+    __gtype_name__ =3D 'JournalVolumePalette'
+
+    def __init__(self, mount):
+        VolumePalette.__init__(self, mount)
+
+        journal_separator =3D gtk.SeparatorMenuItem()
+        self.menu.append(journal_separator)
+        journal_separator.show()
+
+        menu_item_journal_backup =3D MenuItem(_('Journal Backup'))
+        icon =3D Icon(icon_name=3D'transfer-to', icon_size=3Dgtk.ICON_SIZE=
_MENU)
+        menu_item_journal_backup.set_image(icon)
+        icon.show()
+        menu_item_journal_backup.connect('activate',
self.__journal_backup_activate_cb, mount.get_root().get_path())
+        self.menu.append(menu_item_journal_backup)
+        menu_item_journal_backup.show()
+
+        menu_item_journal_restore =3D MenuItem(_('Journal Restore'))
+        icon =3D Icon(icon_name=3D'transfer-from',
icon_size=3Dgtk.ICON_SIZE_MENU)
+        menu_item_journal_restore.set_image(icon)
+        icon.show()
+        menu_item_journal_restore.connect('activate',
self.__journal_restore_activate_cb, mount.get_root().get_path())
+        self.menu.append(menu_item_journal_restore)
+        menu_item_journal_restore.show()
+
+    def __journal_backup_activate_cb(self, menu_item, mount_path):
+        self._do_backup =3D Backup('backup', mount_path)
+        self._do_backup.show()
+
+    def __journal_restore_activate_cb(self, menu_item, mount_path):
+        self._do_restore =3D Backup('restore', mount_path)
+        self._do_restore.show()
--=20
1.6.2.5



More information about the Sugar-devel mailing list