~fnux/pisk

42e646bb35ee40097b51aa4785a3d1058c8f759f — Timothée Floure 2 years ago 2311323
Refresh device list after (un)mounting action
1 files changed, 10 insertions(+), 4 deletions(-)

M disks.pl
M disks.pl => disks.pl +10 -4
@@ 240,7 240,7 @@ sub define_curses_listbox {
	$listbox->focus();
	$listbox->onChange(
		sub {
			handle_listbox_event($listbox, $cui, $udisks2);
			handle_listbox_event($cui, $udisks2, $listbox, $values, $labels);
		}
	);



@@ 289,7 289,7 @@ sub define_curses_bindings {
### Main logic

sub handle_listbox_event {
	my ($listbox, $cui, $udisks2) = @_;
	my ($cui, $udisks2, $listbox, $listbox_values, $listbox_labels) = @_;

	my $device = $listbox->get();
	my $dialog_title = q{}; #Violates ProhibitCallsToUndeclaredSubs


@@ 359,8 359,14 @@ sub handle_listbox_event {

	# Handle actions
	given ($action) {
		when (/^mount$/) { mount_filesystem($device) }
		when (/^unmount$/) { unmount_filesystem($device) }
		when (/^mount$/) {
			mount_filesystem($device)
			refresh_listbox_content($udisks2, $listbox_values, $listbox_labels);
		}
		when (/^unmount$/) {
			unmount_filesystem($device)
			refresh_listbox_content($udisks2, $listbox_values, $listbox_labels);
		}
	}

	# Refresh focus and selection