Class: TopinambourWindow
- Inherits:
-
Gtk::ApplicationWindow
- Object
- Gtk::ApplicationWindow
- TopinambourWindow
- Defined in:
- lib/window.rb
Overview
Copyright 2015-2017 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.
-
#current_label ⇒ Object
readonly
Returns the value of attribute current_label.
-
#current_tab ⇒ Object
readonly
Returns the value of attribute current_tab.
-
#notebook ⇒ Object
readonly
Returns the value of attribute notebook.
-
#overlay ⇒ Object
readonly
Returns the value of attribute overlay.
Instance Method Summary collapse
- #add_terminal(cmd = nil) ⇒ Object
- #close_current_tab ⇒ 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_next_tab ⇒ Object
- #show_prev_tab ⇒ Object
- #show_searchbar ⇒ Object
- #show_shortcuts ⇒ Object
- #show_terminal_chooser ⇒ 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 |
# 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) create_containers 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 |
#current_label ⇒ Object (readonly)
Returns the value of attribute current_label.
18 19 20 |
# File 'lib/window.rb', line 18 def current_label @current_label end |
#current_tab ⇒ Object (readonly)
Returns the value of attribute current_tab.
18 19 20 |
# File 'lib/window.rb', line 18 def current_tab @current_tab end |
#notebook ⇒ Object (readonly)
Returns the value of attribute notebook.
18 19 20 |
# File 'lib/window.rb', line 18 def notebook @notebook end |
#overlay ⇒ Object (readonly)
Returns the value of attribute overlay.
18 19 20 |
# File 'lib/window.rb', line 18 def @overlay end |
Instance Method Details
#add_terminal(cmd = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/window.rb', line 33 def add_terminal(cmd = nil) cmd = cmd || application.settings["default-shell"] working_dir = nil working_dir = @notebook.current.term.pid_dir if @notebook.current terminal = TopinambourTabTerm.new(cmd, working_dir) if terminal.term.pid terminal.show_all @notebook.append_page(terminal) terminal.term.load_settings @notebook.set_tab_reorderable(terminal, true) @notebook.set_page(@notebook.n_pages - 1) @notebook.current.term.grab_focus end end |
#close_current_tab ⇒ Object
99 100 101 102 |
# File 'lib/window.rb', line 99 def close_current_tab @notebook.remove_current_page end |
#display_about ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/window.rb', line 85 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-2017 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" => "1.0.15", "website" => "https://github.com/cedlemo/topinambour", "website_label" => "Topinambour github repository" ) end |
#exit_overlay_mode ⇒ Object
81 82 83 |
# File 'lib/window.rb', line 81 def @overlay.children[1].destroy if end |
#in_overlay_mode? ⇒ Boolean
104 105 106 |
# File 'lib/window.rb', line 104 def @overlay.children.size > 1 ? true : false end |
#quit_gracefully ⇒ Object
51 52 53 54 55 |
# File 'lib/window.rb', line 51 def quit_gracefully @notebook.remove_all_pages application.quit end |
#show_color_selector ⇒ Object
57 58 59 |
# File 'lib/window.rb', line 57 def show_color_selector (TopinambourColorSelector) end |
#show_font_selector ⇒ Object
73 74 75 |
# File 'lib/window.rb', line 73 def show_font_selector (TopinambourFontSelector) end |
#show_next_tab ⇒ Object
67 68 69 70 71 |
# File 'lib/window.rb', line 67 def show_next_tab @notebook.cycle_next_page @notebook.current.term.grab_focus end |
#show_prev_tab ⇒ Object
61 62 63 64 65 |
# File 'lib/window.rb', line 61 def show_prev_tab @notebook.cycle_prev_page @notebook.current.term.grab_focus end |
#show_searchbar ⇒ Object
108 109 110 111 112 |
# File 'lib/window.rb', line 108 def (TopinambourSearchBar) = @overlay.children[1] .search_mode = true if end |
#show_shortcuts ⇒ Object
125 126 127 128 129 130 131 |
# File 'lib/window.rb', line 125 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 |
#show_terminal_chooser ⇒ Object
77 78 79 |
# File 'lib/window.rb', line 77 def show_terminal_chooser (TopinambourTermChooser) end |
#toggle_shrink ⇒ Object
114 115 116 117 118 119 120 121 122 123 |
# File 'lib/window.rb', line 114 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 |