From 5f88ea8be33e84ed887cfb3528d1dfb96acc8b94 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Sun, 18 Aug 2024 00:17:09 +0200 Subject: [PATCH] lapiz-window: Fix 'Use Spaces' CtkCheckMenuItem behavior --- lapiz/lapiz-window.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lapiz/lapiz-window.c b/lapiz/lapiz-window.c index 9640028..e754a3d 100644 --- a/lapiz/lapiz-window.c +++ b/lapiz/lapiz-window.c @@ -1863,13 +1863,24 @@ use_spaces_toggled (CtkCheckMenuItem *item, LapizWindow *window) { LapizView *view; + static use_spaces_toggled_init = TRUE; view = lapiz_window_get_active_view (window); g_signal_handler_block (view, window->priv->spaces_instead_of_tabs_id); - ctk_source_view_set_insert_spaces_instead_of_tabs ( - CTK_SOURCE_VIEW (view), - ctk_check_menu_item_get_active (item)); + + if (use_spaces_toggled_init) { + ctk_source_view_set_insert_spaces_instead_of_tabs (CTK_SOURCE_VIEW (view), + lapiz_prefs_manager_get_insert_spaces ()); + ctk_check_menu_item_set_active (item, lapiz_prefs_manager_get_insert_spaces ()); + use_spaces_toggled_init = FALSE; + } + else + { + ctk_source_view_set_insert_spaces_instead_of_tabs (CTK_SOURCE_VIEW (view), + ctk_check_menu_item_get_active (item)); + } + g_signal_handler_unblock (view, window->priv->spaces_instead_of_tabs_id); }