Method: VMAgui#init_window

Defined in:
lib/vimamsa/gui.rb

#init_windowObject



554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/vimamsa/gui.rb', line 554

def init_window
  @last_debug_idle = Time.now
  app = Gtk::Application.new("net.samiddhi.vimamsa.r#{rand(1000)}", :flags_none)
  @app = app

  Gtk::Settings.default.gtk_application_prefer_dark_theme = true
  Gtk::Settings.default.gtk_theme_name = "Adwaita"
  Gtk::Settings.default.gtk_cursor_blink = false
  Gtk::Settings.default.gtk_cursor_blink_time = 4000

  app.signal_connect "activate" do
    @window = Gtk::ApplicationWindow.new(app)
    @window.set_application(app)

    @window.title = "Multiple Views"
    @vpaned = Gtk::Paned.new(:vertical)

    @vbox = Gtk::Grid.new()
    @window.add(@vbox)

    Thread.new {
      GLib::Idle.add(proc { debug_idle_func })
    }

    reset_controllers

    @windows[1] = new_window(1)

    @last_adj_time = Time.now


    # To show keyboard key binding state
    @statnfo = Gtk::Label.new
    
    # To show e.g. current folder
    @subtitle = Gtk::Label.new("")
    
    @statbox = Gtk::Box.new(:horizontal, 2)
    @statnfo.set_size_request(150, 10)
    @statbox.append(@subtitle)
    @subtitle.hexpand = true
    @statbox.append(@statnfo)
    provider = Gtk::CssProvider.new
    @statnfo.add_css_class("statnfo")
    provider.load(data: "label.statnfo {   background-color:#353535; font-size: 10pt; margin-top:2px; margin-bottom:2px; align:right;}")

    provider = Gtk::CssProvider.new
    @statnfo.style_context.add_provider(provider)

    # numbers: left, top, width, height
    @vbox.attach(@windows[1][:overlay], 0, 2, 2, 1)

    # column, row, width height
    @vbox.attach(@statbox, 1, 1, 1, 1)

    init_minibuffer

    menubar = Gio::Menu.new
    app.menubar = menubar
    @window.show_menubar = true

    @menubar = menubar

    @active_window = @windows[1]

    @window.show

    run_as_idle proc { idle_set_size }

    prov = Gtk::CssProvider.new
    # See gtk-4.9.4/gtk/theme/Default/_common.scss  on how to theme
    # gtksourceview/gtksourcestyleschemepreview.c
    # gtksourceview/gtksourcestylescheme.c
    prov.load(data: " headerbar { padding: 0 0px; min-height: 16px; border-width: 0 0 0px; border-style: solid; }
    
    textview border.left gutter { color: #8aa; font-size:8pt; }     
    
    textview border.left gutter { padding: 0px 0px 0px 0px; margin: 0px 0px 0px 0px; color: #8aa; font-size:9pt; }     
    
       headerbar .title {
    font-weight: bold;
    font-size: 11pt;
    color: #cdffee;
}

 headerbar > windowhandle > box .start {
    border-spacing: 6px;
}
 
 headerbar windowcontrols button {
      min-height: 15px;
      min-width: 15px;
    }

 popover background > contents { padding: 8px; border-radius: 20px; } 
       ")
    @window.style_context.add_provider(prov)

    sc = Gtk::StyleContext.add_provider_for_display(Gdk::Display.default, prov)

    vma.start
  end

  GLib::Idle.add(proc { self.monitor })

  app.run
end