[nautilus] view: add a shadow to the view when not showing tabs



commit ac7810422554e376398bd346217b1ff1e33f0886
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Jul 11 16:32:45 2012 -0400

    view: add a shadow to the view when not showing tabs
    
    When we are showing tabs, the notebook will take care of drawing a
    border around the view.
    When there is only one view, since we disable tabs from the notebook,
    the view needs to draw a shadow instead, or we won't draw any shadow at
    all. In the past this wasn't a problem because the toolbar used to draw
    a stroke for us.

 src/nautilus-view.c |   29 ++++++++++++++++++++++++++++-
 1 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 841b644..7d0f2a0 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -2624,7 +2624,6 @@ nautilus_view_init (NautilusView *view)
 					GTK_POLICY_AUTOMATIC);
 	gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (view), NULL);
 	gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (view), NULL);
-	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view), GTK_SHADOW_NONE);
 
 	gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (view)),
 					      GTK_JUNCTION_TOP | GTK_JUNCTION_LEFT);
@@ -9608,6 +9607,26 @@ real_get_selected_icon_locations (NautilusView *view)
 }
 
 static void
+window_slots_changed (NautilusWindow *window,
+		      NautilusWindowSlot *slot,
+		      NautilusView *view)
+{
+	GList *slots;
+
+	slots = nautilus_window_get_slots (window);
+
+	/* Only add a shadow to the scrolled window when we're in a tabless
+	 * notebook, since when the notebook has tabs, it will draw its own
+	 * border.
+	 */
+	if (g_list_length (slots) > 1) {
+		gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view), GTK_SHADOW_NONE);
+	} else {
+		gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view), GTK_SHADOW_IN);
+	}
+}
+
+static void
 nautilus_view_set_property (GObject         *object,
 			    guint            prop_id,
 			    const GValue    *value,
@@ -9637,6 +9656,14 @@ nautilus_view_set_property (GObject         *object,
 					 directory_view, 0);
 
 		g_signal_connect_object (directory_view->details->window,
+					 "slot-added", G_CALLBACK (window_slots_changed),
+					 directory_view, 0);
+		g_signal_connect_object (directory_view->details->window,
+					 "slot-removed", G_CALLBACK (window_slots_changed),
+					 directory_view, 0);
+		window_slots_changed (window, slot, directory_view);
+
+		g_signal_connect_object (directory_view->details->window,
 					 "hidden-files-mode-changed", G_CALLBACK (hidden_files_mode_changed),
 					 directory_view, 0);
 		nautilus_view_init_show_hidden_files (directory_view);



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