Skip to content

Commit

Permalink
* - Small code fixes and additions
Browse files Browse the repository at this point in the history
  • Loading branch information
Lains committed Sep 14, 2017
1 parent 3f1442a commit 49050c7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
22 changes: 11 additions & 11 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ namespace Quilter {
public Widgets.SourceView view;

// HeaderBar
public Gtk.HeaderBar toolbar;
public File file;

private Gtk.Menu menu;
private Gtk.Button new_button;
private Gtk.Button open_button;
Expand All @@ -33,20 +36,17 @@ namespace Quilter {
private Widgets.Preferences preferences_dialog;
private Widgets.Cheatsheet cheatsheet_dialog;

public Gtk.HeaderBar toolbar;
public File file;

private bool _is_fullscreen;
public bool is_fullscreen {
set {
_is_fullscreen = value;

if (_is_fullscreen)
fullscreen ();
else
unfullscreen ();
}
get { return _is_fullscreen; }
set {
_is_fullscreen = value;

if (_is_fullscreen)
fullscreen ();
else
unfullscreen ();
}
}

public MainWindow (Gtk.Application application) {
Expand Down
6 changes: 2 additions & 4 deletions src/Services/FileUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
*/

namespace Quilter.Services.FileUtils {
public MainWindow window;

public void save_file (File file, uint8[] buffer) throws Error {
var output = new DataOutputStream (file.create(FileCreateFlags.REPLACE_DESTINATION));
long written = 0;
Expand Down Expand Up @@ -112,10 +110,10 @@ namespace Quilter.Services.FileUtils {
string text;

try {
var settings = AppSettings.get_default ();
window.toolbar.subtitle = settings.last_file;
GLib.FileUtils.get_contents (file.get_path (), out text);
Widgets.SourceView.buffer.text = text;
var settings = AppSettings.get_default ();
settings.last_file = file.get_path ();
} catch (Error e) {
warning ("Error: %s", e.message);
}
Expand Down
1 change: 1 addition & 0 deletions src/Widgets/Preferences.vala
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace Quilter.Widgets {
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.use_font = true;
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);
Expand Down

0 comments on commit 49050c7

Please sign in to comment.