Use g_message instead of g_warning.

Use gimp_message instead of self-defined ErrorMessage function.


--Sven
This commit is contained in:
Sven Neumann 1998-05-28 17:09:17 +00:00
parent 1d95a05af0
commit e0a819f62a
5 changed files with 38 additions and 122 deletions

View File

@ -1,3 +1,9 @@
Thu May 28 19:05:13 MEST 1998 Sven Neumann <sven@gimp.org>
* plug-ins/rotate/rotate.c
* plug-ins/screenshot/screenshot.c: adapted to the new
way of error message handling
Thu May 28 01:16:26 PDT 1998 Manish Singh <yosh@gimp.org>
* redid the error message handling. g_message now calls

View File

@ -1,6 +1,6 @@
/*
* Rotate plug-in v0.6 by Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/01/15
* Rotate plug-in v0.7 by Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/05/28
*
* Any suggestions, bug-reports or patches are very welcome.
*
@ -40,6 +40,7 @@
* (01/09/98) v0.5 a few fixes to support portability
* (01/15/98) v0.6 fixed a line that caused rotate to crash on some
* systems
* (05/28/98) v0.7 use the new gimp_message function for error output
*/
/* TODO List
@ -51,7 +52,6 @@
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
/* Defines */
#define PLUG_IN_NAME "plug_in_rotate"
@ -118,7 +118,6 @@ static void rotate_ok_callback (GtkWidget *widget,
gpointer data);
static void rotate_toggle_update (GtkWidget *widget,
gpointer data);
static void ErrorMessage (gchar *message);
gint32 my_gimp_selection_float (gint32 image_ID, gint32 drawable_ID);
gint32 my_gimp_selection_is_empty (gint32 image_ID);
@ -497,13 +496,13 @@ rotate (void)
{
if ( !my_gimp_selection_is_empty (image_ID) )
{
ErrorMessage("You can not rotate the whole image if there's a selection.");
gimp_message("You can not rotate the whole image if there's a selection.");
gimp_drawable_detach (active_drawable);
return;
}
if ( gimp_layer_is_floating_selection (active_drawable->id) )
{
ErrorMessage("You can not rotate the whole image if there's a floating selection.");
gimp_message("You can not rotate the whole image if there's a floating selection.");
gimp_drawable_detach (active_drawable);
return;
}
@ -765,50 +764,6 @@ rotate_toggle_update (GtkWidget *widget,
}
/* Error Message
*
* This code was stolen from Pavel Greenfield's Colormap Rotation plug-in */
static void
ErrorMessage(gchar *message)
{
GtkWidget *window, *label, *button, *table;
gchar **argv=g_new (gchar *, 1);
gint argc=1;
argv[0] = g_strdup ("rotate");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
window=gtk_dialog_new();
gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
gtk_window_set_title(GTK_WINDOW(window), "Rotate Error Message");
gtk_signal_connect (GTK_OBJECT (window), "destroy",
(GtkSignalFunc) rotate_close_callback,
NULL);
button = gtk_button_new_with_label ("Got It!");
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) rotate_ok_callback,
window);
gtk_widget_grab_default (button);
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0);
table=gtk_table_new(2,2,FALSE);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),table,TRUE,TRUE,0);
gtk_widget_show(table);
label=gtk_label_new("");
gtk_label_set(GTK_LABEL(label),message);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table),label,0,1,0,1,
GTK_FILL|GTK_EXPAND,GTK_FILL|GTK_EXPAND,15,15);
gtk_widget_show(window);
gtk_main ();
}

View File

