[latexila] Bind GSettings key to gtef-style-scheme-id property
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Bind GSettings key to gtef-style-scheme-id property
- Date: Fri, 18 Nov 2016 14:13:19 +0000 (UTC)
commit 3bccc3693b8be98514bfd39205e6825ee4015b7b
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Nov 18 15:08:14 2016 +0100
Bind GSettings key to gtef-style-scheme-id property
To simplify the code.
src/app_settings.vala | 14 --------------
src/document.vala | 11 +++++------
src/document_view.vala | 1 -
3 files changed, 5 insertions(+), 21 deletions(-)
---
diff --git a/src/app_settings.vala b/src/app_settings.vala
index e56126e..688f88b 100644
--- a/src/app_settings.vala
+++ b/src/app_settings.vala
@@ -68,20 +68,6 @@ public class AppSettings : GLib.Settings
set_font (setting.get_string (key));
});
- editor.changed["scheme"].connect ((setting, key) =>
- {
- string scheme_id = setting.get_string (key);
-
- Gtk.SourceStyleSchemeManager manager =
- Gtk.SourceStyleSchemeManager.get_default ();
- Gtk.SourceStyleScheme scheme = manager.get_scheme (scheme_id);
-
- foreach (Document doc in LatexilaApp.get_instance ().get_documents ())
- doc.style_scheme = scheme;
-
- // we don't use doc.set_style_scheme_from_string() for performance reason
- });
-
editor.changed["tabs-size"].connect ((setting, key) =>
{
uint val;
diff --git a/src/document.vala b/src/document.vala
index 967ac8f..562f15a 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -49,6 +49,11 @@ public class Document : Gtef.Buffer
{
new_file = false;
});
+
+ GLib.Settings editor_settings =
+ new GLib.Settings ("org.gnome.latexila.preferences.editor");
+ editor_settings.bind ("scheme", this, "gtef-style-scheme-id",
+ SettingsBindFlags.GET);
}
public new void insert (ref TextIter iter, string text, int len)
@@ -340,12 +345,6 @@ public class Document : Gtef.Buffer
return current_etag != null && current_etag != _etag;
}
- public void set_style_scheme_from_string (string scheme_id)
- {
- SourceStyleSchemeManager manager = SourceStyleSchemeManager.get_default ();
- style_scheme = manager.get_scheme (scheme_id);
- }
-
public void comment_selected_lines ()
{
TextIter start;
diff --git a/src/document_view.vala b/src/document_view.vala
index d396ae0..7ffb414 100644
--- a/src/document_view.vala
+++ b/src/document_view.vala
@@ -64,7 +64,6 @@ public class DocumentView : Gtef.View
highlight_current_line = _editor_settings.get_boolean ("highlight-current-line");
doc.highlight_matching_brackets =
_editor_settings.get_boolean ("bracket-matching");
- doc.set_style_scheme_from_string (_editor_settings.get_string ("scheme"));
set_smart_home_end (SourceSmartHomeEndType.AFTER);
// completion
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]