Avoided unnecessary rebuilding of file browser tree with Up and Down buttons

This commit is contained in:
Thomas Schmitt 2013-01-06 09:37:05 +00:00
parent 8115b7eba0
commit aec88f03af
2 changed files with 50 additions and 26 deletions

View File

@ -2474,10 +2474,13 @@ proc browse_tree_select {adr_var_name tr selected} {
# The command to be executed when the user double-clicks a node.
#
proc browse_tree_accept {adr_var_name do_return tr selected} {
global have_bwidget
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
global isomanip_move_target indev_adr outdev_adr cmd_log_target
global debug_log_file execute_script_adr
# Caution: Before using $tr, check for $have_bwidget
if {[llength $selected] > 1} {
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You may only select a single file"
return ""
@ -2613,11 +2616,14 @@ proc browse_tree_up {adr_var_name tr which_fs} {
xorriso_tcltk_errmsg "xorriso-tcltk : SORRY : You must select a single tree item before clicking the \"Up\" button."
return ""
}
set adr [file dirname [lindex $selected 0]]
eval set mem $$adr_var_name
set $adr_var_name $adr
browse_tree_populate $which_fs
set $adr_var_name $mem
set old_adr [lindex $selected 0]
set adr [file dirname $old_adr]
catch {
$tr see $adr
if {[$tr nodes $old_adr 0] != ""} {
$tr closetree $old_adr
}
}
if {$adr != "/" && $adr != ""} {
$tr selection clear
$tr selection set $adr
@ -2637,11 +2643,15 @@ proc browse_tree_down {adr_var_name tr which_fs} {
return ""
}
set adr [lindex $selected 0]
eval set mem $$adr_var_name
set $adr_var_name $adr
browse_tree_populate $which_fs
set $adr_var_name $mem
$tr selection set $adr
if {$which_fs == "isofs"} {
browse_iso_open_dir $tr $adr
} else {
browse_disk_open_dir $tr $adr
}
catch {
$tr opentree $adr 0
$tr see $adr
}
}
@ -2657,12 +2667,15 @@ proc browse_tree_close_dir {tr name} {
# obtained current state down to the current address in the field variable.
#
proc browse_tree_populate {which_fs} {
global have_bwidget
global browse_disk_window_var browse_iso_window_var
global browse_iso_window_is_active browse_disk_window_is_active
global extract_to_adr insert_from_adr burn_write_image_adr isodir_adr
global isomanip_move_target indev_adr outdev_adr cmd_log_target
global debug_log_file execute_script_adr
if {$have_bwidget != 1} {return ""}
if {$which_fs == "isofs"} {
if {$browse_iso_window_is_active == 0} {return ""}
set w {.browse_iso_window}
@ -4539,7 +4552,7 @@ See man xorriso for the meaning of the commands.
The \"Allow extract to disk\" switch controls whether commands like -extract
are allowed in command scripts. If disabled, then command -osirrox is used
to temporarily block those commands (unless the script ublocks itself, which
to temporarily block those commands (unless the script unblocks itself, which
would be nasty behavior).
The item \"Permanently ban extraction\" disables -extract irrevocably for
@ -5794,6 +5807,8 @@ proc setup_by_args {argv0 argv} {
catch {set main_window_geometry $geometry}
set connection_defined 0
set pipe_logging 0
set script_logging 0
set loop_limit [llength $argv]
for {set i 0} {$i < $loop_limit} {incr i} {
@ -5841,24 +5856,16 @@ proc setup_by_args {argv0 argv} {
if {$opt == "--pipe_log_file"} {
set ok "1"
incr i
set name [lrange $argv $i $i]
set ret [start_debug_logging $name 1]
if {$ret <= 0} {
puts stderr \
"$argv0 : Cannot open --pipe_log_file '$debug_log_file' for writing"
central_exit 2
}
set pipe_log_name [lrange $argv $i $i]
# postpone actual log start until start_xorriso has been passed
set pipe_logging 1
}
if {$opt == "--script_log_file"} {
set ok "1"
incr i
set name [lrange $argv $i $i]
set ret [start_command_logging $name 1]
if {$ret <= 0} {
puts stderr \
"$argv0 : Cannot open --script_log_file '$name' for writing"
central_exit 2
}
set script_log_name [lrange $argv $i $i]
# postpone actual log start until start_xorriso has been passed
set script_logging 1
}
if {$opt == "--no_bwidget"} {
set ok "1"
@ -5880,6 +5887,23 @@ proc setup_by_args {argv0 argv} {
set cmd_conn stdout
set reply_conn stdin
}
if {$pipe_logging == 1} {
set ret [start_debug_logging $pipe_log_name 1]
if {$ret <= 0} {
puts stderr \
"$argv0 : Cannot open --pipe_log_file '$pipe_log_name' for writing"
central_exit 2
}
}
if {$script_logging == 1} {
set ret [start_command_logging $script_log_name 1]
if {$ret <= 0} {
puts stderr \
"$argv0 : Cannot open --script_log_file '$script_log_name' for writing"
central_exit 2
}
}
if {$main_window_geometry != ""} {
wm geometry . $main_window_geometry
}

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.01.05.220937"
#define Xorriso_timestamP "2013.01.06.093550"