[pan2/download-meter: 2/3] 2nd draft



commit 0d0073015d9c4760e84eb9f00c05f01118f4af7b
Author: Heinrich MÃller <henmull src gnome org>
Date:   Sun Sep 23 19:45:48 2012 +0200

    2nd draft

 pan/gui/download-meter.cc |    9 ++++++++-
 pan/gui/gui.cc            |   11 ++++++++---
 pan/gui/gui.h             |    1 +
 3 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/pan/gui/download-meter.cc b/pan/gui/download-meter.cc
index 2791a0a..53cdce8 100644
--- a/pan/gui/download-meter.cc
+++ b/pan/gui/download-meter.cc
@@ -23,7 +23,12 @@
 
 using namespace pan;
 
-DownloadMeter :: DownloadMeter () : _val(0ul) {}
+DownloadMeter :: DownloadMeter () : _val(0ul), _view(new ProgressView()), _progress(new Progress("Downloaded bytes"))
+{
+  _view->set_progress(_progress);
+  _progress->add_steps (1000);
+  _progress->set_status_va("Downloaded bytes (%lu)", 0);
+}
 
 void
 DownloadMeter :: add (unsigned long bytes)
@@ -32,6 +37,8 @@ DownloadMeter :: add (unsigned long bytes)
   {
     _val += bytes;
     fire_xfer_bytes(bytes);
+    _progress->increment_step(bytes);
+    _progress->set_status_va("Downloaded bytes (%lu)", _val);
   }
 
 }
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 8ca6acb..efb283a 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -296,6 +296,11 @@ GUI :: GUI (Data& data, Queue& queue, Prefs& prefs, GroupPrefs& group_prefs, Dow
   gtk_container_add (GTK_CONTAINER(frame), w);
   gtk_box_pack_start (GTK_BOX(status_bar), frame, FALSE, FALSE, 0);
 
+  // download meter
+  w = _meter.get_view()->root();
+  gtk_box_pack_start (GTK_BOX(status_bar), w, false, true, 0);
+  gtk_widget_set_size_request (w, 250, -1);
+
   // queue
   w = _queue_size_label = gtk_label_new (NULL);
   gtk_misc_set_padding (GTK_MISC(w), PAD, 0);
@@ -305,9 +310,9 @@ GUI :: GUI (Data& data, Queue& queue, Prefs& prefs, GroupPrefs& group_prefs, Dow
   g_signal_connect (w, "clicked", G_CALLBACK(show_task_window_cb), this);
 
   // drag and drop for message-ids
-//  gtk_drag_dest_set(_workarea_bin,GTK_DEST_DEFAULT_ALL,target_list,3,GDK_ACTION_COPY);
-//  gtk_drag_dest_add_text_targets(_workarea_bin);
-//  gtk_drag_dest_add_uri_targets(_workarea_bin);
+  //  gtk_drag_dest_set(_workarea_bin,GTK_DEST_DEFAULT_ALL,target_list,3,GDK_ACTION_COPY);
+  //  gtk_drag_dest_add_text_targets(_workarea_bin);
+  //  gtk_drag_dest_add_uri_targets(_workarea_bin);
 
   gtk_container_add (GTK_CONTAINER(w), _queue_size_label);
   frame = gtk_frame_new (NULL);
diff --git a/pan/gui/gui.h b/pan/gui/gui.h
index aab8a46..fcc74b2 100644
--- a/pan/gui/gui.h
+++ b/pan/gui/gui.h
@@ -265,6 +265,7 @@ namespace pan
       GtkWidget * _event_log_button;
       GtkWidget * _taskbar;
       std::vector<ProgressView*> _views;
+      ProgressView* _meter_view;
       std::list<Task*> _active_tasks;
       std::string _charset;
 



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