Skip to content

Commit

Permalink
1.1.2 - Font customization reintroduced
Browse files Browse the repository at this point in the history
  • Loading branch information
Lains committed Jun 23, 2017
1 parent 0e7e0a4 commit 03d3670
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 4 deletions.
2 changes: 1 addition & 1 deletion data/com.github.lainsce.quilter.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<name>Quilter</name>
<summary>Focus on your writing</summary>
<description>
<p>Focused writing for any kind of story, even longer ones. Make writing a joy while Focus Mode is active.</p>
<p>Focus on your writing and write beautiful solid stories with the Focus Mode in tow</p>
<ul>
<li>Save your documents anywhere, even on existing files.</li>
<li>Configure whether to have Focus Mode or not.</li>
Expand Down
7 changes: 6 additions & 1 deletion data/com.github.lainsce.quilter.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@
<summary>Dark Mode</summary>
<description>Whether Quilter should be in Dark Mode</description>
</key>
<key name="use-system-font" type="b">
<default>true</default>
<summary>Use system font</summary>
<description>Whether Quilter should use the default system font</description>
</key>
<key name="font" type="s">
<default>'Cousine 12'</default>
<default>'Cousine 11'</default>
<summary>Preferred Font</summary>
<description>Set the preferred font</description>
</key>
Expand Down
12 changes: 12 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
com.github.lainsce.quilter (1.1.2) xenial; urgency=low

* Reintroduce the font customization options.

-- Lains <[email protected]> Thu, 23 June 2017 12:40:00 -0300

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

* AppCenter monetization

-- Lains <[email protected]> Thu, 22 June 2017 09:55:00 -0300

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

* New Focus mode, makes text bigger and the toolbar more light.
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Name our project
project('com.github.lainsce.quilter', ['vala', 'c'],
version: '1.1.0'
version: '1.1.2'
)

# Import main lib files
Expand Down
2 changes: 1 addition & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace Quilter {
app_years = "2017";
exec_name = "com.github.lainsce.quilter";
app_launcher = "com.github.lainsce.quilter";
build_version = "1.0.9";
build_version = "1.1.2";
app_icon = "com.github.lainsce.quilter";
main_url = "https://github.com/lainsce/quilter/";
bug_url = "https://github.com/lainsce/quilter/issues";
Expand Down
1 change: 1 addition & 0 deletions src/Constants/AppSettings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace Quilter {
public bool window_maximized { get; set; }
public bool dark_mode { get; set; }
public bool focus_mode { get; set; }
public bool use_system_font { get; set; }
public string font { get; set; }
public string last_file { get; set; }

Expand Down
17 changes: 17 additions & 0 deletions src/Widgets/Preferences.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ namespace Quilter.Widgets {
public class Preferences : Gtk.Dialog {
Gtk.Switch focus_mode;
Gtk.Switch dark_mode;
Gtk.Switch use_custom_font;
Gtk.FontButton select_font;

public Preferences () {
create_layout ();
Expand All @@ -33,6 +35,7 @@ namespace Quilter.Widgets {
}

private void create_layout () {
var main_settings = AppSettings.get_default ();
var main_grid = new Gtk.Grid ();
main_grid.row_spacing = 6;
main_grid.column_spacing = 12;
Expand All @@ -46,6 +49,16 @@ namespace Quilter.Widgets {
var dark_mode_label = new SettingsLabel (_("Enable Dark Mode:"));
dark_mode = new SettingsSwitch ("dark-mode");

var font_header = new SettingsHeader (_("Font"));
var use_custom_font_label = new SettingsLabel (_("Custom font:"));
use_custom_font = new Gtk.Switch ();
use_custom_font.halign = Gtk.Align.START;
main_settings.schema.bind ("use-system-font", use_custom_font, "active", SettingsBindFlags.INVERT_BOOLEAN);
select_font = new Gtk.FontButton ();
select_font.hexpand = true;
main_settings.schema.bind ("font", select_font, "font-name", SettingsBindFlags.DEFAULT);
main_settings.schema.bind ("use-system-font", select_font, "sensitive", SettingsBindFlags.INVERT_BOOLEAN);

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

Expand All @@ -61,6 +74,10 @@ namespace Quilter.Widgets {
main_grid.attach (focus_mode, 1, 2, 1, 1);
main_grid.attach (dark_mode_label, 0, 3, 1, 1);
main_grid.attach (dark_mode, 1, 3, 1, 1);
main_grid.attach (font_header, 0, 4, 3, 1);
main_grid.attach (use_custom_font_label , 0, 5, 1, 1);
main_grid.attach (use_custom_font, 1, 5, 1, 1);
main_grid.attach (select_font, 2, 5, 1, 1);
main_grid.attach (button_box, 0, 6, 4, 1);

((Gtk.Container) get_content_area ()).add (main_grid);
Expand Down
10 changes: 10 additions & 0 deletions src/Widgets/SourceView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,21 @@ namespace Quilter.Widgets {
}
}

public void use_default_font (bool value) {
if (!value)
return;

var default_font = new GLib.Settings ("org.gnome.desktop.interface").get_string ("monospace-font-name");

this.font = default_font;
}

private void update_settings () {
var settings = AppSettings.get_default ();
if (!settings.focus_mode) {
this.highlight_current_line = false;
this.font = settings.font;
use_default_font (settings.use_system_font);
this.override_font (Pango.FontDescription.from_string (this.font));
} else {
this.highlight_current_line = true;
Expand Down

0 comments on commit 03d3670

Please sign in to comment.