[gtk+/places-sidebar] Remove the use of NautilusWindow



commit 4926cb8bb6119afbb291fa607fb8cb5554bca8cc
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Oct 3 11:38:26 2011 -0500

    Remove the use of NautilusWindow
    
    Now we just need to see if we need to replace calls to
    nautilus_window_set_initiated_unmount() with a signal.
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtkplacessidebar.c |   64 ++++++++++++++++++-----------------------------
 1 files changed, 25 insertions(+), 39 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index a2daa82..16993cd 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -44,7 +44,6 @@ struct _GtkPlacesSidebar {
 	char 	           *uri;
 	GtkListStore       *store;
 	GtkTreeModel       *filter_model;
-	NautilusWindow *window;
 	GtkBookmarksManager *bookmarks_manager;
 	GVolumeMonitor *volume_monitor;
 
@@ -1958,11 +1957,11 @@ mount_shortcut_cb (GtkMenuItem           *item,
 static void
 unmount_done (gpointer data)
 {
-	NautilusWindow *window;
+	GtkPlacesSidebar *sidebar;
 
-	window = data;
-	nautilus_window_set_initiated_unmount (window, FALSE);
-	g_object_unref (window);
+	sidebar = data;
+	nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+	g_object_unref (sidebar);
 }
 
 static void
@@ -1973,7 +1972,7 @@ do_unmount (GMount *mount,
 		nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
 		nautilus_file_operations_unmount_mount_full (NULL, mount, FALSE, TRUE,
 							     unmount_done,
-							     g_object_ref (sidebar->window));
+							     g_object_ref (sidebar));
 	}
 }
 
@@ -2009,14 +2008,14 @@ drive_eject_cb (GObject *source_object,
 		GAsyncResult *res,
 		gpointer user_data)
 {
-	NautilusWindow *window;
+	GtkPlacesSidebar *sidebar;
 	GError *error;
 	char *primary;
 	char *name;
 
-	window = user_data;
-	nautilus_window_set_initiated_unmount (window, FALSE);
-	g_object_unref (window);
+	sidebar = user_data;
+	nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+	g_object_unref (sidebar);
 
 	error = NULL;
 	if (!g_drive_eject_with_operation_finish (G_DRIVE (source_object), res, &error)) {
@@ -2038,14 +2037,14 @@ volume_eject_cb (GObject *source_object,
 		GAsyncResult *res,
 		gpointer user_data)
 {
-	NautilusWindow *window;
+	GtkPlacesSidebar *sidebar;
 	GError *error;
 	char *primary;
 	char *name;
 
-	window = user_data;
-	nautilus_window_set_initiated_unmount (window, FALSE);
-	g_object_unref (window);
+	sidebar = user_data;
+	nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+	g_object_unref (sidebar);
 
 	error = NULL;
 	if (!g_volume_eject_with_operation_finish (G_VOLUME (source_object), res, &error)) {
@@ -2067,14 +2066,14 @@ mount_eject_cb (GObject *source_object,
 		GAsyncResult *res,
 		gpointer user_data)
 {
-	NautilusWindow *window;
+	GtkPlacesSidebar *sidebar;
 	GError *error;
 	char *primary;
 	char *name;
 
-	window = user_data;
-	nautilus_window_set_initiated_unmount (window, FALSE);
-	g_object_unref (window);
+	sidebar = user_data;
+	nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+	g_object_unref (sidebar);
 
 	error = NULL;
 	if (!g_mount_eject_with_operation_finish (G_MOUNT (source_object), res, &error)) {
@@ -2103,15 +2102,15 @@ do_eject (GMount *mount,
 	if (mount != NULL) {
 		nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
 		g_mount_eject_with_operation (mount, 0, mount_op, NULL, mount_eject_cb,
-					      g_object_ref (sidebar->window));
+					      g_object_ref (sidebar));
 	} else if (volume != NULL) {
 		nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
 		g_volume_eject_with_operation (volume, 0, mount_op, NULL, volume_eject_cb,
-					      g_object_ref (sidebar->window));
+					      g_object_ref (sidebar));
 	} else if (drive != NULL) {
 		nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
 		g_drive_eject_with_operation (drive, 0, mount_op, NULL, drive_eject_cb,
-					      g_object_ref (sidebar->window));
+					      g_object_ref (sidebar));
 	}
 	g_object_unref (mount_op);
 }
@@ -2311,14 +2310,14 @@ drive_stop_cb (GObject *source_object,
 	       GAsyncResult *res,
 	       gpointer user_data)
 {
-	NautilusWindow *window;
+	GtkPlacesSidebar *sidebar;
 	GError *error;
 	char *primary;
 	char *name;
 
-	window = user_data;
-	nautilus_window_set_initiated_unmount (window, FALSE);
-	g_object_unref (window);
+	sidebar = user_data;
+	nautilus_window_set_initiated_unmount (sidebar->window, FALSE);
+	g_object_unref (sidebar);
 
 	error = NULL;
 	if (!g_drive_poll_for_media_finish (G_DRIVE (source_object), res, &error)) {
@@ -2356,7 +2355,7 @@ stop_shortcut_cb (GtkMenuItem           *item,
 		mount_op = gtk_mount_operation_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (sidebar))));
 		nautilus_window_set_initiated_unmount (sidebar->window, TRUE);
 		g_drive_stop (drive, G_MOUNT_UNMOUNT_NONE, mount_op, NULL, drive_stop_cb,
-			      g_object_ref (sidebar->window));
+			      g_object_ref (sidebar));
 		g_object_unref (mount_op);
 	}
 	g_object_unref (drive);
@@ -3303,19 +3302,6 @@ gtk_places_sidebar_class_init (GtkPlacesSidebarClass *class)
 			      G_TYPE_ENUM);
 }
 
-/* FIXME: do the following in a constructor or in ::map() */
-static void
-gtk_places_sidebar_set_parent_window (GtkPlacesSidebar *sidebar,
-					   NautilusWindow *window)
-{
-	sidebar->window = window;
-
-	g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER,
-				  G_CALLBACK (bookmarks_popup_menu_detach_cb), sidebar);
-
-	update_places (sidebar);
-}
-
 static void
 gtk_places_sidebar_style_set (GtkWidget *widget,
 				   GtkStyle  *previous_style)



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