Commit 307e0edb authored by Cosimo Cecchi's avatar Cosimo Cecchi

window-slot: cleanup of window_slot_open_location() functions

parent cfdf8076
......@@ -838,26 +838,6 @@ action_open_folder_window_callback (GtkAction *action,
nautilus_file_list_free (selection);
}
static void
open_location (FMDirectoryView *directory_view,
const char *new_uri,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags)
{
GtkWindow *window;
GFile *location;
g_assert (FM_IS_DIRECTORY_VIEW (directory_view));
g_assert (new_uri != NULL);
window = fm_directory_view_get_containing_window (directory_view);
DEBUG ("open_location window=%p: %s", window, new_uri);
location = g_file_new_for_uri (new_uri);
nautilus_window_slot_open_location_full (directory_view->details->slot,
location, mode, flags, NULL, NULL, NULL);
g_object_unref (location);
}
static void
app_chooser_dialog_response_cb (GtkDialog *dialog,
gint response_id,
......@@ -5678,11 +5658,15 @@ action_open_scripts_folder_callback (GtkAction *action,
gpointer callback_data)
{
FMDirectoryView *view;
static GFile *location = NULL;
if (location == NULL) {
location = g_file_new_for_uri (scripts_directory_uri);
}
view = FM_DIRECTORY_VIEW (callback_data);
nautilus_window_slot_go_to (view->details->slot, location, FALSE);
open_location (view, scripts_directory_uri, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, 0);
eel_show_info_dialog_with_details
(_("All executable files in this folder will appear in the "
"Scripts menu."),
......
......@@ -1754,8 +1754,8 @@ activate_files (ActivateParameters *parameters)
uri = nautilus_file_get_activation_uri (file);
f = g_file_new_for_uri (uri);
nautilus_window_slot_open_location_full (parameters->slot,
f, parameters->mode, flags, NULL, NULL, NULL);
nautilus_window_slot_open_location (parameters->slot,
f, parameters->mode, flags, NULL);
g_object_unref (f);
g_free (uri);
}
......
......@@ -260,9 +260,9 @@ path_bar_button_released_callback (GtkWidget *widget,
if (flags != 0) {
slot = nautilus_window_get_active_slot (NAUTILUS_WINDOW_PANE (pane)->window);
nautilus_window_slot_open_location_full (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, NULL, NULL, NULL);
nautilus_window_slot_open_location (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, NULL);
g_object_unref (location);
return TRUE;
}
......
......@@ -1739,9 +1739,9 @@ volume_mounted_cb (GVolume *volume,
if (sidebar->go_to_after_mount_slot != NULL) {
if ((sidebar->go_to_after_mount_flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) {
nautilus_window_slot_open_location_full (sidebar->go_to_after_mount_slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
sidebar->go_to_after_mount_flags, NULL, NULL, NULL);
nautilus_window_slot_open_location (sidebar->go_to_after_mount_slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
sidebar->go_to_after_mount_flags, NULL);
} else {
NautilusApplication *app;
NautilusWindow *new, *cur;
......@@ -1817,9 +1817,9 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar,
/* Navigate to the clicked location */
if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) {
slot = nautilus_window_get_active_slot (sidebar->window);
nautilus_window_slot_open_location_full (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, NULL, NULL, NULL);
nautilus_window_slot_open_location (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, NULL);
} else {
NautilusWindow *cur, *new;
NautilusApplication *app;
......
......@@ -511,8 +511,10 @@ location_menu_item_activated_callback (GtkWidget *menu_item,
close_behind = TRUE;
}
nautilus_window_slot_open_location_with_selection
(slot, dest, selection, close_behind);
nautilus_window_slot_open_location (slot, dest,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND,
selection);
g_list_free_full (selection, g_object_unref);
}
......
......@@ -369,12 +369,12 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
DEBUG ("Tree sidebar, opening location %s", uri);
location = g_file_new_for_uri (uri);
nautilus_window_slot_open_location_full
nautilus_window_slot_open_location
(slot,
location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
view->details->activation_flags,
NULL, NULL, NULL);
NULL);
g_object_unref (location);
} else {
DEBUG ("Tree sidebar, launching application for %s", file_uri);
......@@ -396,12 +396,12 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
DEBUG ("Tree sidebar, opening location %s", uri);
location = g_file_new_for_uri (uri);
nautilus_window_slot_open_location_full
nautilus_window_slot_open_location
(slot,
location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
view->details->activation_flags,
NULL, NULL, NULL);
NULL);
g_object_unref (location);
}
}
......
......@@ -663,24 +663,6 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
}
}
void
nautilus_window_slot_open_location_with_selection (NautilusWindowSlot *slot,
GFile *location,
GList *selection,
gboolean close_behind)
{
NautilusWindowOpenFlags flags;
flags = 0;
if (close_behind) {
flags = NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND;
}
nautilus_window_slot_open_location_full (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, selection, NULL, NULL);
}
void
nautilus_window_slot_go_home (NautilusWindowSlot *slot, gboolean new_tab)
{
......
......@@ -127,17 +127,32 @@ char * nautilus_window_slot_get_location_uri (NautilusWindowSlot *slot);
void nautilus_window_slot_close (NautilusWindowSlot *slot);
void nautilus_window_slot_reload (NautilusWindowSlot *slot);
void nautilus_window_slot_open_location_with_selection (NautilusWindowSlot *slot,
GFile *location,
GList *selection,
gboolean close_behind);
void nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
GFile *location,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
GList *new_selection,
NautilusWindowGoToCallback callback,
gpointer user_data);
void nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
GFile *location,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
GList *new_selection,
NautilusWindowGoToCallback callback,
gpointer user_data);
/* convenience wrapper without callback/user_data */
#define nautilus_window_slot_open_location(slot, location, mode, flags, new_selection)\
nautilus_window_slot_open_location_full(slot, location, mode, flags, new_selection, NULL, NULL)
/* these are wrappers that always open according to current mode */
#define nautilus_window_slot_go_to(slot, location, new_tab) \
nautilus_window_slot_open_location(slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, \
(new_tab ? NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB : 0), \
NULL)
#define nautilus_window_slot_go_to_full(slot, location, new_tab, callback, user_data) \
nautilus_window_slot_open_location_full(slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, \
(new_tab ? NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB : 0), \
NULL, callback, user_data)
#define nautilus_window_slot_go_to_with_selection(slot, location, new_selection) \
nautilus_window_slot_open_location(slot, location,\
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, 0,\
new_selection)
void nautilus_window_slot_stop_loading (NautilusWindowSlot *slot);
void nautilus_window_slot_set_content_view (NautilusWindowSlot *slot,
......@@ -151,18 +166,7 @@ void nautilus_window_slot_connect_content_view (NautilusW
void nautilus_window_slot_disconnect_content_view (NautilusWindowSlot *slot,
NautilusView *view);
#define nautilus_window_slot_go_to(slot,location, new_tab) \
nautilus_window_slot_open_location_full(slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, \
(new_tab ? NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB : 0), \
NULL, NULL, NULL)
#define nautilus_window_slot_go_to_full(slot, location, new_tab, callback, user_data) \
nautilus_window_slot_open_location_full(slot, location, NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, \
(new_tab ? NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB : 0), \
NULL, callback, user_data)
#define nautilus_window_slot_go_to_with_selection(slot,location,new_selection) \
nautilus_window_slot_open_location_with_selection(slot, location, new_selection, FALSE)
void nautilus_window_slot_go_home (NautilusWindowSlot *slot,
gboolean new_tab);
......
......@@ -230,11 +230,15 @@ nautilus_window_go_to_full (NautilusWindow *window,
}
void
nautilus_window_go_to_with_selection (NautilusWindow *window, GFile *location, GList *new_selection)
nautilus_window_go_to_with_selection (NautilusWindow *window,
GFile *location,
GList *new_selection)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
nautilus_window_slot_go_to_with_selection (window->details->active_pane->active_slot, location, new_selection);
nautilus_window_slot_go_to_with_selection (window->details->active_pane->active_slot,
location,
new_selection);
}
static gboolean
......@@ -311,11 +315,10 @@ nautilus_window_go_up (NautilusWindow *window, gboolean close_behind, gboolean n
flags |= NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB;
}
nautilus_window_slot_open_location_full (slot, parent,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags,
selection,
NULL, NULL);
nautilus_window_slot_open_location (slot, parent,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags,
selection);
g_object_unref (parent);
......
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