gnocl::recentManager

    Create an instance of the recentManager widget for the manipulation of the recently used files resouce.

    Synopsis

    gnocl::recentManager sub-command <option val>

    Description

    This command provides a facility for adding, removing and looking up recently used files. Each recently used file is identified by its URI, and has meta-data associated to it, like the names and command lines of the applications that have registered it, the number of time each application has registered the same file, the mime type of the file and whether the file should be displayed only by the applications that have registered it.

    NB. At present only minimal support is given to the access, adding and removing of items from the default recent files manager which is sufficent for most standalone applications. Future releases of Gnocl will have support for the full range of options available within the Gtk+ libraries.

    Subcommands

    gnocl::recentManger getDefault

    Type: String

    Return a named point of access to the default recent chooser manager for the active screen.

    Commands

    add URI
    Add a new file URI to the list of recently accesses files.
    remove URI  
    Remove a file URI to the list of recently accesses files.
    purge  
    Remove all URIs from the currently maintained list.

    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
    Comments

    Sections