@ -1,6 +1,7 @@
/*
* ScreenShot plug-in v0.6 by Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/04/18
* ScreenShot plug-in v0.7
* Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/05/28
*
* Any suggestions, bug-reports or patches are very welcome.
*
@ -36,6 +37,7 @@
* (98/04/02) v0.5 it works non-interactively now and registers
* itself correctly as extension
* (98/04/18) v0.6 cosmetic change to the dialog
* (98/05/28) v0.7 use g_message for error output
*/
#include <stdio.h>
@ -48,7 +50,7 @@
/* Defines */
#define PLUG_IN_NAME "extension_screenshot"
#define PLUG_IN_PRINT_NAME "Screen Shot"
#define PLUG_IN_VERSION "v0.6 (98/04/18)"
#define PLUG_IN_VERSION "v0.7 (98/05/28)"
#define PLUG_IN_MENU_PATH "<Toolbox>/Xtns/Screen Shot"
#define PLUG_IN_AUTHOR "Sven Neumann (neumanns@uni-duesseldorf.de)"
#define PLUG_IN_COPYRIGHT "Sven Neumann"
@ -209,10 +211,6 @@ run (gchar *name, /* name of plugin */
{
/* Run the main function */
shoot();
/* Store variable states for next run */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data (PLUG_IN_NAME, &shootvals, sizeof (ScreenShotValues));
}
status = (image_ID != -1) ? STATUS_SUCCESS : STATUS_EXECUTION_ERROR;
@ -221,6 +219,8 @@ run (gchar *name, /* name of plugin */
{
if (run_mode == RUN_INTERACTIVE)
{
/* Store variable states for next run */
gimp_set_data (PLUG_IN_NAME, &shootvals, sizeof (ScreenShotValues));
/* display the image */
shoot_display_image (image_ID);
}
@ -273,14 +273,14 @@ shoot (void)
/* fork off a xwd process */
if ((pid = fork ()) < 0)
{
g_warning ("screenshot: fork failed: %s\n", g_strerror (errno));
g_message ("screenshot: fork failed: %s\n", g_strerror (errno));
return;
}
else if (pid == 0)
{
execvp (XWD, xwdargv);
/* What are we doing here? exec must have failed */
g_warning ("screenshot: exec failed: xwd: %s\n", g_strerror (errno));
g_message ("screenshot: exec failed: xwd: %s\n", g_strerror (errno));
return;
}
else
@ -289,7 +289,7 @@ shoot (void)
if (!WIFEXITED (status))
{
g_warning ("screenshot: xwd didn't work\n");
g_message ("screenshot: xwd didn't work\n");
return;
}
}

View File

@ -1,6 +1,6 @@
/*
* Rotate plug-in v0.6 by Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/01/15
* Rotate plug-in v0.7 by Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/05/28
*
* Any suggestions, bug-reports or patches are very welcome.
*
@ -40,6 +40,7 @@
* (01/09/98) v0.5 a few fixes to support portability
* (01/15/98) v0.6 fixed a line that caused rotate to crash on some
* systems
* (05/28/98) v0.7 use the new gimp_message function for error output
*/
/* TODO List
@ -51,7 +52,6 @@
#include <gtk/gtk.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
/* Defines */
#define PLUG_IN_NAME "plug_in_rotate"
@ -118,7 +118,6 @@ static void rotate_ok_callback (GtkWidget *widget,
gpointer data);
static void rotate_toggle_update (GtkWidget *widget,
gpointer data);
static void ErrorMessage (gchar *message);
gint32 my_gimp_selection_float (gint32 image_ID, gint32 drawable_ID);
gint32 my_gimp_selection_is_empty (gint32 image_ID);
@ -497,13 +496,13 @@ rotate (void)
{
if ( !my_gimp_selection_is_empty (image_ID) )
{
ErrorMessage("You can not rotate the whole image if there's a selection.");
gimp_message("You can not rotate the whole image if there's a selection.");
gimp_drawable_detach (active_drawable);
return;
}
if ( gimp_layer_is_floating_selection (active_drawable->id) )
{
ErrorMessage("You can not rotate the whole image if there's a floating selection.");
gimp_message("You can not rotate the whole image if there's a floating selection.");
gimp_drawable_detach (active_drawable);
return;
}
@ -765,50 +764,6 @@ rotate_toggle_update (GtkWidget *widget,
}
/* Error Message
*
* This code was stolen from Pavel Greenfield's Colormap Rotation plug-in */
static void
ErrorMessage(gchar *message)
{
GtkWidget *window, *label, *button, *table;
gchar **argv=g_new (gchar *, 1);
gint argc=1;
argv[0] = g_strdup ("rotate");
gtk_init (&argc, &argv);
gtk_rc_parse (gimp_gtkrc ());
window=gtk_dialog_new();
gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
gtk_window_set_title(GTK_WINDOW(window), "Rotate Error Message");
gtk_signal_connect (GTK_OBJECT (window), "destroy",
(GtkSignalFunc) rotate_close_callback,
NULL);
button = gtk_button_new_with_label ("Got It!");
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) rotate_ok_callback,
window);
gtk_widget_grab_default (button);
gtk_widget_show (button);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area), button, TRUE, TRUE, 0);
table=gtk_table_new(2,2,FALSE);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),table,TRUE,TRUE,0);
gtk_widget_show(table);
label=gtk_label_new("");
gtk_label_set(GTK_LABEL(label),message);
gtk_widget_show(label);
gtk_table_attach(GTK_TABLE(table),label,0,1,0,1,
GTK_FILL|GTK_EXPAND,GTK_FILL|GTK_EXPAND,15,15);
gtk_widget_show(window);
gtk_main ();
}

