added "message" function to the GimpProgress interface. Call

2004-10-14  Sven Neumann  <sven@gimp.org>

	* app/core/gimpprogress.[ch]: added "message" function to the
	GimpProgress interface. Call gimp_message() if it is unimplemented.

	* app/plug-in/plug-in-progress.[ch]: added new function
	plug_in_progress_message() that passes the message to the current
	proc_frame's progress.

	* app/widgets/gimpthumbbox.c: implement GimpProgress::message.
	Just do nothing in the implementation. We don't want to see
	messages from file plug-ins that we use to create the thumbnails.

	* tools/pdbgen/pdb/message.pdb
	* app/pdb/message_cmds.c: if there's a current plug-in, dispatch
	the message by calling plug_in_progress_message().

	* app/display/gimpdisplayshell-close.c: fixed wrong types in
	function calls.
This commit is contained in:
Sven Neumann 2004-10-14 15:15:03 +00:00 committed by Sven Neumann
parent 6030036fe2
commit 0b6f4114d8
11 changed files with 155 additions and 29 deletions

View File

@ -1,3 +1,23 @@
2004-10-14 Sven Neumann <sven@gimp.org>
* app/core/gimpprogress.[ch]: added "message" function to the
GimpProgress interface. Call gimp_message() if it is unimplemented.
* app/plug-in/plug-in-progress.[ch]: added new function
plug_in_progress_message() that passes the message to the current
proc_frame's progress.
* app/widgets/gimpthumbbox.c: implement GimpProgress::message.
Just do nothing in the implementation. We don't want to see
messages from file plug-ins that we use to create the thumbnails.
* tools/pdbgen/pdb/message.pdb
* app/pdb/message_cmds.c: if there's a current plug-in, dispatch
the message by calling plug_in_progress_message().
* app/display/gimpdisplayshell-close.c: fixed wrong types in
function calls.
2004-10-14 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcolordialog.c (gimp_color_dialog_new): use

View File

