From e0a819f62a45424456a956a5fecabe37fb2cf322 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 28 May 1998 17:09:17 +0000 Subject: [PATCH] Use g_message instead of g_warning. Use gimp_message instead of self-defined ErrorMessage function. --Sven --- ChangeLog | 6 ++++ plug-ins/common/rotate.c | 57 ++++---------------------------- plug-ins/common/screenshot.c | 20 +++++------ plug-ins/rotate/rotate.c | 57 ++++---------------------------- plug-ins/screenshot/screenshot.c | 20 +++++------ 5 files changed, 38 insertions(+), 122 deletions(-) diff --git a/ChangeLog b/ChangeLog index 28775096d0..571669eb98 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu May 28 19:05:13 MEST 1998 Sven Neumann + + * 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 * redid the error message handling. g_message now calls diff --git a/plug-ins/common/rotate.c b/plug-ins/common/rotate.c index 8775f5651f..035ab87b3c 100644 --- a/plug-ins/common/rotate.c +++ b/plug-ins/common/rotate.c @@ -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. * @@ -39,7 +39,8 @@ * (10/17/97) v0.4 now handles selections * (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 + * systems + * (05/28/98) v0.7 use the new gimp_message function for error output */ /* TODO List @@ -51,7 +52,6 @@ #include #include -#include /* 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 (); -} - diff --git a/plug-ins/common/screenshot.c b/plug-ins/common/screenshot.c index 2f45e5e1c1..286395e0d2 100644 --- a/plug-ins/common/screenshot.c +++ b/plug-ins/common/screenshot.c @@ -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 @@ -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 "/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; } } diff --git a/plug-ins/rotate/rotate.c b/plug-ins/rotate/rotate.c index 8775f5651f..035ab87b3c 100644 --- a/plug-ins/rotate/rotate.c +++ b/plug-ins/rotate/rotate.c @@ -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. * @@ -39,7 +39,8 @@ * (10/17/97) v0.4 now handles selections * (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 + * systems + * (05/28/98) v0.7 use the new gimp_message function for error output */ /* TODO List @@ -51,7 +52,6 @@ #include #include -#include /* 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 (); -} - diff --git a/plug-ins/screenshot/screenshot.c b/plug-ins/screenshot/screenshot.c index 2f45e5e1c1..286395e0d2 100644 --- a/plug-ins/screenshot/screenshot.c +++ b/plug-ins/screenshot/screenshot.c @@ -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 @@ -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 "/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; } }