[devhelp] Call gtk_window_close(), not gtk_widget_destroy(), to save GSettings
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp] Call gtk_window_close(), not gtk_widget_destroy(), to save GSettings
- Date: Sun, 11 Feb 2018 17:56:06 +0000 (UTC)
commit 2cf82a6a21331ac5ca06d70f5e2cce8e4f639295
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Feb 11 18:23:48 2018 +0100
Call gtk_window_close(), not gtk_widget_destroy(), to save GSettings
Saving the window GSettings is now done in the ::delete-event handler,
and apparently it is not called with gtk_widget_destroy().
This commit fixes the problem in those places:
- closing the last tab of a window with Ctrl+w.
- pressing Escape in the assistant.
There is also the problem for the app.quit GAction (Ctrl+q), but calling
gtk_window_close() there creates an infinite loop (with a lot of I/O
going on, I needed to reboot my computer by force :-( it doesn't happen
often to me that kind of thing, when programming).
src/dh-assistant.c | 4 +++-
src/dh-window.c | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-assistant.c b/src/dh-assistant.c
index 03aa937..78bf6ae 100644
--- a/src/dh-assistant.c
+++ b/src/dh-assistant.c
@@ -47,8 +47,10 @@ static gboolean
dh_assistant_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
+ DhAssistant *assistant = DH_ASSISTANT (widget);
+
if (event->keyval == GDK_KEY_Escape) {
- gtk_widget_destroy (widget);
+ gtk_window_close (GTK_WINDOW (assistant));
return GDK_EVENT_STOP;
}
diff --git a/src/dh-window.c b/src/dh-window.c
index 055422d..531cac7 100644
--- a/src/dh-window.c
+++ b/src/dh-window.c
@@ -606,7 +606,7 @@ notebook_page_removed_after_cb (GtkNotebook *notebook,
n_pages = gtk_notebook_get_n_pages (notebook);
if (n_pages == 0)
- gtk_widget_destroy (GTK_WIDGET (window));
+ gtk_window_close (GTK_WINDOW (window));
else
show_or_hide_notebook_tabs (window);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]