Revision 316 src/sourcewindow.c
| sourcewindow.c (revision 316) | ||
|---|---|---|
| 39 | 39 |
|
| 40 | 40 |
static void source_window_size_alloc_cb (GtkWidget *widget, |
| 41 | 41 |
GtkAllocation *allocation); |
| 42 |
static void source_window_destroy_cb (GtkWidget *widget, |
|
| 42 |
static gint source_window_delete_cb (GtkWidget *widget, |
|
| 43 |
GdkEventAny *event, |
|
| 43 | 44 |
SourceWindow *sourcewin); |
| 44 | 45 |
static gboolean key_pressed (GtkWidget *widget, |
| 45 | 46 |
GdkEventKey *event, |
| ... | ... | |
| 68 | 69 |
prefs_common.sourcewin_height); |
| 69 | 70 |
g_signal_connect(G_OBJECT(window), "size_allocate", |
| 70 | 71 |
G_CALLBACK(source_window_size_alloc_cb), sourcewin); |
| 71 |
g_signal_connect(G_OBJECT(window), "destroy",
|
|
| 72 |
G_CALLBACK(source_window_destroy_cb), sourcewin);
|
|
| 72 |
g_signal_connect(G_OBJECT(window), "delete_event",
|
|
| 73 |
G_CALLBACK(source_window_delete_cb), sourcewin);
|
|
| 73 | 74 |
g_signal_connect(G_OBJECT(window), "key_press_event", |
| 74 | 75 |
G_CALLBACK(key_pressed), sourcewin); |
| 75 | 76 |
gtk_widget_realize(window); |
| ... | ... | |
| 109 | 110 |
|
| 110 | 111 |
void source_window_destroy(SourceWindow *sourcewin) |
| 111 | 112 |
{
|
| 113 |
gtk_widget_destroy(sourcewin->window); |
|
| 112 | 114 |
g_free(sourcewin); |
| 113 | 115 |
} |
| 114 | 116 |
|
| ... | ... | |
| 167 | 169 |
prefs_common.sourcewin_height = allocation->height; |
| 168 | 170 |
} |
| 169 | 171 |
|
| 170 |
static void source_window_destroy_cb(GtkWidget *widget,
|
|
| 171 |
SourceWindow *sourcewin)
|
|
| 172 |
static gint source_window_delete_cb(GtkWidget *widget, GdkEventAny *event,
|
|
| 173 |
SourceWindow *sourcewin) |
|
| 172 | 174 |
{
|
| 173 | 175 |
source_window_destroy(sourcewin); |
| 176 |
return TRUE; |
|
| 174 | 177 |
} |
| 175 | 178 |
|
| 176 | 179 |
static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, |
| 177 | 180 |
SourceWindow *sourcewin) |
| 178 | 181 |
{
|
| 179 |
if (event && event->keyval == GDK_Escape) |
|
| 180 |
gtk_widget_destroy(sourcewin->window); |
|
| 182 |
if (event && event->keyval == GDK_Escape) {
|
|
| 183 |
source_window_destroy(sourcewin); |
|
| 184 |
return TRUE; |
|
| 185 |
} |
|
| 181 | 186 |
return FALSE; |
| 182 | 187 |
} |
Also available in: Unified diff