From fd25701d8629ba9292409cde5ee307a049b00749 Mon Sep 17 00:00:00 2001 From: Ivica Ico Bukvic <ico@vt.edu> Date: Wed, 18 Sep 2013 10:52:49 -0400 Subject: [PATCH] *refined recent files menu logic to avoid buggy addition of additional breaks as well as provide more verbose info to the user --- pd/src/pd.tk | 4 +++- pd/src/pd_menus_SHORT.tcl | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pd/src/pd.tk b/pd/src/pd.tk index f097887aa..5ac66af7b 100644 --- a/pd/src/pd.tk +++ b/pd/src/pd.tk @@ -1591,11 +1591,12 @@ match_linux_wm [list .mbar.file add separator] # update recent files match_linux_wm [list .mbar.file add separator] +.mbar.file add command -label "No Recent Files" -state disabled #if {[llength $::recentfiles_list] > 0} { # ::pd_menus::update_recentfiles_menu .mbar.file false #} -match_linux_wm [list .mbar.file add separator] +match_linux_wm [list .mbar.file add separator] .mbar.file add command -label Close -accelerator [accel_munge "Ctrl+w"] \ -state disabled @@ -2841,6 +2842,7 @@ proc pdtk_canvas_new {name width height geometry editable} { } # update recent files match_linux_wm [list $name.m.file add separator] + $name.m.file add command -label "No Recent Files" -state disabled #match_linux_wm [list $name.m.file add separator] #if {[llength $::recentfiles_list] > 0} { # ::pd_menus::update_recentfiles_menu $name.m.file false diff --git a/pd/src/pd_menus_SHORT.tcl b/pd/src/pd_menus_SHORT.tcl index 1f00434e9..929e985c0 100644 --- a/pd/src/pd_menus_SHORT.tcl +++ b/pd/src/pd_menus_SHORT.tcl @@ -81,10 +81,13 @@ proc ::pd_menus::update_recentfiles_on_menu {mymenu {write}} { $mymenu insert [expr $top_separator+1] command \ -label [file tail $filename] -command "open_file {$filename}" } - set filename [lindex $::recentfiles_list 0] - $mymenu insert [expr $top_separator+1] command \ - -label [file tail $filename] -command "open_file {$filename}" - + if { [llength $::recentfiles_list] > 0 } { + set filename [lindex $::recentfiles_list 0] + $mymenu insert [expr $top_separator+1] command \ + -label [file tail $filename] -command "open_file {$filename}" + } else { + $mymenu insert [expr $top_separator+1] command -label "No Recent Files" -state disabled + } # write to config file if {$write == true} { ::pd_guiprefs::write_recentfiles } } \ No newline at end of file -- GitLab