Skip to content

Commit

Permalink
1.7.1 - Don't add duplicate entries on sidebar and be smart and confi…
Browse files Browse the repository at this point in the history
…rm clean sidebar.
  • Loading branch information
Lains committed Feb 22, 2019
1 parent 3d39a5c commit ec6f4ff
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 10 deletions.
8 changes: 8 additions & 0 deletions data/com.github.lainsce.quilter.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@
<content_attribute id="money-gambling">none</content_attribute>
</content_rating>
<releases>
<release version="1.6.8" date="2019-03-01">
<description>
<p>Release: Kodachrome Selector</p>
<ul>
<li>Open files without adding duplicate entries, and clear sidbar is you really need to (it has a confirm dialog).</li>
</ul>
</description>
</release>
<release version="1.7.0" date="2019-02-22">
<description>
<p>Release: Visually Stunning</p>
Expand Down
8 changes: 7 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
com.github.lainsce.quilter (1.7.1) xenial; urgency=low

* Some fixes and tuneups.

-- Lains <[email protected]> Fri, 01 Mar 2019 17:37:00 -0300

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

* Sidebar backend tuneup and visual upgrade!

-- Lains <[email protected]> Fri, 07 Dec 2018 17:37:00 -0300
-- Lains <[email protected]> Fri, 22 Feb 2018 17:37:00 -0300

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

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.7.0'
version: '1.7.1'
)

# Import main lib files
Expand Down
18 changes: 17 additions & 1 deletion src/Services/DialogUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,28 @@ namespace Quilter.Services.DialogUtils {
);
}
construct {
string explanation;
var save = add_button (_("Save"), Gtk.ResponseType.OK);
var cws = add_button (_("Close Without Saving"), Gtk.ResponseType.NO);
var cancel = add_button (_("Cancel"), Gtk.ResponseType.CANCEL) as Gtk.Button;
cancel.clicked.connect (() => { destroy (); });
this.show_all ();
}
}

public class ClearDialog : Granite.MessageDialog {
public MainWindow win;
public ClearDialog () {
Object (
image_icon: new ThemedIcon ("dialog-warning"),
primary_text: _("Clear All Content?"),
secondary_text: _("Do you want to revert to a clean slate? All files and content will be saved and removed!")
);
}
construct {
var save = add_button (_("Clear All"), Gtk.ResponseType.OK);
var cancel = add_button (_("Cancel"), Gtk.ResponseType.CANCEL) as Gtk.Button;
cancel.clicked.connect (() => { destroy (); });
this.show_all ();
}
}
}
4 changes: 2 additions & 2 deletions src/Services/FileManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ namespace Quilter.Services.FileManager {
settings.current_file = file_path;
files += file_path;
settings.last_files = files;
if (win.sidebar != null) {
win.sidebar.add_file (settings.current_file);
if (win.sidebar != null && !(settings.current_file in settings.last_files)) {
win.sidebar.add_file (file_path);
}
try {
debug ("Opening file...");
Expand Down
3 changes: 1 addition & 2 deletions src/Widgets/HeaderBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ namespace Quilter.Widgets {
Widgets.EditView.buffer.set_modified (false);
if (win.sidebar != null)
win.sidebar.clean_all ();

win.sidebar.add_file (cache);
win.sidebar.add_file (cache);
if (this.subtitle == cache)
this.subtitle = "No Documents Open";
dialog.close ();
Expand Down
42 changes: 39 additions & 3 deletions src/Widgets/SideBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace Quilter.Widgets {
file_clean_button.set_image (new Gtk.Image.from_icon_name ("edit-clear-all-symbolic", Gtk.IconSize.LARGE_TOOLBAR));

file_clean_button.clicked.connect (() => {
clean_all ();
clean_all_check ();
});

column.show_all ();
Expand Down Expand Up @@ -109,7 +109,7 @@ namespace Quilter.Widgets {

public Gee.LinkedList<SideBarBox> get_files () {
foreach (Gtk.Widget item in column.get_children ()) {
if (s_files != null)
if (files != null)
s_files.add ((SideBarBox)item);
}
return s_files;
Expand All @@ -123,6 +123,7 @@ namespace Quilter.Widgets {
column.select_row (filebox);
} else if (filebox.file_label.label == cache) {
filebox.file_name_label.label = "New Document";
filebox.file_label.label = "";
column.select_row (filebox);
files += cache;
settings.last_files = files;
Expand All @@ -146,9 +147,44 @@ namespace Quilter.Widgets {
if (s_files != null)
s_files.clear ();
foreach (Gtk.Widget item in column.get_children ()) {
item.destroy ();
item.destroy ();
}
Widgets.EditView.buffer.text = "";
}

public void clean_all_check () {
var dialog = new Services.DialogUtils.ClearDialog ();
dialog.transient_for = win;

dialog.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.OK:
var settings = AppSettings.get_default ();
settings.last_files = null;
settings.current_file = "No Documents Open";
if (s_files != null)
s_files.clear ();
foreach (Gtk.Widget item in column.get_children ()) {
item.destroy ();
}
Widgets.EditView.buffer.text = "";
dialog.close ();
break;
case Gtk.ResponseType.NO:
case Gtk.ResponseType.CANCEL:
case Gtk.ResponseType.CLOSE:
case Gtk.ResponseType.DELETE_EVENT:
dialog.close ();
break;
default:
assert_not_reached ();
}
});


if (Widgets.EditView.buffer.get_modified() == true) {
dialog.run ();
}
}
}
}

0 comments on commit ec6f4ff

Please sign in to comment.