Fix window settings (size, pane height, sort column/direction) not properly saved when exiting the window (bug #10670)
Move the code setting the properties on window->settings to the delete-event handler, at that stage we're sure the window still exists, and that the property setting will actually trigger a config file write.
This commit is contained in:
@@ -225,26 +225,6 @@ xtm_process_window_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
XtmProcessWindow *window = XTM_PROCESS_WINDOW (object);
|
XtmProcessWindow *window = XTM_PROCESS_WINDOW (object);
|
||||||
|
|
||||||
if (GTK_IS_WINDOW (window->window))
|
|
||||||
{
|
|
||||||
gint width, height, handle_position;
|
|
||||||
guint sort_column_id;
|
|
||||||
GtkSortType sort_type;
|
|
||||||
|
|
||||||
gtk_window_get_size (GTK_WINDOW (window->window), &width, &height);
|
|
||||||
xtm_process_tree_view_get_sort_column_id (XTM_PROCESS_TREE_VIEW (window->treeview), (gint*)&sort_column_id, &sort_type);
|
|
||||||
|
|
||||||
handle_position = gtk_paned_get_position (GTK_PANED (window->vpaned));
|
|
||||||
|
|
||||||
g_object_set (window->settings,
|
|
||||||
"window-width", width,
|
|
||||||
"window-height", height,
|
|
||||||
"sort-column-id", sort_column_id,
|
|
||||||
"sort-type", sort_type,
|
|
||||||
"handle-position", handle_position,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GTK_IS_TREE_VIEW (window->treeview))
|
if (GTK_IS_TREE_VIEW (window->treeview))
|
||||||
gtk_widget_destroy (window->treeview);
|
gtk_widget_destroy (window->treeview);
|
||||||
|
|
||||||
@@ -275,6 +255,23 @@ static gboolean
|
|||||||
emit_delete_event_signal (XtmProcessWindow *window, GdkEvent *event)
|
emit_delete_event_signal (XtmProcessWindow *window, GdkEvent *event)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
gint width, height, handle_position;
|
||||||
|
guint sort_column_id;
|
||||||
|
GtkSortType sort_type;
|
||||||
|
|
||||||
|
gtk_window_get_size (GTK_WINDOW (window->window), &width, &height);
|
||||||
|
xtm_process_tree_view_get_sort_column_id (XTM_PROCESS_TREE_VIEW (window->treeview), (gint*)&sort_column_id, &sort_type);
|
||||||
|
|
||||||
|
handle_position = gtk_paned_get_position (GTK_PANED (window->vpaned));
|
||||||
|
|
||||||
|
g_object_set (window->settings,
|
||||||
|
"window-width", width,
|
||||||
|
"window-height", height,
|
||||||
|
"sort-column-id", sort_column_id,
|
||||||
|
"sort-type", sort_type,
|
||||||
|
"handle-position", handle_position,
|
||||||
|
NULL);
|
||||||
|
|
||||||
g_signal_emit_by_name (window, "delete-event", event, &ret, G_TYPE_BOOLEAN);
|
g_signal_emit_by_name (window, "delete-event", event, &ret, G_TYPE_BOOLEAN);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user