From 2edb465b646f671f3372c70f020bd3d3076e86ad Mon Sep 17 00:00:00 2001 From: mbkma Date: Tue, 7 Jul 2020 15:57:46 +0200 Subject: Port main program to GSettings Remove pluma_prefs_manager. Plugins were already ported to GSettings. Based on: https://gitlab.gnome.org/GNOME/gedit/-/commit/4215be0e8924f45170683493beaa2695e8e2e483 --- plugins/modelines/modeline-parser.c | 22 +++++++++++++--------- plugins/spell/pluma-spell-plugin.c | 1 - 2 files changed, 13 insertions(+), 10 deletions(-) (limited to 'plugins') diff --git a/plugins/modelines/modeline-parser.c b/plugins/modelines/modeline-parser.c index 3f347a7b..c5ec0fe8 100644 --- a/plugins/modelines/modeline-parser.c +++ b/plugins/modelines/modeline-parser.c @@ -19,14 +19,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "modeline-parser.h" + #include #include #include #include #include -#include #include -#include "modeline-parser.h" +#include #define MODELINES_LANGUAGE_MAPPINGS_FILE "language-mappings" @@ -675,6 +676,8 @@ modeline_parser_apply_modeline (GtkSourceView *view) GtkTextBuffer *buffer; GtkTextIter iter, liter; gint line_count; + /* FIXME: avoid making a new gsettings variable */ + GSettings *settings = g_settings_new (PLUMA_SCHEMA_ID); options.language_id = NULL; options.set = MODELINE_SET_NONE; @@ -766,13 +769,13 @@ modeline_parser_apply_modeline (GtkSourceView *view) if (has_option (&options, MODELINE_SET_INSERT_SPACES)) { gtk_source_view_set_insert_spaces_instead_of_tabs - (view, options.insert_spaces); + (view, options.insert_spaces); } else if (check_previous (view, previous, MODELINE_SET_INSERT_SPACES)) { gtk_source_view_set_insert_spaces_instead_of_tabs - (view, - pluma_prefs_manager_get_insert_spaces ()); + (view, + g_settings_get_boolean (settings, PLUMA_SETTINGS_INSERT_SPACES)); } if (has_option (&options, MODELINE_SET_TAB_WIDTH)) @@ -782,7 +785,7 @@ modeline_parser_apply_modeline (GtkSourceView *view) else if (check_previous (view, previous, MODELINE_SET_TAB_WIDTH)) { gtk_source_view_set_tab_width (view, - pluma_prefs_manager_get_tabs_size ()); + g_settings_get_uint (settings, PLUMA_SETTINGS_TABS_SIZE)); } if (has_option (&options, MODELINE_SET_INDENT_WIDTH)) @@ -801,7 +804,7 @@ modeline_parser_apply_modeline (GtkSourceView *view) else if (check_previous (view, previous, MODELINE_SET_WRAP_MODE)) { gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), - pluma_prefs_manager_get_wrap_mode ()); + g_settings_get_enum (settings, PLUMA_SETTINGS_WRAP_MODE)); } if (has_option (&options, MODELINE_SET_RIGHT_MARGIN_POSITION)) @@ -811,7 +814,7 @@ modeline_parser_apply_modeline (GtkSourceView *view) else if (check_previous (view, previous, MODELINE_SET_RIGHT_MARGIN_POSITION)) { gtk_source_view_set_right_margin_position (view, - pluma_prefs_manager_get_right_margin_position ()); + g_settings_get_uint (settings, PLUMA_SETTINGS_RIGHT_MARGIN_POSITION)); } if (has_option (&options, MODELINE_SET_SHOW_RIGHT_MARGIN)) @@ -821,7 +824,7 @@ modeline_parser_apply_modeline (GtkSourceView *view) else if (check_previous (view, previous, MODELINE_SET_SHOW_RIGHT_MARGIN)) { gtk_source_view_set_show_right_margin (view, - pluma_prefs_manager_get_display_right_margin ()); + g_settings_get_boolean (settings, PLUMA_SETTINGS_DISPLAY_RIGHT_MARGIN)); } if (previous) @@ -842,6 +845,7 @@ modeline_parser_apply_modeline (GtkSourceView *view) } g_free (options.language_id); + g_object_unref (settings); } void diff --git a/plugins/spell/pluma-spell-plugin.c b/plugins/spell/pluma-spell-plugin.c index fdc2588f..c09c4cd0 100644 --- a/plugins/spell/pluma-spell-plugin.c +++ b/plugins/spell/pluma-spell-plugin.c @@ -36,7 +36,6 @@ #include #include -#include #include #include -- cgit v1.2.1