method

new

Importance_0
v1_9_2_180 - Show latest stable - 0 notes - Class: MainWindow
new(encoding) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File ext/json/lib/json/editor.rb, line 1050
      def initialize(encoding)
        @changed  = false
        @encoding = encoding
        super(TOPLEVEL)
        display_title
        set_default_size(800, 600)
        signal_connect(:delete_event) { quit }

        vbox = VBox.new(false, 0)
        add(vbox)
        #vbox.border_width = 0

        @treeview = JSONTreeView.new(self)
        @treeview.signal_connect(:'cursor-changed') do
          display_status('')
        end

        menu_bar = create_menu_bar
        vbox.pack_start(menu_bar, false, false, 0)

        sw = ScrolledWindow.new(nil, nil)
        sw.shadow_type = SHADOW_ETCHED_IN
        sw.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
        vbox.pack_start(sw, true, true, 0)
        sw.add(@treeview)

        @status_bar = Statusbar.new
        vbox.pack_start(@status_bar, false, false, 0)

        @filename ||= nil
        if @filename
          data = read_data(@filename)
          view_new_model Editor.data2model(data)
        end

        signal_connect(:button_release_event) do |_,event|
          if event.button == 2
            c = Gtk::Clipboard.get(Gdk::Selection::PRIMARY)
            if url = c.wait_for_text
              location_open url
            end
            false
          else
            true
          end
        end
      end
Register or log in to add new notes.