Commit 9cabb3e9 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

only set progress value to 0.0 if it isn't 0.0 already. Allows to use

2005-02-12  Sven Neumann  <sven@gimp.org>

	* app/plug-in/plug-in-progress.c (plug_in_progress_start): only
	set progress value to 0.0 if it isn't 0.0 already. Allows to use
	gimp_progress_init() to change the progress message w/o causing
	gtk_progress_bar_set_fraction() to be called.

	* plug-ins/uri/uri-backend-gnomevfs.c: use gimp_progress_pulse()
	if the filesize is unknown. Also limit frequency of progress
	updates.
parent a8765712
2005-02-12 Sven Neumann <sven@gimp.org>
* app/plug-in/plug-in-progress.c (plug_in_progress_start): only
set progress value to 0.0 if it isn't 0.0 already. Allows to use
gimp_progress_init() to change the progress message w/o causing
gtk_progress_bar_set_fraction() to be called.
* plug-ins/uri/uri-backend-gnomevfs.c: use gimp_progress_pulse()
if the filesize is unknown. Also limit frequency of progress
updates.
2005-02-12 Sven Neumann <sven@gimp.org>
* app/base/pixel-processor.c: fixed a bug I introduced with my
......
......@@ -79,7 +79,9 @@ plug_in_progress_start (PlugIn *plug_in,
if (gimp_progress_is_active (proc_frame->progress))
{
gimp_progress_set_text (proc_frame->progress, message);
gimp_progress_set_value (proc_frame->progress, 0.0);
if (gimp_progress_get_value (proc_frame->progress) > 0.0)
gimp_progress_set_value (proc_frame->progress, 0.0);
}
else
{
......
......@@ -79,7 +79,9 @@ plug_in_progress_start (PlugIn *plug_in,
if (gimp_progress_is_active (proc_frame->progress))
{
gimp_progress_set_text (proc_frame->progress, message);
gimp_progress_set_value (proc_frame->progress, 0.0);
if (gimp_progress_get_value (proc_frame->progress) > 0.0)
gimp_progress_set_value (proc_frame->progress, 0.0);
}
else
{
......
......@@ -180,6 +180,7 @@ copy_uri (const gchar *src_uri,
GnomeVFSResult result;
gchar *memsize;
gchar *message;
GTimeVal last_time = { 0, 0 };
gimp_progress_init (_("Connecting to server..."));
......@@ -231,8 +232,9 @@ copy_uri (const gchar *src_uri,
while (TRUE)
{
GnomeVFSFileSize chunk_read;
GnomeVFSFileSize chunk_written;
GnomeVFSFileSize chunk_read;
GnomeVFSFileSize chunk_written;
GTimeVal now;
result = gnome_vfs_read (read_handle, buffer, sizeof (buffer),
&chunk_read);
......@@ -261,18 +263,30 @@ copy_uri (const gchar *src_uri,
bytes_read += chunk_read;
if (file_size > 0)
{
gimp_progress_update ((gdouble) bytes_read / (gdouble) file_size);
}
else
/* update the progress only up to 10 times a second */
g_get_current_time (&now);
if (((now.tv_sec - last_time.tv_sec) * 1000 +
(now.tv_usec - last_time.tv_usec) / 1000) > 100)
{
memsize = gimp_memsize_to_string (bytes_read);
message = g_strdup_printf (copied_format_str, memsize);
g_free (memsize);
if (file_size > 0)
{
gimp_progress_update ((gdouble) bytes_read / (gdouble) file_size);
}
else
{
memsize = gimp_memsize_to_string (bytes_read);
message = g_strdup_printf (copied_format_str, memsize);
g_free (memsize);
gimp_progress_init (message);
g_free (message);
gimp_progress_pulse ();
}
gimp_progress_init (message);
g_free (message);
last_time = now;
}
result = gnome_vfs_write (write_handle, buffer, chunk_read,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment