Class: MainWindow

Class | MainWindow
In: | lib/json/editor.rb
Parent: | Gtk::Window

The editor main window

### Methods

ask_for_location ask_save change clear create_menu_bar display_status display_title edit file_open file_save file_save_as load_file load_location location_open new quit read_data select_file store_file unchange view_new_model

### Included Modules

Gtk

### Public Class methods

new(encoding)

### Public Instance methods

ask_for_location()

Ask for location URI a to load data from. Returns the URI as a string.

ask_save()

Opens a dialog, asking, if changes should be saved to a file.

change()

Sets editor status to changed, to indicate that the edited data containts unsaved changes.

clear()

Clear the current model, after asking to save all unsaved changes.

create_menu_bar()

Creates the menu bar with the pulldown menus and returns it.

display_status(text)

Displays text in the status bar.

display_title()

Display the new title according to the editor‘s current state.

edit(json)

Edit the string json in the editor.

file_open(filename = nil)

Open the file filename or call the select_file method to ask for a filename.

file_save()

Save the current file.

file_save_as()

Save the current file as the filename

load_file(filename)

Load the file named filename into the editor as a JSON document.

load_location(uri)

Load the data at location uri into the editor as a JSON document.

location_open(uri = nil)

Open the data at the location uri, if given. Otherwise open a dialog to ask for the uri.

quit()

Quit this editor, that is, leave this editor‘s main loop.

read_data(filename)

Read a JSON document from the file named filename, parse it into a ruby data structure, and return the data.

select_file(message)

Open a file selecton dialog, displaying message, and return the selected filename or nil, if no file was selected.

store_file(path)

Store the current JSON document to path.

unchange()

Sets editor status to unchanged, to indicate that the edited data doesn‘t containt unsaved changes.

view_new_model(model)

Puts a new model model into the Gtk::TreeView to be edited.

[Validate]