Commit 553edbfb authored by Cosimo Cecchi's avatar Cosimo Cecchi

window: cleanup nautilus_window_go_up()

parent 558e394a
......@@ -633,7 +633,8 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
}
void
nautilus_window_slot_go_home (NautilusWindowSlot *slot, gboolean new_tab)
nautilus_window_slot_go_home (NautilusWindowSlot *slot,
gboolean new_tab)
{
GFile *home;
NautilusWindowOpenFlags flags;
......@@ -653,6 +654,45 @@ nautilus_window_slot_go_home (NautilusWindowSlot *slot, gboolean new_tab)
g_object_unref (home);
}
void
nautilus_window_slot_go_up (NautilusWindowSlot *slot,
gboolean close_behind,
gboolean new_tab)
{
GFile *parent;
GList *selection;
NautilusWindowOpenFlags flags;
if (slot->location == NULL) {
return;
}
parent = g_file_get_parent (slot->location);
if (parent == NULL) {
return;
}
selection = g_list_prepend (NULL, g_object_ref (slot->location));
flags = 0;
if (close_behind) {
flags |= NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
}
if (new_tab) {
flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
}
nautilus_window_slot_open_location (slot, parent,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags,
selection);
g_object_unref (parent);
g_list_free_full (selection, g_object_unref);
}
static char *
nautilus_window_slot_get_view_error_label (NautilusWindowSlot *slot)
{
......
......@@ -536,7 +536,11 @@ static void
action_up_callback (GtkAction *action,
gpointer user_data)
{
nautilus_window_go_up (NAUTILUS_WINDOW (user_data), FALSE, should_open_in_new_tab ());
NautilusWindow *window = user_data;
NautilusWindowSlot *slot;
slot = nautilus_window_get_active_slot (window);
nautilus_window_slot_go_up (slot, FALSE, should_open_in_new_tab ());
}
static void
......
......@@ -163,6 +163,9 @@ gboolean nautilus_window_slot_content_view_matches_iid (NautilusWindowSlot *slo
void nautilus_window_slot_go_home (NautilusWindowSlot *slot,
gboolean new_tab);
void nautilus_window_slot_go_up (NautilusWindowSlot *slot,
gboolean close_behind,
gboolean new_tab);
void nautilus_window_slot_set_content_view_widget (NautilusWindowSlot *slot,
NautilusView *content_view);
......
......@@ -244,7 +244,9 @@ nautilus_window_go_to_with_selection (NautilusWindow *window,
static gboolean
nautilus_window_go_up_signal (NautilusWindow *window, gboolean close_behind)
{
nautilus_window_go_up (window, close_behind, FALSE);
nautilus_window_slot_go_up (nautilus_window_get_active_slot (window),
close_behind, FALSE);
return TRUE;
}
......@@ -283,48 +285,6 @@ nautilus_window_new_tab (NautilusWindow *window)
}
}
void
nautilus_window_go_up (NautilusWindow *window, gboolean close_behind, gboolean new_tab)
{
NautilusWindowSlot *slot;
GFile *parent;
GList *selection;
NautilusWindowOpenFlags flags;
g_assert (NAUTILUS_IS_WINDOW (window));
slot = window->details->active_pane->active_slot;
if (slot->location == NULL) {
return;
}
parent = g_file_get_parent (slot->location);
if (parent == NULL) {
return;
}
selection = g_list_prepend (NULL, g_object_ref (slot->location));
flags = 0;
if (close_behind) {
flags |= NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
}
if (new_tab) {
flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
}
nautilus_window_slot_open_location (slot, parent,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags,
selection);
g_object_unref (parent);
g_list_free_full (selection, g_object_unref);
}
static void
real_set_allow_up (NautilusWindow *window,
gboolean allow)
......
......@@ -160,9 +160,6 @@ void nautilus_window_go_to_with_selection (NautilusWindow *window
GFile *location,
GList *new_selection);
void nautilus_window_new_tab (NautilusWindow *window);
void nautilus_window_go_up (NautilusWindow *window,
gboolean close_behind,
gboolean new_tab);
void nautilus_window_prompt_for_location (NautilusWindow *window,
const char *initial);
void nautilus_window_display_error (NautilusWindow *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