From 53238ebc288c14fa45cb500d704b20d1bc9847a2 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 5 May 2000 13:29:46 +0000 Subject: [PATCH] app/docindex.[ch] call dialog_[un]register(). Fixes #10284. Also removed 2000-05-05 Michael Natterer * app/docindex.[ch] * app/docindexif.[ch]: call dialog_[un]register(). Fixes #10284. Also removed some useless stuff. * app/gdisplay_color_ui.c * modules/cdisplay_gamma.c * modules/cdisplay_highcontrast.c: call dialog_[un]register(). --- ChangeLog | 10 +++ app/display/gimpdisplayshell-filter-dialog.c | 14 +++- app/docindex.c | 17 +++-- app/docindex.h | 9 +-- app/docindexif.c | 47 ++++---------- app/docindexif.h | 16 ++--- app/gdisplay_color_ui.c | 14 +++- app/widgets/gimpcolordisplayeditor.c | 14 +++- modules/cdisplay_gamma.c | 67 ++++++++++++-------- modules/cdisplay_highcontrast.c | 65 +++++++++++-------- 10 files changed, 155 insertions(+), 118 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac1b5054f0..ffa968ba90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2000-05-05 Michael Natterer + + * app/docindex.[ch] + * app/docindexif.[ch]: call dialog_[un]register(). Fixes #10284. + Also removed some useless stuff. + + * app/gdisplay_color_ui.c + * modules/cdisplay_gamma.c + * modules/cdisplay_highcontrast.c: call dialog_[un]register(). + 2000-05-05 Jay Cox * app/pixel_processor.c: try to minimize the overhead of diff --git a/app/display/gimpdisplayshell-filter-dialog.c b/app/display/gimpdisplayshell-filter-dialog.c index aa9581eea4..5aac8e405e 100644 --- a/app/display/gimpdisplayshell-filter-dialog.c +++ b/app/display/gimpdisplayshell-filter-dialog.c @@ -16,15 +16,21 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" + +#include + #include "color_area.h" +#include "dialog_handler.h" #include "gdisplay.h" #include "gdisplay_color.h" #include "gdisplay_color_ui.h" #include "gimpimageP.h" #include "gimpui.h" + #include "libgimp/parasite.h" + #include "libgimp/gimpintl.h" -#include + typedef struct _ColorDisplayDialog ColorDisplayDialog; @@ -106,8 +112,8 @@ make_dialog (ColorDisplayDialog *cdd) GtkWidget *hbox; GtkWidget *scrolled_win; GtkWidget *vbbox; - char *titles[2]; - int i; + gchar *titles[2]; + gint i; static ButtonInfo buttons[] = { @@ -131,6 +137,8 @@ make_dialog (ColorDisplayDialog *cdd) NULL); + dialog_register (cdd->shell); + hbox = gtk_hbox_new (FALSE, 4); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox, TRUE, TRUE, 4); diff --git a/app/docindex.c b/app/docindex.c index 766915cc48..a36ac8b0db 100644 --- a/app/docindex.c +++ b/app/docindex.c @@ -17,6 +17,7 @@ #include +#include "dialog_handler.h" #include "docindexif.h" #include "docindex.h" #include "gimpdnd.h" @@ -167,13 +168,10 @@ idea_window_delete_event_callback (GtkWidget *widget, GdkEvent *event, gpointer data) { - if (! exit_from_go ()) - { - save_idea_manager (ideas); - create_idea_list (); - g_free (ideas); - ideas = 0; - } + save_idea_manager (ideas); + create_idea_list (); + g_free (ideas); + ideas = 0; return FALSE; } @@ -186,9 +184,10 @@ idea_hide_callback (GtkWidget *widget, save_idea_manager (ideas); /* False if exitting */ - if ((! exit_from_go ()) && ideas) + if (ideas) { create_idea_list (); + dialog_unregister (ideas->window); gtk_widget_destroy (ideas->window); g_free (ideas); ideas = 0; @@ -614,7 +613,7 @@ idea_remove_callback (GtkWidget *widget, } void -close_idea_window( void ) +close_idea_window (void) { idea_hide_callback (NULL, NULL); } diff --git a/app/docindex.h b/app/docindex.h index 58f91fd043..83c9db3de9 100644 --- a/app/docindex.h +++ b/app/docindex.h @@ -22,12 +22,10 @@ typedef struct idea_manager { /* The scrollbar */ - GtkWidget *vscrollbar, - /* The GTK window */ - *window; + GtkWidget *vscrollbar; + /* The GTK window */ + GtkWidget *window; GtkWidget *tree; - /* The menufactory */ - GtkMenuFactory *menubar; /* The window menu widget */ GtkWidget *window_menu; /* The status bar widget */ @@ -36,7 +34,6 @@ typedef struct idea_manager guint contextid; gboolean changed; gboolean named; - gchar *title; gint auto_save; gint long_term_auto_save; gint count; diff --git a/app/docindexif.c b/app/docindexif.c index 43ea74013b..fc120d5b6d 100644 --- a/app/docindexif.c +++ b/app/docindexif.c @@ -15,6 +15,9 @@ #include #include +#include + +#include "dialog_handler.h" #include "docindex.h" #include "docindexif.h" #include "fileops.h" @@ -56,12 +59,6 @@ open_or_raise (gchar *file_name) } } -gboolean -exit_from_go () -{ - return FALSE; -} - void open_file_in_position (gchar *filename, gint position) { @@ -73,7 +70,8 @@ GtkMenuFactory *create_idea_menu () return NULL; } -GtkWidget *create_idea_toolbar () +GtkWidget * +create_idea_toolbar (void) { GtkWidget *toolbar; @@ -168,7 +166,7 @@ clear_white (FILE *fp) /* reset_usize * A callback so that the window can be resized smaller. */ gint -reset_usize (gpointer data ) +reset_usize (gpointer data) { gtk_widget_set_usize (GTK_WIDGET (data), 0, 0); return FALSE; @@ -178,13 +176,12 @@ void make_idea_window (gint x, gint y) { - GtkWidget *main_vbox, *menu; + GtkWidget *main_vbox; GtkWidget *scrolled_win; GtkWidget *toolbar; - GtkAccelGroup *accel; /* malloc idea_manager */ - ideas = g_malloc0 (sizeof (idea_manager)); + ideas = g_new0 (idea_manager, 1); /* Setup tree */ ideas->tree = gtk_tree_new (); @@ -195,23 +192,11 @@ make_idea_window (gint x, gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS ); gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), - ideas->tree ); + ideas->tree); gtk_widget_show (ideas->tree); /* allocate the window and attach the menu */ ideas->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - ideas->menubar = create_idea_menu (ideas); - if (ideas->menubar) - { - menu = ideas->menubar->widget; - /* Setup accelerator (hotkey) table */ - accel = ideas->menubar->accel_group; - - /* Add accelerators to window widget */ - gtk_window_add_accel_group (GTK_WINDOW (ideas->window), accel); - } - else - menu = NULL; /* Setup the status bar */ ideas->status = gtk_statusbar_new (); @@ -224,25 +209,17 @@ make_idea_window (gint x, /* Setup a vbox to contain the menu */ main_vbox = gtk_vbox_new (FALSE, 0); - if (menu) - gtk_box_pack_start (GTK_BOX (main_vbox), menu, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (main_vbox), toolbar, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (main_vbox), scrolled_win, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (main_vbox), ideas->status, FALSE, FALSE, 0); - if (menu) - gtk_widget_show (menu); gtk_widget_show (scrolled_win); gtk_widget_show (ideas->status); - /* Set the GOWindow title */ - ideas->title = g_strdup (_("Document Index")); - /* Set the GtkWindow title */ - gtk_window_set_title (GTK_WINDOW (ideas->window), ideas->title); + gtk_window_set_title (GTK_WINDOW (ideas->window), _("Document Index")); /* Set the initial status message */ - gtk_statusbar_push (GTK_STATUSBAR (ideas->status), ideas->contextid, - _("GTK successfully started")); + gtk_statusbar_push (GTK_STATUSBAR (ideas->status), ideas->contextid, ""); /* Connect the signals */ gtk_signal_connect (GTK_OBJECT (ideas->window), "delete_event", @@ -267,4 +244,6 @@ make_idea_window (gint x, gimp_help_connect_help_accel (ideas->window, gimp_standard_help_func, "dialogs/document_index.html"); + + dialog_register (ideas->window); } diff --git a/app/docindexif.h b/app/docindexif.h index 3428033bdd..db2f30052b 100644 --- a/app/docindexif.h +++ b/app/docindexif.h @@ -17,14 +17,18 @@ #include +struct bool_char_pair +{ + gboolean boole; + gchar *string; +}; + void open_or_raise (gchar *file_name); void raise_if_match (gpointer data, gpointer user_data); -gboolean exit_from_go (); void open_file_in_position (gchar *filename, gint position); -GtkMenuFactory * create_idea_menu (); -GtkWidget * create_idea_toolbar (); +GtkWidget * create_idea_toolbar (void); void clear_white (FILE *fp); int getinteger (FILE *fp); gchar * append2 (gchar *string1, @@ -33,10 +37,4 @@ gchar * append2 (gchar *string1, gboolean del2); gint reset_usize (gpointer data); -struct bool_char_pair -{ - gboolean boole; - gchar *string; -}; - #endif /* __DOCINDEXIF_H__ */ diff --git a/app/gdisplay_color_ui.c b/app/gdisplay_color_ui.c index aa9581eea4..5aac8e405e 100644 --- a/app/gdisplay_color_ui.c +++ b/app/gdisplay_color_ui.c @@ -16,15 +16,21 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" + +#include + #include "color_area.h" +#include "dialog_handler.h" #include "gdisplay.h" #include "gdisplay_color.h" #include "gdisplay_color_ui.h" #include "gimpimageP.h" #include "gimpui.h" + #include "libgimp/parasite.h" + #include "libgimp/gimpintl.h" -#include + typedef struct _ColorDisplayDialog ColorDisplayDialog; @@ -106,8 +112,8 @@ make_dialog (ColorDisplayDialog *cdd) GtkWidget *hbox; GtkWidget *scrolled_win; GtkWidget *vbbox; - char *titles[2]; - int i; + gchar *titles[2]; + gint i; static ButtonInfo buttons[] = { @@ -131,6 +137,8 @@ make_dialog (ColorDisplayDialog *cdd) NULL); + dialog_register (cdd->shell); + hbox = gtk_hbox_new (FALSE, 4); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox, TRUE, TRUE, 4); diff --git a/app/widgets/gimpcolordisplayeditor.c b/app/widgets/gimpcolordisplayeditor.c index aa9581eea4..5aac8e405e 100644 --- a/app/widgets/gimpcolordisplayeditor.c +++ b/app/widgets/gimpcolordisplayeditor.c @@ -16,15 +16,21 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" + +#include + #include "color_area.h" +#include "dialog_handler.h" #include "gdisplay.h" #include "gdisplay_color.h" #include "gdisplay_color_ui.h" #include "gimpimageP.h" #include "gimpui.h" + #include "libgimp/parasite.h" + #include "libgimp/gimpintl.h" -#include + typedef struct _ColorDisplayDialog ColorDisplayDialog; @@ -106,8 +112,8 @@ make_dialog (ColorDisplayDialog *cdd) GtkWidget *hbox; GtkWidget *scrolled_win; GtkWidget *vbbox; - char *titles[2]; - int i; + gchar *titles[2]; + gint i; static ButtonInfo buttons[] = { @@ -131,6 +137,8 @@ make_dialog (ColorDisplayDialog *cdd) NULL); + dialog_register (cdd->shell); + hbox = gtk_hbox_new (FALSE, 4); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cdd->shell)->vbox), hbox, TRUE, TRUE, 4); diff --git a/modules/cdisplay_gamma.c b/modules/cdisplay_gamma.c index 32d18c59e2..4a969e64e5 100644 --- a/modules/cdisplay_gamma.c +++ b/modules/cdisplay_gamma.c @@ -17,18 +17,23 @@ */ #include "config.h" -#include #include +#include + #include -#include #include #include +#include #include -#include +#include "app/dialog_handler.h" + #include "modregister.h" +#include "libgimp/gimpintl.h" + + #define COLOR_DISPLAY_NAME _("Gamma") typedef struct _GammaContext GammaContext; @@ -116,7 +121,7 @@ module_unload (void *shutdown_data, void (*completed_cb)(void *), void *completed_data) { -#ifndef __EMX__ +#ifndef __EMX__ gimp_color_display_unregister (COLOR_DISPLAY_NAME); #else mod_color_display_unregister (COLOR_DISPLAY_NAME); @@ -157,9 +162,9 @@ gamma_clone (gpointer cd_ID) static void gamma_create_lookup_table (GammaContext *context) { - double one_over_gamma; - double ind; - int i; + gdouble one_over_gamma; + gdouble ind; + gint i; if (context->gamma == 0.0) context->gamma = 1.0; @@ -179,7 +184,10 @@ gamma_destroy (gpointer cd_ID) GammaContext *context = cd_ID; if (context->shell) - gtk_widget_destroy (context->shell); + { + dialog_unregister (context->shell); + gtk_widget_destroy (context->shell); + } g_free (context->lookup); g_free (context); @@ -188,13 +196,13 @@ gamma_destroy (gpointer cd_ID) static void gamma_convert (gpointer cd_ID, guchar *buf, - int width, - int height, - int bpp, - int bpl) + gint width, + gint height, + gint bpp, + gint bpl) { guchar *lookup = ((GammaContext *) cd_ID)->lookup; - int i, j = height; + gint i, j = height; /* You will not be using the entire buffer most of the time. * Hence, the simplistic code for this is as follows: @@ -271,6 +279,7 @@ gamma_configure_ok_callback (GtkWidget *widget, context->gamma = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (context->spinner)); gamma_create_lookup_table (context); + dialog_unregister (context->shell); gtk_widget_destroy (GTK_WIDGET (context->shell)); context->shell = NULL; @@ -284,6 +293,7 @@ gamma_configure_cancel_callback (GtkWidget *widget, { GammaContext *context = data; + dialog_unregister (context->shell); gtk_widget_destroy (GTK_WIDGET (context->shell)); context->shell = NULL; @@ -310,17 +320,20 @@ gamma_configure (gpointer cd_ID, context->cancel_func = cancel_func; context->cancel_data = cancel_data; - context->shell = gimp_dialog_new (_("Gamma"), "gamma", - gimp_standard_help_func, "modules/gamma.html", - GTK_WIN_POS_MOUSE, - FALSE, TRUE, FALSE, + context->shell = + gimp_dialog_new (_("Gamma"), "gamma", + gimp_standard_help_func, "modules/gamma.html", + GTK_WIN_POS_MOUSE, + FALSE, TRUE, FALSE, - _("OK"), gamma_configure_ok_callback, - cd_ID, NULL, NULL, TRUE, FALSE, - _("Cancel"), gamma_configure_cancel_callback, - cd_ID, NULL, NULL, FALSE, TRUE, - - NULL); + _("OK"), gamma_configure_ok_callback, + cd_ID, NULL, NULL, TRUE, FALSE, + _("Cancel"), gamma_configure_cancel_callback, + cd_ID, NULL, NULL, FALSE, TRUE, + + NULL); + + dialog_register (context->shell); hbox = gtk_hbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); @@ -347,9 +360,11 @@ gamma_configure_cancel (gpointer cd_ID) GammaContext *context = cd_ID; if (context->shell) - gtk_widget_destroy (context->shell); - - context->shell = NULL; + { + dialog_unregister (context->shell); + gtk_widget_destroy (context->shell); + context->shell = NULL; + } if (context->cancel_func) context->cancel_func (context, context->cancel_data); diff --git a/modules/cdisplay_highcontrast.c b/modules/cdisplay_highcontrast.c index b071678d9f..8711132e12 100644 --- a/modules/cdisplay_highcontrast.c +++ b/modules/cdisplay_highcontrast.c @@ -19,16 +19,21 @@ #include +#include + #include -#include #include #include #include #include -#include +#include "app/dialog_handler.h" + #include "modregister.h" +#include "libgimp/gimpintl.h" + + #define COLOR_DISPLAY_NAME _("High Contrast") typedef struct _ContrastContext ContrastContext; @@ -98,7 +103,7 @@ static GimpModuleInfo info = G_MODULE_EXPORT GimpModuleStatus module_init (GimpModuleInfo **inforet) { -#ifndef __EMX__ +#ifndef __EMX__ if (gimp_color_display_register (COLOR_DISPLAY_NAME, &methods)) #else if (mod_color_display_register (COLOR_DISPLAY_NAME, &methods)) @@ -116,7 +121,7 @@ module_unload (void *shutdown_data, void (*completed_cb)(void *), void *completed_data) { -#ifndef __EMX__ +#ifndef __EMX__ gimp_color_display_unregister (COLOR_DISPLAY_NAME); #else mod_color_display_unregister (COLOR_DISPLAY_NAME); @@ -125,7 +130,7 @@ module_unload (void *shutdown_data, static gpointer -contrast_new (int type) +contrast_new (gint type) { ContrastContext *context; @@ -155,7 +160,7 @@ contrast_clone (gpointer cd_ID) static void contrast_create_lookup_table (ContrastContext *context) { - int i; + gint i; if (context->contrast == 0.0) context->contrast = 1.0; @@ -173,7 +178,10 @@ contrast_destroy (gpointer cd_ID) ContrastContext *context = cd_ID; if (context->shell) - gtk_widget_destroy (context->shell); + { + dialog_unregister (context->shell); + gtk_widget_destroy (context->shell); + } g_free (context->lookup); g_free (context); @@ -182,13 +190,13 @@ contrast_destroy (gpointer cd_ID) static void contrast_convert (gpointer cd_ID, guchar *buf, - int width, - int height, - int bpp, - int bpl) + gint width, + gint height, + gint bpp, + gint bpl) { guchar *lookup = ((ContrastContext *) cd_ID)->lookup; - int i, j = height; + gint i, j = height; /* You will not be using the entire buffer most of the time. * Hence, the simplistic code for this is as follows: @@ -265,6 +273,7 @@ contrast_configure_ok_callback (GtkWidget *widget, context->contrast = gtk_spin_button_get_value_as_float (GTK_SPIN_BUTTON (context->spinner)); contrast_create_lookup_table (context); + dialog_unregister (context->shell); gtk_widget_destroy (GTK_WIDGET (context->shell)); context->shell = NULL; @@ -278,6 +287,7 @@ contrast_configure_cancel_callback (GtkWidget *widget, { ContrastContext *context = data; + dialog_unregister (context->shell); gtk_widget_destroy (GTK_WIDGET (context->shell)); context->shell = NULL; @@ -304,17 +314,20 @@ contrast_configure (gpointer cd_ID, context->cancel_func = cancel_func; context->cancel_data = cancel_data; - context->shell = gimp_dialog_new (_("High Contrast"), "high contrast", - gimp_standard_help_func, "modules/highcontrast.html", - GTK_WIN_POS_MOUSE, - FALSE, TRUE, FALSE, + context->shell = + gimp_dialog_new (_("High Contrast"), "high contrast", + gimp_standard_help_func, "modules/highcontrast.html", + GTK_WIN_POS_MOUSE, + FALSE, TRUE, FALSE, - _("OK"), contrast_configure_ok_callback, - cd_ID, NULL, NULL, TRUE, FALSE, - _("Cancel"), contrast_configure_cancel_callback, - cd_ID, NULL, NULL, FALSE, TRUE, - - NULL); + _("OK"), contrast_configure_ok_callback, + cd_ID, NULL, NULL, TRUE, FALSE, + _("Cancel"), contrast_configure_cancel_callback, + cd_ID, NULL, NULL, FALSE, TRUE, + + NULL); + + dialog_register (context->shell); hbox = gtk_hbox_new (FALSE, 2); gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); @@ -341,9 +354,11 @@ contrast_configure_cancel (gpointer cd_ID) ContrastContext *context = cd_ID; if (context->shell) - gtk_widget_destroy (context->shell); - - context->shell = NULL; + { + dialog_unregister (context->shell); + gtk_widget_destroy (context->shell); + context->shell = NULL; + } if (context->cancel_func) context->cancel_func (context, context->cancel_data);