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



commit e926cf5a46ec0805810b7837a9b11f7b12d363cb
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 83b5405..4ee535c 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -2204,6 +2204,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
@@ -2221,6 +2234,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]