Class JSON::Editor::FileMenu
In: lib/json/editor.rb
Parent: Object
StringScanner Parser JSONTreeView MainWindow Gtk::TreeView OptionsMenu EditMenu PopUpMenu FileMenu Gtk::Window Enumerable TreeIter Gtk State lib/json.rb lib/json/editor.rb MenuExtension lib/json/editor.rb Gtk Editor JSON Module: JSON

This class creates the File pulldown menu.

Methods

create   new   open   quit   revert   save   save_as  

Included Modules

MenuExtension

Public Instance methods

Create the menu.

[Source]

     # File lib/json/editor.rb, line 492
492:       def create
493:         title = MenuItem.new('File')
494:         title.submenu = menu
495:         add_item('New', &method(:new))
496:         add_item('Open', &method(:open))
497:         add_item('Revert', &method(:revert))
498:         add_separator
499:         add_item('Save', &method(:save))
500:         add_item('Save As', &method(:save_as))
501:         add_separator
502:         add_item('Quit', &method(:quit))
503:         title
504:       end

Clear the model and filename, but ask to save the JSON document, if unsaved changes have occured.

[Source]

     # File lib/json/editor.rb, line 459
459:       def new(item)
460:         window.clear
461:       end

Open a file and load it into the editor. Ask to save the JSON document first, if unsaved changes have occured.

[Source]

     # File lib/json/editor.rb, line 465
465:       def open(item)
466:         window.file_open
467:       end

Quit the editor, after asking to save any unsaved changes first.

[Source]

     # File lib/json/editor.rb, line 487
487:       def quit(item)
488:         window.quit
489:       end

Revert the current JSON document in the editor to the saved version.

[Source]

     # File lib/json/editor.rb, line 470
470:       def revert(item)
471:         window.instance_eval do
472:           @filename and file_open(@filename) 
473:         end
474:       end

Save the current JSON document.

[Source]

     # File lib/json/editor.rb, line 477
477:       def save(item)
478:         window.file_save
479:       end

Save the current JSON document under the given filename.

[Source]

     # File lib/json/editor.rb, line 482
482:       def save_as(item)
483:         window.file_save_as
484:       end

[Validate]