Skip to content

Commit

Permalink
1.3.6 - Show/Hide the Statusbar in the current session
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulo Galardi committed Oct 8, 2017
1 parent 01f01ec commit 3843243
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 31 deletions.
10 changes: 9 additions & 1 deletion data/com.github.lainsce.quilter.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
<url type="homepage">https://github.com/lainsce/quilter/</url>
<url type="bugtracker">https://github.com/lainsce/quilter/issues</url>
<releases>
<release version="1.3.4" date="2017-10-01">
<description>
<p>Release: When in Doubt, Hide your Status</p>
<ul>
<li>Added a switch on the Preferences to show or hide the Statusbar in the current session</li>
</ul>
</description>
</release>
<release version="1.3.4" date="2017-10-01">
<description>
<p>Release: Focus pocus!</p>
Expand Down Expand Up @@ -186,6 +194,6 @@
<custom>
<value key="x-appcenter-color-primary">#b8d2e2</value>
<value key="x-appcenter-color-primary-text">#333333</value>
<value key="x-appcenter-suggested-price">2</value>
<!--><value key="x-appcenter-suggested-price">2</value><-->
</custom>
</component>
4 changes: 4 additions & 0 deletions data/com.github.lainsce.quilter.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
<default>""</default>
<summary>Spell check language used</summary>
<description>This must be the name of one of the installed languages</description>
</key>
<key name="statusbar" type="b">
<default>true</default>
<summary>Show (true) or Hide (false) the statusbar</summary>
</key>
</schema>
</schemalist>
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
com.github.lainsce.quilter (1.3.6) xenial; urgency=low

* Preferences - Show or hide the Statusbar in the current session.

-- Lains <[email protected]> Sun, 8 October 2017 11:05:00 -0300

com.github.lainsce.quilter (1.3.5) xenial; urgency=low

* Focus Mode now has a better way of showing focus on the text.
Expand Down
48 changes: 28 additions & 20 deletions po/com.github.lainsce.quilter.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: com.github.lainsce.quilter\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-04 23:09-0300\n"
"POT-Creation-Date: 2017-10-08 10:54-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand All @@ -21,80 +21,88 @@ msgstr ""
msgid "Quilter"
msgstr ""

#: src/MainWindow.vala:92
#: src/MainWindow.vala:93
msgid "New file"
msgstr ""

#: src/MainWindow.vala:102
#: src/MainWindow.vala:103
msgid "Save as…"
msgstr ""

#: src/MainWindow.vala:115 src/Services/DialogUtils.vala:58
#: src/MainWindow.vala:116 src/Services/DialogUtils.vala:58
msgid "Save file"
msgstr ""

#: src/MainWindow.vala:128
#: src/MainWindow.vala:129
msgid "Open…"
msgstr ""

#: src/MainWindow.vala:141
#: src/MainWindow.vala:142
msgid "Settings"
msgstr ""

#: src/MainWindow.vala:145
#: src/MainWindow.vala:146
msgid "Markdown Cheatsheet"
msgstr ""

#: src/MainWindow.vala:152 src/Widgets/Preferences.vala:33
#: src/MainWindow.vala:153 src/Widgets/Preferences.vala:34
msgid "Preferences"
msgstr ""

#: src/MainWindow.vala:179
#: src/MainWindow.vala:180
msgid "Edit"
msgstr ""

#: src/MainWindow.vala:180
#: src/MainWindow.vala:181
msgid "Preview"
msgstr ""

#: src/Widgets/StatusBar.vala:41
#: src/Widgets/StatusBar.vala:44
msgid "Words: "
msgstr ""

#: src/Widgets/Preferences.vala:46
#: src/Widgets/Preferences.vala:47
msgid "Editor"
msgstr ""

#: src/Widgets/Preferences.vala:47
#: src/Widgets/Preferences.vala:48
msgid "Enable Focus Mode:"
msgstr ""

#: src/Widgets/Preferences.vala:49
#: src/Widgets/Preferences.vala:50
msgid "Enable Dark Mode:"
msgstr ""

#: src/Widgets/Preferences.vala:52
#: src/Widgets/Preferences.vala:53
msgid "Show the Save Button:"
msgstr ""

#: src/Widgets/Preferences.vala:55
#: src/Widgets/Preferences.vala:56
msgid "Font"
msgstr ""

#: src/Widgets/Preferences.vala:56
#: src/Widgets/Preferences.vala:57
msgid "Custom font:"
msgstr ""

#: src/Widgets/Preferences.vala:66
#: src/Widgets/Preferences.vala:67
msgid "Spellcheck"
msgstr ""

#: src/Widgets/Preferences.vala:67
#: src/Widgets/Preferences.vala:68
msgid "Enable Spellchecking:"
msgstr ""

#: src/Widgets/Preferences.vala:72
msgid "Statusbar"
msgstr ""

#: src/Widgets/Preferences.vala:73
msgid "Show Statusbar:"
msgstr ""

#. Close button
#: src/Widgets/Preferences.vala:71 src/Widgets/Cheatsheet.vala:48
#: src/Widgets/Preferences.vala:77 src/Widgets/Cheatsheet.vala:48
msgid "Close"
msgstr ""

Expand Down
8 changes: 8 additions & 0 deletions po/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ msgstr "Autocorrector"
msgid "Enable Spellchecking:"
msgstr "Habilitar Autocorrector"

#: src/Widgets/Preferences.vala:72
msgid "Statusbar"
msgstr "Barra del Estado"

#: src/Widgets/Preferences.vala:73
msgid "Show Statusbar:"
msgstr "Mostrar la Barra del Estado:"

