Files
gimp/app/plug-in/plug-in-progress.c
Michael Natterer d407244f7e renamed plug_in_progress_init() to plug_in_progress_start() so it matches
2003-01-20  Michael Natterer  <mitch@gimp.org>

	* app/plug-in/plug-in-progress.[ch]: renamed plug_in_progress_init()
	to plug_in_progress_start() so it matches plug_in_progress_end().
	Added g_return_if_fail() to all functions.

	* app/plug-in/plug-in.[ch]: plug_in_new(): require the passed
	path to be absolute. Removed plug_in_search_in_path(). Replaced
	some if(plug_in){...} by g_return_if_fail(plug_in!=NULL). Cleanup.

	* app/plug-in/plug-ins.c: plug_ins_def_add_from_rc(): refuse to
	add plug_in_defs with non-absolute paths (should never happen).
	Misc cleanup all over the place like s/GSList *tmp/GSList *list/.

	* app/plug-in/plug-in-params.c: cleanup.

	* tools/pdbgen/pdb/plug_in.pdb: changed accordingly.

	* app/pdb/plug_in_cmds.c: regenerated.

	* app/gui/brush-select.c
	* app/gui/gradient-select.c
	* app/gui/palette-select.c
	* app/gui/pattern-select.c: some code review & cleanup.
2003-01-20 12:17:32 +00:00

103 lines
2.6 KiB
C

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "plug-in-types.h"
#ifdef __GNUC__
#warning FIXME #include "display/display-types.h"
#endif
#include "display/display-types.h"
#include "display/gimpdisplay.h"
#include "display/gimpprogress.h"
#include "plug-in.h"
#include "plug-in-progress.h"
/* local function prototypes */
static void plug_in_progress_cancel (GtkWidget *widget,
PlugIn *plug_in);
/* public functions */
void
plug_in_progress_start (PlugIn *plug_in,
const gchar *message,
gint gdisp_ID)
{
GimpDisplay *gdisp = NULL;
g_return_if_fail (plug_in != NULL);
if (! message)
message = plug_in->args[0];
if (gdisp_ID > 0)
gdisp = gimp_display_get_by_ID (plug_in->gimp, gdisp_ID);
if (plug_in->progress)
plug_in->progress = gimp_progress_restart (plug_in->progress, message,
G_CALLBACK (plug_in_progress_cancel),
plug_in);
else
plug_in->progress = gimp_progress_start (gdisp, message, TRUE,
G_CALLBACK (plug_in_progress_cancel),
plug_in);
}
void
plug_in_progress_update (PlugIn *plug_in,
gdouble percentage)
{
g_return_if_fail (plug_in != NULL);
if (! plug_in->progress)
plug_in_progress_start (plug_in, NULL, -1);
gimp_progress_update (plug_in->progress, percentage);
}
void
plug_in_progress_end (PlugIn *plug_in)
{
g_return_if_fail (plug_in != NULL);
if (plug_in->progress)
{
gimp_progress_end (plug_in->progress);
plug_in->progress = NULL;
}
}
/* private functions */
static void
plug_in_progress_cancel (GtkWidget *widget,
PlugIn *plug_in)
{
plug_in_destroy (plug_in);
}