From c8efb90364641bdbb532082f77490775e26ecc78 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 20 Apr 2004 13:44:19 +0000 Subject: [PATCH] renamed convert_to_indexed() to convert_dialog_new() and return the 2004-04-20 Michael Natterer * app/gui/convert-dialog.[ch]: renamed convert_to_indexed() to convert_dialog_new() and return the dialog. Removed convert_to_rgb() and convert_to_grayscale(). * app/gui/offset-dialog.[ch]: renamed offset_dialog_create() to offset_dialog_new() and return the dialog. * app/Makefile.am * app/actions/drawable-commands.c * app/actions/image-commands.c: changed accordingly. --- ChangeLog | 13 +++++++++++++ app/Makefile.am | 4 ++-- app/actions/drawable-commands.c | 4 +++- app/actions/image-commands.c | 11 ++++++++--- app/dialogs/convert-dialog.c | 28 +++++----------------------- app/dialogs/convert-dialog.h | 6 ++---- app/dialogs/offset-dialog.c | 13 +++++++------ app/dialogs/offset-dialog.h | 4 ++-- app/gui/convert-dialog.c | 28 +++++----------------------- app/gui/convert-dialog.h | 6 ++---- app/gui/offset-dialog.c | 13 +++++++------ app/gui/offset-dialog.h | 4 ++-- 12 files changed, 58 insertions(+), 76 deletions(-) diff --git a/ChangeLog b/ChangeLog index a38d8cbf72..d5ef161d52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-04-20 Michael Natterer + + * app/gui/convert-dialog.[ch]: renamed convert_to_indexed() + to convert_dialog_new() and return the dialog. Removed + convert_to_rgb() and convert_to_grayscale(). + + * app/gui/offset-dialog.[ch]: renamed offset_dialog_create() + to offset_dialog_new() and return the dialog. + + * app/Makefile.am + * app/actions/drawable-commands.c + * app/actions/image-commands.c: changed accordingly. + 2004-04-20 Michael Natterer * app/gui/*-commands.[ch]: removed... diff --git a/app/Makefile.am b/app/Makefile.am index 4b6ae91167..9b06c661e2 100644 --- a/app/Makefile.am +++ b/app/Makefile.am @@ -81,11 +81,11 @@ gimp_2_1_LDFLAGS = \ -u $(SYMPREFIX)gimp_xml_parser_new \ -u $(SYMPREFIX)gimp_drawable_stroke_vectors \ \ - -u $(SYMPREFIX)convert_to_indexed \ + -u $(SYMPREFIX)convert_dialog_new \ -u $(SYMPREFIX)grid_dialog_new \ -u $(SYMPREFIX)info_dialog_new \ -u $(SYMPREFIX)info_window_create \ - -u $(SYMPREFIX)offset_dialog_create \ + -u $(SYMPREFIX)offset_dialog_new \ -u $(SYMPREFIX)palette_import_dialog_show \ -u $(SYMPREFIX)resize_widget_new \ -u $(SYMPREFIX)stroke_dialog_new \ diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c index 061be6b10b..315df5921d 100644 --- a/app/actions/drawable-commands.c +++ b/app/actions/drawable-commands.c @@ -219,7 +219,9 @@ drawable_offset_cmd_callback (GtkWidget *widget, { GimpImage *gimage; GimpDrawable *drawable; + GtkWidget *dialog; return_if_no_drawable (gimage, drawable, data); - offset_dialog_create (drawable, widget); + dialog = offset_dialog_new (drawable, widget); + gtk_widget_show (dialog); } diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c index a4321bf5b3..ce40e512bf 100644 --- a/app/actions/image-commands.c +++ b/app/actions/image-commands.c @@ -32,6 +32,7 @@ #include "core/gimpchannel.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" +#include "core/gimpimage-convert.h" #include "core/gimpimage-crop.h" #include "core/gimpimage-duplicate.h" #include "core/gimpimage-flip.h" @@ -115,7 +116,8 @@ image_convert_rgb_cmd_callback (GtkWidget *widget, GimpImage *gimage; return_if_no_image (gimage, data); - convert_to_rgb (gimage); + gimp_image_convert (gimage, GIMP_RGB, 0, 0, FALSE, FALSE, 0, NULL); + gimp_image_flush (gimage); } void @@ -125,7 +127,8 @@ image_convert_grayscale_cmd_callback (GtkWidget *widget, GimpImage *gimage; return_if_no_image (gimage, data); - convert_to_grayscale (gimage); + gimp_image_convert (gimage, GIMP_GRAY, 0, 0, FALSE, FALSE, 0, NULL); + gimp_image_flush (gimage); } void @@ -133,9 +136,11 @@ image_convert_indexed_cmd_callback (GtkWidget *widget, gpointer data) { GimpImage *gimage; + GtkWidget *dialog; return_if_no_image (gimage, data); - convert_to_indexed (gimage, widget); + dialog = convert_dialog_new (gimage, widget); + gtk_widget_show (dialog); } void diff --git a/app/dialogs/convert-dialog.c b/app/dialogs/convert-dialog.c index 026e01cc1b..7b988d176d 100644 --- a/app/dialogs/convert-dialog.c +++ b/app/dialogs/convert-dialog.c @@ -80,26 +80,8 @@ static gint saved_num_colors = 256; static GimpConvertPaletteType saved_palette_type = GIMP_MAKE_PALETTE; -void -convert_to_rgb (GimpImage *gimage) -{ - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - - gimp_image_convert (gimage, GIMP_RGB, 0, 0, FALSE, FALSE, 0, NULL); - gimp_image_flush (gimage); -} - -void -convert_to_grayscale (GimpImage* gimage) -{ - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - - gimp_image_convert (gimage, GIMP_GRAY, 0, 0, FALSE, FALSE, 0, NULL); - gimp_image_flush (gimage); -} - -void -convert_to_indexed (GimpImage *gimage, +GtkWidget * +convert_dialog_new (GimpImage *gimage, GtkWidget *parent) { IndexedDialog *dialog; @@ -113,8 +95,8 @@ convert_to_indexed (GimpImage *gimage, GtkWidget *toggle; GSList *group = NULL; - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - g_return_if_fail (GTK_IS_WIDGET (parent)); + g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); + g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); dialog = g_new0 (IndexedDialog, 1); @@ -359,7 +341,7 @@ convert_to_indexed (GimpImage *gimage, gtk_widget_show (label); } - gtk_widget_show (dialog->shell); + return dialog->shell; } diff --git a/app/dialogs/convert-dialog.h b/app/dialogs/convert-dialog.h index d94bccdc6d..315a66eade 100644 --- a/app/dialogs/convert-dialog.h +++ b/app/dialogs/convert-dialog.h @@ -20,10 +20,8 @@ #define __CONVERT_DIALOG_H__ -void convert_to_rgb (GimpImage *gimage); -void convert_to_grayscale (GimpImage *gimage); -void convert_to_indexed (GimpImage *gimage, - GtkWidget *parent); +GtkWidget * convert_dialog_new (GimpImage *gimage, + GtkWidget *parent); #endif /* __CONVERT_DIALOG_H__ */ diff --git a/app/dialogs/offset-dialog.c b/app/dialogs/offset-dialog.c index 1279d0bdb6..30bc1d8ef8 100644 --- a/app/dialogs/offset-dialog.c +++ b/app/dialogs/offset-dialog.c @@ -69,9 +69,9 @@ static void offset_halfheight_callback (GtkWidget *widget, /* public functions */ -void -offset_dialog_create (GimpDrawable *drawable, - GtkWidget *parent) +GtkWidget * +offset_dialog_new (GimpDrawable *drawable, + GtkWidget *parent) { OffsetDialog *off_d; GtkWidget *check; @@ -84,8 +84,8 @@ offset_dialog_create (GimpDrawable *drawable, GtkWidget *radio_button; const gchar *title = NULL; - g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); - g_return_if_fail (GTK_IS_WIDGET (parent)); + g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); + g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); off_d = g_new0 (OffsetDialog, 1); @@ -223,7 +223,8 @@ offset_dialog_create (GimpDrawable *drawable, gtk_widget_set_sensitive (frame, ! off_d->wrap_around); gtk_widget_show (vbox); - gtk_widget_show (off_d->dlg); + + return off_d->dlg; } diff --git a/app/dialogs/offset-dialog.h b/app/dialogs/offset-dialog.h index ca63f580d9..7311da5913 100644 --- a/app/dialogs/offset-dialog.h +++ b/app/dialogs/offset-dialog.h @@ -20,8 +20,8 @@ #define __OFFSET_DIALOG_H__ -void offset_dialog_create (GimpDrawable *drawable, - GtkWidget *parent); +GtkWidget * offset_dialog_new (GimpDrawable *drawable, + GtkWidget *parent); #endif /* __OFFSET_DIALOG_H__ */ diff --git a/app/gui/convert-dialog.c b/app/gui/convert-dialog.c index 026e01cc1b..7b988d176d 100644 --- a/app/gui/convert-dialog.c +++ b/app/gui/convert-dialog.c @@ -80,26 +80,8 @@ static gint saved_num_colors = 256; static GimpConvertPaletteType saved_palette_type = GIMP_MAKE_PALETTE; -void -convert_to_rgb (GimpImage *gimage) -{ - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - - gimp_image_convert (gimage, GIMP_RGB, 0, 0, FALSE, FALSE, 0, NULL); - gimp_image_flush (gimage); -} - -void -convert_to_grayscale (GimpImage* gimage) -{ - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - - gimp_image_convert (gimage, GIMP_GRAY, 0, 0, FALSE, FALSE, 0, NULL); - gimp_image_flush (gimage); -} - -void -convert_to_indexed (GimpImage *gimage, +GtkWidget * +convert_dialog_new (GimpImage *gimage, GtkWidget *parent) { IndexedDialog *dialog; @@ -113,8 +95,8 @@ convert_to_indexed (GimpImage *gimage, GtkWidget *toggle; GSList *group = NULL; - g_return_if_fail (GIMP_IS_IMAGE (gimage)); - g_return_if_fail (GTK_IS_WIDGET (parent)); + g_return_val_if_fail (GIMP_IS_IMAGE (gimage), NULL); + g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); dialog = g_new0 (IndexedDialog, 1); @@ -359,7 +341,7 @@ convert_to_indexed (GimpImage *gimage, gtk_widget_show (label); } - gtk_widget_show (dialog->shell); + return dialog->shell; } diff --git a/app/gui/convert-dialog.h b/app/gui/convert-dialog.h index d94bccdc6d..315a66eade 100644 --- a/app/gui/convert-dialog.h +++ b/app/gui/convert-dialog.h @@ -20,10 +20,8 @@ #define __CONVERT_DIALOG_H__ -void convert_to_rgb (GimpImage *gimage); -void convert_to_grayscale (GimpImage *gimage); -void convert_to_indexed (GimpImage *gimage, - GtkWidget *parent); +GtkWidget * convert_dialog_new (GimpImage *gimage, + GtkWidget *parent); #endif /* __CONVERT_DIALOG_H__ */ diff --git a/app/gui/offset-dialog.c b/app/gui/offset-dialog.c index 1279d0bdb6..30bc1d8ef8 100644 --- a/app/gui/offset-dialog.c +++ b/app/gui/offset-dialog.c @@ -69,9 +69,9 @@ static void offset_halfheight_callback (GtkWidget *widget, /* public functions */ -void -offset_dialog_create (GimpDrawable *drawable, - GtkWidget *parent) +GtkWidget * +offset_dialog_new (GimpDrawable *drawable, + GtkWidget *parent) { OffsetDialog *off_d; GtkWidget *check; @@ -84,8 +84,8 @@ offset_dialog_create (GimpDrawable *drawable, GtkWidget *radio_button; const gchar *title = NULL; - g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); - g_return_if_fail (GTK_IS_WIDGET (parent)); + g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), NULL); + g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL); off_d = g_new0 (OffsetDialog, 1); @@ -223,7 +223,8 @@ offset_dialog_create (GimpDrawable *drawable, gtk_widget_set_sensitive (frame, ! off_d->wrap_around); gtk_widget_show (vbox); - gtk_widget_show (off_d->dlg); + + return off_d->dlg; } diff --git a/app/gui/offset-dialog.h b/app/gui/offset-dialog.h index ca63f580d9..7311da5913 100644 --- a/app/gui/offset-dialog.h +++ b/app/gui/offset-dialog.h @@ -20,8 +20,8 @@ #define __OFFSET_DIALOG_H__ -void offset_dialog_create (GimpDrawable *drawable, - GtkWidget *parent); +GtkWidget * offset_dialog_new (GimpDrawable *drawable, + GtkWidget *parent); #endif /* __OFFSET_DIALOG_H__ */