[nautilus/places-sidebar: 2/6] Create a GtkPlacesSidebar and connect stub handlers to it



commit 45e13089129added1e0b60b2f1f3dc5f833453d6
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Oct 22 18:28:38 2012 -0500

    Create a GtkPlacesSidebar and connect stub handlers to it
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 src/nautilus-window-private.h |    3 +-
 src/nautilus-window.c         |   61 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 58 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 25a629e..6f43f4d 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -62,7 +62,8 @@ struct NautilusWindowDetails
         
         /* Side Pane */
         int side_pane_width;
-        GtkWidget *sidebar;
+        GtkWidget *sidebar;        /* container for the GtkPlacesSidebar */
+        GtkWidget *places_sidebar; /* the actual GtkPlacesSidebar */
 
         /* Main view */
         GtkWidget *main_view;
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index c73a529..b3a0a85 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -38,7 +38,6 @@
 #include "nautilus-location-entry.h"
 #include "nautilus-mime-actions.h"
 #include "nautilus-notebook.h"
-#include "nautilus-places-sidebar.h"
 #include "nautilus-pathbar.h"
 #include "nautilus-toolbar.h"
 #include "nautilus-view-factory.h"
@@ -550,6 +549,43 @@ setup_side_pane_width (NautilusWindow *window)
 				window->details->side_pane_width);
 }
 
+/* Callback used when the places sidebar changes location; we need to change the displayed folder */
+static void
+places_sidebar_location_selected_cb (GtkPlacesSidebar *sidebar,
+				     GFile            *location,
+				     GtkPlacesOpenMode open_mode,
+				     gpointer          user_data)
+{
+	/* FIXME */
+}
+
+/* Callback used when the places sidebar needs us to show the file properties dialog */
+static void
+places_sidebar_show_file_properties_cb (GtkPlacesSidebar *sidebar,
+					GFile            *file,
+					gpointer          user_data)
+{
+	/* FIXME */
+}
+
+/* Callback used when the places sidebar needs us to empty the trash */
+static void
+places_sidebar_empty_trash_requested_cb (GtkPlacesSidebar *sidebar,
+					 gpointer          user_data)
+{
+	/* FIXME */
+}
+
+/* Callback used when the places sidebar needs us to present an error message */
+static void
+places_sidebar_show_error_message (GtkPlacesSidebar *sidebar,
+				   const char       *primary,
+				   const char       *secondary,
+				   gpointer          user_data)
+{
+	/* FIXME */
+}
+
 static void
 nautilus_window_set_up_sidebar (NautilusWindow *window)
 {
@@ -569,10 +605,24 @@ nautilus_window_set_up_sidebar (NautilusWindow *window)
 			  G_CALLBACK (side_pane_size_allocate_callback),
 			  window);
 
-	sidebar = nautilus_places_sidebar_new (window);
-	gtk_box_pack_start (GTK_BOX (window->details->sidebar), sidebar, TRUE, TRUE, 0);
-	gtk_widget_show (sidebar);
-	gtk_widget_show (GTK_WIDGET (window->details->sidebar));
+	window->details->places_sidebar = gtk_places_sidebar_new ();
+	gtk_places_sidebar_set_multiple_tabs_supported (window->details->places_sidebar, TRUE);
+	gtk_places_sidebar_set_multiple_windows_supported (window->details->places_sidebar, TRUE);
+	gtk_places_sidebar_set_show_properties (window->details->places_sidebar, TRUE);
+	gtk_places_sidebar_set_show_trash (window->details->places_sidebar, TRUE);
+
+	g_signal_connect (window->details->places_sidebar, "location-selected",
+			  G_CALLBACK (places_sidebar_location_selected_cb), window);
+	g_signal_connect (window->details->places_sidebar, "show-file-properties",
+			  G_CALLBACK (places_sidebar_show_file_properties_cb), window);
+	g_signal_connect (window->details->places_sidebar, "empty-trash-requested",
+			  G_CALLBACK (places_sidebar_empty_trash_requested_cb), window);
+	g_signal_connect (window->details->places_sidebar, "show-error-message",
+			  G_CALLBACK (places_sidebar_show_error_message), window);
+
+	gtk_box_pack_start (GTK_BOX (window->details->sidebar), window->details->places_sidebar, TRUE, TRUE, 0);
+	gtk_widget_show (window->details->places_sidebar);
+	gtk_widget_show (window->details->sidebar);
 }
 
 static void
@@ -583,6 +633,7 @@ nautilus_window_tear_down_sidebar (NautilusWindow *window)
 	if (window->details->sidebar != NULL) {
 		gtk_widget_destroy (GTK_WIDGET (window->details->sidebar));
 		window->details->sidebar = NULL;
+		window->details->places_sidebar = NULL;
 	}
 }
 



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