nautilus r13971 - in branches/multiview: . src



Author: cneumair
Date: Sat Mar 22 19:04:09 2008
New Revision: 13971
URL: http://svn.gnome.org/viewvc/nautilus?rev=13971&view=rev

Log:
2008-03-22  Christian Neumair  <cneumair gnome org>

	* src/nautilus-window-manage-views.c
	(nautilus_window_emit_location_change),
	(nautilus_window_report_location_change),
	(location_has_really_changed):
	* src/nautilus-window-manage-views.h:
	* src/nautilus-window.c (nautilus_window_set_active_slot):
	Split out emission code from nautilus_window_report_location_change() into
	nautilus_window_emit_location_change(), use it with a location copy
	in location_has_really_changed().


Modified:
   branches/multiview/ChangeLog
   branches/multiview/src/nautilus-window-manage-views.c
   branches/multiview/src/nautilus-window-manage-views.h
   branches/multiview/src/nautilus-window.c

Modified: branches/multiview/src/nautilus-window-manage-views.c
==============================================================================
--- branches/multiview/src/nautilus-window-manage-views.c	(original)
+++ branches/multiview/src/nautilus-window-manage-views.c	Sat Mar 22 19:04:09 2008
@@ -1313,46 +1313,44 @@
         }
 }
 
+static void
+nautilus_window_emit_location_change (NautilusWindow *window,
+				      GFile *location)
+{
+	char *uri;
+
+	uri = g_file_get_uri (location);
+	g_signal_emit_by_name (window, "loading_uri", uri);
+	g_free (uri);
+}
+
 /* reports location change to window's "loading-uri" clients, i.e.
- * sidebar panels
- *
- * Usually, we emit the pending location.
- *
- * If current_location is true, this emission happens due to
- * switching the active slot. In this case, we want to re-emit
- * with the current location of the new slot if no URI is pending.
- *
- * If current_location is false, this emission happens due to
- * switching the view INSIDE the active slot. In this case, we
- * do not want to emit if no URI is pending.
+ * sidebar panels [used when switching tabs]. It will emit the pending
+ * location, or the existing location if none is pending.
  */
 void
-nautilus_window_report_location_change (NautilusWindow *window,
-					gboolean current_location)
+nautilus_window_report_location_change (NautilusWindow *window)
 {
 	NautilusWindowSlot *slot;
-	GFile *location_copy;
-	char *uri;
+	GFile *location;
+
+	g_assert (NAUTILUS_IS_WINDOW (window));
 
 	slot = window->details->active_slot;
+	g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
 
-	location_copy = NULL;
+	location = NULL;
 
 	if (slot->pending_location != NULL) {
-		location_copy = g_object_ref (slot->pending_location);
+		location = slot->pending_location;
 	}
 
-	if (current_location &&
-	    location_copy == NULL &&
-	    slot->location != NULL) {
-		location_copy = g_object_ref (slot->location);
+	if (location == NULL && slot->location != NULL) {
+		location = slot->location;
 	}
 
-	if (location_copy != NULL) {
-		uri = g_file_get_uri (location_copy);
-		g_signal_emit_by_name (window, "loading_uri", uri);
-		g_free (uri);
-		g_object_unref (location_copy);
+	if (location != NULL) {
+		nautilus_window_emit_location_change (window, location);
 	}
 }
 
@@ -1362,6 +1360,7 @@
 {
 	NautilusWindow *window;
 	GtkWidget *widget;
+	GFile *location_copy;
 
 	window = slot->window;
 
@@ -1381,10 +1380,19 @@
 		update_for_new_location (slot);
 	}
 
+	location_copy = NULL;
+	if (slot->location != NULL) {
+		location_copy = g_object_ref (slot->location);
+	}
+
 	free_location_change (slot);
 
-	if (slot == window->details->active_slot) {
-		nautilus_window_report_location_change (window, FALSE);
+	if (location_copy != NULL) {
+		if (slot == window->details->active_slot) {
+			nautilus_window_emit_location_change (window, location_copy);
+		}
+
+		g_object_unref (location_copy);
 	}
 }
 

Modified: branches/multiview/src/nautilus-window-manage-views.h
==============================================================================
--- branches/multiview/src/nautilus-window-manage-views.h	(original)
+++ branches/multiview/src/nautilus-window-manage-views.h	Sat Mar 22 19:04:09 2008
@@ -68,7 +68,6 @@
                                                NautilusView       *view);
 void nautilus_window_report_load_complete     (NautilusWindow     *window,
                                                NautilusView       *view);
-void nautilus_window_report_location_change   (NautilusWindow     *window,
-					       gboolean            current_location);
+void nautilus_window_report_location_change   (NautilusWindow     *window);
 
 #endif /* NAUTILUS_WINDOW_MANAGE_VIEWS_H */

Modified: branches/multiview/src/nautilus-window.c
==============================================================================
--- branches/multiview/src/nautilus-window.c	(original)
+++ branches/multiview/src/nautilus-window.c	Sat Mar 22 19:04:09 2008
@@ -825,7 +825,7 @@
 
 	if (new_slot != NULL) {
 		/* inform sidebar panels */
-		nautilus_window_report_location_change (window, TRUE);
+		nautilus_window_report_location_change (window);
 		/* TODO decide whether "selection-changed" should be emitted */
 
 		if (new_slot->content_view != NULL) {



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