[file-roller] do not ask to open the destination when extracting with DnD
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [file-roller] do not ask to open the destination when extracting with DnD
- Date: Sun, 20 Dec 2015 17:53:27 +0000 (UTC)
commit 1f5927a6cef2f8f6dc0c618d89dbe973f9ce190b
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sun Dec 20 18:52:34 2015 +0100
do not ask to open the destination when extracting with DnD
src/dlg-extract.c | 32 ++++---------------
src/fr-application.c | 8 ++--
src/fr-window.c | 80 ++++++++++++++++++++++++++++++++++++++++++-------
src/fr-window.h | 21 +++++-------
4 files changed, 88 insertions(+), 53 deletions(-)
---
diff --git a/src/dlg-extract.c b/src/dlg-extract.c
index d73d07c..4457c1e 100644
--- a/src/dlg-extract.c
+++ b/src/dlg-extract.c
@@ -220,31 +220,13 @@ extract_cb (GtkWidget *w,
/* extract ! */
- if (fr_window_batch_get_current_action_type (window) == FR_BATCH_ACTION_EXTRACT_ASK_OPTIONS) {
-
- /* no need to ask the user the extract options again if the
- * action is re-executed (for example when asking the password) */
-
- fr_window_batch_replace_current_action (window,
- FR_BATCH_ACTION_EXTRACT,
- extract_data_new (window,
- file_list,
- destination,
- base_dir,
- skip_newer,
- FR_OVERWRITE_ASK,
- junk_paths),
- (GFreeFunc) extract_data_free);
- fr_window_batch_resume (window);
- }
- else
- fr_window_archive_extract (window,
- file_list,
- destination,
- base_dir,
- skip_newer,
- FR_OVERWRITE_ASK,
- junk_paths);
+ fr_window_extract_archive_and_continue (window,
+ file_list,
+ destination,
+ base_dir,
+ skip_newer,
+ FR_OVERWRITE_ASK,
+ junk_paths);
_g_string_list_free (file_list);
g_object_unref (destination);
diff --git a/src/fr-application.c b/src/fr-application.c
index 85814a4..f3eb069 100644
--- a/src/fr-application.c
+++ b/src/fr-application.c
@@ -564,6 +564,8 @@ fr_application_command_line (GApplication *application,
if (default_directory != NULL)
fr_window_set_default_dir (FR_WINDOW (window), default_directory, TRUE);
+ fr_window_set_notify (FR_WINDOW (window), arg_notify);
+
file_list = NULL;
while ((filename = remaining_args[i++]) != NULL)
file_list = g_list_prepend (file_list, g_application_command_line_create_file_for_arg
(command_line, filename));
@@ -573,8 +575,6 @@ fr_application_command_line (GApplication *application,
fr_window_batch__add_files (FR_WINDOW (window), add_to_archive, file_list);
if (! arg_notify)
fr_window_batch_append_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
- else
- fr_window_set_notify (FR_WINDOW (window), TRUE);
fr_window_batch_start (FR_WINDOW (window));
_g_object_list_unref (file_list);
@@ -592,6 +592,8 @@ fr_application_command_line (GApplication *application,
if (default_directory != NULL)
fr_window_set_default_dir (FR_WINDOW (window), default_directory, TRUE);
+ fr_window_set_notify (FR_WINDOW (window), arg_notify);
+
fr_window_batch_new (FR_WINDOW (window), _("Extract archive"));
while ((archive = remaining_args[i++]) != NULL) {
GFile *file;
@@ -606,8 +608,6 @@ fr_application_command_line (GApplication *application,
}
if (! arg_notify)
fr_window_batch_append_action (FR_WINDOW (window), FR_BATCH_ACTION_QUIT, NULL, NULL);
- else
- fr_window_set_notify (FR_WINDOW (window), TRUE);
fr_window_batch_start (FR_WINDOW (window));
}
else { /* Open each archive in a window */
diff --git a/src/fr-window.c b/src/fr-window.c
index ab57811..51270a9 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -114,7 +114,7 @@ typedef struct {
} FrBatchAction;
-struct _ExtractData {
+typedef struct {
FrWindow *window;
GList *file_list;
GFile *destination;
@@ -123,7 +123,8 @@ struct _ExtractData {
FrOverwrite overwrite;
gboolean junk_paths;
char *password;
-};
+ gboolean ask_to_open_destination;
+} ExtractData;
typedef enum {
@@ -4050,6 +4051,13 @@ fr_window_create_archive_and_continue (FrWindow *window,
}
+static gboolean
+_fr_window_get_ask_to_open_destination (FrWindow *window)
+{
+ return ! window->priv->batch_mode || window->priv->notify;
+}
+
+
static void
new_archive_dialog_response_cb (GtkDialog *dialog,
int response,
@@ -4506,6 +4514,7 @@ wait_dnd_extraction (FrWindow *window)
window->priv->drag_base_dir,
FALSE,
FR_OVERWRITE_ASK,
+ FALSE,
FALSE);
DndWaitInfo wait_info = { NULL, NULL };
@@ -6405,14 +6414,15 @@ fr_window_archive_remove (FrWindow *window,
/* -- fr_window_archive_extract -- */
-ExtractData *
+static ExtractData *
extract_data_new (FrWindow *window,
GList *file_list,
GFile *destination,
const char *base_dir,
gboolean skip_older,
FrOverwrite overwrite,
- gboolean junk_paths)
+ gboolean junk_paths,
+ gboolean ask_to_open_destination)
{
ExtractData *edata;
@@ -6425,12 +6435,13 @@ extract_data_new (FrWindow *window,
edata->junk_paths = junk_paths;
if (base_dir != NULL)
edata->base_dir = g_strdup (base_dir);
+ edata->ask_to_open_destination = ask_to_open_destination;
return edata;
}
-void
+static void
extract_data_free (ExtractData *edata)
{
g_return_if_fail (edata != NULL);
@@ -6468,7 +6479,7 @@ archive_extraction_ready_cb (GObject *source_object,
GError *error = NULL;
batch_mode = window->priv->batch_mode;
- ask_to_open_destination = ! batch_mode || window->priv->notify;
+ ask_to_open_destination = edata->ask_to_open_destination;
g_object_ref (window);
_g_clear_object (&window->priv->last_extraction_destination);
@@ -6804,7 +6815,8 @@ fr_window_archive_extract (FrWindow *window,
const char *base_dir,
gboolean skip_older,
FrOverwrite overwrite,
- gboolean junk_paths)
+ gboolean junk_paths,
+ gboolean ask_to_open_destination)
{
ExtractData *edata;
gboolean do_not_extract = FALSE;
@@ -6816,7 +6828,8 @@ fr_window_archive_extract (FrWindow *window,
base_dir,
skip_older,
overwrite,
- junk_paths);
+ junk_paths,
+ ask_to_open_destination);
fr_window_set_current_action (window,
FR_BATCH_ACTION_EXTRACT,
@@ -6937,7 +6950,8 @@ fr_window_archive_extract_here (FrWindow *window,
NULL,
skip_older,
overwrite,
- junk_paths);
+ junk_paths,
+ _fr_window_get_ask_to_open_destination (window));
g_object_unref (destination);
}
@@ -9357,7 +9371,8 @@ fr_window_exec_batch_action (FrWindow *window,
edata->base_dir,
edata->skip_older,
edata->overwrite,
- edata->junk_paths);
+ edata->junk_paths,
+ edata->ask_to_open_destination);
break;
case FR_BATCH_ACTION_EXTRACT_HERE:
@@ -9689,7 +9704,8 @@ fr_window_batch__extract_here (FrWindow *window,
NULL,
FALSE,
FR_OVERWRITE_ASK,
- FALSE),
+ FALSE,
+ _fr_window_get_ask_to_open_destination (window)),
(GFreeFunc) extract_data_free);
fr_window_batch_append_action (window,
FR_BATCH_ACTION_CLOSE,
@@ -9719,7 +9735,8 @@ fr_window_batch__extract (FrWindow *window,
NULL,
FALSE,
FR_OVERWRITE_ASK,
- FALSE),
+ FALSE,
+ _fr_window_get_ask_to_open_destination
(window)),
(GFreeFunc) extract_data_free);
else
fr_window_batch_append_action (window,
@@ -9770,3 +9787,42 @@ fr_window_dnd_extraction_finished (FrWindow *window,
window->priv->dnd_extract_finished_with_error = TRUE;
}
}
+
+
+void
+fr_window_extract_archive_and_continue (FrWindow *window,
+ GList *file_list,
+ GFile *destination,
+ const char *base_dir,
+ gboolean skip_older,
+ FrOverwrite overwrite,
+ gboolean junk_paths)
+{
+ if (fr_window_batch_get_current_action_type (window) == FR_BATCH_ACTION_EXTRACT_ASK_OPTIONS) {
+
+ /* no need to ask the user the extract options again if the
+ * action is re-executed (for example when asking the password) */
+
+ fr_window_batch_replace_current_action (window,
+ FR_BATCH_ACTION_EXTRACT,
+ extract_data_new (window,
+ file_list,
+ destination,
+ base_dir,
+ skip_older,
+ FR_OVERWRITE_ASK,
+ junk_paths,
+
_fr_window_get_ask_to_open_destination (window)),
+ (GFreeFunc) extract_data_free);
+ fr_window_batch_resume (window);
+ }
+ else
+ fr_window_archive_extract (window,
+ file_list,
+ destination,
+ base_dir,
+ skip_older,
+ FR_OVERWRITE_ASK,
+ junk_paths,
+ _fr_window_get_ask_to_open_destination (window));
+}
diff --git a/src/fr-window.h b/src/fr-window.h
index 5f4d2f3..4ea0f4e 100644
--- a/src/fr-window.h
+++ b/src/fr-window.h
@@ -148,7 +148,8 @@ void fr_window_archive_extract (FrWindow *window,
const char *base_dir,
gboolean skip_older,
FrOverwrite overwrite,
- gboolean junk_paths);
+ gboolean junk_paths,
+ gboolean ask_to_open_destination);
void fr_window_archive_extract_here (FrWindow *window,
gboolean skip_older,
gboolean overwrite,
@@ -272,17 +273,6 @@ void fr_window_use_progress_dialog (FrWindow *window,
/* batch mode procedures. */
-typedef struct _ExtractData ExtractData;
-
-ExtractData * extract_data_new (FrWindow *window,
- GList *file_list,
- GFile *destination,
- const char *base_dir,
- gboolean skip_older,
- FrOverwrite overwrite,
- gboolean junk_paths);
-void extract_data_free (ExtractData *edata);
-
void fr_window_set_current_action (FrWindow *window,
FrBatchActionType
action,
@@ -335,5 +325,12 @@ gboolean fr_window_file_list_drag_data_get (FrWindow *window
void fr_window_update_dialog_closed (FrWindow *window);
void fr_window_dnd_extraction_finished (FrWindow *window,
gboolean error);
+void fr_window_extract_archive_and_continue (FrWindow *window,
+ GList *file_list,
+ GFile *destination,
+ const char *base_dir,
+ gboolean skip_older,
+ FrOverwrite overwrite,
+ gboolean junk_paths);
#endif /* FR_WINDOW_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]