Commit dd27eb1e authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/widgets/gimpcolormapeditor.c app/widgets/gimpcontainereditor.[ch] pass

2003-01-10  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimpcolormapeditor.c
	* app/widgets/gimpcontainereditor.[ch]
	* app/widgets/gimpdataeditor.c: pass the editor widget as
	callback_data to GtkItemFactory callbacks, not a "Gimp" pointer.

	* app/gui/buffers-commands.c
	* app/gui/colormap-editor-commands.c
	* app/gui/data-commands.c
	* app/gui/documents-commands.c
	* app/gui/gradient-editor-commands.c
	* app/gui/gradients-commands.c
	* app/gui/images-commands.c
	* app/gui/palette-editor-commands.c
	* app/gui/palettes-commands.c

	* app/gui/patterns-commands.c: simply cast the passed "data"
	pointer instead of calling gimp_widget_get_callback_context().
	Don't #include "widgets/gimpwidgets-utils.h".
parent 8d86ec25
2003-01-10 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcolormapeditor.c
* app/widgets/gimpcontainereditor.[ch]
* app/widgets/gimpdataeditor.c: pass the editor widget as
callback_data to GtkItemFactory callbacks, not a "Gimp" pointer.
* app/gui/buffers-commands.c
* app/gui/colormap-editor-commands.c
* app/gui/data-commands.c
* app/gui/documents-commands.c
* app/gui/gradient-editor-commands.c
* app/gui/gradients-commands.c
* app/gui/images-commands.c
* app/gui/palette-editor-commands.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c: simply cast the passed "data"
pointer instead of calling gimp_widget_get_callback_context().
Don't #include "widgets/gimpwidgets-utils.h".
2003-01-10 Michael Natterer <mitch@gimp.org>
 
