[gnome-notes/fix-selection-bar: 2/3] Show empty message in notebook and trash bin (2)




commit be3f72bd0011832725ea245ab516dbc4e240eeb5
Author: Isaque Galdino <igaldino gmail com>
Date:   Tue Aug 11 23:44:25 2020 -0300

    Show empty message in notebook and trash bin (2)
    
    I've found more cases where empty message is not shown in notebook and
    trash bin when tey are empty.
    
    Previous related commit 242e2d88824b31c7080b8cdde414f4cd75444e7a

 src/bjb-controller.c   | 24 +++++++++++++++---------
 src/bjb-main-toolbar.c |  3 ++-
 2 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/bjb-controller.c b/src/bjb-controller.c
index 7f766063..0c4f218e 100644
--- a/src/bjb-controller.c
+++ b/src/bjb-controller.c
@@ -508,8 +508,6 @@ update_controller_callback (GList *result,
   }
 }
 
-
-
 void
 bjb_controller_apply_needle (BjbController *self)
 {
@@ -525,9 +523,13 @@ bjb_controller_apply_needle (BjbController *self)
   {
     result = biji_manager_get_items (self->manager, self->group);
 
-    if (result == NULL && self->group == BIJI_LIVING_ITEMS)
-      bjb_window_base_switch_to (self->window, BJB_WINDOW_BASE_NO_NOTE);
-
+    if (result == NULL)
+      {
+        if (!self->notebook && self->group == BIJI_LIVING_ITEMS)
+          bjb_window_base_switch_to (self->window, BJB_WINDOW_BASE_NO_NOTE);
+        else
+          bjb_window_base_switch_to (self->window, BJB_WINDOW_BASE_NO_RESULT);
+      }
     else
       update_controller_callback (result, self);
 
@@ -625,9 +627,13 @@ on_manager_changed (BijiManager            *manager,
         gtk_list_store_remove (GTK_LIST_STORE (self->model), p_iter);
 
       self->items_to_show = g_list_remove (self->items_to_show, item);
-      if (self->items_to_show == NULL && group == BIJI_LIVING_ITEMS)
-        bjb_window_base_switch_to (self->window, BJB_WINDOW_BASE_NO_NOTE);
-
+      if (self->items_to_show == NULL)
+        {
+          if (!self->notebook && group == BIJI_LIVING_ITEMS)
+            bjb_window_base_switch_to (self->window, BJB_WINDOW_BASE_NO_NOTE);
+          else
+            bjb_window_base_switch_to (self->window, BJB_WINDOW_BASE_NO_RESULT);
+        }
       else
         notify_displayed_items_changed (self);
 
@@ -860,7 +866,7 @@ bjb_controller_set_group (BjbController   *self,
 
     else
       bjb_controller_apply_needle (self);
-    //bjb_window_base_switch_to (self->window, group);
+
     return;
   }
   else /* Archives */
diff --git a/src/bjb-main-toolbar.c b/src/bjb-main-toolbar.c
index f308ee8a..fb8bc141 100644
--- a/src/bjb-main-toolbar.c
+++ b/src/bjb-main-toolbar.c
@@ -186,6 +186,8 @@ update_selection_buttons (BjbController *controller,
   gtk_widget_set_sensitive (self->empty_button, some_item_is_visible);
   gtk_widget_set_sensitive (self->search_button, some_item_is_visible);
   gtk_widget_set_sensitive (self->select_button, some_item_is_visible);
+
+  on_view_selection_changed_cb (self);
 }
 
 static void
@@ -296,7 +298,6 @@ static void
 on_empty_clicked_callback        (BjbMainToolbar *self)
 {
   biji_manager_empty_bin (bjb_window_base_get_manager (GTK_WIDGET (self->window)));
-  bjb_window_base_switch_to (BJB_WINDOW_BASE (self->window), BJB_WINDOW_BASE_NO_RESULT);
 }
 
 


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