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



commit 765eb7d38c3c464d28f3b88afcd9ec688b5da4b0
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 |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 262395c..6e4aa61 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -2648,8 +2648,13 @@ static void
 change_view (NautilusWindowSlot *self)
 {
     NautilusWindowSlotPrivate *priv;
+    NautilusView *view;
+    gboolean view_changed;
 
     priv = nautilus_window_slot_get_instance_private (self);
+    view = priv->new_content_view;
+    view_changed = priv->content_view != 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
@@ -2658,6 +2663,14 @@ change_view (NautilusWindowSlot *self)
     nautilus_window_slot_remove_extra_location_widgets (self);
     nautilus_window_slot_switch_new_content_view (self);
 
+    /* Remove the old actionbar before switching to the new view */
+    if (view_changed &&
+        priv->content_view &&
+        nautilus_view_get_action_bar (priv->content_view))
+    {
+        gtk_container_remove (GTK_CONTAINER (self), nautilus_view_get_action_bar (priv->content_view));
+    }
+
     if (priv->pending_location != NULL)
     {
         /* Tell the window we are finished. */
@@ -2668,6 +2681,17 @@ change_view (NautilusWindowSlot *self)
      * add back the extra location widgets.
      */
     nautilus_window_slot_setup_extra_location_widgets (self);
+
+    /* 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 (self), actionbar, FALSE, FALSE, 0);
+        gtk_widget_show (actionbar);
+    }
 }
 
 static void


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