A menu item which provides a list of all recently opened files as monitored by the system recent chooser manager.
Synopsis
gnocl::menuRecentChooser [-option value...]
Screenshot
Options
- -pattern
- type: string (default: "*")
- List of file patterns to use in ordert to filter the list of filenames disiplayed. e.g "*.c *.h".
- -sort
- type: string (defaul: "none")
- Determine the ordering of the items displayed based upon the frequency of use. The availalble option are none (i.e. by time), least or most..
- -limit
- type: integer (default: 10)
- The maximum number of recently opened files to be displayed. Using a value of -1 will result in the display of all items..
- -showIcons
- type: boolean (default: 1)
- Whether or not to display a file icon registered as corresponding to the extension of a displayed item.
- -showNotFound
- type: boolean (default: 1)
- Whether or not to show the names of
items no longer present. Setting this item to 0 will result in a check
on every available resource (including remote devices) and so will be a
time consuming activity.
- -showNumbers
- type: boolean (default: 1)
- Whether the menu items are prepended by a number acting as keyboard mneumonic.
- -showLocal
- type: boolean (default: 1)
- Whether or not the item is
sensitive to user input.to only show local items.
- -showPrivate
- type: boolean (default: 0)
- Whether or not private items are to be displayed.
- -showTips
- type: boolean (default: 1)
- Whether or not to show a tooltip containing the full path of the active item.
- -onClicked
- type: string (default: "")
- Tcl script which is executed whenever
the mouse pointer enters the button. Before evaluation the following
percent strings are substituted:
%w widget name %f URI of file entry selected.
-
Local files will be prefixed with "file://" which may need to be
removed for use in scripts. See the example below for more details.
Description
A menu that displays a list of those files listed by the Gtk recent
file manager as being opened. The items displayed can be filtered
according to application requirements. Items are added/removed using an
instance of the gnocl::recentManager widget.
Commands
- id delete
- Deletes the widget and the
associated tcl command.
- id configure
[-option
value...]
- Configures the widget. Option may
have any of the values accepted on creation of the widget.
Example
#---------------
# test-recent.tcl
#---------------
#!/bin/sh
#\
exec tclsh "$0" "$@"
package require Gnocl
set txt [gnocl::text]
set box [gnocl::box -orientation vertical]
set tbar [gnocl::toolBar]
$box add $tbar
$box add $txt -fill {1 1} -expand 1
set rc_mgr [gnocl::recentManager getDefault]
set rc_menu [gnocl::menuRecentChooser \
-showNumbers 1 \
-limit 5 \
-showIcons 1 \
-showNotFound 1 \
-showPrivate 1 \
-showTips 1 \
-patterns "*.tcl *.c *.h" \
-onClicked {
set fname [string range %f 5 end]
openFile $fname
} ]
$tbar add menuButton \
-icon %#Open \
-text Open \
-menu $rc_menu \
-tooltip "Open File" \
-arrowTooltip "Open Recent" \
-onClicked {
set fname [gnocl::fileChooserDialog]
openFile $fname
puts "file://$fname"
$rc_mgr add "$fname"
}
proc openFile {fname} {
global txt
global rc_mgr
if {$fname == ""} {return}
if {1} {
set fp [open $fname "r"]
set data [read $fp]
close $fp
$txt set $data
unset data
}
}
gnocl::window -child $box -setSize 0.3
|