[nautilus] slot: fold function into the only caller



commit 419d49de7dd714095fbd63dd7093fec5c07a52fb
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Jan 6 12:37:56 2012 +0100

    slot: fold function into the only caller
    
    Also simplify its code a bit.

 src/nautilus-window-slot.c |   57 ++++++++++++++++---------------------------
 1 files changed, 21 insertions(+), 36 deletions(-)
---
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 5c8ee91..c030d6c 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -338,58 +338,43 @@ nautilus_window_slot_get_window (NautilusWindowSlot *slot)
 	return slot->pane->window;
 }
 
-/* nautilus_window_slot_set_title:
- *
- * Sets slot->title, and if it changed
- * synchronizes the actual GtkWindow title which
- * might look a bit different (e.g. with "file browser:" added)
+/* nautilus_window_slot_update_title:
+ * 
+ * Re-calculate the slot title.
+ * Called when the location or view has changed.
+ * @slot: The NautilusWindowSlot in question.
+ * 
  */
-static void
-nautilus_window_slot_set_title (NautilusWindowSlot *slot,
-				const char *title)
+void
+nautilus_window_slot_update_title (NautilusWindowSlot *slot)
 {
 	NautilusWindow *window;
-	gboolean changed;
-
-	g_assert (NAUTILUS_IS_WINDOW_SLOT (slot));
+	char *title;
+	gboolean do_sync = FALSE;
 
+	title = nautilus_compute_title_for_location (slot->location);
 	window = NAUTILUS_WINDOW (slot->pane->window);
 
-	changed = FALSE;
-
 	if (g_strcmp0 (title, slot->title) != 0) {
-		changed = TRUE;
+		do_sync = TRUE;
 
 		g_free (slot->title);
-		slot->title = g_strdup (title);
+		slot->title = title;
+		title = NULL;
 	}
 
-	if (strlen (slot->title) > 0 && slot->current_location_bookmark) {
-		changed = TRUE;
+	if (strlen (slot->title) > 0 &&
+	    slot->current_location_bookmark != NULL) {
+		do_sync = TRUE;
 	}
 
-	if (changed) {
+	if (do_sync) {
 		nautilus_window_sync_title (window, slot);
 	}
-}
 
-
-/* nautilus_window_slot_update_title:
- * 
- * Re-calculate the slot title.
- * Called when the location or view has changed.
- * @slot: The NautilusWindowSlot in question.
- * 
- */
-void
-nautilus_window_slot_update_title (NautilusWindowSlot *slot)
-{
-	char *title;
-
-	title = nautilus_compute_title_for_location (slot->location);
-	nautilus_window_slot_set_title (slot, title);
-
-	g_free (title);
+	if (title != NULL) {
+		g_free (title);
+	}
 }
 
 /* nautilus_window_slot_update_icon:



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