summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorP. F. Chimento <philip.chimento@gmail.com>2013-08-30 17:47:15 -0700
committerP. F. Chimento <philip.chimento@gmail.com>2013-08-30 17:47:15 -0700
commit2444b1473a980e770b9a85f93ecfb75efd97bbed (patch)
tree2e86deb62b6b5141540000991b8ea87de69a1234
parent96eb3b8a521b397f0bdceaf8399fe8da4466618d (diff)
parent20e6a38f94cb02c94d9091b104ad390d0d995279 (diff)
Merge pull request #286 from endlessm/issues/284
#284 Emit delete-event on x button click
-rw-r--r--endless/eoswindow.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/endless/eoswindow.c b/endless/eoswindow.c
index 84d8434..1e963f4 100644
--- a/endless/eoswindow.c
+++ b/endless/eoswindow.c
@@ -510,6 +510,15 @@ eos_window_forall (GtkContainer *container,
callback_data);
}
+/* Our default delete event handler destroys the window. */
+static gboolean
+eos_window_default_delete (GtkWidget* window,
+ gpointer user_data)
+{
+ gtk_widget_destroy (GTK_WIDGET (window));
+ return FALSE;
+}
+
static void
eos_window_class_init (EosWindowClass *klass)
{
@@ -531,6 +540,7 @@ eos_window_class_init (EosWindowClass *klass)
widget_class->unmap = eos_window_unmap;
widget_class->show = eos_window_show;
container_class->forall = eos_window_forall;
+ widget_class->delete_event = eos_window_default_delete;
/**
* EosWindow:application:
@@ -575,7 +585,10 @@ on_close_clicked_cb (GtkWidget* top_bar,
{
if (user_data != NULL)
{
- gtk_widget_destroy (GTK_WIDGET (user_data));
+ // We don't actually care about the return value, the default "delete-event" handler
+ // will take care of closing windows for us
+ gboolean dummy = FALSE;
+ g_signal_emit_by_name (G_OBJECT (user_data), "delete-event", NULL, &dummy);
}
}