Disks scanning performance: GTK+ mode: Prevent expensive polling gdk_flush()es.
authorshort <>
Sat, 13 Dec 2003 15:16:31 +0000 (15:16 +0000)
committershort <>
Sat, 13 Dec 2003 15:16:31 +0000 (15:16 +0000)
src/install/acquire/ui-gnome.c

index 344177e..e0d6ec0 100644 (file)
@@ -250,6 +250,8 @@ struct timeval diff_timeval;
 
 static gboolean ui_gnome_progress(GnomeVFSURI *uri)
 {
+gboolean want_gdk_flush=FALSE;
+
        /* 'uri' may be NULL */
 
        gdk_threads_enter();
@@ -267,9 +269,11 @@ static gchar *uri_text=NULL;
                        }
 
                if (uri_text) {
-                       if (want_progress_update(&ProgressEntry_updated_timeval))
+                       if (want_progress_update(&ProgressEntry_updated_timeval)) {
                                gtk_entry_set_text(ProgressEntry,
                                                uri_text+(strncmp(uri_text,"file://",strlen("file://")) ? 0 : strlen("file://")));
+                               want_gdk_flush=TRUE;
+                               }
                        }
                }
 
@@ -280,7 +284,8 @@ static gchar *uri_text=NULL;
                                FALSE); /* may_block */
 #endif /* UI_GNOME_THREADS */
 
-       gdk_flush();
+       if (want_gdk_flush)
+               gdk_flush();
        gdk_threads_leave();
 
        /* Do not: g_thread_yield();