summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2012-08-31 21:13:51 -0400
committerCosimo Cecchi <cosimoc@gnome.org>2012-08-31 22:57:36 -0400
commit2b62d950b0b85277c126a91447942aafd8f159bf (patch)
treefd1ebd685535d18340992f6d199938c7bdab5bcf
parent109d00336b4c7f10d7d359924c180d49406bbd0c (diff)
downloadnautilus-2b62d950b0b85277c126a91447942aafd8f159bf.tar.gz
window: make notebook-removal in close_slot() optional
In preparation for the next commit.
-rw-r--r--src/nautilus-window.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index e01a50925..2ed52e8cc 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -310,7 +310,8 @@ nautilus_window_set_search_visible (NautilusWindow *window,
static void
close_slot (NautilusWindow *window,
- NautilusWindowSlot *slot)
+ NautilusWindowSlot *slot,
+ gboolean remove_from_notebook)
{
int page_num;
GtkNotebook *notebook;
@@ -325,17 +326,20 @@ close_slot (NautilusWindow *window,
g_signal_emit (window, signals[SLOT_REMOVED], 0, slot);
notebook = GTK_NOTEBOOK (window->details->notebook);
- page_num = gtk_notebook_page_num (notebook, GTK_WIDGET (slot));
- g_assert (page_num >= 0);
- g_signal_handlers_block_by_func (notebook,
- G_CALLBACK (notebook_switch_page_cb),
- window);
- /* this will call gtk_widget_destroy on the slot */
- gtk_notebook_remove_page (notebook, page_num);
- g_signal_handlers_unblock_by_func (notebook,
- G_CALLBACK (notebook_switch_page_cb),
- window);
+ if (remove_from_notebook) {
+ page_num = gtk_notebook_page_num (notebook, GTK_WIDGET (slot));
+ g_assert (page_num >= 0);
+
+ g_signal_handlers_block_by_func (notebook,
+ G_CALLBACK (notebook_switch_page_cb),
+ window);
+ /* this will call gtk_widget_destroy on the slot */
+ gtk_notebook_remove_page (notebook, page_num);
+ g_signal_handlers_unblock_by_func (notebook,
+ G_CALLBACK (notebook_switch_page_cb),
+ window);
+ }
}
NautilusWindowSlot *
@@ -674,7 +678,7 @@ nautilus_window_slot_close (NautilusWindow *window,
nautilus_window_set_active_slot (window, next_slot);
}
- close_slot (window, slot);
+ close_slot (window, slot, TRUE);
/* If that was the last slot in the window, close the window. */
if (window->details->slots == NULL) {
@@ -1150,7 +1154,7 @@ destroy_slots_foreach (gpointer data,
NautilusWindowSlot *slot = data;
NautilusWindow *window = user_data;
- close_slot (window, slot);
+ close_slot (window, slot, TRUE);
}
static void