From acdae9b354fd9f58cadd8d688a9b7743722522a9 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 23 Mar 2006 21:56:13 +0000 Subject: [PATCH] app/core/gimp-gui.[ch] app/gui/gui-vtable.c pass displays around as 2006-03-23 Michael Natterer * app/core/gimp-gui.[ch] * app/gui/gui-vtable.c * app/plug-in/plug-in-progress.[ch]: pass displays around as GimpObject, not as integer IDs. * tools/pdbgen/pdb/progress.pdb: changed accordingly. * app/pdb/progress_cmds.c * libgimp/gimpprogress_pdb.c: regenerated. --- ChangeLog | 12 ++++++++++++ app/core/gimp-gui.c | 7 ++++--- app/core/gimp-gui.h | 4 ++-- app/gui/gui-vtable.c | 11 ++++------- app/pdb/progress_cmds.c | 6 +++--- app/plug-in/gimpplugin-progress.c | 9 +++++---- app/plug-in/gimpplugin-progress.h | 2 +- app/plug-in/plug-in-progress.c | 9 +++++---- app/plug-in/plug-in-progress.h | 2 +- libgimp/gimpprogress_pdb.c | 2 +- tools/pdbgen/pdb/progress.pdb | 4 ++-- 11 files changed, 40 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78fac842b8..ffe97b04a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2006-03-23 Michael Natterer + + * app/core/gimp-gui.[ch] + * app/gui/gui-vtable.c + * app/plug-in/plug-in-progress.[ch]: pass displays around as + GimpObject, not as integer IDs. + + * tools/pdbgen/pdb/progress.pdb: changed accordingly. + + * app/pdb/progress_cmds.c + * libgimp/gimpprogress_pdb.c: regenerated. + 2006-03-23 Michael Natterer * tools/pdbgen/stddefs.pdb: removed std_image_arg(), diff --git a/app/core/gimp-gui.c b/app/core/gimp-gui.c index a66c9351c3..86eeb7e6ff 100644 --- a/app/core/gimp-gui.c +++ b/app/core/gimp-gui.c @@ -346,13 +346,14 @@ gimp_menus_create_branch (Gimp *gimp, } GimpProgress * -gimp_new_progress (Gimp *gimp, - gint display_ID) +gimp_new_progress (Gimp *gimp, + GimpObject *display) { g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); + g_return_val_if_fail (display == NULL || GIMP_IS_OBJECT (display), NULL); if (gimp->gui.progress_new) - return gimp->gui.progress_new (gimp, display_ID); + return gimp->gui.progress_new (gimp, display); return NULL; } diff --git a/app/core/gimp-gui.h b/app/core/gimp-gui.h index 447a94b078..76a2088f98 100644 --- a/app/core/gimp-gui.h +++ b/app/core/gimp-gui.h @@ -69,7 +69,7 @@ struct _GimpGui const gchar *menu_label); GimpProgress * (* progress_new) (Gimp *gimp, - gint display_ID); + GimpObject *display); void (* progress_free) (Gimp *gimp, GimpProgress *progress); @@ -138,7 +138,7 @@ void gimp_menus_create_branch (Gimp *gimp, const gchar *menu_label); GimpProgress * gimp_new_progress (Gimp *gimp, - gint display_ID); + GimpObject *display); void gimp_free_progress (Gimp *gimp, GimpProgress *progress); diff --git a/app/gui/gui-vtable.c b/app/gui/gui-vtable.c index 07c8cb3ba4..6971bcdca0 100644 --- a/app/gui/gui-vtable.c +++ b/app/gui/gui-vtable.c @@ -115,7 +115,7 @@ static void gui_menus_create_branch (Gimp *gimp, const gchar *menu_path, const gchar *menu_label); static GimpProgress * gui_new_progress (Gimp *gimp, - gint display_ID); + GimpObject *display); static void gui_free_progress (Gimp *gimp, GimpProgress *progress); static gboolean gui_pdb_dialog_new (Gimp *gimp, @@ -549,13 +549,10 @@ gui_menus_create_branch (Gimp *gimp, } static GimpProgress * -gui_new_progress (Gimp *gimp, - gint display_ID) +gui_new_progress (Gimp *gimp, + GimpObject *display) { - GimpDisplay *display = NULL; - - if (display_ID > 0) - display = gimp_display_get_by_ID (gimp, display_ID); + g_return_val_if_fail (display == NULL || GIMP_IS_DISPLAY (display), NULL); if (display) return GIMP_PROGRESS (display); diff --git a/app/pdb/progress_cmds.c b/app/pdb/progress_cmds.c index 538d84de46..7d05d8eeea 100644 --- a/app/pdb/progress_cmds.c +++ b/app/pdb/progress_cmds.c @@ -60,13 +60,13 @@ progress_init_invoker (Gimp *gimp, { gboolean success = TRUE; gchar *message; - gint32 gdisplay; + GimpObject *gdisplay; message = (gchar *) args[0].value.pdb_pointer; if (message && !g_utf8_validate (message, -1, NULL)) success = FALSE; - gdisplay = args[1].value.pdb_int; + gdisplay = gimp_get_display_by_ID (gimp, args[1].value.pdb_int); if (success) { @@ -90,7 +90,7 @@ static ProcArg progress_init_inargs[] = "Message to use in the progress dialog" }, { - GIMP_PDB_INT32, + GIMP_PDB_DISPLAY, "gdisplay", "GimpDisplay to update progressbar in, or -1 for a seperate window" } diff --git a/app/plug-in/gimpplugin-progress.c b/app/plug-in/gimpplugin-progress.c index 4a9dd88609..689de39817 100644 --- a/app/plug-in/gimpplugin-progress.c +++ b/app/plug-in/gimpplugin-progress.c @@ -45,17 +45,18 @@ static void plug_in_progress_cancel_callback (GimpProgress *progress, void plug_in_progress_start (PlugIn *plug_in, const gchar *message, - gint display_ID) + GimpObject *display) { PlugInProcFrame *proc_frame; g_return_if_fail (plug_in != NULL); + g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display)); proc_frame = plug_in_get_proc_frame (plug_in); if (! proc_frame->progress) { - proc_frame->progress = gimp_new_progress (plug_in->gimp, display_ID); + proc_frame->progress = gimp_new_progress (plug_in->gimp, display); if (proc_frame->progress) { @@ -148,7 +149,7 @@ plug_in_progress_set_value (PlugIn *plug_in, ! gimp_progress_is_active (proc_frame->progress) || ! proc_frame->progress_cancel_id) { - plug_in_progress_start (plug_in, NULL, -1); + plug_in_progress_start (plug_in, NULL, NULL); } if (proc_frame->progress && gimp_progress_is_active (proc_frame->progress)) @@ -168,7 +169,7 @@ plug_in_progress_pulse (PlugIn *plug_in) ! gimp_progress_is_active (proc_frame->progress) || ! proc_frame->progress_cancel_id) { - plug_in_progress_start (plug_in, NULL, -1); + plug_in_progress_start (plug_in, NULL, NULL); } if (proc_frame->progress && gimp_progress_is_active (proc_frame->progress)) diff --git a/app/plug-in/gimpplugin-progress.h b/app/plug-in/gimpplugin-progress.h index b14e57448b..9518a6512f 100644 --- a/app/plug-in/gimpplugin-progress.h +++ b/app/plug-in/gimpplugin-progress.h @@ -24,7 +24,7 @@ void plug_in_progress_start (PlugIn *plug_in, const gchar *message, - gint display_ID); + GimpObject *display); void plug_in_progress_end (PlugIn *plug_in); void plug_in_progress_set_text (PlugIn *plug_in, const gchar *message); diff --git a/app/plug-in/plug-in-progress.c b/app/plug-in/plug-in-progress.c index 4a9dd88609..689de39817 100644 --- a/app/plug-in/plug-in-progress.c +++ b/app/plug-in/plug-in-progress.c @@ -45,17 +45,18 @@ static void plug_in_progress_cancel_callback (GimpProgress *progress, void plug_in_progress_start (PlugIn *plug_in, const gchar *message, - gint display_ID) + GimpObject *display) { PlugInProcFrame *proc_frame; g_return_if_fail (plug_in != NULL); + g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display)); proc_frame = plug_in_get_proc_frame (plug_in); if (! proc_frame->progress) { - proc_frame->progress = gimp_new_progress (plug_in->gimp, display_ID); + proc_frame->progress = gimp_new_progress (plug_in->gimp, display); if (proc_frame->progress) { @@ -148,7 +149,7 @@ plug_in_progress_set_value (PlugIn *plug_in, ! gimp_progress_is_active (proc_frame->progress) || ! proc_frame->progress_cancel_id) { - plug_in_progress_start (plug_in, NULL, -1); + plug_in_progress_start (plug_in, NULL, NULL); } if (proc_frame->progress && gimp_progress_is_active (proc_frame->progress)) @@ -168,7 +169,7 @@ plug_in_progress_pulse (PlugIn *plug_in) ! gimp_progress_is_active (proc_frame->progress) || ! proc_frame->progress_cancel_id) { - plug_in_progress_start (plug_in, NULL, -1); + plug_in_progress_start (plug_in, NULL, NULL); } if (proc_frame->progress && gimp_progress_is_active (proc_frame->progress)) diff --git a/app/plug-in/plug-in-progress.h b/app/plug-in/plug-in-progress.h index b14e57448b..9518a6512f 100644 --- a/app/plug-in/plug-in-progress.h +++ b/app/plug-in/plug-in-progress.h @@ -24,7 +24,7 @@ void plug_in_progress_start (PlugIn *plug_in, const gchar *message, - gint display_ID); + GimpObject *display); void plug_in_progress_end (PlugIn *plug_in); void plug_in_progress_set_text (PlugIn *plug_in, const gchar *message); diff --git a/libgimp/gimpprogress_pdb.c b/libgimp/gimpprogress_pdb.c index 5244567984..b76dc4b34b 100644 --- a/libgimp/gimpprogress_pdb.c +++ b/libgimp/gimpprogress_pdb.c @@ -47,7 +47,7 @@ _gimp_progress_init (const gchar *message) return_vals = gimp_run_procedure ("gimp-progress-init", &nreturn_vals, GIMP_PDB_STRING, message, - GIMP_PDB_INT32, gimp_default_display (), + GIMP_PDB_DISPLAY, gimp_default_display (), GIMP_PDB_END); success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS; diff --git a/tools/pdbgen/pdb/progress.pdb b/tools/pdbgen/pdb/progress.pdb index 4337e8359f..578a2616f3 100644 --- a/tools/pdbgen/pdb/progress.pdb +++ b/tools/pdbgen/pdb/progress.pdb @@ -30,7 +30,7 @@ HELP @inargs = ( { name => 'message', type => 'string', null_ok => 1, wrap => 1, desc => 'Message to use in the progress dialog' }, - { name => 'gdisplay', type => 'int32', + { name => 'gdisplay', type => 'display', no_success => 1, desc => 'GimpDisplay to update progressbar in, or -1 for a seperate window', implicit_fill => 'gimp_default_display ()' } @@ -42,7 +42,7 @@ HELP if (gimp->current_plug_in && gimp->current_plug_in->open) { if (! gimp->no_interface) - plug_in_progress_start (gimp->current_plug_in, message, gdisplay); + plug_in_progress_start (gimp->current_plug_in, message, gdisplay); } else success = FALSE;