summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fr-command-7z.c16
-rw-r--r--src/fr-command-rar.c33
-rw-r--r--src/fr-command-tar.c10
-rw-r--r--src/fr-command-zip.c4
-rw-r--r--src/fr-window.c29
5 files changed, 37 insertions, 55 deletions
diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c
index 29af8cf..a5607f5 100644
--- a/src/fr-command-7z.c
+++ b/src/fr-command-7z.c
@@ -254,10 +254,6 @@ fr_command_7z_list (FrCommand *comm)
}
-static char Progress_Message[4196];
-static char Progress_Filename[4096];
-
-
static void
parse_progress_line (FrCommand *comm,
const char *prefix,
@@ -267,16 +263,8 @@ parse_progress_line (FrCommand *comm,
int prefix_len;
prefix_len = strlen (prefix);
- if (strncmp (line, prefix, prefix_len) == 0) {
- double fraction;
-
- strcpy (Progress_Filename, line + prefix_len);
- sprintf (Progress_Message, "%s%s", message_prefix, file_name_from_path (Progress_Filename));
- fr_command_message (comm, Progress_Message);
-
- fraction = (double) ++comm->n_file / (comm->n_files + 1);
- fr_command_progress (comm, fraction);
- }
+ if (strncmp (line, prefix, prefix_len) == 0)
+ fr_command_progress (comm, (double) ++comm->n_file / (comm->n_files + 1));
}
diff --git a/src/fr-command-rar.c b/src/fr-command-rar.c
index bc84229..a2236b1 100644
--- a/src/fr-command-rar.c
+++ b/src/fr-command-rar.c
@@ -349,43 +349,14 @@ fr_command_rar_list (FrCommand *comm)
}
-static char Progress_Message[4196];
-static char Progress_Filename[4096];
-
-
static void
parse_progress_line (FrCommand *comm,
const char *prefix,
const char *message_prefix,
const char *line)
{
- int prefix_len;
-
- prefix_len = strlen (prefix);
- if (strncmp (line, prefix, prefix_len) == 0) {
- double fraction;
- int len;
- char *b_idx;
-
- strcpy (Progress_Filename, line + prefix_len);
-
- /* when a new volume is created a sequence of backspaces is
- * issued, remove the backspaces from the filename */
- b_idx = strchr (Progress_Filename, '\x08');
- if (b_idx != NULL)
- *b_idx = 0;
-
- /* remove the OK at the end of the filename */
- len = strlen (Progress_Filename);
- if ((len > 5) && (strncmp (Progress_Filename + len - 5, " OK ", 5) == 0))
- Progress_Filename[len - 5] = 0;
-
- sprintf (Progress_Message, "%s%s", message_prefix, file_name_from_path (Progress_Filename));
- fr_command_message (comm, Progress_Message);
-
- fraction = (double) ++comm->n_file / (comm->n_files + 1);
- fr_command_progress (comm, fraction);
- }
+ if (strncmp (line, prefix, strlen (prefix)) == 0)
+ fr_command_progress (comm, (double) ++comm->n_file / (comm->n_files + 1));
}
diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
index 7b7ef02..62818a9 100644
--- a/src/fr-command-tar.c
+++ b/src/fr-command-tar.c
@@ -283,7 +283,6 @@ process_line__generic (char *line,
char *action_msg)
{
FrCommand *comm = FR_COMMAND (data);
- char *msg;
if (line == NULL)
return;
@@ -291,14 +290,15 @@ process_line__generic (char *line,
if (line[strlen (line) - 1] == '/') /* ignore directories */
return;
- msg = g_strconcat (action_msg, file_name_from_path (line), NULL);
- fr_command_message (comm, msg);
- g_free (msg);
-
if (comm->n_files != 0) {
double fraction = (double) ++comm->n_file / (comm->n_files + 1);
fr_command_progress (comm, fraction);
}
+ else {
+ char *msg = g_strconcat (action_msg, file_name_from_path (line), NULL);
+ fr_command_message (comm, msg);
+ g_free (msg);
+ }
}
diff --git a/src/fr-command-zip.c b/src/fr-command-zip.c
index 2a5d42e..748af19 100644
--- a/src/fr-command-zip.c
+++ b/src/fr-command-zip.c
@@ -206,12 +206,12 @@ process_line__common (char *line,
if (line == NULL)
return;
- fr_command_message (comm, line);
-
if (comm->n_files != 0) {
double fraction = (double) ++comm->n_file / (comm->n_files + 1);
fr_command_progress (comm, fraction);
}
+ else
+ fr_command_message (comm, line);
}
diff --git a/src/fr-window.c b/src/fr-window.c
index 7f2dddf..7e2c6a7 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -2671,9 +2671,9 @@ open_progress_dialog (FrWindow *window,
static gboolean
-fr_window_progress_cb (FrCommand *command,
- double fraction,
- FrWindow *window)
+fr_window_progress_cb (FrArchive *archive,
+ double fraction,
+ FrWindow *window)
{
window->priv->progress_pulse = (fraction < 0.0);
if (! window->priv->progress_pulse) {
@@ -2681,6 +2681,29 @@ fr_window_progress_cb (FrCommand *command,
if (window->priv->progress_dialog != NULL)
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->pd_progress_bar), fraction);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (window->priv->progress_bar), fraction);
+
+ if ((archive != NULL) && (archive->command->n_files > 0)) {
+ char *message = NULL;
+ int remaining_files;
+
+ remaining_files = archive->command->n_files - archive->command->n_file + 1;
+
+ switch (window->priv->action) {
+ case FR_ACTION_ADDING_FILES:
+ case FR_ACTION_EXTRACTING_FILES:
+ case FR_ACTION_DELETING_FILES:
+ message = g_strdup_printf (ngettext (_("%d file remaining"),
+ _("%'d files remaining"),
+ remaining_files), remaining_files);
+ break;
+ default:
+ break;
+ }
+
+ if (message != NULL)
+ fr_command_message (archive->command, message);
+ }
+
#ifdef LOG_PROGRESS
g_print ("progress > %2.2f\n", fraction);
#endif