[regexxer] Add gsettings key to configure the textview.
- From: Fabien Parent <fparent src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [regexxer] Add gsettings key to configure the textview.
- Date: Sun, 6 Mar 2011 16:58:30 +0000 (UTC)
commit 599e1204604e5a61b2b102ee9b416f7498447d46
Author: Fabien Parent <parent f gmail com>
Date: Sun Mar 6 17:58:24 2011 +0100
Add gsettings key to configure the textview.
src/globalstrings.h | 4 ++++
src/mainwindow.cc | 6 ++++++
ui/org.regexxer.gschema.xml.in | 31 +++++++++++++++++++++++++++++++
3 files changed, 41 insertions(+), 0 deletions(-)
---
diff --git a/src/globalstrings.h b/src/globalstrings.h
index 611412c..49cecb1 100644
--- a/src/globalstrings.h
+++ b/src/globalstrings.h
@@ -45,6 +45,10 @@ const char *const conf_key_window_height = "window-height";
const char *const conf_key_window_position_x = "window-position-x";
const char *const conf_key_window_position_y = "window-position-y";
const char *const conf_key_window_maximized = "window-maximized";
+const char *const conf_key_show_line_numbers = "show-line-numbers";
+const char *const conf_key_highlight_current_line = "highlight-current-line";
+const char *const conf_key_auto_indentation = "auto-indentation";
+const char *const conf_key_draw_spaces = "draw-space";
const char *const ui_mainwindow_filename = REGEXXER_PKGDATADIR G_DIR_SEPARATOR_S
"mainwindow.ui";
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 623418d..3fa101e 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -244,6 +244,12 @@ void MainWindow::initialize(const InitState& init)
if (maximized)
window_->maximize();
+ textview_->set_show_line_numbers(settings->get_boolean(conf_key_show_line_numbers));
+ textview_->set_highlight_current_line(settings->get_boolean(conf_key_highlight_current_line));
+ textview_->set_auto_indent(settings->get_boolean(conf_key_auto_indentation));
+ textview_->set_draw_spaces(static_cast<Gsv::SourceDrawSpacesFlags>
+ (settings->get_flags(conf_key_draw_spaces)));
+
std::string folder;
if (!init.folder.empty())
diff --git a/ui/org.regexxer.gschema.xml.in b/ui/org.regexxer.gschema.xml.in
index 0c93099..a71c48b 100644
--- a/ui/org.regexxer.gschema.xml.in
+++ b/ui/org.regexxer.gschema.xml.in
@@ -1,4 +1,11 @@
<schemalist>
+ <flags id="draw-space-flags">
+ <value nick="space" value="1"/>
+ <value nick="tab" value="2"/>
+ <value nick="new-line" value="4"/>
+ <value nick="nbsp" value="8"/>
+ </flags>
+
<schema id="org.regexxer" path="/apps/regexxer/">
<key name="files-patterns" type="as">
<default>['*.[ch]','*.{c,cc,cpp,cxx,c++,C,h,hh,hpp,hxx,h++}','*.{ccg,hg}','*.idl','*.{java,jsp}','*.{pl,pm,cgi}','*.py','*.php[0-9]?','*.{html,htm,shtml,js,wml}','*.{xml,xsl,css,dtd,xsd}']</default>
@@ -71,5 +78,29 @@
<_summary>window maximization</_summary>
<_description>Whether the window is maximized.</_description>
</key>
+
+ <key name="show-line-numbers" type="b">
+ <default>true</default>
+ <_summary>Show line numbers</_summary>
+ <_description>Whether to show the line numbers of the text view.</_description>
+ </key>
+
+ <key name="highlight-current-line" type="b">
+ <default>true</default>
+ <_summary>Highlight the current line</_summary>
+ <_description>Whether to highlight the current line of the text view.</_description>
+ </key>
+
+ <key name="auto-indentation" type="b">
+ <default>true</default>
+ <_summary>Auto indentation</_summary>
+ <_description>Whether to enable auto indentation the text view.</_description>
+ </key>
+
+ <key name="draw-space" flags="draw-space-flags">
+ <default>["space","tab"]</default>
+ <_summary>Draw spaces</_summary>
+ <_description>Which type of space to draw in the text view.</_description>
+ </key>
</schema>
</schemalist>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]