View File

@ -1,6 +1,7 @@
/*
* ScreenShot plug-in v0.6 by Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/04/18
* ScreenShot plug-in v0.7
* Sven Neumann, neumanns@uni-duesseldorf.de
* 1998/05/28
*
* Any suggestions, bug-reports or patches are very welcome.
*
@ -36,6 +37,7 @@
* (98/04/02) v0.5 it works non-interactively now and registers
* itself correctly as extension
* (98/04/18) v0.6 cosmetic change to the dialog
* (98/05/28) v0.7 use g_message for error output
*/
#include <stdio.h>
@ -48,7 +50,7 @@
/* Defines */
#define PLUG_IN_NAME "extension_screenshot"
#define PLUG_IN_PRINT_NAME "Screen Shot"
#define PLUG_IN_VERSION "v0.6 (98/04/18)"
#define PLUG_IN_VERSION "v0.7 (98/05/28)"
#define PLUG_IN_MENU_PATH "<Toolbox>/Xtns/Screen Shot"
#define PLUG_IN_AUTHOR "Sven Neumann (neumanns@uni-duesseldorf.de)"
#define PLUG_IN_COPYRIGHT "Sven Neumann"
@ -209,10 +211,6 @@ run (gchar *name, /* name of plugin */
{
/* Run the main function */
shoot();
/* Store variable states for next run */
if (run_mode == RUN_INTERACTIVE)
gimp_set_data (PLUG_IN_NAME, &shootvals, sizeof (ScreenShotValues));
}
status = (image_ID != -1) ? STATUS_SUCCESS : STATUS_EXECUTION_ERROR;
@ -221,6 +219,8 @@ run (gchar *name, /* name of plugin */
{
if (run_mode == RUN_INTERACTIVE)
{
/* Store variable states for next run */
gimp_set_data (PLUG_IN_NAME, &shootvals, sizeof (ScreenShotValues));
/* display the image */
shoot_display_image (image_ID);
}
@ -273,14 +273,14 @@ shoot (void)
/* fork off a xwd process */
if ((pid = fork ()) < 0)
{
g_warning ("screenshot: fork failed: %s\n", g_strerror (errno));
g_message ("screenshot: fork failed: %s\n", g_strerror (errno));
return;
}
else if (pid == 0)
{
execvp (XWD, xwdargv);
/* What are we doing here? exec must have failed */
g_warning ("screenshot: exec failed: xwd: %s\n", g_strerror (errno));
g_message ("screenshot: exec failed: xwd: %s\n", g_strerror (errno));
return;
}
else
@ -289,7 +289,7 @@ shoot (void)
if (!WIFEXITED (status))
{
g_warning ("screenshot: xwd didn't work\n");
g_message ("screenshot: xwd didn't work\n");
return;
}
}