Move GtkWidget::delete_event() impl from the shell to the window

Still has a FIXME but is in the right place now at least
This commit is contained in:
Michael Natterer 2009-09-25 12:48:30 +02:00
parent b11c3355cb
commit a5945740e0
2 changed files with 17 additions and 15 deletions

View File

@ -62,7 +62,6 @@
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-callbacks.h"
#include "gimpdisplayshell-close.h"
#include "gimpdisplayshell-cursor.h"
#include "gimpdisplayshell-dnd.h"
#include "gimpdisplayshell-draw.h"
@ -122,8 +121,6 @@ static void gimp_display_shell_destroy (GtkObject *object);
static void gimp_display_shell_unrealize (GtkWidget *widget);
static void gimp_display_shell_screen_changed (GtkWidget *widget,
GdkScreen *previous);
static gboolean gimp_display_shell_delete_event (GtkWidget *widget,
GdkEventAny *aevent);
static gboolean gimp_display_shell_configure_event(GtkWidget *widget,
GdkEventConfigure*cevent);
static gboolean
@ -207,7 +204,6 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
widget_class->unrealize = gimp_display_shell_unrealize;
widget_class->screen_changed = gimp_display_shell_screen_changed;
widget_class->delete_event = gimp_display_shell_delete_event;
widget_class->configure_event = gimp_display_shell_configure_event;
widget_class->window_state_event = gimp_display_shell_window_state_event;
widget_class->popup_menu = gimp_display_shell_popup_menu;
@ -663,17 +659,6 @@ gimp_display_shell_screen_changed (GtkWidget *widget,
}
}
static gboolean
gimp_display_shell_delete_event (GtkWidget *widget,
GdkEventAny *aevent)
{
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget);
gimp_display_shell_close (shell, FALSE);
return TRUE;
}
static gboolean
gimp_display_shell_configure_event (GtkWidget *widget,
GdkEventConfigure *cevent)

View File

@ -34,6 +34,7 @@
#include "gimpdisplay.h"
#include "gimpdisplay-foreach.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-close.h"
#include "gimpimagewindow.h"
#include "gimpstatusbar.h"
@ -66,6 +67,8 @@ static void gimp_image_window_get_property (GObject *object,
static void gimp_image_window_destroy (GtkObject *object);
static gboolean gimp_image_window_delete_event (GtkWidget *widget,
GdkEventAny *event);
static gboolean gimp_image_window_window_state (GtkWidget *widget,
GdkEventWindowState *event);
static void gimp_image_window_style_set (GtkWidget *widget,
@ -120,6 +123,7 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
gtk_object_class->destroy = gimp_image_window_destroy;
widget_class->delete_event = gimp_image_window_delete_event;
widget_class->window_state_event = gimp_image_window_window_state;
widget_class->style_set = gimp_image_window_style_set;
@ -282,6 +286,19 @@ gimp_image_window_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static gboolean
gimp_image_window_delete_event (GtkWidget *widget,
GdkEventAny *event)
{
GimpImageWindow *window = GIMP_IMAGE_WINDOW (widget);
GimpDisplay *display = gimp_image_window_get_active_display (window);
/* FIXME multiple shells */
gimp_display_shell_close (GIMP_DISPLAY_SHELL (display->shell), FALSE);
return TRUE;
}
static gboolean
gimp_image_window_window_state (GtkWidget *widget,
GdkEventWindowState *event)