[Sugar-devel] [PATCH] Bug #630:Modal Dialog Fix and Journal Memory Full Alert added

Tomeu Vizoso tomeu at sugarlabs.org
Tue Oct 5 05:29:27 EDT 2010


On Fri, Sep 24, 2010 at 16:46, Mukul Gupta <mukul at seeta.in> wrote:
> Modal Dialog should be displayed only once at startup if free
> memory is less than 50MB but greater than 10MB. Instead, for every
> redundant Modal Dialog Display, an Alert in the Journal signifying
> Low Memory is displayed.But when free memory reaches a critical
> limit(ie. 10MB) Modal Dialog is displayed repeatedly asking the
> user to delete some data in the Journal along with an alert in the
> Journal

How can I know if this change is desired? The comments in #630 suggest
a different approach.

Or maybe you are addressing another issue instead of #630?

Regards,

Tomeu

> ---
>  src/jarabe/journal/journalactivity.py |   22 ++++++++++++++--------
>  1 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/src/jarabe/journal/journalactivity.py b/src/jarabe/journal/journalactivity.py
> index 44cc018..aa4001b 100644
> --- a/src/jarabe/journal/journalactivity.py
> +++ b/src/jarabe/journal/journalactivity.py
> @@ -49,7 +49,7 @@ J_DBUS_SERVICE = 'org.laptop.Journal'
>  J_DBUS_INTERFACE = 'org.laptop.Journal'
>  J_DBUS_PATH = '/org/laptop/Journal'
>
> -_SPACE_TRESHOLD = 52428800
> +_SPACE_THRESHOLD = 52428800
>  _BUNDLE_ID = 'org.laptop.JournalActivity'
>
>  class JournalActivityDBusService(dbus.service.Object):
> @@ -116,7 +116,7 @@ class JournalActivity(Window):
>         self._main_toolbox = None
>         self._detail_toolbox = None
>         self._volumes_toolbar = None
> -
> +       self.modal_already_shown=False
>         self._setup_main_view()
>         self._setup_secondary_view()
>
> @@ -139,7 +139,7 @@ class JournalActivity(Window):
>
>         self._critical_space_alert = None
>         self._check_available_space()
> -
> +
>     def __volume_error_cb(self, gobject, message, severity):
>         alert = ErrorAlert(title=severity, msg=message)
>         alert.connect('response', self.__alert_response_cb)
> @@ -337,11 +337,17 @@ class JournalActivity(Window):
>             return
>         stat = os.statvfs(env.get_profile_path())
>         free_space = stat[statvfs.F_BSIZE] * stat[statvfs.F_BAVAIL]
> -        if free_space < _SPACE_TRESHOLD:
> -            self._critical_space_alert = ModalAlert()
> -            self._critical_space_alert.connect('destroy',
> -                                               self.__alert_closed_cb)
> -            self._critical_space_alert.show()
> +       if free_space < _SPACE_THRESHOLD:
> +           if self.modal_already_shown==False or free_space < _SPACE_THRESHOLD/5:
> +               self._critical_space_alert = ModalAlert()
> +               self._critical_space_alert.connect('destroy',
> +                                                  self.__alert_closed_cb)
> +               self._critical_space_alert.show()
> +               self.modal_already_shown=True
> +               alert = ErrorAlert(title="Journal Almost Full", msg="Please delete some data from journal")
> +               alert.connect('response', self.__alert_response_cb)
> +               self.add_alert(alert)
> +               alert.show()
>
>     def __alert_closed_cb(self, data):
>         self.show_main_view()
> --
> 1.7.0.4
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>


More information about the Sugar-devel mailing list