gcmd-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gcmd-dev] FTP transfer patch - showing amount of bytes instead percenta


From: Kamil Madac
Subject: [gcmd-dev] FTP transfer patch - showing amount of bytes instead percentage
Date: Tue, 19 Jun 2007 15:03:17 +0200

Hello there

When I copied big file (6gb) from FTP I had a problem  that
gnome-commander displayed in progress window only percentage value of
currently copied bytes, and it lasts very long unless the activity of
transferring was visible. So I made a short patch that shows in
progress window info about how many bytes (Kb, Mb, Gb, ...) was
currently transferred.

This patch is for stable version 1.2.4

--- ./gnome-commander-1.2.4-orig/src/gnome-cmd-xfer-progress-win.cc     
2007-03-12
00:54:42.000000000 +0100
+++ ./gnome-commander-1.2.4/src/gnome-cmd-xfer-progress-win.cc  2007-06-17
21:20:35.000000000 +0200
@@ -155,6 +155,8 @@
{
    gchar text[128];
    const gchar *total_str;
+    gchar *total_str_copy;
+    const gchar *bytes_copied_str;
    gfloat prog = -1.0f;
    gint prog_percent = -1;

@@ -167,14 +169,18 @@
    gtk_progress_set_percentage (GTK_PROGRESS (win->totalprog), prog);

    total_str = size2string(bytes_total, gnome_cmd_data_get_size_disp_mode());
-
-    g_snprintf (text, sizeof (text), _("%d%% of %s copied"),
-                prog_percent, total_str);
+    total_str_copy = g_strdup(total_str);
+    bytes_copied_str = size2string(bytes_copied,
gnome_cmd_data_get_size_disp_mode());
+
+    g_snprintf (text, sizeof (text), _("%s of %s copied"),
+                bytes_copied_str, total_str_copy);

    gtk_label_set_text (GTK_LABEL (win->fileprog_label), text);

    g_snprintf (text, sizeof (text), _("%d%% copied"), prog_percent);
    gtk_window_set_title (GTK_WINDOW (win), text);
+
+    g_free(total_str_copy);
}

Kamil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]