[bijiben] main-toolbar: Stuck in Trash View



commit 5ce5172ca037eb7168ac287a0bccd801d3bc316a
Author: Isaque Galdino <igaldino gmail com>
Date:   Thu Jun 15 15:40:34 2017 -0300

    main-toolbar: Stuck in Trash View
    
    When you empty trash, in trash view, the main toolbar changes and you
    get stuck in that view. The only way to leave it is closing the
    application.
    
    That happens because the window state changes from ARCHIVE_VIEW to
    NO_NOTE, but this stated is shared by MAIN_VIEW as well, so it gets
    lost.
    
    This commit change the behavior to whenever you click empty trash, the
    window state continues to be ARCHIVE_VIEW, which is the default when you
    check Trash for the first time even without items.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=763971

 src/bjb-main-toolbar.c |    2 +-
 src/bjb-window-base.c  |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index 4e49dc2..32817d7 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -1024,7 +1024,7 @@ populate_main_toolbar(BjbMainToolbar *self)
 
 
   /* Simply clear then populate */
-  if (to_be != priv->type)
+  if (to_be != priv->type || view_type == BJB_WINDOW_BASE_ARCHIVE_VIEW)
   {
     /* If we leave a note view */
     if (priv->type == BJB_TOOLBAR_NOTE_VIEW)
diff --git a/src/bjb-window-base.c b/src/bjb-window-base.c
index 0ce44ba..8156826 100644
--- a/src/bjb-window-base.c
+++ b/src/bjb-window-base.c
@@ -481,11 +481,13 @@ void
 bjb_window_base_switch_to (BjbWindowBase *self, BjbWindowViewType type)
 {
   BjbWindowBasePriv *priv = self->priv;
-  priv->current_view = type;
 
   if (type != BJB_WINDOW_BASE_NOTE_VIEW)
     destroy_note_if_needed (self);
 
+  if (priv->current_view == BJB_WINDOW_BASE_ARCHIVE_VIEW && type == BJB_WINDOW_BASE_NO_NOTE)
+    type = priv->current_view;
+
   switch (type)
   {
 
@@ -553,6 +555,8 @@ bjb_window_base_switch_to (BjbWindowBase *self, BjbWindowViewType type)
       return;
   }
 
+  priv->current_view = type;
+
   g_signal_emit (G_OBJECT (self), bjb_win_base_signals[BJB_WIN_BASE_VIEW_CHANGED],0);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]