Skip to content

Commit

Permalink
1.9.2 - Remove All Files button on the Sidebar replaces the close but…
Browse files Browse the repository at this point in the history
…tons and more fixes
  • Loading branch information
Lains committed Jun 23, 2019
1 parent 3eca87b commit dcb7f1c
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 82 deletions.
8 changes: 8 additions & 0 deletions data/com.github.lainsce.quilter.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@
<content_attribute id="money-gambling">none</content_attribute>
</content_rating>
<releases>
<release version="1.9.2" date="2019-06-28">
<description>
<p>Release: Sidebar File Cleaner-o-matic</p>
<ul>
<li>Added: "Remove All Files" button on the sidebar, this way, no files will be harmed with the old close file buttons.</li>
</ul>
</description>
</release>
<release version="1.9.1" date="2019-06-08">
<description>
<p>Release: Export without Errors</p>
Expand Down
Binary file modified data/images/shot-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/images/shot-focused.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/images/shot-preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/images/shot-sepia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/images/shot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions data/styles/app-main-stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,13 @@ actionbar,

.quilter-sidebar-button {
border-top: 1px solid alpha (#000, 0.25);
border-right: 1px solid alpha (#000, 0.25);
background: @colorPrimary;
border-radius: 0;
padding: 2px;
padding: 4px;
}

.quilter-sidebar-button:hover {
background: alpha (mix (@bg_color, @accentColor, 0.5), 0.58);
}

.quilter-sidebar-button:active,
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.9.1'
version: '1.9.2'
)

# Import main lib files
Expand Down
4 changes: 0 additions & 4 deletions src/Styles/quilter.vala
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ public class Quilter.Styles.quilter {
font-size: 18px;
}
ul, ol {
margin-left: -40px;
}
hr {
overflow: visible;
padding: 0;
Expand Down
4 changes: 0 additions & 4 deletions src/Styles/quilterdark.vala
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ public class Quilter.Styles.quilterdark {
font-size: 18px;
}
ul, ol {
margin-left: -40px;
}
hr {
overflow: visible;
padding: 0;
Expand Down
4 changes: 0 additions & 4 deletions src/Styles/quiltermoon.vala
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,6 @@ public class Quilter.Styles.quiltermoon {
font-size: 18px;
}
ul, ol {
margin-left: -40px;
}
hr {
overflow: visible;
padding: 0;
Expand Down
4 changes: 0 additions & 4 deletions src/Styles/quiltersepia.vala
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,6 @@ public class Quilter.Styles.quiltersepia {
font-size: 18px;
}
ul, ol {
margin-left: -40px;
}
hr {
overflow: visible;
padding: 0;
Expand Down
27 changes: 27 additions & 0 deletions src/Widgets/SideBar.vala
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,33 @@ namespace Quilter.Widgets {
}
});

var file_clean_button = new Gtk.Button ();
var fcb_context = file_clean_button.get_style_context ();
fcb_context.add_class ("quilter-sidebar-button");
file_clean_button.always_show_image = true;
file_clean_button.vexpand = false;
file_clean_button.hexpand = false;
file_clean_button.valign = Gtk.Align.CENTER;
file_clean_button.tooltip_text = "Removes files from the Sidebar, leaving it empty again.\nNo files will be saved however!";
file_clean_button.set_label (_("Remove All Files"));
var file_clean_button_style_context = file_clean_button.get_style_context ();
file_clean_button_style_context.add_class (Gtk.STYLE_CLASS_FLAT);
file_clean_button.set_image (new Gtk.Image.from_icon_name ("edit-clear-all-symbolic", Gtk.IconSize.LARGE_TOOLBAR));

file_clean_button.clicked.connect (() => {
delete_row ();
win.edit_view_content.buffer.text = "";
Services.FileManager.file = null;
win.toolbar.set_subtitle (_("No Documents Open"));
});

column.show_all ();

files_grid = new Gtk.Grid ();
files_grid.hexpand = false;
files_grid.set_size_request (280, -1);
files_grid.attach (column, 0, 0, 1, 1);
files_grid.attach (file_clean_button, 0, 1, 1, 1);
files_grid.show_all ();
return files_grid;
}
Expand Down Expand Up @@ -253,6 +274,12 @@ namespace Quilter.Widgets {
return filebox;
}

public void delete_row () {
foreach (Gtk.Widget item in column.get_children ()) {
item.destroy ();
}
}

public int list_sort (Gtk.ListBoxRow first_row, Gtk.ListBoxRow second_row) {
var row_1 = first_row;
var row_2 = second_row;
Expand Down
62 changes: 0 additions & 62 deletions src/Widgets/SideBarBox.vala
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,6 @@ namespace Quilter.Widgets {

var file_icon = new Gtk.Image.from_icon_name ("text-markdown", Gtk.IconSize.LARGE_TOOLBAR);

var file_remove_button = new Gtk.Button();
var file_remove_button_c = file_remove_button.get_style_context ();
file_remove_button_c.add_class ("flat");
file_remove_button_c.add_class ("quilter-task-button");
file_remove_button_c.add_class ("color-button");
file_remove_button.has_focus = false;
file_remove_button.has_tooltip = true;
file_remove_button.valign = Gtk.Align.CENTER;
file_remove_button.hexpand = true;
file_remove_button.set_size_request (24,24);
file_remove_button.halign = Gtk.Align.END;
file_remove_button.set_image (new Gtk.Image.from_icon_name ("window-close-symbolic",Gtk.IconSize.BUTTON));
file_remove_button.tooltip_text = (_("Remove File"));

file_grid = new Gtk.Grid ();
file_grid.hexpand = false;
file_grid.row_spacing = 3;
Expand All @@ -99,59 +85,11 @@ namespace Quilter.Widgets {
file_grid.attach (file_icon, 0, 0, 1, 2);
file_grid.attach (file_name_label, 1, 0, 1, 1);
file_grid.attach (file_label, 1, 1, 1, 1);
file_grid.attach (file_remove_button, 2, 0, 1, 2);

file_remove_button.clicked.connect (() => {
var dialog = new Services.DialogUtils.Dialog2 ();
dialog.transient_for = win;
dialog.response.connect ((response_id) => {
switch (response_id) {
case Gtk.ResponseType.OK:
debug ("User saves the file.");
save_as ();
delete_row ();
dialog.close ();
win.edit_view_content.buffer.text = "";
win.edit_view_content.buffer.set_modified (false);
Services.FileManager.file = null;
win.toolbar.set_subtitle (_("No Documents Open"));
Widgets.SideBar.get_instance ().store.clear ();
break;
case Gtk.ResponseType.NO:
delete_row ();
dialog.close ();
win.edit_view_content.buffer.text = "";
win.edit_view_content.buffer.set_modified (false);
Services.FileManager.file = null;
win.toolbar.set_subtitle (_("No Documents Open"));
Widgets.SideBar.get_instance ().store.clear ();
break;
case Gtk.ResponseType.CANCEL:
case Gtk.ResponseType.CLOSE:
case Gtk.ResponseType.DELETE_EVENT:
dialog.close ();
break;
default:
assert_not_reached ();
}
});
if (win.edit_view_content.buffer.get_modified () == true) {
dialog.run ();
} else if (win.edit_view_content.buffer.get_modified () == false) {
delete_row ();
win.edit_view_content.buffer.text = "";
Services.FileManager.file = null;
win.toolbar.set_subtitle (_("No Documents Open"));
}
});

this.add (file_grid);
this.hexpand = true;
this.show_all ();
this.path = path;
}
public void delete_row () {
this.destroy ();
}
}
}
6 changes: 5 additions & 1 deletion src/Widgets/WebView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ namespace Quilter.Widgets {
string processed_mk;
process_frontmatter (buf.text, out processed_mk);
var mkd = new Markdown.Document.gfm_format (processed_mk.data,
0x00001000 +
0x00002000 +
0x00004000 +
0x00200000 +
0x00400000 +
Expand All @@ -221,7 +223,9 @@ namespace Quilter.Widgets {
0x04000000 +
0x10000000 +
0x40000000);
mkd.compile (0x00004000 +
mkd.compile (0x00001000 +
0x00002000 +
0x00004000 +
0x00200000 +
0x00400000 +
0x02000000 +
Expand Down

0 comments on commit dcb7f1c

Please sign in to comment.