Commit a8d0c04c authored by Cosimo Cecchi's avatar Cosimo Cecchi

window-slot: cleanup connect/disconnect_view()

parent 307e0edb
......@@ -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);
......
......@@ -374,30 +374,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)
......@@ -410,7 +386,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);
......@@ -429,7 +405,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);
}
}
......
......@@ -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,
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment