topinambour 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +40 -46
- data/bin/topinambour +11 -3
- data/data/headerbar.ui +173 -0
- data/data/prefs-dialog.ui +576 -0
- data/data/topinambour.css +16 -0
- data/data/topinambour.gresource +0 -0
- data/data/topinambour.gresource.xml +2 -0
- data/data/window-menu.ui +1 -0
- data/lib/actions.rb +14 -4
- data/lib/application.rb +6 -6
- data/lib/color_selector.rb +3 -6
- data/lib/css_editor.rb +1 -1
- data/lib/css_handler.rb +12 -7
- data/lib/font_selector.rb +2 -4
- data/lib/notebook.rb +9 -1
- data/lib/preferences.rb +185 -0
- data/lib/resize_message.rb +1 -1
- data/lib/rgb_names_regexes.rb +3 -0
- data/lib/searchbar.rb +54 -0
- data/lib/shortcuts.rb +27 -8
- data/lib/style_properties.rb +48 -37
- data/lib/terminal.rb +3 -1
- data/lib/terminal_chooser.rb +26 -19
- data/lib/terminal_regex.rb +3 -2
- data/lib/window.rb +100 -35
- metadata +12 -9
- data/lib/headerbar.rb +0 -126
data/lib/terminal_chooser.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2015-2016
|
1
|
+
# Copyright 2015-2016 Cedric LE MOIGNE, cedlemo@gmx.com
|
2
2
|
# This file is part of Topinambour.
|
3
3
|
#
|
4
4
|
# Topinambour is free software: you can redistribute it and/or modify
|
@@ -17,7 +17,7 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
|
|
17
17
|
def initialize(window)
|
18
18
|
super(nil, nil)
|
19
19
|
@window = window
|
20
|
-
set_size_request(
|
20
|
+
set_size_request(250, @window.notebook.current.allocation.to_a[3] - 8)
|
21
21
|
set_halign(:end)
|
22
22
|
set_valign(:center)
|
23
23
|
set_name("terminal_chooser")
|
@@ -43,11 +43,14 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
|
|
43
43
|
|
44
44
|
def fill_grid
|
45
45
|
@window.notebook.children.each_with_index do |child, i|
|
46
|
-
button =
|
46
|
+
button = Gtk::Label.new("tab. #{(i + 1).to_s}")
|
47
|
+
button.angle = 45
|
47
48
|
@grid.attach(button, 0, i, 1, 1)
|
49
|
+
button = generate_preview_button(child, i)
|
50
|
+
@grid.attach(button, 1, i, 1, 1)
|
48
51
|
add_drag_and_drop_functionalities(button)
|
49
52
|
button = generate_close_tab_button
|
50
|
-
@grid.attach(button,
|
53
|
+
@grid.attach(button, 2, i, 1, 1)
|
51
54
|
end
|
52
55
|
@grid.attach(generate_separator, 0, @window.notebook.n_pages, 2, 1)
|
53
56
|
button = generate_quit_button
|
@@ -84,21 +87,20 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
|
|
84
87
|
|
85
88
|
def update_preview_button_tooltip(range)
|
86
89
|
(range).each do |j|
|
87
|
-
puts j
|
88
90
|
@grid.get_child_at(0, j).tooltip_text = j.to_s
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
92
94
|
def generate_preview_button(child, i)
|
93
95
|
button = Gtk::Button.new
|
94
|
-
button.
|
95
|
-
button.set_tooltip_text(i.to_s)
|
96
|
+
button.image = generate_preview_image(child.preview)
|
97
|
+
button.set_tooltip_text((i + 1).to_s)
|
96
98
|
button.signal_connect("clicked") { @window.notebook.current_page = i }
|
97
99
|
button
|
98
100
|
end
|
99
101
|
|
100
102
|
def generate_preview_image(pixbuf)
|
101
|
-
scaled_pix = pixbuf.scale(150, 75,
|
103
|
+
scaled_pix = pixbuf.scale(150, 75, :bilinear)
|
102
104
|
img = Gtk::Image.new(:pixbuf => scaled_pix)
|
103
105
|
img.show
|
104
106
|
img
|
@@ -130,18 +132,19 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
|
|
130
132
|
[["test", Gtk::TargetFlags::SAME_APP, 12_345]],
|
131
133
|
Gdk::DragAction::COPY |
|
132
134
|
Gdk::DragAction::MOVE)
|
133
|
-
button.drag_source_set_icon_name("grab")
|
135
|
+
#button.drag_source_set_icon_name("grab")
|
134
136
|
# Drag source signals
|
135
137
|
# drag-begin User starts a drag Set-up drag icon
|
136
138
|
# drag-data-get When drag data is requested by the destination Transfer drag data from source to destination
|
137
139
|
# drag-data-delete When a drag with the action Gdk.DragAction.MOVE is completed Delete data from the source to complete the "move"
|
138
140
|
# drag-end When the drag is complete Undo anything done in drag-begin
|
139
141
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
142
|
+
button.signal_connect "drag-begin" do |widget|
|
143
|
+
widget.drag_source_set_icon_pixbuf(widget.image.pixbuf)
|
144
|
+
end
|
145
|
+
|
146
|
+
button.signal_connect("drag-data-get") do |widget, _context, selection_data, _info, _time|
|
147
|
+
index = grid_line_of(widget)
|
145
148
|
selection_data.set(Gdk::Selection::TYPE_INTEGER, index.to_s)
|
146
149
|
end
|
147
150
|
# button.signal_connect "drag-data-delete" do
|
@@ -169,21 +172,25 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
|
|
169
172
|
button.signal_connect("drag-drop") do |widget, context, _x, _y, time|
|
170
173
|
widget.drag_get_data(context, context.targets[0], time)
|
171
174
|
end
|
172
|
-
button.signal_connect("drag-data-received") do |
|
173
|
-
index =
|
175
|
+
button.signal_connect("drag-data-received") do |widget, context, _x, _y, selection_data, _info, _time|
|
176
|
+
index = grid_line_of(widget)
|
174
177
|
index_of_dragged_object = index
|
175
178
|
context.targets.each do |target|
|
176
179
|
next unless target.name == "test" || selection_data.type == :type_integer
|
177
|
-
data_len = selection_data.data
|
178
|
-
index_of_dragged_object = selection_data.data
|
180
|
+
data_len = selection_data.data.size
|
181
|
+
index_of_dragged_object = selection_data.data.pack("C#{data_len}").to_i
|
179
182
|
end
|
180
183
|
if index_of_dragged_object != index
|
181
184
|
dragged = @window.notebook.get_nth_page(index_of_dragged_object)
|
182
185
|
@window.notebook.reorder_child(dragged, index)
|
183
186
|
@window.notebook.children.each_with_index do |child, i|
|
184
|
-
@grid.get_child_at(
|
187
|
+
@grid.get_child_at(1, i).image = generate_preview_image(child.preview)
|
185
188
|
end
|
186
189
|
end
|
187
190
|
end
|
188
191
|
end
|
192
|
+
|
193
|
+
def grid_line_of(widget)
|
194
|
+
@grid.child_get_property(widget, "top-attach")
|
195
|
+
end
|
189
196
|
end
|
data/lib/terminal_regex.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2016
|
1
|
+
# Copyright 2016 Cedric LE MOIGNE, cedlemo@gmx.com
|
2
2
|
# This file is part of Topinambour.
|
3
3
|
#
|
4
4
|
# Topinambour is free software: you can redistribute it and/or modify
|
@@ -108,7 +108,8 @@ RGB_COLOR = "rgb\\s*\\(\\s*#{UINT8_CLASS}\\s*\\,\\s*#{UINT8_CLASS}\\s*\\,\\s*#{U
|
|
108
108
|
RGBPERC_COLOR = "rgb\\s*\\(\\s*#{PERCENT_CLASS}\\s*\\,\\s*#{PERCENT_CLASS}\\s*\\,\\s*#{PERCENT_CLASS}\\s*\\)"
|
109
109
|
RGBA_COLOR = "rgba\\s*\\(\\s*#{UINT8_CLASS}\\s*\\,\\s*#{UINT8_CLASS}\\s*\\,\\s*#{UINT8_CLASS}\\s*\\,\\s*[0-1](\\.[0-9]*)?\\s*\\)"
|
110
110
|
RGBAPERC_COLOR = "rgba\\s*\\(\\s*#{PERCENT_CLASS}\\s*\\,\\s*#{PERCENT_CLASS}\\s*\\,\\s*#{PERCENT_CLASS}\\s*\\,\\s*[0-1](\\.[0-9]*)?\\s*\\)"
|
111
|
-
|
111
|
+
include RgbNames
|
112
|
+
CSS_COLORS = "#{HEX_COLOR}|#{RGB_COLOR}|#{RGBPERC_COLOR}|#{RGBA_COLOR}|#{RGBAPERC_COLOR}|#{COLOR_NAMES}"
|
112
113
|
end
|
113
114
|
|
114
115
|
module TopinambourRegex
|
data/lib/window.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2015-2016
|
1
|
+
# Copyright 2015-2016 Cedric LE MOIGNE, cedlemo@gmx.com
|
2
2
|
# This file is part of Topinambour.
|
3
3
|
#
|
4
4
|
# Topinambour is free software: you can redistribute it and/or modify
|
@@ -15,8 +15,8 @@
|
|
15
15
|
# along with Topinambour. If not, see <http://www.gnu.org/licenses/>.
|
16
16
|
|
17
17
|
class TopinambourWindow
|
18
|
-
attr_reader :notebook, :bar, :overlay, :current_label, :current_tab
|
19
|
-
|
18
|
+
attr_reader :notebook, :bar, :overlay, :current_label, :current_tab
|
19
|
+
attr_accessor :shell, :css_editor_style
|
20
20
|
def initialize(application)
|
21
21
|
super(:application => application)
|
22
22
|
set_icon_name("utilities-terminal-symbolic")
|
@@ -28,6 +28,9 @@ class TopinambourWindow
|
|
28
28
|
signal_connect "key-press-event" do |widget, event|
|
29
29
|
TopinambourShortcuts.handle_key_press(widget, event)
|
30
30
|
end
|
31
|
+
signal_connect "scroll-event" do |widget, event|
|
32
|
+
TopinambourShortcuts.handle_scroll(widget, event)
|
33
|
+
end
|
31
34
|
end
|
32
35
|
|
33
36
|
def add_terminal(cmd = @shell)
|
@@ -82,6 +85,10 @@ class TopinambourWindow
|
|
82
85
|
toggle_overlay(TopinambourTermChooser)
|
83
86
|
end
|
84
87
|
|
88
|
+
def show_terminal_chooser2
|
89
|
+
toggle_overlay(TopinambourTermChooserb)
|
90
|
+
end
|
91
|
+
|
85
92
|
def exit_overlay_mode
|
86
93
|
@overlay.children[1].destroy if in_overlay_mode?
|
87
94
|
end
|
@@ -90,20 +97,19 @@ class TopinambourWindow
|
|
90
97
|
@default_width = style_get_property("width")
|
91
98
|
@default_height = style_get_property("height")
|
92
99
|
set_default_size(@default_width, @default_height)
|
93
|
-
set_size_request(@default_width, @default_height)
|
94
100
|
@shell = style_get_property("shell")
|
95
101
|
@css_editor_style = style_get_property("css-editor-style")
|
96
102
|
end
|
97
103
|
|
98
104
|
def display_about
|
99
105
|
Gtk::AboutDialog.show(self,
|
100
|
-
"authors" => ["
|
106
|
+
"authors" => ["Cedric Le Moigne <cedlemo@gmx.com>"],
|
101
107
|
"comments" => "Terminal Emulator based on the ruby bindings of Gtk3 and Vte3",
|
102
|
-
"copyright" => "Copyright (C) 2015-2016
|
108
|
+
"copyright" => "Copyright (C) 2015-2016 Cedric Le Moigne",
|
103
109
|
"license" => "This program is licenced under the licence GPL-3.0 and later.",
|
104
110
|
"logo_icon_name" => "utilities-terminal-symbolic",
|
105
111
|
"program_name" => "Topinambour",
|
106
|
-
"version" => "1.0.
|
112
|
+
"version" => "1.0.9",
|
107
113
|
"website" => "https://github.com/cedlemo/topinambour",
|
108
114
|
"website_label" => "Topinambour github repository"
|
109
115
|
)
|
@@ -118,11 +124,28 @@ class TopinambourWindow
|
|
118
124
|
@overlay.children.size > 1 ? true : false
|
119
125
|
end
|
120
126
|
|
127
|
+
def show_searchbar
|
128
|
+
toggle_overlay(TopinambourSearchBar)
|
129
|
+
overlayed_widget = @overlay.children[1]
|
130
|
+
overlayed_widget.search_mode = true if overlayed_widget
|
131
|
+
end
|
132
|
+
|
133
|
+
def toggle_shrink
|
134
|
+
w, h = size
|
135
|
+
if @shrink_saved_height
|
136
|
+
resize(w, @shrink_saved_height)
|
137
|
+
@shrink_saved_height = nil
|
138
|
+
else
|
139
|
+
resize(w, 1)
|
140
|
+
@shrink_saved_height = h
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
121
144
|
private
|
122
145
|
|
123
146
|
def add_overlay(widget)
|
124
147
|
@overlay.add_overlay(widget)
|
125
|
-
@overlay.set_overlay_pass_through(widget,
|
148
|
+
@overlay.set_overlay_pass_through(widget, false)
|
126
149
|
end
|
127
150
|
|
128
151
|
def create_containers
|
@@ -133,33 +156,75 @@ class TopinambourWindow
|
|
133
156
|
end
|
134
157
|
|
135
158
|
def create_header_bar
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
@
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
159
|
+
resource_file = "/com/github/cedlemo/topinambour/headerbar.ui"
|
160
|
+
builder = Gtk::Builder.new(:resource => resource_file)
|
161
|
+
set_titlebar(builder["headerbar"])
|
162
|
+
@current_label = builder["current_label"]
|
163
|
+
current_label_signals
|
164
|
+
@current_tab = builder["current_tab"]
|
165
|
+
next_prev_new_signals(builder)
|
166
|
+
overview_font_color_signals(builder)
|
167
|
+
main_menu_signal(builder)
|
168
|
+
end
|
169
|
+
|
170
|
+
def current_label_signals
|
171
|
+
@current_label.signal_connect "activate" do |entry|
|
172
|
+
@notebook.current.custom_title = entry.text
|
173
|
+
@notebook.current.grab_focus
|
174
|
+
end
|
175
|
+
|
176
|
+
@current_label.signal_connect "icon-release" do |entry, position|
|
177
|
+
if position == :primary
|
178
|
+
close_current_tab
|
179
|
+
elsif position == :secondary
|
180
|
+
@notebook.current.custom_title = nil
|
181
|
+
entry.text = @notebook.current.window_title
|
182
|
+
end
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
def next_prev_new_signals(builder)
|
187
|
+
builder["prev_button"].signal_connect "clicked" do
|
188
|
+
show_prev_tab
|
189
|
+
end
|
190
|
+
|
191
|
+
builder["next_button"].signal_connect "clicked" do
|
192
|
+
show_next_tab
|
193
|
+
end
|
194
|
+
|
195
|
+
builder["new_term"].signal_connect "clicked" do
|
196
|
+
add_terminal
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
def overview_font_color_signals(builder)
|
201
|
+
builder["term_overv_button"].signal_connect "clicked" do
|
202
|
+
show_terminal_chooser
|
203
|
+
end
|
204
|
+
|
205
|
+
builder["font_sel_button"].signal_connect "clicked" do
|
206
|
+
show_font_selector
|
207
|
+
end
|
208
|
+
|
209
|
+
builder["colors_sel_button"].signal_connect "clicked" do
|
210
|
+
show_color_selector
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def main_menu_signal(builder)
|
215
|
+
builder["menu_button"].signal_connect "clicked" do |button|
|
216
|
+
ui_file = "/com/github/cedlemo/topinambour/window-menu.ui"
|
217
|
+
winmenu = Gtk::Builder.new(:resource => ui_file)["winmenu"]
|
218
|
+
event = Gtk.current_event
|
219
|
+
menu = Gtk::Popover.new(button, winmenu)
|
220
|
+
x, y = event.window.coords_to_parent(event.x,
|
221
|
+
event.y)
|
222
|
+
rect = Gdk::Rectangle.new(x - button.allocation.x,
|
223
|
+
y - button.allocation.y,
|
224
|
+
1, 1)
|
225
|
+
menu.set_pointing_to(rect)
|
226
|
+
menu.show
|
227
|
+
end
|
163
228
|
end
|
164
229
|
|
165
230
|
def toggle_overlay(klass)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: topinambour
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Cedric LE MOIGNE
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: vte3
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.0'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.0.
|
22
|
+
version: 3.0.9
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3.0'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 3.0.
|
32
|
+
version: 3.0.9
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: gtksourceview3
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '3.0'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 3.0.
|
42
|
+
version: 3.0.9
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '3.0'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 3.0.
|
52
|
+
version: 3.0.9
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: sass
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,8 +86,10 @@ files:
|
|
86
86
|
- data/color-select-symbolic.svg
|
87
87
|
- data/emblem-photos-symbolic.svg
|
88
88
|
- data/font-select-symbolic.svg
|
89
|
+
- data/headerbar.ui
|
89
90
|
- data/pan-end-symbolic.svg
|
90
91
|
- data/pan-start-symbolic.svg
|
92
|
+
- data/prefs-dialog.ui
|
91
93
|
- data/tab-new-symbolic.svg
|
92
94
|
- data/terminal-menu.ui
|
93
95
|
- data/topinambour.css
|
@@ -102,9 +104,11 @@ files:
|
|
102
104
|
- lib/css_editor.rb
|
103
105
|
- lib/css_handler.rb
|
104
106
|
- lib/font_selector.rb
|
105
|
-
- lib/headerbar.rb
|
106
107
|
- lib/notebook.rb
|
108
|
+
- lib/preferences.rb
|
107
109
|
- lib/resize_message.rb
|
110
|
+
- lib/rgb_names_regexes.rb
|
111
|
+
- lib/searchbar.rb
|
108
112
|
- lib/shortcuts.rb
|
109
113
|
- lib/style_properties.rb
|
110
114
|
- lib/terminal.rb
|
@@ -136,4 +140,3 @@ signing_key:
|
|
136
140
|
specification_version: 4
|
137
141
|
summary: Ruby-gnome2 Terminal emulator
|
138
142
|
test_files: []
|
139
|
-
has_rdoc:
|
data/lib/headerbar.rb
DELETED
@@ -1,126 +0,0 @@
|
|
1
|
-
# Copyright 2016 Cédric LE MOIGNE, cedlemo@gmx.com
|
2
|
-
# This file is part of Topinambour.
|
3
|
-
#
|
4
|
-
# Topinambour is free software: you can redistribute it and/or modify
|
5
|
-
# it under the terms of the GNU General Public License as published by
|
6
|
-
# the Free Software Foundation, either version 3 of the License, or
|
7
|
-
# any later version.
|
8
|
-
#
|
9
|
-
# Topinambour is distributed in the hope that it will be useful,
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
-
# GNU General Public License for more details.
|
13
|
-
#
|
14
|
-
# You should have received a copy of the GNU General Public License
|
15
|
-
# along with Topinambour. If not, see <http://www.gnu.org/licenses/>.
|
16
|
-
|
17
|
-
module TopinambourHeaderBar
|
18
|
-
def self.generate_header_bar(window)
|
19
|
-
bar = Gtk::HeaderBar.new
|
20
|
-
bar.title = "Topinambour"
|
21
|
-
bar.has_subtitle = false
|
22
|
-
bar.show_close_button = true
|
23
|
-
window.set_titlebar(bar)
|
24
|
-
bar
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.generate_current_label_tooltips(label)
|
28
|
-
label.tooltip_text = <<-TOOLTIP
|
29
|
-
Change the name of the tab and hit
|
30
|
-
enter in order to validate
|
31
|
-
TOOLTIP
|
32
|
-
label.set_icon_tooltip_text(:secondary, <<-SECTOOLTIP)
|
33
|
-
Reset your changes and use the
|
34
|
-
default label for the current tab
|
35
|
-
SECTOOLTIP
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.generate_current_label_signals(label, window)
|
39
|
-
label.signal_connect "activate" do |entry|
|
40
|
-
window.notebook.current.custom_title = entry.text
|
41
|
-
end
|
42
|
-
|
43
|
-
label.signal_connect "icon-release" do |entry, position|
|
44
|
-
if position == :secondary
|
45
|
-
window.notebook.current.custom_title = nil
|
46
|
-
entry.text = window.notebook.current.window_title
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def self.generate_current_label(window)
|
52
|
-
label = Gtk::Entry.new
|
53
|
-
label.has_frame = false
|
54
|
-
label.width_chars = 35
|
55
|
-
label.set_icon_from_icon_name(:secondary, "edit-clear")
|
56
|
-
|
57
|
-
generate_current_label_tooltips(label)
|
58
|
-
generate_current_label_signals(label, window)
|
59
|
-
label
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.generate_prev_button(window)
|
63
|
-
gen_icon_button("pan-start-symbolic", "prev") do
|
64
|
-
window.show_prev_tab
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
def self.generate_current_tab
|
69
|
-
Gtk::Label.new("1/1")
|
70
|
-
end
|
71
|
-
|
72
|
-
def self.generate_next_button(window)
|
73
|
-
gen_icon_button("pan-end-symbolic", "next") do
|
74
|
-
window.show_next_tab
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def self.generate_new_tab_button(window)
|
79
|
-
gen_icon_button("tab-new-symbolic", "New terminal") do
|
80
|
-
window.add_terminal
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
def self.generate_open_menu_button(window)
|
85
|
-
gen_icon_button("open-menu-symbolic", "Main Menu") do |button|
|
86
|
-
builder = Gtk::Builder.new(:resource => "/com/github/cedlemo/topinambour/window-menu.ui")
|
87
|
-
menu = Gtk::Menu.new(builder["winmenu"])
|
88
|
-
menu.attach_to_widget(button)
|
89
|
-
menu.children[0].signal_connect("activate") { window.show_css_editor }
|
90
|
-
|
91
|
-
menu.show_all
|
92
|
-
event = Gtk.current_event
|
93
|
-
menu.popup(nil, nil, event.button, event.time)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
def self.generate_font_sel_button(window)
|
98
|
-
gen_icon_button("font-select-symbolic", "Set font") do
|
99
|
-
window.show_font_selector
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
def self.generate_color_sel_button(window)
|
104
|
-
gen_icon_button("color-select-symbolic", "Set colors") do
|
105
|
-
window.show_color_selector
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def self.generate_term_overv_button(window)
|
110
|
-
gen_icon_button("emblem-photos-symbolic", "Terminals overview") do
|
111
|
-
window.show_terminal_chooser
|
112
|
-
end
|
113
|
-
end
|
114
|
-
def self.gen_icon_button(icon_name, tooltip)
|
115
|
-
button = Gtk::Button.new
|
116
|
-
image = Gtk::Image.new(:icon_name => icon_name, :size => :button)
|
117
|
-
button.add(image)
|
118
|
-
button.tooltip_text = tooltip
|
119
|
-
if block_given?
|
120
|
-
button.signal_connect "clicked" do |widget|
|
121
|
-
yield(widget)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
button
|
125
|
-
end
|
126
|
-
end
|