[nautilus/wip/gaction: 14/23] nautilus-view: dont allow opening multiple files
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/gaction: 14/23] nautilus-view: dont allow opening multiple files
- Date: Mon, 12 Jan 2015 17:01:28 +0000 (UTC)
commit acec08ca8bd4e8fa95198246ffa9e394a8facf60
Author: Carlos Soriano <carlos sorian89 gmail com>
Date: Mon Jan 5 13:59:57 2015 +0100
nautilus-view: dont allow opening multiple files
Opening multiple files at once can cause confusion and user errors, like
opening multiple applications at once.
This action is confusing as it is, and probably is better to force the
user to open each item, or either open the application the user wants to
open and manage from there opening multiple files for that application.
src/nautilus-canvas-view.c | 5 +--
src/nautilus-list-view.c | 5 +--
src/nautilus-view.c | 85 +++++++++-----------------------------------
src/nautilus-view.h | 3 +-
4 files changed, 22 insertions(+), 76 deletions(-)
---
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index 9907914..7999140 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -1299,7 +1299,7 @@ canvas_container_activate_callback (NautilusCanvasContainer *container,
nautilus_view_activate_files (NAUTILUS_VIEW (canvas_view),
file_list,
- 0, TRUE);
+ 0);
}
static void
@@ -1378,8 +1378,7 @@ canvas_container_activate_alternate_callback (NautilusCanvasContainer *container
nautilus_view_activate_files (NAUTILUS_VIEW (canvas_view),
file_list,
- flags,
- TRUE);
+ flags);
}
static void
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 7d4f180..b52ffcc 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -276,7 +276,7 @@ activate_selected_items (NautilusListView *view)
nautilus_view_activate_files (NAUTILUS_VIEW (view),
file_list,
- 0, TRUE);
+ 0);
nautilus_file_list_free (file_list);
}
@@ -305,8 +305,7 @@ activate_selected_items_alternate (NautilusListView *view,
}
nautilus_view_activate_files (NAUTILUS_VIEW (view),
file_list,
- flags,
- TRUE);
+ flags);
nautilus_file_list_free (file_list);
}
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index bf3b5e1..5bf3229 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -281,8 +281,6 @@ static void nautilus_view_set_show_hidden_files (NautilusView
gboolean show_hidden);
static void clipboard_changed_callback (NautilusClipboardMonitor *monitor,
NautilusView *view);
-static void open_one_in_new_window (gpointer data,
- gpointer callback_data);
static void schedule_update_menus (NautilusView *view);
static void remove_update_menus_timeout_callback (NautilusView *view);
static void schedule_update_status (NautilusView *view);
@@ -881,39 +879,6 @@ nautilus_view_get_containing_window (NautilusView *view)
}
static gboolean
-nautilus_view_confirm_multiple (GtkWindow *parent_window,
- int count,
- gboolean tabs)
-{
- GtkDialog *dialog;
- char *prompt;
- char *detail;
- int response;
-
- if (count <= SILENT_WINDOW_OPEN_LIMIT) {
- return TRUE;
- }
-
- prompt = _("Are you sure you want to open all files?");
- if (tabs) {
- detail = g_strdup_printf (ngettext("This will open %'d separate tab.",
- "This will open %'d separate tabs.", count), count);
- } else {
- detail = g_strdup_printf (ngettext("This will open %'d separate window.",
- "This will open %'d separate windows.", count), count);
- }
- dialog = eel_show_yes_no_dialog (prompt, detail,
- _("_OK"), _("_Cancel"),
- parent_window);
- g_free (detail);
-
- response = gtk_dialog_run (dialog);
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
- return response == GTK_RESPONSE_YES;
-}
-
-static gboolean
selection_contains_one_item_in_menu_callback (NautilusView *view, GList *selection)
{
if (g_list_length (selection) == 1) {
@@ -979,26 +944,31 @@ nautilus_view_activate_selection (NautilusView *view)
selection = nautilus_view_get_selection (view);
nautilus_view_activate_files (view,
selection,
- 0,
- TRUE);
+ 0);
nautilus_file_list_free (selection);
}
void
nautilus_view_activate_files (NautilusView *view,
GList *files,
- NautilusWindowOpenFlags flags,
- gboolean confirm_multiple)
+ NautilusWindowOpenFlags flags)
{
char *path;
+ /* Opening more than one file could cause problems to the user
+ * or unwanted behaviour, also confusing. So only allow to open
+ * one file per time
+ */
+ if (g_list_length (files) != 1)
+ return;
+
path = get_view_directory (view);
nautilus_mime_activate_files (nautilus_view_get_containing_window (view),
view->details->slot,
files,
path,
flags,
- confirm_multiple);
+ FALSE);
g_free (path);
}
@@ -1042,8 +1012,7 @@ action_open_close_parent_callback (GtkAction *action,
selection = nautilus_view_get_selection (view);
nautilus_view_activate_files (view,
selection,
- NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND,
- TRUE);
+ NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND);
nautilus_file_list_free (selection);
}
@@ -1084,16 +1053,13 @@ action_open_alternate_callback (GtkAction *action,
{
NautilusView *view;
GList *selection;
- GtkWindow *window;
view = NAUTILUS_VIEW (callback_data);
selection = nautilus_view_get_selection (view);
- window = nautilus_view_get_containing_window (view);
-
- if (nautilus_view_confirm_multiple (window, g_list_length (selection), FALSE)) {
- g_list_foreach (selection, open_one_in_new_window, view);
- }
+ nautilus_view_activate_files (view,
+ selection,
+ NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB);
nautilus_file_list_free (selection);
}
@@ -1104,19 +1070,13 @@ action_open_new_tab_callback (GtkAction *action,
{
NautilusView *view;
GList *selection;
- GtkWindow *window;
view = NAUTILUS_VIEW (callback_data);
selection = nautilus_view_get_selection (view);
- window = nautilus_view_get_containing_window (view);
-
- if (nautilus_view_confirm_multiple (window, g_list_length (selection), TRUE)) {
- nautilus_view_activate_files (view,
- selection,
- NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB,
- FALSE);
- }
+ nautilus_view_activate_files (view,
+ selection,
+ NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB);
nautilus_file_list_free (selection);
}
@@ -4029,17 +3989,6 @@ update_context_menu_position_from_event (NautilusView *view,
/* handle the open command */
-static void
-open_one_in_new_window (gpointer data, gpointer callback_data)
-{
- g_assert (NAUTILUS_IS_FILE (data));
- g_assert (NAUTILUS_IS_VIEW (callback_data));
-
- nautilus_view_activate_file (NAUTILUS_VIEW (callback_data),
- NAUTILUS_FILE (data),
- NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW);
-}
-
NautilusFile *
nautilus_view_get_directory_as_file (NautilusView *view)
{
diff --git a/src/nautilus-view.h b/src/nautilus-view.h
index 170e7f1..0368a8a 100644
--- a/src/nautilus-view.h
+++ b/src/nautilus-view.h
@@ -313,8 +313,7 @@ gboolean nautilus_view_get_loading (NautilusView
*/
void nautilus_view_activate_files (NautilusView *view,
GList *files,
- NautilusWindowOpenFlags flags,
- gboolean confirm_multiple);
+ NautilusWindowOpenFlags flags);
void nautilus_view_preview_files (NautilusView *view,
GList *files,
GArray *locations);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]