The following commit has been merged in the master branch:
commit 9e2ecd108f993b78daefd9977396255cf96ec6da
Author: Andrei Zavada <johnhom...@gmail.com>
Date:   Sat Dec 15 21:15:46 2012 +0200

    flush gtk both ways, depending on caller
    
    This is gdk_window_process_all_updates() vs
    while ( gtk_events_pending() )      gtk_main_iteration(); episode 34658.

diff --git a/src/ui/mw/mw-splash.cc b/src/ui/mw/mw-splash.cc
index 47f924c..01a38ef 100644
--- a/src/ui/mw/mw-splash.cc
+++ b/src/ui/mw/mw-splash.cc
@@ -46,7 +46,8 @@ download_process_child_exited_cb( VteTerminal *terminal, 
gpointer userdata)
                        "Exit status %d. Try again next time.", exit_status);
        ED.dl_pid = -1;
        ED.ED->scan_tree( bind 
(&aghui::SExpDesignUI::sb_main_progress_indicator, &ED,
-                               placeholders::_1, placeholders::_2, 
placeholders::_3));
+                               placeholders::_1, placeholders::_2, 
placeholders::_3,
+                               aghui::TGtkRefreshMode::gdk));
        ED.populate( false);
 }
 
diff --git a/src/ui/mw/mw.cc b/src/ui/mw/mw.cc
index ca5dc8b..40b01bf 100644
--- a/src/ui/mw/mw.cc
+++ b/src/ui/mw/mw.cc
@@ -212,7 +212,8 @@ SExpDesignUI (aghui::SSessionChooser *parent,
                sure_dir = dir;
        ED = new agh::CExpDesign (sure_dir,
                                  bind( 
&SExpDesignUI::sb_main_progress_indicator, this,
-                                       placeholders::_1, placeholders::_2, 
placeholders::_3));
+                                       placeholders::_1, placeholders::_2, 
placeholders::_3,
+                                       aghui::TGtkRefreshMode::gtk));
        load_artifact_detection_profiles();
        if ( global_artifact_detection_profiles.empty() )
                global_artifact_detection_profiles["default"] = 
metrics::mc::SArtifactDetectionPP ();
@@ -409,7 +410,8 @@ do_rescan_tree( bool with_update)
        ED -> sync();
        if ( with_update )
                ED -> scan_tree( bind 
(&SExpDesignUI::sb_main_progress_indicator, this,
-                                      placeholders::_1, placeholders::_2, 
placeholders::_3));
+                                      placeholders::_1, placeholders::_2, 
placeholders::_3,
+                                      aghui::TGtkRefreshMode::gdk));
        else
                ED -> scan_tree();
        populate( false);
@@ -538,11 +540,19 @@ buf_on_main_status_bar()
 
 void
 aghui::SExpDesignUI::
-sb_main_progress_indicator( const char* current, size_t n, size_t i)
+sb_main_progress_indicator( const char* current, size_t n, size_t i, 
aghui::TGtkRefreshMode mode)
 {
        snprintf_buf( "(%zu of %zu) %s", i, n, current);
        buf_on_main_status_bar();
-       gdk_window_process_all_updates();
+
+       switch ( mode ) {
+       case TGtkRefreshMode::gtk:
+               aghui::gtk_flush();  // this brings down the whole of GTK if 
called from a callback
+               break;
+       case TGtkRefreshMode::gdk:
+               gdk_window_process_all_updates(); // this, however, fails to do 
the update if called *not* from a callback
+               break;
+       }
 }
 
 
diff --git a/src/ui/mw/mw.hh b/src/ui/mw/mw.hh
index 9390cf5..fb23961 100644
--- a/src/ui/mw/mw.hh
+++ b/src/ui/mw/mw.hh
@@ -309,7 +309,8 @@ class SExpDesignUI
        int     ctl_params0_siman_params_t_initial_exponent;
 
       // status bar bits
-       void sb_main_progress_indicator( const char*, size_t n, size_t i);
+       void sb_main_progress_indicator( const char*, size_t n, size_t i,
+                                        aghui::TGtkRefreshMode);
        void buf_on_main_status_bar();
 
       // dnd
diff --git a/src/ui/ui.hh b/src/ui/ui.hh
index 0f8d10c..8aed21a 100644
--- a/src/ui/ui.hh
+++ b/src/ui/ui.hh
@@ -105,6 +105,9 @@ struct SManagedColor {
 };
 
 
+enum class TGtkRefreshMode {
+       gtk, gdk
+};
 
 inline void
 gtk_flush()

-- 
Sleep experiment manager

_______________________________________________
debian-med-commit mailing list
debian-med-commit@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to