@ -28,6 +28,7 @@
#include "core-types.h"
#include "gimpmarshal.h"
#include "gimp-gui.h"
#include "gimpprogress.h"
#include "gimp-intl.h"
@ -189,6 +190,25 @@ gimp_progress_get_value (GimpProgress *progress)
return 0.0;
}
void
gimp_progress_message (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message)
{
GimpProgressInterface *progress_iface;
g_return_if_fail (GIMP_IS_PROGRESS (progress));
progress_iface = GIMP_PROGRESS_GET_INTERFACE (progress);
if (progress_iface->message)
progress_iface->message (progress, gimp, domain, message);
else
gimp_message (gimp, domain, message);
}
void
gimp_progress_cancel (GimpProgress *progress)
{

View File

@ -48,6 +48,11 @@ struct _GimpProgressInterface
gdouble percentage);
gdouble (* get_value) (GimpProgress *progress);
void (* message) (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message);
/* signals */
void (* cancel) (GimpProgress *progress);
};
@ -67,6 +72,11 @@ void gimp_progress_set_value (GimpProgress *progress,
gdouble percentage);
gdouble gimp_progress_get_value (GimpProgress *progress);
void gimp_progress_message (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message);
void gimp_progress_cancel (GimpProgress *progress);
void gimp_progress_update_and_flush (gint min,

View File

@ -50,8 +50,8 @@
static void gimp_display_shell_close_dialog (GimpDisplayShell *shell,
GimpImage *gimage);
static void gimp_display_shell_close_name_changed (GimpImage *image,
GtkWidget *box);
static gboolean gimp_display_shell_close_time_changed (GtkWidget *box);
GimpMessageBox *box);
static gboolean gimp_display_shell_close_time_changed (GimpMessageBox *box);
static void gimp_display_shell_close_response (GtkWidget *widget,
gboolean close,
GimpDisplayShell *shell);
@ -172,27 +172,32 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
}
static void
gimp_display_shell_close_name_changed (GimpImage *image,
GtkWidget *box)
gimp_display_shell_close_name_changed (GimpImage *image,
GimpMessageBox *box)
{
gchar *name;
gchar *title;
GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (box));
gchar *name;
name = file_utils_uri_to_utf8_basename (gimp_image_get_uri (image));
title = g_strdup_printf (_("Close %s"), name);
gtk_window_set_title (GTK_WINDOW (gtk_widget_get_toplevel (box)), title);
g_free (title);
if (window)
{
gchar *title = g_strdup_printf (_("Close %s"), name);
gimp_message_box_set_primary_text (GIMP_MESSAGE_BOX (box),
gtk_window_set_title (GTK_WINDOW (window), title);
g_free (title);
}
gimp_message_box_set_primary_text (box,
_("Save the changes to image '%s' "
"before closing?"), name);
"before closing?"),
name);
g_free (name);
}
static gboolean
gimp_display_shell_close_time_changed (GtkWidget *box)
gimp_display_shell_close_time_changed (GimpMessageBox *box)
{
GimpImage *image = g_object_get_data (G_OBJECT (box), "gimp-image");
@ -200,7 +205,7 @@ gimp_display_shell_close_time_changed (GtkWidget *box)
{
gchar *period = gimp_time_since (image->dirty_time);
gimp_message_box_set_text (GIMP_MESSAGE_BOX (box),
gimp_message_box_set_text (box,
_("If you don't save the image, "
"changes from the last %s will be lost."),
period);
@ -208,7 +213,7 @@ gimp_display_shell_close_time_changed (GtkWidget *box)
}
else
{
gimp_message_box_set_text (GIMP_MESSAGE_BOX (box), NULL);
gimp_message_box_set_text (box, NULL);
}
return TRUE;

View File

@ -29,6 +29,7 @@
#include "core/gimp.h"
#include "gimp-intl.h"
#include "plug-in/plug-in-progress.h"
#include "plug-in/plug-in.h"
static ProcRecord message_proc;
@ -58,14 +59,10 @@ message_invoker (Gimp *gimp,
if (success)
{
gchar *domain = NULL;
if (gimp->current_plug_in)
domain = plug_in_get_undo_desc (gimp->current_plug_in);
gimp_message (gimp, domain, message);
g_free (domain);
plug_in_progress_message (gimp->current_plug_in, message);
else
gimp_message (gimp, NULL, message);
}
return procedural_db_return_args (&message_proc, success);

View File

@ -216,6 +216,33 @@ plug_in_progress_cancel (PlugIn *plug_in,
return FALSE;
}
void
plug_in_progress_message (PlugIn *plug_in,
const gchar *message)
{
PlugInProcFrame *proc_frame;
gchar *domain;
g_return_if_fail (plug_in != NULL);
g_return_if_fail (message != NULL);
proc_frame = plug_in_get_proc_frame (plug_in);
domain = plug_in_get_undo_desc (plug_in);
if (proc_frame->progress)
{
gimp_progress_message (proc_frame->progress,
plug_in->gimp, domain, message);
}
else
{
gimp_message (plug_in->gimp, domain, message);
}
g_free (domain);
}
/* private functions */

View File

@ -36,5 +36,8 @@ gboolean plug_in_progress_uninstall (PlugIn *plug_in,
gboolean plug_in_progress_cancel (PlugIn *plug_in,
const gchar *progress_callback);
void plug_in_progress_message (PlugIn *plug_in,
const gchar *message);
#endif /* __PLUG_IN_PROGRESS_H__ */

View File

@ -216,6 +216,33 @@ plug_in_progress_cancel (PlugIn *plug_in,
return FALSE;
}
void
plug_in_progress_message (PlugIn *plug_in,
const gchar *message)
{
PlugInProcFrame *proc_frame;
gchar *domain;
g_return_if_fail (plug_in != NULL);
g_return_if_fail (message != NULL);
proc_frame = plug_in_get_proc_frame (plug_in);
domain = plug_in_get_undo_desc (plug_in);
if (proc_frame->progress)
{
gimp_progress_message (proc_frame->progress,
plug_in->gimp, domain, message);
}
else
{
gimp_message (plug_in->gimp, domain, message);
}
g_free (domain);
}
/* private functions */

View File

@ -36,5 +36,8 @@ gboolean plug_in_progress_uninstall (PlugIn *plug_in,
gboolean plug_in_progress_cancel (PlugIn *plug_in,
const gchar *progress_callback);
void plug_in_progress_message (PlugIn *plug_in,
const gchar *message);
#endif /* __PLUG_IN_PROGRESS_H__ */

View File

@ -67,6 +67,11 @@ static void gimp_thumb_box_progress_set_value (GimpProgress *progress,
gdouble percentage);
static gdouble gimp_thumb_box_progress_get_value (GimpProgress *progress);
static void gimp_thumb_box_progress_message (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message);
static gboolean gimp_thumb_box_ebox_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpThumbBox *box);
@ -160,6 +165,8 @@ gimp_thumb_box_progress_iface_init (GimpProgressInterface *progress_iface)
progress_iface->is_active = gimp_thumb_box_progress_is_active;
progress_iface->set_value = gimp_thumb_box_progress_set_value;
progress_iface->get_value = gimp_thumb_box_progress_get_value;
progress_iface->message = gimp_thumb_box_progress_message;
}
static void
@ -287,6 +294,15 @@ gimp_thumb_box_progress_get_value (GimpProgress *progress)
return 0.0;
}
static void
gimp_thumb_box_progress_message (GimpProgress *progress,
Gimp *gimp,
const gchar *domain,
const gchar *message)
{
/* GimpThumbBox never shows any messages */
}
/* public functions */

View File

@ -40,14 +40,10 @@ HELP
%invoke = (
code => <<CODE
{
gchar *domain = NULL;
if (gimp->current_plug_in)
domain = plug_in_get_undo_desc (gimp->current_plug_in);
gimp_message (gimp, domain, message);
g_free (domain);
plug_in_progress_message (gimp->current_plug_in, message);
else
gimp_message (gimp, NULL, message);
}
CODE
);
@ -90,7 +86,9 @@ HELP
%invoke = ( code => 'gimp->message_handler = handler;' );
}
@headers = qw(<string.h> "core/gimp.h" "plug-in/plug-in.h" "gimp-intl.h");
@headers = qw(<string.h>
"core/gimp.h" "plug-in/plug-in.h" "plug-in/plug-in-progress.h"
"gimp-intl.h");
@procs = qw(message message_get_handler message_set_handler);
%exports = (app => [@procs], lib => [@procs]);