Class: TopinambourWindow
- Inherits:
-
Gtk::ApplicationWindow
- Object
- Gtk::ApplicationWindow
- TopinambourWindow
- Defined in:
- lib/window.rb
Overview
Copyright 2015-2018 Cedric LE MOIGNE, [email protected] This file is part of Topinambour.
Topinambour is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
Topinambour is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Topinambour. If not, see <www.gnu.org/licenses/>.
Instance Attribute Summary collapse
-
#bar ⇒ Object
readonly
Returns the value of attribute bar.
-
#overlay ⇒ Object
readonly
Returns the value of attribute overlay.
-
#terminal ⇒ Object
readonly
Returns the value of attribute terminal.
Instance Method Summary collapse
- #add_terminal(cmd = nil) ⇒ Object
- #display_about ⇒ Object
- #exit_overlay_mode ⇒ Object
- #in_overlay_mode? ⇒ Boolean
-
#initialize(application) ⇒ TopinambourWindow
constructor
A new instance of TopinambourWindow.
- #quit_gracefully ⇒ Object
- #show_color_selector ⇒ Object
- #show_font_selector ⇒ Object
- #show_shortcuts ⇒ Object
- #toggle_shrink ⇒ Object
Constructor Details
#initialize(application) ⇒ TopinambourWindow
Returns a new instance of TopinambourWindow.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/window.rb', line 19 def initialize(application) super(application) set_icon_name("utilities-terminal-symbolic") set_name("topinambour-window") load_settings set_position(:center) @overlay = Gtk::Overlay.new add(@overlay) show_all signal_connect "key-press-event" do |, event| TopinambourShortcuts.handle_key_press(, event) end end |
Instance Attribute Details
#bar ⇒ Object (readonly)
Returns the value of attribute bar.
18 19 20 |
# File 'lib/window.rb', line 18 def @bar end |
#overlay ⇒ Object (readonly)
Returns the value of attribute overlay.
18 19 20 |
# File 'lib/window.rb', line 18 def @overlay end |
#terminal ⇒ Object (readonly)
Returns the value of attribute terminal.
18 19 20 |
# File 'lib/window.rb', line 18 def terminal @terminal end |
Instance Method Details
#add_terminal(cmd = nil) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/window.rb', line 34 def add_terminal(cmd = nil) cmd = cmd || application.settings["default-shell"] terminal = TopinambourTermBox.new(cmd) @overlay.add(terminal) @terminal = terminal.term terminal.term.load_settings end |
#display_about ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/window.rb', line 59 def display_about Gtk::AboutDialog.show(self, "authors" => ["Cedric Le Moigne <[email protected]>"], "comments" => "Terminal Emulator based on the ruby bindings of Gtk3 and Vte3", "copyright" => "Copyright (C) 2015-2018 Cedric Le Moigne", "license" => "This program is licenced under the licence GPL-3.0 and later.", "logo_icon_name" => "utilities-terminal-symbolic", "program_name" => "Topinambour", "version" => "2.0.2", "website" => "https://github.com/cedlemo/topinambour", "website_label" => "Topinambour github repository" ) end |
#exit_overlay_mode ⇒ Object
55 56 57 |
# File 'lib/window.rb', line 55 def @overlay.children[1].destroy if end |
#in_overlay_mode? ⇒ Boolean
73 74 75 |
# File 'lib/window.rb', line 73 def @overlay.children.size > 1 ? true : false end |
#quit_gracefully ⇒ Object
43 44 45 |
# File 'lib/window.rb', line 43 def quit_gracefully application.quit end |
#show_color_selector ⇒ Object
47 48 49 |
# File 'lib/window.rb', line 47 def show_color_selector (TopinambourColorSelector) end |
#show_font_selector ⇒ Object
51 52 53 |
# File 'lib/window.rb', line 51 def show_font_selector (TopinambourFontSelector) end |
#show_shortcuts ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/window.rb', line 88 def show_shortcuts resource_file = "/com/github/cedlemo/topinambour/shortcuts.ui" builder = Gtk::Builder.new(:resource => resource_file) shortcuts_win = builder["shortcuts-window"] shortcuts_win.transient_for = self shortcuts_win.show end |
#toggle_shrink ⇒ Object
77 78 79 80 81 82 83 84 85 86 |
# File 'lib/window.rb', line 77 def toggle_shrink w, h = size if @shrink_saved_height resize(w, @shrink_saved_height) @shrink_saved_height = nil else resize(w, 1) @shrink_saved_height = h end end |