Commit 4d6b4f51 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

implement GtkDialog::close() and synthesize a "delete_event"

2003-03-20  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpdialog.c: implement GtkDialog::close() and
	synthesize a "delete_event" unconditionally.

	* app/widgets/gimpviewabledialog.c: emit "close" instead of
	synthesizing "delete_event".

	* app/widgets/gimppreview.[ch]: removed "extended_clicked" signal
	and added "GdkModifierType state" to "clicked"'s signature.

	* app/gui/file-open-dialog.c
	* app/gui/test-commands.c
	* app/widgets/gimpcontainergridview.c
	* app/widgets/gimptoolbox-indicator-area.c: changed accordingly.
parent af066154
2003-03-20 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpdialog.c: implement GtkDialog::close() and
synthesize a "delete_event" unconditionally.
* app/widgets/gimpviewabledialog.c: emit "close" instead of
synthesizing "delete_event".
* app/widgets/gimppreview.[ch]: removed "extended_clicked" signal
and added "GdkModifierType state" to "clicked"'s signature.
* app/gui/file-open-dialog.c
* app/gui/test-commands.c
* app/widgets/gimpcontainergridview.c
* app/widgets/gimptoolbox-indicator-area.c: changed accordingly.
2003-03-20 Sven Neumann <sven@gimp.org>
* app/core/gimpimage-new.c (gimp_image_new_values_new): default
......@@ -76,9 +76,7 @@ static gboolean file_open_thumbnail_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GtkWidget *open_dialog);
static void file_open_thumbnail_clicked (GtkWidget *widget,
GtkWidget *open_dialog);
static void file_open_thumbnail_ext_clicked (GtkWidget *widget,
guint state,
GdkModifierType state,
GtkWidget *open_dialog);
static void file_open_ok_callback (GtkWidget *widget,
GtkWidget *open_dialog);
......@@ -293,9 +291,6 @@ file_open_dialog_create (Gimp *gimp,
g_signal_connect (open_options_preview, "clicked",
G_CALLBACK (file_open_thumbnail_clicked),
open_dialog);
g_signal_connect (open_options_preview, "extended_clicked",
G_CALLBACK (file_open_thumbnail_ext_clicked),
open_dialog);
open_options_title = gtk_label_new (_("No Selection"));
gtk_box_pack_start (GTK_BOX (vbox2),
......@@ -578,16 +573,9 @@ file_open_thumbnail_button_press (GtkWidget *widget,
}
static void
file_open_thumbnail_clicked (GtkWidget *widget,
GtkWidget *open_dialog)
{
file_open_create_thumbnails (open_dialog, FALSE);
}
static void
file_open_thumbnail_ext_clicked (GtkWidget *widget,
guint state,
GtkWidget *open_dialog)
file_open_thumbnail_clicked (GtkWidget *widget,
GdkModifierType state,
GtkWidget *open_dialog)
{
gboolean always_create;
......
......@@ -76,9 +76,7 @@ static gboolean file_open_thumbnail_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GtkWidget *open_dialog);
static void file_open_thumbnail_clicked (GtkWidget *widget,
GtkWidget *open_dialog);
static void file_open_thumbnail_ext_clicked (GtkWidget *widget,
guint state,
GdkModifierType state,
GtkWidget *open_dialog);
static void file_open_ok_callback (GtkWidget *widget,
GtkWidget *open_dialog);
......@@ -293,9 +291,6 @@ file_open_dialog_create (Gimp *gimp,
g_signal_connect (open_options_preview, "clicked",
G_CALLBACK (file_open_thumbnail_clicked),
open_dialog);
g_signal_connect (open_options_preview, "extended_clicked",
G_CALLBACK (file_open_thumbnail_ext_clicked),
open_dialog);
open_options_title = gtk_label_new (_("No Selection"));
gtk_box_pack_start (GTK_BOX (vbox2),
......@@ -578,16 +573,9 @@ file_open_thumbnail_button_press (GtkWidget *widget,
}
static void
file_open_thumbnail_clicked (GtkWidget *widget,
GtkWidget *open_dialog)
{
file_open_create_thumbnails (open_dialog, FALSE);
}
static void
file_open_thumbnail_ext_clicked (GtkWidget *widget,
guint state,
GtkWidget *open_dialog)
file_open_thumbnail_clicked (GtkWidget *widget,
GdkModifierType state,
GtkWidget *open_dialog)
{
gboolean always_create;
......
......@@ -65,6 +65,7 @@ container_view_scale_callback (GtkAdjustment *adj,
static void
brushes_callback (GtkWidget *widget,
GdkModifierType state,
GimpContainerView *view)
{
gimp_container_view_set_container (view, view->context->gimp->brush_factory->container);
......@@ -72,6 +73,7 @@ brushes_callback (GtkWidget *widget,
static void
patterns_callback (GtkWidget *widget,
GdkModifierType state,
GimpContainerView *view)
{
gimp_container_view_set_container (view, view->context->gimp->pattern_factory->container);
......@@ -79,6 +81,7 @@ patterns_callback (GtkWidget *widget,
static void
gradients_callback (GtkWidget *widget,
GdkModifierType state,
GimpContainerView *view)
{
gimp_container_view_set_container (view, view->context->gimp->gradient_factory->container);
......@@ -86,6 +89,7 @@ gradients_callback (GtkWidget *widget,
static void
palettes_callback (GtkWidget *widget,
GdkModifierType state,
GimpContainerView *view)
{
gimp_container_view_set_container (view, view->context->gimp->palette_factory->container);
......@@ -93,6 +97,7 @@ palettes_callback (GtkWidget *widget,
static void
images_callback (GtkWidget *widget,
GdkModifierType state,
GimpContainerView *view)
{
gimp_container_view_set_container (view, view->context->gimp->images);
......
......@@ -59,6 +59,7 @@ static void gimp_container_grid_view_select_item (GimpContainerView *v
static void gimp_container_grid_view_clear_items (GimpContainerView *view);
static void gimp_container_grid_view_set_preview_size (GimpContainerView *view);
static void gimp_container_grid_view_item_selected (GtkWidget *widget,
GdkModifierType state,
gpointer data);
static void gimp_container_grid_view_item_activated (GtkWidget *widget,
gpointer data);
......@@ -342,8 +343,9 @@ gimp_container_grid_view_set_preview_size (GimpContainerView *view)
}
static void
gimp_container_grid_view_item_selected (GtkWidget *widget,
gpointer data)
gimp_container_grid_view_item_selected (GtkWidget *widget,
GdkModifierType state,
gpointer data)
{
gimp_container_view_item_selected (GIMP_CONTAINER_VIEW (data),
GIMP_PREVIEW (widget)->viewable);
......
......@@ -51,7 +51,6 @@ enum
{
CLICKED,
DOUBLE_CLICKED,
EXTENDED_CLICKED,
CONTEXT,
LAST_SIGNAL
};
......@@ -133,8 +132,9 @@ gimp_preview_class_init (GimpPreviewClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPreviewClass, clicked),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gimp_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
GDK_TYPE_MODIFIER_TYPE);
preview_signals[DOUBLE_CLICKED] =
g_signal_new ("double_clicked",
......@@ -145,16 +145,6 @@ gimp_preview_class_init (GimpPreviewClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
preview_signals[EXTENDED_CLICKED] =
g_signal_new ("extended_clicked",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPreviewClass, extended_clicked),
NULL, NULL,
gimp_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
GDK_TYPE_MODIFIER_TYPE);
preview_signals[CONTEXT] =
g_signal_new ("context",
G_TYPE_FROM_CLASS (klass),
......@@ -177,7 +167,6 @@ gimp_preview_class_init (GimpPreviewClass *klass)
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->extended_clicked = NULL;
klass->context = NULL;
}
......@@ -443,17 +432,8 @@ gimp_preview_button_release_event (GtkWidget *widget,
if (preview->clickable && preview->in_button)
{
if (preview->press_state &
(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))
{
g_signal_emit (widget,
preview_signals[EXTENDED_CLICKED], 0,
preview->press_state);
}
else
{
g_signal_emit (widget, preview_signals[CLICKED], 0);
}
g_signal_emit (widget, preview_signals[CLICKED], 0,
preview->press_state);
}
}
else
......
......@@ -62,11 +62,10 @@ struct _GimpPreviewClass
GtkDrawingAreaClass parent_class;
/* signals */
void (* clicked) (GimpPreview *preview);
void (* double_clicked) (GimpPreview *preview);
void (* extended_clicked) (GimpPreview *preview,
guint modifier_state);
void (* context) (GimpPreview *preview);
void (* clicked) (GimpPreview *preview,
GdkModifierType modifier_state);
void (* double_clicked) (GimpPreview *preview);
void (* context) (GimpPreview *preview);
};
......
......@@ -48,8 +48,9 @@
static void
brush_preview_clicked (GtkWidget *widget,
GimpToolbox *toolbox)
brush_preview_clicked (GtkWidget *widget,
GdkModifierType state,
GimpToolbox *toolbox)
{
gimp_dialog_factory_dialog_raise (GIMP_DOCK (toolbox)->dialog_factory,
"gimp-brush-grid", -1);
......@@ -68,8 +69,9 @@ brush_preview_drop_brush (GtkWidget *widget,
}
static void
pattern_preview_clicked (GtkWidget *widget,
GimpToolbox *toolbox)
pattern_preview_clicked (GtkWidget *widget,
GdkModifierType state,
GimpToolbox *toolbox)
{
gimp_dialog_factory_dialog_raise (GIMP_DOCK (toolbox)->dialog_factory,
"gimp-pattern-grid", -1);
......@@ -88,8 +90,9 @@ pattern_preview_drop_pattern (GtkWidget *widget,
}
static void
gradient_preview_clicked (GtkWidget *widget,
GimpToolbox *toolbox)
gradient_preview_clicked (GtkWidget *widget,
GdkModifierType state,
GimpToolbox *toolbox)
{
gimp_dialog_factory_dialog_raise (GIMP_DOCK (toolbox)->dialog_factory,
"gimp-gradient-list", -1);
......
......@@ -51,7 +51,6 @@ enum
{
CLICKED,
DOUBLE_CLICKED,
EXTENDED_CLICKED,
CONTEXT,
LAST_SIGNAL
};
......@@ -133,8 +132,9 @@ gimp_preview_class_init (GimpPreviewClass *klass)
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPreviewClass, clicked),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
gimp_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
GDK_TYPE_MODIFIER_TYPE);
preview_signals[DOUBLE_CLICKED] =
g_signal_new ("double_clicked",
......@@ -145,16 +145,6 @@ gimp_preview_class_init (GimpPreviewClass *klass)
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
preview_signals[EXTENDED_CLICKED] =
g_signal_new ("extended_clicked",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpPreviewClass, extended_clicked),
NULL, NULL,
gimp_marshal_VOID__FLAGS,
G_TYPE_NONE, 1,
GDK_TYPE_MODIFIER_TYPE);
preview_signals[CONTEXT] =
g_signal_new ("context",
G_TYPE_FROM_CLASS (klass),
......@@ -177,7 +167,6 @@ gimp_preview_class_init (GimpPreviewClass *klass)
klass->clicked = NULL;
klass->double_clicked = NULL;
klass->extended_clicked = NULL;
klass->context = NULL;
}
......@@ -443,17 +432,8 @@ gimp_preview_button_release_event (GtkWidget *widget,
if (preview->clickable && preview->in_button)
{
if (preview->press_state &
(GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK))
{
g_signal_emit (widget,
preview_signals[EXTENDED_CLICKED], 0,
preview->press_state);
}
else
{
g_signal_emit (widget, preview_signals[CLICKED], 0);
}
g_signal_emit (widget, preview_signals[CLICKED], 0,
preview->press_state);
}
}
else
......
......@@ -62,11 +62,10 @@ struct _GimpPreviewClass
GtkDrawingAreaClass parent_class;
/* signals */
void (* clicked) (GimpPreview *preview);
void (* double_clicked) (GimpPreview *preview);
void (* extended_clicked) (GimpPreview *preview,
guint modifier_state);
void (* context) (GimpPreview *preview);
void (* clicked) (GimpPreview *preview,
GdkModifierType modifier_state);
void (* double_clicked) (GimpPreview *preview);
void (* context) (GimpPreview *preview);
};
......
......@@ -335,22 +335,5 @@ gimp_viewable_dialog_name_changed (GimpObject *object,
static void
gimp_viewable_dialog_close (GimpViewableDialog *dialog)
{
GtkWidget *widget = GTK_WIDGET (dialog);
/* Synthesize delete_event to close dialog. */
if (widget->window)
{
GdkEventAny event;
event.type = GDK_DELETE;
event.window = widget->window;
event.send_event = TRUE;
g_object_ref (event.window);
gtk_main_do_event ((GdkEvent *) &event);
g_object_unref (event.window);
}
g_signal_emit_by_name (dialog, "close");
}
......@@ -37,6 +37,7 @@ static void gimp_dialog_init (GimpDialog *dialog);
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void gimp_dialog_close (GtkDialog *dialog);
static GtkDialogClass *parent_class = NULL;
......@@ -74,12 +75,16 @@ static void
gimp_dialog_class_init (GimpDialogClass *klass)
{
GtkWidgetClass *widget_class;
GtkDialogClass *dialog_class;
widget_class = GTK_WIDGET_CLASS (klass);
dialog_class = GTK_DIALOG_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
widget_class->delete_event = gimp_dialog_delete_event;
dialog_class->close = gimp_dialog_close;
}
static void
......@@ -102,6 +107,27 @@ gimp_dialog_delete_event (GtkWidget *widget,
return TRUE;
}
static void
gimp_dialog_close (GtkDialog *dialog)
{
/* Synthesize delete_event to close dialog. */
GtkWidget *widget = GTK_WIDGET (dialog);
if (widget->window)
{
GdkEvent *event;
event = gdk_event_new (GDK_DELETE);
event->any.window = g_object_ref (widget->window);
event->any.send_event = TRUE;
gtk_main_do_event (event);
gdk_event_free (event);
}
}
/**
* gimp_dialog_new:
* @title: The dialog's title which will be set with
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment