[gparted/psusi/refactor] fixup! Thread the internal copy algorithm (#685740)



commit 6a8d4fd8036a41647f735cee8b394a920f9c3b6e
Author: Phillip Susi <psusi ubuntu com>
Date:   Sat Mar 2 21:14:00 2013 -0500

    fixup! Thread the internal copy algorithm (#685740)
    
    Make sure final update is performed, and put at the right place in the tree

 src/Copy_Blocks.cc |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/Copy_Blocks.cc b/src/Copy_Blocks.cc
index dbecddc..e2005b1 100644
--- a/src/Copy_Blocks.cc
+++ b/src/Copy_Blocks.cc
@@ -84,10 +84,10 @@ bool copy_blocks::set_progress_info()
        if (done == length || !success)
        {
                //reset fraction to -1 to make room for a new one (or a pulsebar)
-               operationdetail.get_last_child().get_last_child().fraction = -1;
+               operationdetail.fraction = -1;
 
                //final description
-               operationdetail.get_last_child().get_last_child().set_description(
+               operationdetail.set_description(
                        String::ucompose( readonly ?
                                          /*TO TRANSLATORS: looks like  1.00 MiB of 16.00 MiB read */
                                          _("%1 of %2 read") :
@@ -104,8 +104,10 @@ bool copy_blocks::set_progress_info()
        return false;
 }
 
-static bool mainquit(void *dummy)
+static bool mainquit(copy_blocks *cb)
 {
+       while ( Gtk::Main::events_pending() )
+               Gtk::Main::iteration();
        Gtk::Main::quit();
        return false;
 }
@@ -167,7 +169,10 @@ void copy_blocks::copy_thread()
        }
 
        //set progress bar current info on completion
-       g_idle_add( (GSourceFunc)mainquit, NULL );
+       Glib::signal_idle().connect( sigc::mem_fun(
+                                            *this,
+                                            &copy_blocks::set_progress_info) );
+       g_idle_add( (GSourceFunc)mainquit, this );
 }
 
 bool copy_blocks::copy()


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