[nautilus/refactor: 6/26] window-slot: cleanup connect/disconnect_view()
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/refactor: 6/26] window-slot: cleanup connect/disconnect_view()
- Date: Wed, 29 Dec 2010 17:57:58 +0000 (UTC)
commit c55a0f4bd070c39801064bdb6879da5d1de5a460
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Dec 21 19:29:09 2010 +0100
window-slot: cleanup connect/disconnect_view()
src/nautilus-window-manage-views.c | 10 +++++-----
src/nautilus-window-slot.c | 28 ++--------------------------
src/nautilus-window-slot.h | 7 -------
src/nautilus-window.c | 14 ++++++++++----
4 files changed, 17 insertions(+), 42 deletions(-)
---
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 55586ff..56e5329 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -1254,7 +1254,7 @@ create_content_view (NautilusWindowSlot *slot,
eel_accessibility_set_description (view, _("View of the current folder"));
slot->new_content_view = view;
- nautilus_window_slot_connect_content_view (slot, slot->new_content_view);
+ nautilus_window_connect_content_view (window, slot->new_content_view);
}
/* Actually load the pending location and selection: */
@@ -1413,7 +1413,7 @@ location_has_really_changed (NautilusWindowSlot *slot)
/* Switch to the new content view. */
if (gtk_widget_get_parent (widget) == NULL) {
if (slot->content_view != NULL) {
- nautilus_window_slot_disconnect_content_view (slot, slot->content_view);
+ nautilus_window_disconnect_content_view (window, slot->content_view);
}
nautilus_window_slot_set_content_view_widget (slot, slot->new_content_view);
}
@@ -1772,7 +1772,7 @@ free_location_change (NautilusWindowSlot *slot)
nautilus_view_stop_loading (slot->new_content_view);
window->details->temporarily_ignore_view_signals = FALSE;
- nautilus_window_slot_disconnect_content_view (slot, slot->new_content_view);
+ nautilus_window_disconnect_content_view (window, slot->new_content_view);
g_object_unref (slot->new_content_view);
slot->new_content_view = NULL;
}
@@ -1825,7 +1825,7 @@ nautilus_window_report_view_failed (NautilusWindow *window,
fallback_load_location = NULL;
if (view == slot->content_view) {
- nautilus_window_slot_disconnect_content_view (slot, view);
+ nautilus_window_disconnect_content_view (window, view);
nautilus_window_slot_set_content_view_widget (slot, NULL);
report_current_content_view_failure_to_user (slot);
@@ -2027,7 +2027,7 @@ nautilus_window_manage_views_close_slot (NautilusWindowPane *pane,
NautilusWindowSlot *slot)
{
if (slot->content_view != NULL) {
- nautilus_window_slot_disconnect_content_view (slot, slot->content_view);
+ nautilus_window_disconnect_content_view (slot->pane->window, slot->content_view);
}
free_location_change (slot);
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 5220ef4..a410368 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -377,30 +377,6 @@ nautilus_window_slot_is_in_active_pane (NautilusWindowSlot *slot,
}
void
-nautilus_window_slot_connect_content_view (NautilusWindowSlot *slot,
- NautilusView *view)
-{
- NautilusWindow *window;
-
- window = slot->pane->window;
- if (window != NULL && slot == nautilus_window_get_active_slot (window)) {
- nautilus_window_connect_content_view (window, view);
- }
-}
-
-void
-nautilus_window_slot_disconnect_content_view (NautilusWindowSlot *slot,
- NautilusView *view)
-{
- NautilusWindow *window;
-
- window = slot->pane->window;
- if (window != NULL && window->details->active_pane && window->details->active_pane->active_slot == slot) {
- nautilus_window_disconnect_content_view (window, view);
- }
-}
-
-void
nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
NautilusView *new_view)
{
@@ -412,7 +388,7 @@ nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
if (slot->content_view != NULL) {
/* disconnect old view */
- nautilus_window_slot_disconnect_content_view (slot, slot->content_view);
+ nautilus_window_disconnect_content_view (window, slot->content_view);
widget = nautilus_view_get_widget (slot->content_view);
gtk_widget_destroy (widget);
@@ -431,7 +407,7 @@ nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
g_object_ref (slot->content_view);
/* connect new view */
- nautilus_window_slot_connect_content_view (slot, new_view);
+ nautilus_window_connect_content_view (window, new_view);
}
}
diff --git a/src/nautilus-window-slot.h b/src/nautilus-window-slot.h
index f0d0a2f..f0d2411 100644
--- a/src/nautilus-window-slot.h
+++ b/src/nautilus-window-slot.h
@@ -161,13 +161,6 @@ const char *nautilus_window_slot_get_content_view_id (NautilusWindow
gboolean nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slot,
const char *iid);
-void nautilus_window_slot_connect_content_view (NautilusWindowSlot *slot,
- NautilusView *view);
-void nautilus_window_slot_disconnect_content_view (NautilusWindowSlot *slot,
- NautilusView *view);
-
-
-
void nautilus_window_slot_go_home (NautilusWindowSlot *slot,
gboolean new_tab);
void nautilus_window_slot_go_up (NautilusWindowSlot *slot,
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 60c9192..bdd9ce9 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -856,7 +856,7 @@ nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new
if (old_slot != NULL) {
/* inform window */
if (old_slot->content_view != NULL) {
- nautilus_window_slot_disconnect_content_view (old_slot, old_slot->content_view);
+ nautilus_window_disconnect_content_view (window, old_slot->content_view);
}
/* inform slot & view */
@@ -884,7 +884,7 @@ nautilus_window_set_active_slot (NautilusWindow *window, NautilusWindowSlot *new
if (new_slot->content_view != NULL) {
/* inform window */
- nautilus_window_slot_connect_content_view (new_slot, new_slot->content_view);
+ nautilus_window_connect_content_view (window, new_slot->content_view);
}
/* inform slot & view */
@@ -1434,7 +1434,10 @@ nautilus_window_connect_content_view (NautilusWindow *window,
g_assert (NAUTILUS_IS_VIEW (view));
slot = nautilus_window_get_slot_for_view (window, view);
- g_assert (slot == nautilus_window_get_active_slot (window));
+
+ if (slot != nautilus_window_get_active_slot (window)) {
+ return;
+ }
g_signal_connect (view, "zoom-level-changed",
G_CALLBACK (zoom_level_changed_callback),
@@ -1462,7 +1465,10 @@ nautilus_window_disconnect_content_view (NautilusWindow *window,
g_assert (NAUTILUS_IS_VIEW (view));
slot = nautilus_window_get_slot_for_view (window, view);
- g_assert (slot == nautilus_window_get_active_slot (window));
+
+ if (slot != nautilus_window_get_active_slot (window)) {
+ return;
+ }
g_signal_handlers_disconnect_by_func (view, G_CALLBACK (zoom_level_changed_callback), window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]