added GIMP_PROGRESS_COMMAND_PULSE.

2005-02-12  Michael Natterer  <mitch@gimp.org>

	* libgimpbase/gimpbaseenums.h (enum GimpProgressCommand):
	added GIMP_PROGRESS_COMMAND_PULSE.

	* libgimpbase/gimpbaseenums.c
	* plug-ins/pygimp/gimpenums.py
	* tools/pdbgen/enums.pl: regenerated.

	* app/core/gimppdbprogress.c: implement GimpProgress::pulse()
	and send a PULSE command to the callback.

	* libgimp/gimpprogress.c: handle PULSE by calling the set_value()
	callback with a value of -1 and document that hack in the API docs.

	* libgimp/gimpprogressbar.c: interpret -1 as request to pulse.
This commit is contained in:
Michael Natterer 2005-02-12 15:46:31 +00:00 committed by Michael Natterer
parent 7c19953c39
commit fc677ae7b4
8 changed files with 53 additions and 4 deletions

View File

@ -1,3 +1,20 @@
2005-02-12 Michael Natterer <mitch@gimp.org>
* libgimpbase/gimpbaseenums.h (enum GimpProgressCommand):
added GIMP_PROGRESS_COMMAND_PULSE.
* libgimpbase/gimpbaseenums.c
* plug-ins/pygimp/gimpenums.py
* tools/pdbgen/enums.pl: regenerated.
* app/core/gimppdbprogress.c: implement GimpProgress::pulse()
and send a PULSE command to the callback.
* libgimp/gimpprogress.c: handle PULSE by calling the set_value()
callback with a value of -1 and document that hack in the API docs.
* libgimp/gimpprogressbar.c: interpret -1 as request to pulse.
2005-02-12 Sven Neumann <sven@gimp.org>
* app/core/gimpprogress.[ch]: added GimpProgress::pulse.

View File

@ -71,6 +71,7 @@ static void gimp_pdb_progress_progress_set_text (GimpProgress *progress,
static void gimp_pdb_progress_progress_set_value (GimpProgress *progress,
gdouble percentage);
static gdouble gimp_pdb_progress_progress_get_value (GimpProgress *progress);
static void gimp_pdb_progress_progress_pulse (GimpProgress *progress);
static GObjectClass *parent_class = NULL;
@ -156,6 +157,7 @@ gimp_pdb_progress_progress_iface_init (GimpProgressInterface *progress_iface)
progress_iface->set_text = gimp_pdb_progress_progress_set_text;
progress_iface->set_value = gimp_pdb_progress_progress_set_value;
progress_iface->get_value = gimp_pdb_progress_progress_get_value;
progress_iface->pulse = gimp_pdb_progress_progress_pulse;
}
static GObject *
@ -351,6 +353,17 @@ gimp_pdb_progress_progress_get_value (GimpProgress *progress)
}
static void
gimp_pdb_progress_progress_pulse (GimpProgress *progress)
{
GimpPdbProgress *pdb_progress = GIMP_PDB_PROGRESS (progress);
if (pdb_progress->active)
gimp_pdb_progress_run_callback (pdb_progress,
GIMP_PROGRESS_COMMAND_PULSE,
NULL, 0.0);
}
GimpPdbProgress *
gimp_pdb_progress_get_by_callback (GimpPdbProgressClass *klass,
const gchar *callback_name)

View File

@ -67,6 +67,11 @@ static GHashTable *gimp_progress_ht = NULL;
* Return value: the name of the temporary procedure that's been installed
*
* Since: GIMP 2.2
*
* Note that since GIMP 2.4, the @value_callback can be called with
* nagative values. This is triggered by calls to gimp_progress_pulse().
* The callback should then implement a progress indicating busyness,
* e.g. by calling gtk_progress_bar_pulse().
**/
const gchar *
gimp_progress_install (GimpProgressStartCallback start_callback,
@ -218,6 +223,11 @@ gimp_temp_progress_run (const gchar *name,
progress_data->data);
break;
case GIMP_PROGRESS_COMMAND_PULSE:
progress_data->value_callback (-1.0,
progress_data->data);
break;
default:
g_warning ("Unknown command passed to progress callback");
break;

View File

@ -160,7 +160,10 @@ gimp_progress_bar_set_value (gdouble percentage,
{
GimpProgressBar *bar = GIMP_PROGRESS_BAR (user_data);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), percentage);
if (percentage >= 0.0)
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), percentage);
else
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar));
if (GTK_WIDGET_DRAWABLE (bar))
while (g_main_context_pending (NULL))

View File

@ -842,6 +842,7 @@ gimp_progress_command_get_type (void)
{ GIMP_PROGRESS_COMMAND_END, "GIMP_PROGRESS_COMMAND_END", "end" },
{ GIMP_PROGRESS_COMMAND_SET_TEXT, "GIMP_PROGRESS_COMMAND_SET_TEXT", "set-text" },
{ GIMP_PROGRESS_COMMAND_SET_VALUE, "GIMP_PROGRESS_COMMAND_SET_VALUE", "set-value" },
{ GIMP_PROGRESS_COMMAND_PULSE, "GIMP_PROGRESS_COMMAND_PULSE", "pulse" },
{ 0, NULL, NULL }
};
@ -851,6 +852,7 @@ gimp_progress_command_get_type (void)
{ GIMP_PROGRESS_COMMAND_END, "GIMP_PROGRESS_COMMAND_END", NULL },
{ GIMP_PROGRESS_COMMAND_SET_TEXT, "GIMP_PROGRESS_COMMAND_SET_TEXT", NULL },
{ GIMP_PROGRESS_COMMAND_SET_VALUE, "GIMP_PROGRESS_COMMAND_SET_VALUE", NULL },
{ GIMP_PROGRESS_COMMAND_PULSE, "GIMP_PROGRESS_COMMAND_PULSE", NULL },
{ 0, NULL, NULL }
};

View File

@ -379,7 +379,8 @@ typedef enum
GIMP_PROGRESS_COMMAND_START,
GIMP_PROGRESS_COMMAND_END,
GIMP_PROGRESS_COMMAND_SET_TEXT,
GIMP_PROGRESS_COMMAND_SET_VALUE
GIMP_PROGRESS_COMMAND_SET_VALUE,
GIMP_PROGRESS_COMMAND_PULSE
} GimpProgressCommand;

View File

@ -268,6 +268,7 @@ PROGRESS_COMMAND_START = 0
PROGRESS_COMMAND_END = 1
PROGRESS_COMMAND_SET_TEXT = 2
PROGRESS_COMMAND_SET_VALUE = 3
PROGRESS_COMMAND_PULSE = 4
# GimpRepeatMode
REPEAT_NONE = 0

View File

@ -286,11 +286,13 @@ package Gimp::CodeGen::enums;
symbols => [ qw(GIMP_PROGRESS_COMMAND_START
GIMP_PROGRESS_COMMAND_END
GIMP_PROGRESS_COMMAND_SET_TEXT
GIMP_PROGRESS_COMMAND_SET_VALUE) ],
GIMP_PROGRESS_COMMAND_SET_VALUE
GIMP_PROGRESS_COMMAND_PULSE) ],
mapping => { GIMP_PROGRESS_COMMAND_START => '0',
GIMP_PROGRESS_COMMAND_END => '1',
GIMP_PROGRESS_COMMAND_SET_TEXT => '2',
GIMP_PROGRESS_COMMAND_SET_VALUE => '3' }
GIMP_PROGRESS_COMMAND_SET_VALUE => '3',
GIMP_PROGRESS_COMMAND_PULSE => '4' }
},
GimpHistogramChannel =>
{ contig => 1,