new (MainWindow)

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