Commit edc53100 authored by Cosimo Cecchi's avatar Cosimo Cecchi

all: remove NautilusWindowOpenMode enumeration

The mode is now always decided by the GSettings preference.
parent e94fe49e
......@@ -1792,8 +1792,7 @@ icon_container_activate_callback (NautilusIconContainer *container,
nautilus_view_activate_files (NAUTILUS_VIEW (icon_view),
file_list,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE, 0,
TRUE);
0, TRUE);
}
static void
......@@ -1842,7 +1841,6 @@ icon_container_activate_alternate_callback (NautilusIconContainer *container,
nautilus_view_activate_files (NAUTILUS_VIEW (icon_view),
file_list,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags,
TRUE);
}
......
......@@ -260,9 +260,7 @@ activate_selected_items (NautilusListView *view)
nautilus_view_activate_files (NAUTILUS_VIEW (view),
file_list,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
0,
TRUE);
0, TRUE);
nautilus_file_list_free (file_list);
}
......@@ -291,7 +289,6 @@ activate_selected_items_alternate (NautilusListView *view,
}
nautilus_view_activate_files (NAUTILUS_VIEW (view),
file_list,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags,
TRUE);
nautilus_file_list_free (file_list);
......
......@@ -77,7 +77,6 @@ typedef struct {
GList *mountables;
GList *start_mountables;
GList *not_mounted;
NautilusWindowOpenMode mode;
NautilusWindowOpenFlags flags;
char *timed_wait_prompt;
gboolean timed_wait_active;
......@@ -1064,7 +1063,6 @@ typedef struct {
GtkWindow *parent_window;
NautilusFile *file;
GList *files;
NautilusWindowOpenMode mode;
NautilusWindowOpenFlags flags;
char *activation_directory;
gboolean user_confirmation;
......@@ -1285,7 +1283,6 @@ search_for_application_dbus_call_notify_cb (GDBusProxy *proxy,
parameters_install->slot,
parameters_install->files,
parameters_install->activation_directory,
parameters_install->mode,
parameters_install->flags,
parameters_install->user_confirmation);
......@@ -1428,7 +1425,6 @@ application_unhandled_uri (ActivateParameters *parameters, char *uri)
parameters_install->activation_directory = g_strdup (parameters->activation_directory);
parameters_install->file = file;
parameters_install->files = get_file_list_for_launch_locations (parameters->locations);
parameters_install->mode = parameters->mode;
parameters_install->flags = parameters->flags;
parameters_install->user_confirmation = parameters->user_confirmation;
parameters_install->uri = g_strdup(uri);
......@@ -1755,7 +1751,7 @@ activate_files (ActivateParameters *parameters)
uri = nautilus_file_get_activation_uri (file);
f = g_file_new_for_uri (uri);
nautilus_window_slot_open_location (parameters->slot,
f, parameters->mode, flags, NULL);
f, flags, NULL);
g_object_unref (f);
g_free (uri);
}
......@@ -2270,7 +2266,6 @@ nautilus_mime_activate_files (GtkWindow *parent_window,
NautilusWindowSlot *slot,
GList *files,
const char *launch_directory,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
gboolean user_confirmation)
{
......@@ -2297,7 +2292,6 @@ nautilus_mime_activate_files (GtkWindow *parent_window,
parameters->cancellable = g_cancellable_new ();
parameters->activation_directory = g_strdup (launch_directory);
parameters->locations = launch_locations_from_file_list (files);
parameters->mode = mode;
parameters->flags = flags;
parameters->user_confirmation = user_confirmation;
......@@ -2355,7 +2349,6 @@ nautilus_mime_activate_file (GtkWindow *parent_window,
NautilusWindowSlot *slot,
NautilusFile *file,
const char *launch_directory,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags)
{
GList *files;
......@@ -2363,6 +2356,6 @@ nautilus_mime_activate_file (GtkWindow *parent_window,
g_return_if_fail (NAUTILUS_IS_FILE (file));
files = g_list_prepend (NULL, file);
nautilus_mime_activate_files (parent_window, slot, files, launch_directory, mode, flags, FALSE);
nautilus_mime_activate_files (parent_window, slot, files, launch_directory, flags, FALSE);
g_list_free (files);
}
......@@ -45,14 +45,12 @@ void nautilus_mime_activate_files (GtkWi
NautilusWindowSlot *slot,
GList *files,
const char *launch_directory,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
gboolean user_confirmation);
void nautilus_mime_activate_file (GtkWindow *parent_window,
NautilusWindowSlot *slot_info,
NautilusFile *file,
const char *launch_directory,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags);
......
......@@ -270,7 +270,6 @@ 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 (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, NULL);
g_object_unref (location);
return TRUE;
......
......@@ -1744,7 +1744,6 @@ 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 (sidebar->go_to_after_mount_slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
sidebar->go_to_after_mount_flags, NULL);
} else {
NautilusApplication *app;
......@@ -1822,7 +1821,6 @@ open_selected_bookmark (NautilusPlacesSidebar *sidebar,
if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) == 0) {
slot = nautilus_window_get_active_slot (sidebar->window);
nautilus_window_slot_open_location (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, NULL);
} else {
NautilusWindow *cur, *new;
......
......@@ -507,7 +507,6 @@ location_menu_item_activated_callback (GtkWidget *menu_item,
}
nautilus_window_slot_open_location (slot, dest,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
close_behind ? NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND : 0,
selection);
......
......@@ -372,7 +372,6 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
nautilus_window_slot_open_location
(slot,
location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
view->details->activation_flags,
NULL);
g_object_unref (location);
......@@ -399,7 +398,6 @@ got_activation_uri_callback (NautilusFile *file, gpointer callback_data)
nautilus_window_slot_open_location
(slot,
location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
view->details->activation_flags,
NULL);
g_object_unref (location);
......
......@@ -1079,7 +1079,6 @@ get_view_directory (NautilusView *view)
void
nautilus_view_activate_files (NautilusView *view,
GList *files,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
gboolean confirm_multiple)
{
......@@ -1090,7 +1089,6 @@ nautilus_view_activate_files (NautilusView *view,
view->details->slot,
files,
path,
mode,
flags,
confirm_multiple);
......@@ -1100,7 +1098,6 @@ nautilus_view_activate_files (NautilusView *view,
static void
nautilus_view_activate_file (NautilusView *view,
NautilusFile *file,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags)
{
char *path;
......@@ -1110,7 +1107,6 @@ nautilus_view_activate_file (NautilusView *view,
view->details->slot,
file,
path,
mode,
flags);
g_free (path);
......@@ -1128,7 +1124,6 @@ action_open_callback (GtkAction *action,
selection = nautilus_view_get_selection (view);
nautilus_view_activate_files (view,
selection,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
0,
TRUE);
nautilus_file_list_free (selection);
......@@ -1146,7 +1141,6 @@ action_open_close_parent_callback (GtkAction *action,
selection = nautilus_view_get_selection (view);
nautilus_view_activate_files (view,
selection,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND,
TRUE);
nautilus_file_list_free (selection);
......@@ -1189,7 +1183,6 @@ action_open_new_tab_callback (GtkAction *action,
if (nautilus_view_confirm_multiple (window, g_list_length (selection), TRUE)) {
nautilus_view_activate_files (view,
selection,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB,
FALSE);
}
......@@ -4275,7 +4268,6 @@ open_one_in_new_window (gpointer data, gpointer callback_data)
nautilus_view_activate_file (NAUTILUS_VIEW (callback_data),
NAUTILUS_FILE (data),
NAUTILUS_WINDOW_OPEN_IN_NAVIGATION,
0);
}
......@@ -4287,7 +4279,6 @@ open_one_in_folder_window (gpointer data, gpointer callback_data)
nautilus_view_activate_file (NAUTILUS_VIEW (callback_data),
NAUTILUS_FILE (data),
NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
0);
}
......@@ -6900,7 +6891,6 @@ action_location_open_alternate_callback (GtkAction *action,
nautilus_view_activate_file (view,
file,
NAUTILUS_WINDOW_OPEN_IN_NAVIGATION,
0);
}
......@@ -6920,7 +6910,6 @@ action_location_open_in_new_tab_callback (GtkAction *action,
nautilus_view_activate_file (view,
file,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB);
}
......@@ -6938,7 +6927,6 @@ action_location_open_folder_window_callback (GtkAction *action,
nautilus_view_activate_file (view,
file,
NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
0);
}
......
......@@ -319,7 +319,6 @@ gboolean nautilus_view_get_loading (NautilusView
*/
void nautilus_view_activate_files (NautilusView *view,
GList *files,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
gboolean confirm_multiple);
void nautilus_view_start_batching_selection_changes (NautilusView *view);
......
......@@ -435,25 +435,9 @@ cancel_viewed_file_changed_callback (NautilusWindowSlot *slot)
}
}
static void
new_window_show_callback (GtkWidget *widget,
gpointer user_data)
{
NautilusWindow *window;
window = NAUTILUS_WINDOW (user_data);
nautilus_window_close (window);
g_signal_handlers_disconnect_by_func (widget,
G_CALLBACK (new_window_show_callback),
user_data);
}
void
nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
GFile *location,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
GList *new_selection,
NautilusWindowGoToCallback callback,
......@@ -464,7 +448,6 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
NautilusWindowPane *pane;
NautilusWindowSlot *target_slot;
NautilusWindowOpenFlags slot_flags;
gboolean existing = FALSE;
GFile *old_location;
char *old_uri, *new_uri;
int new_slot_position;
......@@ -477,6 +460,8 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
target_window = NULL;
target_slot = NULL;
target_same = FALSE;
target_navigation = FALSE;
old_uri = nautilus_window_slot_get_location_uri (slot);
if (old_uri == NULL) {
......@@ -498,32 +483,18 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
old_location = nautilus_window_slot_get_location (slot);
switch (mode) {
case NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE :
if (g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
/* always use browser: if we're on the desktop the target is a new navigation window,
* otherwise it's the same window.
*/
if (is_desktop) {
target_navigation = TRUE;
} else {
target_same = TRUE;
}
} else if (flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW) {
/* if it's specified to open a new window, and we're not using spatial,
* the target is a navigation.
*/
if (g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER)) {
/* always use browser: if we're on the desktop the target is a new navigation window,
* otherwise it's the same window.
*/
if (is_desktop) {
target_navigation = TRUE;
} else {
target_same = TRUE;
}
break;
case NAUTILUS_WINDOW_OPEN_IN_NAVIGATION :
} else {
target_navigation = TRUE;
break;
default :
g_critical ("Unknown open location mode");
g_object_unref (old_location);
return;
}
}
app = nautilus_application_dup_singleton ();
......@@ -535,38 +506,10 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
(app,
NULL,
gtk_window_get_screen (GTK_WINDOW (window)));
} else {
target_window = nautilus_application_get_spatial_window
(app,
window,
NULL,
location,
gtk_window_get_screen (GTK_WINDOW (window)),
&existing);
}
g_object_unref (app);
/* if the spatial window is already showing, present it and set the
* new selection, if present.
*/
if (existing) {
target_slot = target_window->details->active_pane->active_slot;
gtk_window_present (GTK_WINDOW (target_window));
if (new_selection != NULL && slot->content_view != NULL) {
nautilus_view_set_selection (target_slot->content_view, new_selection);
}
/* call the callback successfully */
if (callback != NULL) {
callback (window, NULL, user_data);
}
return;
}
g_assert (target_window != NULL);
if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB) != 0 &&
......@@ -583,20 +526,6 @@ nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
target_slot = nautilus_window_open_slot (window->details->active_pane, slot_flags);
}
if ((flags & NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND) != 0) {
if (NAUTILUS_IS_SPATIAL_WINDOW (window) && !NAUTILUS_IS_DESKTOP_WINDOW (window)) {
if (gtk_widget_get_visible (GTK_WIDGET (target_window))) {
nautilus_window_close (window);
} else {
g_signal_connect_object (target_window,
"show",
G_CALLBACK (new_window_show_callback),
window,
G_CONNECT_AFTER);
}
}
}
if (target_slot == NULL) {
if (target_window == window) {
target_slot = slot;
......@@ -1975,7 +1904,6 @@ nautilus_navigation_window_back_or_forward (NautilusNavigationWindow *window,
if (new_tab) {
nautilus_window_slot_open_location_full (slot, location,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB,
NULL, NULL, NULL);
} else {
......
......@@ -543,7 +543,6 @@ nautilus_window_slot_go_home (NautilusWindowSlot *slot,
home = g_file_new_for_path (g_get_home_dir ());
nautilus_window_slot_open_location_full (slot, home,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags, NULL, NULL, NULL);
g_object_unref (home);
}
......@@ -578,7 +577,6 @@ nautilus_window_slot_go_up (NautilusWindowSlot *slot,
}
nautilus_window_slot_open_location (slot, parent,
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
flags,
selection);
......
......@@ -128,23 +128,22 @@ void nautilus_window_slot_reload (NautilusWindowSlot *slot);
void nautilus_window_slot_open_location_full (NautilusWindowSlot *slot,
GFile *location,
NautilusWindowOpenMode mode,
NautilusWindowOpenFlags flags,
GList *new_selection, /* NautilusFile list */
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)
#define nautilus_window_slot_open_location(slot, location, flags, new_selection)\
nautilus_window_slot_open_location_full(slot, location, 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, \
nautilus_window_slot_open_location(slot, location, \
(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, \
nautilus_window_slot_open_location_full(slot, location, \
(new_tab ? NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB : 0), \
NULL, callback, user_data)
......
......@@ -40,12 +40,6 @@ typedef void (* NautilusWindowGoToCallback) (NautilusWindow *window,
GError *error,
gpointer user_data);
typedef enum {
NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
NAUTILUS_WINDOW_OPEN_IN_NAVIGATION
} NautilusWindowOpenMode;
typedef enum {
/* used in spatial mode */
NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND = 1<<0,
......
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