summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2018-11-04 17:03:10 +0100
committerGitHub <noreply@github.com>2018-11-04 17:03:10 +0100
commitb931485fea289a3eb2b919bf6317bba8650d2bf4 (patch)
treeed3f3a5b64016028d3bc78f4676f0be248c15e1b
parent11693bed8f1d992118efcd7548060b00db2ba1ca (diff)
downloadmidori-git-b931485fea289a3eb2b919bf6317bba8650d2bf4.tar.gz
Hide downloads and clear model when clicking Clear (#154)
The "Clear" button should clear all downloads, and consequently hide the downloads button.
-rw-r--r--core/download-button.vala6
-rw-r--r--ui/download-button.ui2
2 files changed, 7 insertions, 1 deletions
diff --git a/core/download-button.vala b/core/download-button.vala
index 7bac8041..5056862a 100644
--- a/core/download-button.vala
+++ b/core/download-button.vala
@@ -20,6 +20,8 @@ namespace Midori {
[GtkChild]
public Gtk.Popover popover;
[GtkChild]
+ public Gtk.Button clear;
+ [GtkChild]
public Gtk.ListBox listbox;
string cache = File.new_for_path (Path.build_filename (
@@ -29,6 +31,10 @@ namespace Midori {
construct {
listbox.bind_model (model, create_row);
popover.relative_to = this;
+ clear.clicked.connect (() => {
+ hide ();
+ model.remove_all ();
+ });
}
internal WebKit.WebContext web_context { set {
diff --git a/ui/download-button.ui b/ui/download-button.ui
index 96d5102e..0958ed2f 100644
--- a/ui/download-button.ui
+++ b/ui/download-button.ui
@@ -22,7 +22,7 @@
</object>
</child>
<child>
- <object class="GtkButton">
+ <object class="GtkButton" id="clear">
<property name="focus-on-click">no</property>
<property name="relief">half</property>
<property name="label" translatable="yes" context="downloads">_Clear</property>