Move away from creating all item_factories statically in
......
......@@ -32,7 +32,6 @@
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimpwidgets-utils.h"
#include "buffers-commands.h"
......@@ -47,10 +46,7 @@ buffers_paste_buffer_cmd_callback (GtkWidget *widget,
{
GimpBufferView *view;
view = (GimpBufferView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->paste_button));
}
......@@ -61,10 +57,7 @@ buffers_paste_buffer_into_cmd_callback (GtkWidget *widget,
{
GimpBufferView *view;
view = (GimpBufferView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->paste_into_button));
}
......@@ -75,10 +68,7 @@ buffers_paste_buffer_as_new_cmd_callback (GtkWidget *widget,
{
GimpBufferView *view;
view = (GimpBufferView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->paste_as_new_button));
}
......@@ -89,10 +79,7 @@ buffers_delete_buffer_cmd_callback (GtkWidget *widget,
{
GimpBufferView *view;
view = (GimpBufferView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_BUFFER_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
......
......@@ -32,7 +32,6 @@
#include "widgets/gimpcolormapeditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "color-notebook.h"
#include "colormap-editor-commands.h"
......@@ -58,10 +57,7 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget,
GimpColormapEditor *editor;
GimpImage *gimage;
editor = (GimpColormapEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
......@@ -85,10 +81,7 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
GimpImage *gimage;
GimpRGB color;
editor = (GimpColormapEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
......
......@@ -32,7 +32,6 @@
#include "widgets/gimpcolormapeditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "color-notebook.h"
#include "colormap-editor-commands.h"
......@@ -58,10 +57,7 @@ colormap_editor_add_color_cmd_callback (GtkWidget *widget,
GimpColormapEditor *editor;
GimpImage *gimage;
editor = (GimpColormapEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
......@@ -85,10 +81,7 @@ colormap_editor_edit_color_cmd_callback (GtkWidget *widget,
GimpImage *gimage;
GimpRGB color;
editor = (GimpColormapEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_COLORMAP_EDITOR (data);
gimage = editor->gimage;
......
......@@ -23,7 +23,6 @@
#include "gui-types.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpwidgets-utils.h"
#include "data-commands.h"
......@@ -36,15 +35,10 @@ data_new_data_cmd_callback (GtkWidget *widget,
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->new_button))
{
gtk_button_clicked (GTK_BUTTON (view->new_button));
}
gtk_button_clicked (GTK_BUTTON (view->new_button));
}
void
......@@ -53,15 +47,10 @@ data_duplicate_data_cmd_callback (GtkWidget *widget,
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->duplicate_button))
{
gtk_button_clicked (GTK_BUTTON (view->duplicate_button));
}
gtk_button_clicked (GTK_BUTTON (view->duplicate_button));
}
void
......@@ -70,15 +59,10 @@ data_edit_data_cmd_callback (GtkWidget *widget,
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->edit_button))
{
gtk_button_clicked (GTK_BUTTON (view->edit_button));
}
gtk_button_clicked (GTK_BUTTON (view->edit_button));
}
void
......@@ -87,15 +71,10 @@ data_delete_data_cmd_callback (GtkWidget *widget,
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->delete_button))
{
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}
void
......@@ -104,13 +83,8 @@ data_refresh_data_cmd_callback (GtkWidget *widget,
{
GimpDataFactoryView *view;
view = (GimpDataFactoryView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DATA_FACTORY_VIEW (data);
if (GTK_WIDGET_SENSITIVE (view->refresh_button))
{
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
}
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
}
......@@ -31,7 +31,6 @@
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpdocumentview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "documents-commands.h"
......@@ -46,10 +45,7 @@ documents_open_document_cmd_callback (GtkWidget *widget,
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DOCUMENT_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->open_button));
}
......@@ -60,10 +56,7 @@ documents_raise_or_open_document_cmd_callback (GtkWidget *widget,
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DOCUMENT_VIEW (data);
gimp_button_extended_clicked (GIMP_BUTTON (view->open_button),
GDK_SHIFT_MASK);
......@@ -75,10 +68,7 @@ documents_file_open_dialog_cmd_callback (GtkWidget *widget,
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DOCUMENT_VIEW (data);
gimp_button_extended_clicked (GIMP_BUTTON (view->open_button),
GDK_CONTROL_MASK);
......@@ -90,10 +80,7 @@ documents_remove_document_cmd_callback (GtkWidget *widget,
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DOCUMENT_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->remove_button));
}
......@@ -105,10 +92,7 @@ documents_recreate_preview_cmd_callback (GtkWidget *widget,
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DOCUMENT_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
}
......@@ -119,10 +103,7 @@ documents_reload_previews_cmd_callback (GtkWidget *widget,
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DOCUMENT_VIEW (data);
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_SHIFT_MASK);
......@@ -134,10 +115,7 @@ documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_DOCUMENT_VIEW (data);
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_CONTROL_MASK);
......
......@@ -31,7 +31,6 @@
#include "widgets/gimpgradienteditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpwidgets-utils.h"
#include "color-notebook.h"
#include "gradient-editor-commands.h"
......@@ -73,10 +72,7 @@ gradient_editor_left_color_cmd_callback (GtkWidget *widget,
GimpGradientEditor *editor;
GimpGradient *gradient;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -109,10 +105,7 @@ gradient_editor_load_left_cmd_callback (GtkWidget *widget,
GimpRGB color;
gint i;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -184,10 +177,7 @@ gradient_editor_save_left_cmd_callback (GtkWidget *widget,
{
GimpGradientEditor *editor;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
editor->saved_colors[action] = editor->control_sel_l->left_color;
}
......@@ -200,10 +190,7 @@ gradient_editor_right_color_cmd_callback (GtkWidget *widget,
GimpGradientEditor *editor;
GimpGradient *gradient;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -236,10 +223,7 @@ gradient_editor_load_right_cmd_callback (GtkWidget *widget,
GimpRGB color;
gint i;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -311,10 +295,7 @@ gradient_editor_save_right_cmd_callback (GtkWidget *widget,
{
GimpGradientEditor *editor;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
editor->saved_colors[action] = editor->control_sel_l->left_color;
}
......@@ -324,7 +305,7 @@ gradient_editor_blending_func_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpGradientEditor *editor;
GimpGradientEditor *editor;
GimpGradient *gradient;
GimpGradientSegmentType type;
GimpGradientSegment *seg, *aseg;
......@@ -332,10 +313,7 @@ gradient_editor_blending_func_cmd_callback (GtkWidget *widget,
if (! GTK_CHECK_MENU_ITEM (widget)->active)
return;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -362,7 +340,7 @@ gradient_editor_coloring_type_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpGradientEditor *editor;
GimpGradientEditor *editor;
GimpGradient *gradient;
GimpGradientSegmentColor color;
GimpGradientSegment *seg, *aseg;
......@@ -370,10 +348,7 @@ gradient_editor_coloring_type_cmd_callback (GtkWidget *widget,
if (! GTK_CHECK_MENU_ITEM (widget)->active)
return;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -400,17 +375,14 @@ gradient_editor_flip_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpGradientEditor *editor;
GimpGradientEditor *editor;
GimpGradient *gradient;
GimpGradientSegment *oseg, *oaseg;
GimpGradientSegment *seg, *prev, *tmp;
GimpGradientSegment *lseg, *rseg;
gdouble left, right;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -541,10 +513,7 @@ gradient_editor_replicate_cmd_callback (GtkWidget *widget,
const gchar *title;
const gchar *desc;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
if (editor->control_sel_l == editor->control_sel_r)
{
......@@ -617,10 +586,7 @@ gradient_editor_split_midpoint_cmd_callback (GtkWidget *widget,
GimpGradient *gradient;
GimpGradientSegment *seg, *lseg, *rseg;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -655,10 +621,7 @@ gradient_editor_split_uniformly_cmd_callback (GtkWidget *widget,
const gchar *title;
const gchar *desc;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
if (editor->control_sel_l == editor->control_sel_r)
{
......@@ -730,15 +693,12 @@ gradient_editor_delete_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpGradientEditor *editor;
GimpGradientEditor *editor;
GimpGradient *gradient;
GimpGradientSegment *lseg, *rseg, *seg, *aseg, *next;
gdouble join;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -822,14 +782,11 @@ gradient_editor_recenter_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpGradientEditor *editor;
GimpGradientEditor *editor;
GimpGradient *gradient;
GimpGradientSegment *seg, *aseg;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -855,17 +812,14 @@ gradient_editor_redistribute_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
GimpGradientEditor *editor;
GimpGradientEditor *editor;
GimpGradient *gradient;
GimpGradientSegment *seg, *aseg;
gdouble left, right, seg_len;
gint num_segs;
gint i;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gradient = GIMP_GRADIENT (GIMP_DATA_EDITOR (editor)->data);
......@@ -921,10 +875,7 @@ gradient_editor_blend_color_cmd_callback (GtkWidget *widget,
{
GimpGradientEditor *editor;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gimp_gradient_segments_blend_endpoints (editor->control_sel_l,
editor->control_sel_r,
......@@ -944,10 +895,7 @@ gradient_editor_blend_opacity_cmd_callback (GtkWidget *widget,
{
GimpGradientEditor *editor;
editor = (GimpGradientEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_GRADIENT_EDITOR (data);
gimp_gradient_segments_blend_endpoints (editor->control_sel_l,
editor->control_sel_r,
......
......@@ -32,7 +32,6 @@
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "gradients-commands.h"
......@@ -54,10 +53,7 @@ gradients_save_as_pov_ray_cmd_callback (GtkWidget *widget,
{
GimpContainerEditor *editor;
editor = (GimpContainerEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_CONTAINER_EDITOR (data);
gradients_save_as_pov_query (editor);
}
......
......@@ -31,7 +31,6 @@
#include "widgets/gimpcontainerlistview.h"
#include "widgets/gimpimageview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "images-commands.h"
......@@ -46,10 +45,7 @@ images_raise_displays_cmd_callback (GtkWidget *widget,
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_IMAGE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->raise_button));
}
......@@ -60,10 +56,7 @@ images_new_display_cmd_callback (GtkWidget *widget,
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
view = GIMP_IMAGE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->new_button));
}
......@@ -74,10 +67,7 @@ images_delete_image_cmd_callback (GtkWidget *widget,
{
GimpImageView *view;
view = (GimpImageView *) gimp_widget_get_callback_context (widget);