new (MainWindow)

          # File lib/json/editor.rb, line 1041
    1041:       def initialize(encoding)
    1042:         @changed  = false
    1043:         @encoding = encoding
    1044:         super(TOPLEVEL)
    1045:         display_title
    1046:         set_default_size(800, 600)
    1047:         signal_connect(:delete_event) { quit }
    1048:
    1049:         vbox = VBox.new(false, 0)
    1050:         add(vbox)
    1051:         #vbox.border_width = 0
    1052:
    1053:         @treeview = JSONTreeView.new(self)
    1054:         @treeview.signal_connect('cursor-changed''cursor-changed') do
    1055:           display_status('')
    1056:         end
    1057:
    1058:         menu_bar = create_menu_bar
    1059:         vbox.pack_start(menu_bar, false, false, 0)
    1060:
    1061:         sw = ScrolledWindow.new(nil, nil)
    1062:         sw.shadow_type = SHADOW_ETCHED_IN
    1063:         sw.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
    1064:         vbox.pack_start(sw, true, true, 0)
    1065:         sw.add(@treeview)
    1066:
    1067:         @status_bar = Statusbar.new
    1068:         vbox.pack_start(@status_bar, false, false, 0)
    1069:
    1070:         @filename ||= nil
    1071:         if @filename
    1072:           data = read_data(@filename)
    1073:           view_new_model Editor.data2model(data)
    1074:         end
    1075:
    1076:         signal_connect(:button_release_event) do |_,event|
    1077:           if event.button == 2
    1078:             c = Gtk::Clipboard.get(Gdk::Selection::PRIMARY)
    1079:             if url = c.wait_for_text
    1080:               location_open url
    1081:             end
    1082:             false
    1083:           else
    1084:             true
    1085:           end
    1086:         end
    1087:       end