#. Close button
#: src/Widgets/Preferences.vala:71 src/Widgets/Cheatsheet.vala:48
msgid "Close"
Expand Down
8 changes: 8 additions & 0 deletions po/pt_BR.po
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ msgstr "Verificação de Ortografia"
msgid "Enable Spellchecking:"
msgstr "Habilitar Verificação de Ortografia:"

#: src/Widgets/Preferences.vala:72
msgid "Statusbar"
msgstr "Barra de Estado"

#: src/Widgets/Preferences.vala:73
msgid "Show Statusbar:"
msgstr "Mostrar a Barra de Estado:"

#. Close button
#: src/Widgets/Preferences.vala:71 src/Widgets/Cheatsheet.vala:48
msgid "Close"
Expand Down
1 change: 1 addition & 0 deletions src/Constants/AppSettings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace Quilter {
public bool use_system_font { get; set; }
public bool show_save_button { get; set; }
public bool spellcheck { get; set; }
public bool statusbar { get; set; }
public string font { get; set; }
public string last_file { get; set; }
public string spellcheck_language { get; set; }
Expand Down
10 changes: 9 additions & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace Quilter {
private Gtk.StackSwitcher view_mode;
private Gtk.ScrolledWindow edit_view;
private Gtk.ScrolledWindow preview_view;
private Gtk.Grid grid;
private Widgets.Preferences preferences_dialog;
private Widgets.Cheatsheet cheatsheet_dialog;
private bool timer_scheduled = false;
Expand Down Expand Up @@ -67,6 +68,7 @@ namespace Quilter {
width_request: 920);

schedule_timer ();
statusbar.update_wordcount ();
edit_view_content.changed.connect (schedule_timer);
edit_view_content.changed.connect (statusbar.update_wordcount);
}
Expand Down Expand Up @@ -181,7 +183,7 @@ namespace Quilter {

statusbar = new Widgets.StatusBar ();

var grid = new Gtk.Grid ();
grid = new Gtk.Grid ();
grid.orientation = Gtk.Orientation.VERTICAL;
grid.add (stack);
grid.add (statusbar);
Expand All @@ -207,6 +209,7 @@ namespace Quilter {
settings.changed.connect (() => {
show_save_button ();
focus_mode_toolbar ();
show_statusbar ();
});

int x = settings.window_x;
Expand Down Expand Up @@ -341,5 +344,10 @@ namespace Quilter {
toolbar.pack_start (save_button);
save_button.visible = settings.show_save_button;
}

public void show_statusbar () {
var settings = AppSettings.get_default ();
statusbar.visible = settings.statusbar;
}
}
}
12 changes: 11 additions & 1 deletion src/Widgets/Preferences.vala
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace Quilter.Widgets {
Gtk.Switch dark_mode;
Gtk.Switch use_custom_font;
Gtk.Switch spellcheck;
Gtk.Switch statusbar;
Gtk.Switch save_button;
Gtk.FontButton select_font;

Expand Down Expand Up @@ -68,6 +69,11 @@ namespace Quilter.Widgets {
spellcheck_label.set_halign (Gtk.Align.END);
spellcheck = new SettingsSwitch ("spellcheck");

var statusbar_header = new SettingsHeader (_("Statusbar"));
var statusbar_label = new Gtk.Label (_("Show Statusbar:"));
statusbar_label.set_halign (Gtk.Align.END);
statusbar = new SettingsSwitch ("statusbar");

var close_button = new Gtk.Button.with_label (_("Close"));
close_button.clicked.connect (() => {this.destroy ();});

Expand All @@ -94,7 +100,11 @@ namespace Quilter.Widgets {
main_grid.attach (spellcheck_label, 0, 8, 1, 1);
main_grid.attach (spellcheck, 1, 8, 1, 1);

main_grid.attach (button_box, 0, 9, 4, 1);
main_grid.attach (statusbar_header, 0, 9, 1, 1);
main_grid.attach (statusbar_label, 0, 10, 1, 1);
main_grid.attach (statusbar, 1, 10, 1, 1);

main_grid.attach (button_box, 0, 11, 4, 1);

((Gtk.Container) get_content_area ()).add (main_grid);
}
Expand Down
19 changes: 11 additions & 8 deletions src/Widgets/StatusBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,24 @@ using Granite;

namespace Quilter {
public class Widgets.StatusBar : Gtk.ActionBar {
public SourceView editor;
public Gtk.Label wordcount_label;

public StatusBar () {
wordcount_label = new Gtk.Label("");
wordcount_label.set_width_chars (18);
update_wordcount ();
pack_start (wordcount_label);
wordcount_item ();
}

construct {
var context = this.get_style_context ();
context.add_class ("quilter-statusbar");
}

public void wordcount_item () {
wordcount_label = new Gtk.Label("");
wordcount_label.set_width_chars (18);
update_wordcount ();
pack_start (wordcount_label);
}

public void update_wordcount () {
var wc = get_count();
wordcount_label.set_text((_("Words: ")) + wc.words.to_string());
Expand All @@ -44,7 +47,7 @@ namespace Quilter {
public WordCount get_count() {
try {
var reg = new Regex("[\\s\\W]+", RegexCompileFlags.OPTIMIZE);
string text = editor.buffer.text;
string text = Widgets.SourceView.buffer.text;
string result = reg.replace (text, text.length, 0, " ");

return new WordCount(result.strip().split(" ").length, result.length);
Expand All @@ -54,7 +57,7 @@ namespace Quilter {
}
}

public class WordCount {
public class Widgets.WordCount {
public int words { get; private set; }
public int chars { get; private set; }

Expand All @@ -63,4 +66,4 @@ namespace Quilter {
this.chars = chars;
}
}
}
}

0 comments on commit 3843243

Please sign in to comment.