[nautilus/wip/gbsneto/actionbar: 10/10] window-slot: show actionbar



commit 006e16da2950e3288876a68b9e8f2e12d3f4ea6a
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Mar 2 01:03:25 2016 -0300

    window-slot: show actionbar
    
    When we change the view, add the view's actionbar
    to the bottom of the window slot.

 src/nautilus-window-slot.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 8b948ed..896e747 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -2172,6 +2172,19 @@ done:
 static void
 change_view (NautilusWindowSlot *slot)
 {
+        NautilusView *view;
+        gboolean view_changed;
+
+        view = slot->details->new_content_view;
+        view_changed = slot->details->content_view != view;
+
+        /* Remove the old actionbar before switching to the new view */
+        if (view_changed &&
+            slot->details->content_view &&
+            nautilus_view_get_action_bar (slot->details->content_view)) {
+                gtk_container_remove (GTK_CONTAINER (slot), nautilus_view_get_action_bar 
(slot->details->content_view));
+        }
+
        /* Switch to the new content view.
         * Destroy the extra location widgets first, since they might hold
         * a pointer to the old view, which will possibly be destroyed inside
@@ -2189,6 +2202,16 @@ change_view (NautilusWindowSlot *slot)
         * add back the extra location widgets.
         */
        nautilus_window_slot_setup_extra_location_widgets (slot);
+
+        /* Add the actionbar (if any) after the extra location widgets are set */
+        if (view_changed && nautilus_view_get_action_bar (view)) {
+                GtkWidget *actionbar;
+
+                actionbar = nautilus_view_get_action_bar (view);
+
+                gtk_box_pack_end (GTK_BOX (slot), actionbar, FALSE, FALSE, 0);
+                gtk_widget_show (actionbar);
+        }
 }
 
 static void


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