[nautilus] files-view: Stop using gtk_dialog_run()
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] files-view: Stop using gtk_dialog_run()
- Date: Tue, 28 Dec 2021 23:48:37 +0000 (UTC)
commit 18de1a7d040c1112ae62e2cea64a4386caae4b97
Author: António Fernandes <antoniof gnome org>
Date: Tue Dec 28 23:28:28 2021 +0000
files-view: Stop using gtk_dialog_run()
We use it to confirm activation of multiple windows.
But the mime-actions.c code already handles that better.
So, rely on the mime-actions code for this confirmation and drop our
blocking dialog code.
Closes https://gitlab.gnome.org/GNOME/nautilus/-/issues/1992
src/nautilus-files-view.c | 77 ++++++-----------------------------------------
1 file changed, 9 insertions(+), 68 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 375139636..3f16c95d1 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -323,8 +323,6 @@ static void load_directory (NautilusFilesView *view,
static void on_clipboard_owner_changed (GtkClipboard *clipboard,
GdkEvent *event,
gpointer user_data);
-static void open_one_in_new_window (gpointer data,
- gpointer callback_data);
static void schedule_update_context_menus (NautilusFilesView *view);
static void remove_update_context_menus_timeout_callback (NautilusFilesView *view);
static void schedule_update_status (NautilusFilesView *view);
@@ -1173,43 +1171,6 @@ nautilus_files_view_get_containing_window (NautilusFilesView *view)
return GTK_WINDOW (window);
}
-static gboolean
-nautilus_files_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 char *
get_view_directory (NautilusFilesView *view)
{
@@ -1462,21 +1423,15 @@ action_open_item_new_tab (GSimpleAction *action,
{
NautilusFilesView *view;
g_autolist (NautilusFile) selection = NULL;
- GtkWindow *window;
view = NAUTILUS_FILES_VIEW (user_data);
selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
- window = nautilus_files_view_get_containing_window (view);
-
- if (nautilus_files_view_confirm_multiple (window, g_list_length (selection), TRUE))
- {
- nautilus_files_view_activate_files (view,
- selection,
- NAUTILUS_OPEN_FLAG_NEW_TAB |
- NAUTILUS_OPEN_FLAG_DONT_MAKE_ACTIVE,
- FALSE);
- }
+ nautilus_files_view_activate_files (view,
+ selection,
+ NAUTILUS_OPEN_FLAG_NEW_TAB |
+ NAUTILUS_OPEN_FLAG_DONT_MAKE_ACTIVE,
+ TRUE);
}
static void
@@ -2635,17 +2590,15 @@ action_open_item_new_window (GSimpleAction *action,
gpointer user_data)
{
NautilusFilesView *view;
- GtkWindow *window;
GList *selection;
view = NAUTILUS_FILES_VIEW (user_data);
selection = nautilus_view_get_selection (NAUTILUS_VIEW (view));
- window = GTK_WINDOW (nautilus_files_view_get_containing_window (view));
- if (nautilus_files_view_confirm_multiple (window, g_list_length (selection), TRUE))
- {
- g_list_foreach (selection, open_one_in_new_window, view);
- }
+ nautilus_files_view_activate_files (view,
+ selection,
+ NAUTILUS_OPEN_FLAG_NEW_WINDOW,
+ TRUE);
nautilus_file_list_free (selection);
}
@@ -4891,18 +4844,6 @@ trash_or_delete_files (GtkWindow *parent_window,
g_list_free_full (locations, g_object_unref);
}
-static void
-open_one_in_new_window (gpointer data,
- gpointer callback_data)
-{
- g_assert (NAUTILUS_IS_FILE (data));
- g_assert (NAUTILUS_IS_FILES_VIEW (callback_data));
-
- nautilus_files_view_activate_file (NAUTILUS_FILES_VIEW (callback_data),
- NAUTILUS_FILE (data),
- NAUTILUS_OPEN_FLAG_NEW_WINDOW);
-}
-
NautilusFile *
nautilus_files_view_get_directory_as_file (NautilusFilesView *view)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]