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".
This commit is contained in:
Michael Natterer 2003-01-10 19:30:32 +00:00 committed by Michael Natterer
parent 8d86ec25e0
commit dd27eb1ec9
25 changed files with 147 additions and 436 deletions

View File

@ -1,3 +1,24 @@
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

View File

@ -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));
}

View File

@ -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;

View File

@ -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;

View File

@ -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));
}

View File

@ -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);

View File

@ -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,

View File

@ -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);
}

View File

@ -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);
if (! view)
return;
view = GIMP_IMAGE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}

View File

@ -30,7 +30,6 @@
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimptoolbox-color-area.h"
#include "color-notebook.h"
@ -59,10 +58,7 @@ palette_editor_new_color_cmd_callback (GtkWidget *widget,
GimpContext *user_context;
GimpRGB color;
editor = (GimpPaletteEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
@ -87,10 +83,7 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
GimpPaletteEditor *editor;
GimpPalette *palette;
editor = (GimpPaletteEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
@ -133,10 +126,7 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget,
GimpPaletteEditor *editor;
GimpPalette *palette;
editor = (GimpPaletteEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);

View File

@ -33,7 +33,6 @@
#include "widgets/gimpitemfactory.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimppreview.h"
#include "widgets/gimpwidgets-utils.h"
#include "palette-import-dialog.h"
#include "palettes-commands.h"
@ -63,10 +62,7 @@ palettes_import_palette_cmd_callback (GtkWidget *widget,
{
GimpContainerEditor *editor;
editor = (GimpContainerEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_CONTAINER_EDITOR (data);
palette_import_dialog_show (editor->view->context->gimp);
}
@ -77,10 +73,7 @@ palettes_merge_palettes_cmd_callback (GtkWidget *widget,
{
GimpContainerEditor *editor;
editor = (GimpContainerEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_CONTAINER_EDITOR (data);
palettes_merge_palettes_query (editor);
}

View File

@ -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));
}

View File

@ -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;

View File

@ -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));
}

View File

@ -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);

View File

@ -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,

View File

@ -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);
}

View File

@ -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);
if (! view)
return;
view = GIMP_IMAGE_VIEW (data);
gtk_button_clicked (GTK_BUTTON (view->delete_button));
}

View File

@ -30,7 +30,6 @@
#include "widgets/gimppaletteeditor.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "widgets/gimptoolbox-color-area.h"
#include "color-notebook.h"
@ -59,10 +58,7 @@ palette_editor_new_color_cmd_callback (GtkWidget *widget,
GimpContext *user_context;
GimpRGB color;
editor = (GimpPaletteEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
@ -87,10 +83,7 @@ palette_editor_edit_color_cmd_callback (GtkWidget *widget,
GimpPaletteEditor *editor;
GimpPalette *palette;
editor = (GimpPaletteEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);
@ -133,10 +126,7 @@ palette_editor_delete_color_cmd_callback (GtkWidget *widget,
GimpPaletteEditor *editor;
GimpPalette *palette;
editor = (GimpPaletteEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_PALETTE_EDITOR (data);
palette = GIMP_PALETTE (GIMP_DATA_EDITOR (editor)->data);

View File

@ -33,7 +33,6 @@
#include "widgets/gimpitemfactory.h"
#include "widgets/gimplistitem.h"
#include "widgets/gimppreview.h"
#include "widgets/gimpwidgets-utils.h"
#include "palette-import-dialog.h"
#include "palettes-commands.h"
@ -63,10 +62,7 @@ palettes_import_palette_cmd_callback (GtkWidget *widget,
{
GimpContainerEditor *editor;
editor = (GimpContainerEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_CONTAINER_EDITOR (data);
palette_import_dialog_show (editor->view->context->gimp);
}
@ -77,10 +73,7 @@ palettes_merge_palettes_cmd_callback (GtkWidget *widget,
{
GimpContainerEditor *editor;
editor = (GimpContainerEditor *) gimp_widget_get_callback_context (widget);
if (! editor)
return;
editor = GIMP_CONTAINER_EDITOR (data);
palettes_merge_palettes_query (editor);
}

View File

@ -28,7 +28,6 @@
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpdatafactoryview.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "patterns-commands.h"

View File

@ -252,7 +252,7 @@ gimp_colormap_editor_new (GimpImage *gimage,
editor->item_factory = gimp_menu_factory_menu_new (menu_factory,
"<ColormapEditor>",
GTK_TYPE_MENU,
menu_factory->gimp,
editor,
FALSE);
/* The palette frame */

View File

@ -156,7 +156,7 @@ gimp_container_editor_construct (GimpContainerEditor *editor,
editor->item_factory = gimp_menu_factory_menu_new (menu_factory,
menu_identifier,
GTK_TYPE_MENU,
context->gimp,
editor,
FALSE);
switch (view_type)

View File

@ -57,21 +57,21 @@ struct _GimpContainerEditorClass
};
GType gimp_container_editor_get_type (void) G_GNUC_CONST;
GType gimp_container_editor_get_type (void) G_GNUC_CONST;
/* protected */
gboolean gimp_container_editor_construct (GimpContainerEditor *editor,
GimpViewType view_type,
GimpContainer *container,
GimpContext *context,
gint preview_size,
gboolean reorderable,
gint min_items_x,
gint min_items_y,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier);
gboolean gimp_container_editor_construct (GimpContainerEditor *editor,
GimpViewType view_type,
GimpContainer *container,
GimpContext *context,
gint preview_size,
gboolean reorderable,
gint min_items_x,
gint min_items_y,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier);
#endif /* __GIMP_CONTAINER_EDITOR_H__ */

View File

@ -222,7 +222,7 @@ gimp_data_editor_construct (GimpDataEditor *editor,
editor->item_factory = gimp_menu_factory_menu_new (menu_factory,
menu_identifier,
GTK_TYPE_MENU,
gimp,
editor,
FALSE);
data = (GimpData *)