Skip to content

Commit

Permalink
Update blocklist button only active when we have a blocklist
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmhewitt committed Jun 25, 2017
1 parent 45b2f8a commit 51df6d0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/PreferencesWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,19 @@ public class Torrential.PreferencesWindow : Gtk.Dialog {
randomise_port_switch.bind_property ("active", port_entry, "sensitive", BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE | BindingFlags.INVERT_BOOLEAN);
var port_label = create_label (_("Port number:"));

var update_blocklist_button = create_button (_("Update Blocklist"));
var blocklist_entry = create_entry ();
saved_state.bind_property ("blocklist_url", blocklist_entry, "text", BindingFlags.BIDIRECTIONAL | BindingFlags.SYNC_CREATE);
blocklist_entry.changed.connect (() => {
update_blocklist_button.sensitive = blocklist_entry.text.strip ().length > 0;
});
var blocklist_label = create_label (_("Blocklist URL:"));

update_blocklist_stack = new Gtk.Stack ();
var spinner = new Gtk.Spinner ();
spinner.active = true;
var update_blocklist_button = create_button (_("Update Blocklist"));

update_blocklist_button.sensitive = blocklist_entry.text.strip ().length > 0;
update_blocklist_button.clicked.connect (() => {
update_blocklist_stack.visible_child_name = "spinner";
update_blocklist ();
Expand Down

0 comments on commit 51df6d0

Please sign in to comment.