topinambour 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 992cf1b66a113669bb7103401a101e9fa3f1d97d
4
- data.tar.gz: e0f45aba03748b34f8ea2276035dddb7c534a92b
3
+ metadata.gz: 0c375742bddecb003e389bb6cea4c6490caf71ad
4
+ data.tar.gz: 1e5d10e6a5013656fef450706c6b2168ff3af3a4
5
5
  SHA512:
6
- metadata.gz: 1eed728dc94c6019167d69878c8381f121fad9dac32f9cafa2826cd894c42e6d4ab25a7c21f3e8e920f19fb58035706ed966d5f387224f12ed4c0469da8a9229
7
- data.tar.gz: db9520fccb7604376319c8cf9e91e55e574c0e9e76e2d539652c7e50b21336a06801121af0afa77d9b231527466d54b57a6d3f3b75c0d183f547600a1b2f17be
6
+ metadata.gz: f3476123395d21c5fd0437e3eea3d6999136e312c1f999f1d527ed576926e5cf72e675b12ac38faa3263d73e5e5f119e434e197b8893a9c8912f09f14f5c80d1
7
+ data.tar.gz: b11c2169ad5adbfe1cdeb5e825a2d545912f50b4c3675093f39d818a69dfec10d9874f0bbbfa6bba2473dcde6d86d73e2e626ffbab5f71b2e98748fd7c3a26b3
data/bin/topinambour CHANGED
@@ -41,8 +41,7 @@ Gio::Resources.register(resource)
41
41
 
42
42
  %w(actions style_properties css_handler application rgb_names_regexes
43
43
  terminal_regex terminal notebook color_selector font_selector
44
- terminal_chooser shortcuts searchbar window css_editor
45
- preferences).each do |l|
44
+ terminal_chooser shortcuts searchbar window preferences).each do |l|
46
45
  if File.exist?("#{USR_LIB_PATH}/#{l}.rb")
47
46
  require "#{USR_LIB_PATH}/#{l}.rb"
48
47
  else
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Generated with glade 3.20.0 -->
3
+ <interface>
4
+ <requires lib="gtk+" version="3.0"/>
5
+ <object class="GtkWindow">
6
+ <property name="can_focus">False</property>
7
+ <child>
8
+ <placeholder/>
9
+ </child>
10
+ </object>
11
+ </interface>
data/data/prefs-dialog.ui CHANGED
@@ -180,18 +180,7 @@
180
180
  </packing>
181
181
  </child>
182
182
  <child>
183
- <object class="GtkLabel" id="css_editor_label">
184
- <property name="visible">True</property>
185
- <property name="can_focus">False</property>
186
- <property name="halign">start</property>
187
- <property name="valign">start</property>
188
- <property name="label" translatable="yes">Css Editor</property>
189
- </object>
190
- <packing>
191
- <property name="expand">False</property>
192
- <property name="fill">False</property>
193
- <property name="position">6</property>
194
- </packing>
183
+ <placeholder/>
195
184
  </child>
196
185
  <child>
197
186
  <placeholder/>
@@ -257,7 +246,6 @@
257
246
  <property name="visible">True</property>
258
247
  <property name="can_focus">False</property>
259
248
  <property name="halign">start</property>
260
- <property name="valign">start</property>
261
249
  <property name="label" translatable="yes">Audible Bell</property>
262
250
  </object>
263
251
  <packing>
@@ -270,7 +258,6 @@
270
258
  <property name="visible">True</property>
271
259
  <property name="can_focus">True</property>
272
260
  <property name="halign">end</property>
273
- <property name="valign">center</property>
274
261
  </object>
275
262
  <packing>
276
263
  <property name="left_attach">1</property>
@@ -282,7 +269,6 @@
282
269
  <property name="visible">True</property>
283
270
  <property name="can_focus">False</property>
284
271
  <property name="halign">start</property>
285
- <property name="valign">start</property>
286
272
  <property name="label" translatable="yes">Allow Bold</property>
287
273
  </object>
288
274
  <packing>
@@ -307,7 +293,6 @@
307
293
  <property name="visible">True</property>
308
294
  <property name="can_focus">False</property>
309
295
  <property name="halign">start</property>
310
- <property name="valign">start</property>
311
296
  <property name="label" translatable="yes">Scroll On Output</property>
312
297
  </object>
313
298
  <packing>
@@ -320,7 +305,6 @@
320
305
  <property name="visible">True</property>
321
306
  <property name="can_focus">True</property>
322
307
  <property name="halign">end</property>
323
- <property name="valign">start</property>
324
308
  </object>
325
309
  <packing>
326
310
  <property name="left_attach">1</property>
@@ -332,7 +316,6 @@
332
316
  <property name="visible">True</property>
333
317
  <property name="can_focus">False</property>
334
318
  <property name="halign">start</property>
335
- <property name="valign">start</property>
336
319
  <property name="label" translatable="yes">Scroll On Keystroke</property>
337
320
  </object>
338
321
  <packing>
@@ -345,7 +328,6 @@
345
328
  <property name="visible">True</property>
346
329
  <property name="can_focus">True</property>
347
330
  <property name="halign">end</property>
348
- <property name="valign">start</property>
349
331
  </object>
350
332
  <packing>
351
333
  <property name="left_attach">1</property>
@@ -357,7 +339,6 @@
357
339
  <property name="visible">True</property>
358
340
  <property name="can_focus">False</property>
359
341
  <property name="halign">start</property>
360
- <property name="valign">start</property>
361
342
  <property name="label" translatable="yes">Rewrap On Resize</property>
362
343
  </object>
363
344
  <packing>
@@ -370,7 +351,6 @@
370
351
  <property name="visible">True</property>
371
352
  <property name="can_focus">True</property>
372
353
  <property name="halign">end</property>
373
- <property name="valign">start</property>
374
354
  </object>
375
355
  <packing>
376
356
  <property name="left_attach">1</property>
@@ -382,7 +362,6 @@
382
362
  <property name="visible">True</property>
383
363
  <property name="can_focus">True</property>
384
364
  <property name="halign">end</property>
385
- <property name="valign">start</property>
386
365
  </object>
387
366
  <packing>
388
367
  <property name="left_attach">1</property>
@@ -394,7 +373,6 @@
394
373
  <property name="visible">True</property>
395
374
  <property name="can_focus">False</property>
396
375
  <property name="halign">start</property>
397
- <property name="valign">start</property>
398
376
  <property name="label" translatable="yes">Mouse Autohide</property>
399
377
  </object>
400
378
  <packing>
@@ -414,7 +392,6 @@
414
392
  <property name="visible">True</property>
415
393
  <property name="can_focus">False</property>
416
394
  <property name="halign">start</property>
417
- <property name="valign">start</property>
418
395
  <property name="label" translatable="yes">Cursor Shape</property>
419
396
  </object>
420
397
  <packing>
@@ -446,7 +423,6 @@
446
423
  <property name="visible">True</property>
447
424
  <property name="can_focus">False</property>
448
425
  <property name="halign">start</property>
449
- <property name="valign">start</property>
450
426
  <property name="label" translatable="yes">Cursor Blink</property>
451
427
  </object>
452
428
  <packing>
@@ -478,7 +454,6 @@
478
454
  <property name="visible">True</property>
479
455
  <property name="can_focus">False</property>
480
456
  <property name="halign">start</property>
481
- <property name="valign">start</property>
482
457
  <property name="label" translatable="yes">Backspace Binding</property>
483
458
  </object>
484
459
  <packing>
@@ -512,7 +487,6 @@
512
487
  <property name="visible">True</property>
513
488
  <property name="can_focus">False</property>
514
489
  <property name="halign">start</property>
515
- <property name="valign">start</property>
516
490
  <property name="label" translatable="yes">Delete Binding</property>
517
491
  </object>
518
492
  <packing>
data/data/topinambour.css CHANGED
@@ -26,31 +26,15 @@
26
26
  }
27
27
 
28
28
  TopinambourWindow headerbar entry{
29
- border-radius: 4px;
29
+ /*border-radius: 4px;*/
30
30
  }
31
31
 
32
- #OverviewBox {
32
+ #overview-main-box {
33
33
  background-color: rgba(0,0,0,0.2);
34
34
  border: solid 1px rgba(49, 150, 188, 1);
35
35
  border-radius: 6px 0px 0px 6px;
36
36
  }
37
37
 
38
- treeview.view#terms-list {
39
- background-color: rgba(0, 0, 0, 0.2);
40
- border-radius: 6px 0px 0px 6px;
41
- }
42
- treeview.view header {
43
- background-color: rgba(1,1,1,0.2);
44
- }treeview.view rubberband {
45
- background-color: rgba(1,1,1,0.2);
46
- }
47
- box#overview-main-box {
48
- background-color: rgba(0,0,0,0.2);
49
- border: solid 1px rgba(49, 150, 188, 1);
50
- border-radius: 6px 0px 0px 6px;
51
- }
52
-
53
-
54
38
  grid button {
55
39
  margin: 0px;
56
40
  padding: 0px;
@@ -59,6 +43,6 @@ grid button {
59
43
 
60
44
  grid button image {
61
45
  border: solid 3px rgba(0, 0, 0, 0.0);
62
- margin: 0px;
46
+ margin: 0px;
63
47
  padding: 0px;
64
48
  }
Binary file
data/data/window-menu.ui CHANGED
@@ -3,10 +3,6 @@
3
3
  <!-- interface-requires gtk+ 3.0 -->
4
4
  <menu id="winmenu">
5
5
  <section>
6
- <item >
7
- <attribute name="label" translatable="yes" >_Css Configuration Editor</attribute>
8
- <attribute name="action">app.css_editor</attribute>
9
- </item>
10
6
  <item>
11
7
  <attribute name="label" translatable="yes">_Preferences</attribute>
12
8
  <attribute name="action">app.preferences</attribute>
data/lib/notebook.rb CHANGED
@@ -26,7 +26,7 @@ class TopinambourNotebook < Gtk::Notebook
26
26
  end
27
27
 
28
28
  signal_connect "switch-page" do |_widget, next_page, next_page_num|
29
- toplevel.current_label.text = next_page.terminal_title if next_page.class == TopinambourTerminal
29
+ toplevel.current_label.text = next_page.terminal_title
30
30
  toplevel.current_tab.text = "#{next_page_num + 1}/#{n_pages}"
31
31
  generate_tab_preview if page >= 0
32
32
  end
@@ -87,7 +87,6 @@ class TopinambourNotebook < Gtk::Notebook
87
87
 
88
88
  def send_to_all_terminals(method_name, values)
89
89
  each do |tab|
90
- next unless tab.class == TopinambourTerminal
91
90
  tab.send(method_name, *values)
92
91
  end
93
92
  end
data/lib/preferences.rb CHANGED
@@ -21,7 +21,6 @@ module TopinambourPreferences
21
21
  builder = Gtk::Builder.new(:resource => resource_file)
22
22
  dialog = builder["Preferences_dialog"]
23
23
  dialog.transient_for = parent
24
- add_source_view_style_chooser(builder, parent)
25
24
  add_actions(builder, parent)
26
25
  connect_response(dialog, builder)
27
26
  dialog
@@ -47,7 +46,6 @@ module TopinambourPreferences
47
46
 
48
47
  def self.get_all_properties(widget, builder)
49
48
  props = {}
50
- props.merge!(get_source_view_style(builder))
51
49
  props.merge!(get_entry_value(builder))
52
50
  props.merge!(get_switch_values(builder))
53
51
  props.merge!(get_spin_values(widget))
@@ -127,26 +125,6 @@ module TopinambourPreferences
127
125
  end
128
126
  end
129
127
 
130
- # Hack because when added via glade, the builder fail to load the ui.
131
- def self.add_source_view_style_chooser(builder, parent)
132
- box = builder["gen_prefs_box"]
133
- button = GtkSource::StyleSchemeChooserButton.new
134
- sm = GtkSource::StyleSchemeManager.default
135
- button.style_scheme = sm.get_scheme(parent.css_editor_style)
136
- button.show
137
- button.signal_connect "style-updated" do |widget|
138
- parent.css_editor_style = widget.style_scheme.id
139
- end
140
- box.pack_start(button, :expand => true, :fill => false)
141
- end
142
-
143
- def self.get_source_view_style(builder)
144
- box = builder["gen_prefs_box"]
145
- penultimate = box.children.size - 2
146
- style = box.children[penultimate].style_scheme.id
147
- { "-TopinambourWindow-css-editor-style" => style }
148
- end
149
-
150
128
  def self.get_entry_value(builder)
151
129
  text = builder["shell_entry"].text
152
130
  { "-TopinambourWindow-shell" => text }
data/lib/shortcuts.rb CHANGED
@@ -59,9 +59,6 @@ module TopinambourShortcuts
59
59
  when Gdk::Keyval::KEY_O
60
60
  window.show_terminal_chooser
61
61
  true
62
- when Gdk::Keyval::KEY_E
63
- window.show_css_editor
64
- true
65
62
  when Gdk::Keyval::KEY_slash
66
63
  window.show_searchbar
67
64
  true
@@ -17,9 +17,9 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
17
17
  def initialize(window)
18
18
  super(nil, nil)
19
19
  @window = window
20
- set_size_request(250, @window.notebook.current.allocation.to_a[3] - 8)
21
20
  set_halign(:end)
22
21
  set_valign(:center)
22
+ set_policy(:never, :automatic)
23
23
  set_name("terminal_chooser")
24
24
 
25
25
  window.notebook.generate_tab_preview
@@ -27,40 +27,95 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
27
27
  fill_grid
28
28
 
29
29
  @box = Gtk::Box.new(:vertical, 4)
30
- @box.name = "OverviewBox"
30
+ @box.name = "overview-main-box"
31
31
  @box.pack_start(@grid, :expand => true, :fill => true, :padding => 4)
32
32
  add(@box)
33
+ set_size_request(-1, @window.notebook.current.allocation.to_a[3] - 8)
33
34
  end
34
35
 
35
36
  private
36
37
 
37
38
  def generate_grid
38
39
  @grid = Gtk::Grid.new
39
- @grid.valign = :start
40
- @grid.halign = :center
41
- @grid.row_spacing = 2
40
+ @grid.row_spacing = 4
41
+ @grid.column_spacing = 6
42
42
  end
43
43
 
44
44
  def fill_grid
45
45
  @window.notebook.children.each_with_index do |child, i|
46
- button = Gtk::Label.new("tab. #{(i + 1).to_s}")
47
- button.angle = 45
48
- @grid.attach(button, 0, i, 1, 1)
49
- button = generate_preview_button(child, i)
50
- @grid.attach(button, 1, i, 1, 1)
51
- add_drag_and_drop_functionalities(button)
52
- button = generate_close_tab_button
53
- @grid.attach(button, 2, i, 1, 1)
46
+ generate_row_grid(child, i)
54
47
  end
55
48
  @grid.attach(generate_separator, 0, @window.notebook.n_pages, 2, 1)
56
49
  button = generate_quit_button
57
50
  @grid.attach(button, 0, @window.notebook.n_pages + 1, 2, 1)
58
51
  end
59
52
 
53
+ def generate_row_grid(term, index)
54
+ button = Gtk::Label.new("tab. #{index + 1}")
55
+ button.angle = 45
56
+ @grid.attach(button, 0, index, 1, 1)
57
+ button = generate_preview_button(term, index)
58
+ @grid.attach(button, 1, index, 1, 1)
59
+ add_drag_and_drop_functionalities(button)
60
+ label = generate_label(term)
61
+ @grid.attach(label, 2, index, 1, 1)
62
+ button = generate_close_tab_button
63
+ @grid.attach(button, 3, index, 1, 1)
64
+ end
65
+
66
+ def add_label_popup_entry_activate_signal(entry, popup, label, term)
67
+ entry.signal_connect "activate" do |widget|
68
+ label.text = widget.buffer.text
69
+ term.custom_title = widget.buffer.text
70
+ term.toplevel.current_label.text = widget.buffer.text
71
+ popup.destroy
72
+ end
73
+ end
74
+
75
+ def add_label_popup_entry_icon_release(entry, label, term)
76
+ entry.signal_connect "icon-release" do |widget, position|
77
+ if position == :secondary
78
+ term.custom_title = nil
79
+ label.text = term.window_title
80
+ term.toplevel.current_label.text = label.text
81
+ widget.buffer.text = label.text
82
+ end
83
+ end
84
+ end
85
+
86
+ def generate_label_popup(label, event, term)
87
+ entry = Gtk::Entry.new
88
+ entry.max_width_chars = 50
89
+ entry.buffer.text = label.text
90
+ entry.set_icon_from_icon_name(:secondary, "edit-clear")
91
+ pp = Gtk::Popover.new
92
+ add_label_popup_entry_activate_signal(entry, pp, label, term)
93
+ add_label_popup_entry_icon_release(entry, label, term)
94
+
95
+ pp.add(entry)
96
+ x, y = event.window.coords_to_parent(event.x, event.y)
97
+ rect = Gdk::Rectangle.new(x - label.allocation.x, y - label.allocation.y,
98
+ 1, 1)
99
+ pp.pointing_to = rect
100
+ pp.relative_to = label
101
+ pp.show_all
102
+ end
103
+
104
+ def generate_label(term)
105
+ label = Gtk::Label.new(term.terminal_title)
106
+ label.halign = :start
107
+ label.selectable = true
108
+ label.signal_connect "button-release-event" do |w, e|
109
+ generate_label_popup(w, e, term)
110
+ end
111
+ label
112
+ end
113
+
60
114
  def generate_close_tab_button
61
115
  button = Gtk::EventBox.new
62
116
  button.tooltip_text = "Close Tab"
63
- image = Gtk::Image.new(:icon_name => "window-close-symbolic", :size => :button)
117
+ image = Gtk::Image.new(:icon_name => "window-close-symbolic",
118
+ :size => :button)
64
119
  button.add(image)
65
120
  button.hexpand = false
66
121
  button.vexpand = false
@@ -86,7 +141,7 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
86
141
  end
87
142
 
88
143
  def update_preview_button_tooltip(range)
89
- (range).each do |j|
144
+ range.each do |j|
90
145
  @grid.get_child_at(0, j).tooltip_text = j.to_s
91
146
  end
92
147
  end
@@ -113,11 +168,10 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
113
168
  def generate_quit_button
114
169
  button = Gtk::EventBox.new
115
170
  button.tooltip_text = "Quit Topinambour"
116
- image = Gtk::Image.new(:icon_name => "application-exit-symbolic", :size => :dialog)
171
+ image = Gtk::Image.new(:icon_name => "application-exit-symbolic",
172
+ :size => :dialog)
117
173
  button.add(image)
118
- button.signal_connect "button_press_event" do
119
- @window.quit_gracefully
120
- end
174
+ button.signal_connect("button_press_event") { @window.quit_gracefully }
121
175
  button
122
176
  end
123
177
 
@@ -132,18 +186,19 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
132
186
  [["test", Gtk::TargetFlags::SAME_APP, 12_345]],
133
187
  Gdk::DragAction::COPY |
134
188
  Gdk::DragAction::MOVE)
135
- #button.drag_source_set_icon_name("grab")
136
189
  # Drag source signals
137
190
  # drag-begin User starts a drag Set-up drag icon
138
- # drag-data-get When drag data is requested by the destination Transfer drag data from source to destination
139
- # drag-data-delete When a drag with the action Gdk.DragAction.MOVE is completed Delete data from the source to complete the "move"
191
+ # drag-data-get When drag data is requested by the destination Transfer
192
+ # drag data from source to destination
193
+ # drag-data-delete When a drag with the action Gdk.DragAction.MOVE is
194
+ # completed Delete data from the source to complete the "move"
140
195
  # drag-end When the drag is complete Undo anything done in drag-begin
141
196
 
142
197
  button.signal_connect "drag-begin" do |widget|
143
- widget.drag_source_set_icon_pixbuf(widget.image.pixbuf)
198
+ widget.drag_source_set_icon_pixbuf(widget.image.pixbuf)
144
199
  end
145
200
 
146
- button.signal_connect("drag-data-get") do |widget, _context, selection_data, _info, _time|
201
+ button.signal_connect("drag-data-get") do |widget, _, selection_data, _, _|
147
202
  index = grid_line_of(widget)
148
203
  selection_data.set(Gdk::Selection::TYPE_INTEGER, index.to_s)
149
204
  end
@@ -163,16 +218,18 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
163
218
  Gdk::DragAction::MOVE)
164
219
 
165
220
  # Drag destination signals
166
- # drag-motion Drag icon moves over a drop area Allow only certain areas to be dropped onto
167
- # drag-drop Icon is dropped onto a drag area Allow only certain areas to be dropped onto
168
- # drag-data-received When drag data is received by the destination Transfer drag data from source to destination
221
+ # drag-motion Drag icon moves over a drop area Allow only certain areas to
222
+ # be dropped onto drag-drop Icon is dropped onto a drag area Allow only
223
+ # certain areas to be dropped onto drag-data-received When drag data is
224
+ # received by the destination Transfer drag data from source to destination
169
225
  # button.signal_connect "drag-motion" do
170
226
  # puts "drag motion for #{index}"
171
227
  # end
172
228
  button.signal_connect("drag-drop") do |widget, context, _x, _y, time|
173
229
  widget.drag_get_data(context, context.targets[0], time)
174
230
  end
175
- button.signal_connect("drag-data-received") do |widget, context, _x, _y, selection_data, _info, _time|
231
+
232
+ button.signal_connect("drag-data-received") do |widget, context, _x, _y, selection_data|
176
233
  index = grid_line_of(widget)
177
234
  index_of_dragged_object = index
178
235
  context.targets.each do |target|
@@ -181,15 +238,20 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
181
238
  index_of_dragged_object = selection_data.data.pack("C#{data_len}").to_i
182
239
  end
183
240
  if index_of_dragged_object != index
184
- dragged = @window.notebook.get_nth_page(index_of_dragged_object)
185
- @window.notebook.reorder_child(dragged, index)
186
- @window.notebook.children.each_with_index do |child, i|
187
- @grid.get_child_at(1, i).image = generate_preview_image(child.preview)
188
- end
241
+ drag_image_and_reorder_terms(index_of_dragged_object, index)
189
242
  end
190
243
  end
191
244
  end
192
245
 
246
+ def drag_image_and_reorder_terms(src_index, dest_index)
247
+ dragged = @window.notebook.get_nth_page(src_index)
248
+ @window.notebook.reorder_child(dragged, dest_index)
249
+ @window.notebook.children.each_with_index do |child, i|
250
+ @grid.get_child_at(1, i).image = generate_preview_image(child.preview)
251
+ @grid.get_child_at(2, i).label = child.terminal_title
252
+ end
253
+ end
254
+
193
255
  def grid_line_of(widget)
194
256
  @grid.child_get_property(widget, "top-attach")
195
257
  end
data/lib/window.rb CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  class TopinambourWindow
18
18
  attr_reader :notebook, :bar, :overlay, :current_label, :current_tab
19
- attr_accessor :shell, :css_editor_style
19
+ attr_accessor :shell
20
20
  def initialize(application)
21
21
  super(:application => application)
22
22
  set_icon_name("utilities-terminal-symbolic")
@@ -36,10 +36,7 @@ class TopinambourWindow
36
36
  def add_terminal(cmd = @shell)
37
37
  exit_overlay_mode
38
38
  working_dir = nil
39
- # Check if current tab is a TopinambourTerminal (can be TopinambourCssEditor)
40
- if @notebook.current.class == TopinambourTerminal && @notebook.n_pages > 0
41
- working_dir = @notebook.current.pid_dir
42
- end
39
+ working_dir = @notebook.current.pid_dir if @notebook.current
43
40
 
44
41
  terminal = TopinambourTerminal.new(cmd, working_dir)
45
42
  terminal.show
@@ -56,7 +53,7 @@ class TopinambourWindow
56
53
  end
57
54
 
58
55
  def show_color_selector
59
- toggle_overlay(TopinambourColorSelector) if @notebook.current.class == TopinambourTerminal
56
+ toggle_overlay(TopinambourColorSelector)
60
57
  end
61
58
 
62
59
  def show_prev_tab
@@ -72,13 +69,7 @@ class TopinambourWindow
72
69
  end
73
70
 
74
71
  def show_font_selector
75
- toggle_overlay(TopinambourFontSelector) if @notebook.current.class == TopinambourTerminal
76
- end
77
-
78
- def show_css_editor
79
- css_editor = TopinambourCssEditor.new(self)
80
- @notebook.append_page(css_editor, Gtk::Label.new)
81
- @notebook.set_page(@notebook.n_pages - 1)
72
+ toggle_overlay(TopinambourFontSelector)
82
73
  end
83
74
 
84
75
  def show_terminal_chooser
@@ -98,7 +89,6 @@ class TopinambourWindow
98
89
  @default_height = style_get_property("height")
99
90
  set_default_size(@default_width, @default_height)
100
91
  @shell = style_get_property("shell")
101
- @css_editor_style = style_get_property("css-editor-style")
102
92
  end
103
93
 
104
94
  def display_about
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.9
4
+ version: 1.0.10
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-08-09 00:00:00.000000000 Z
11
+ date: 2016-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vte3
@@ -81,6 +81,7 @@ files:
81
81
  - COPYING
82
82
  - README.md
83
83
  - bin/topinambour
84
+ - data/#app-menu.ui#
84
85
  - data/app-menu.ui
85
86
  - data/application-exit-symbolic.svg
86
87
  - data/color-select-symbolic.svg
@@ -101,12 +102,10 @@ files:
101
102
  - lib/actions.rb
102
103
  - lib/application.rb
103
104
  - lib/color_selector.rb
104
- - lib/css_editor.rb
105
105
  - lib/css_handler.rb
106
106
  - lib/font_selector.rb
107
107
  - lib/notebook.rb
108
108
  - lib/preferences.rb
109
- - lib/resize_message.rb
110
109
  - lib/rgb_names_regexes.rb
111
110
  - lib/searchbar.rb
112
111
  - lib/shortcuts.rb
data/lib/css_editor.rb DELETED
@@ -1,172 +0,0 @@
1
- # Copyright 2015-2016 Cedric 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
- require "gtksourceview3"
17
- class TopinambourCssEditor < Gtk::Grid
18
- attr_accessor :tab_label, :preview
19
- def initialize(window)
20
- super()
21
- @window = window
22
- @provider = window.application.provider
23
- @default_css = window.application.css_content
24
- @modified_css = @default_css
25
- @tab_label = "Css Editor"
26
-
27
- gen_source_view
28
-
29
- sw = Gtk::ScrolledWindow.new(nil, nil)
30
- sw.vexpand = true
31
- sw.hexpand = true
32
- sw.add(@view)
33
- attach(sw, 0, 0, 3, 1)
34
-
35
- button = gen_close_button
36
- attach(button, 0, 1, 1, 1)
37
-
38
- button = gen_reset_button
39
- attach(button, 1, 1, 1, 1)
40
-
41
- @style_button = gen_style_chooser_button
42
- attach(@style_button, 2, 1, 1, 1)
43
-
44
- button = gen_save_button(@view.buffer)
45
- attach(button, 3, 1, 1, 1)
46
- manage_buffer_changes
47
- manage_css_errors
48
- show_all
49
- end
50
-
51
- private
52
-
53
- def gen_source_view
54
- @view = GtkSource::View.new
55
- @manager = GtkSource::LanguageManager.new
56
- @language = @manager.get_language("css")
57
- @sm = GtkSource::StyleSchemeManager.default
58
-
59
- @view.show_line_numbers = true
60
- @view.insert_spaces_instead_of_tabs = true
61
- @view.buffer.language = @language
62
- @view.buffer.highlight_syntax = true
63
- @view.buffer.highlight_matching_brackets = true
64
- @view.buffer.text = @default_css
65
- @view.show_right_margin = true
66
- @view.right_margin_position = 80
67
- @view.smart_backspace = true
68
- end
69
-
70
- def gen_close_button
71
- button = Gtk::Button.new(:label => "Close Tab")
72
- button.signal_connect "clicked" do
73
- toplevel.close_current_tab
74
- end
75
- button.vexpand = false
76
- button.hexpand = false
77
- button
78
- end
79
-
80
- def gen_reset_button
81
- button = Gtk::Button.new(:label => "Reset")
82
- button.signal_connect "clicked" do
83
- @view.buffer.text = @default_css
84
- end
85
- button.vexpand = false
86
- button.hexpand = false
87
- button
88
- end
89
-
90
- def gen_style_chooser_button
91
- style_scheme = nil
92
- if @sm.scheme_ids.include?(@window.css_editor_style)
93
- style_scheme = @sm.get_scheme(@window.css_editor_style)
94
- else
95
- style_scheme = @sm.get_scheme("classic")
96
- end
97
- @view.buffer.style_scheme = style_scheme
98
- button = GtkSource::StyleSchemeChooserButton.new
99
- button.vexpand = false
100
- button.hexpand = true
101
- button.style_scheme = @view.buffer.style_scheme
102
- button.signal_connect "style-updated" do |widget|
103
- @view.buffer.style_scheme = widget.style_scheme
104
- end
105
- button
106
- end
107
-
108
- def gen_save_button(buffer)
109
- button = Gtk::Button.new(:label => "Save")
110
- button.signal_connect "clicked" do
111
- @window.application.replace_old_conf_with(buffer.text)
112
- reload_custom_css_properties
113
- end
114
- button.vexpand = false
115
- button.hexpand = false
116
- button
117
- end
118
-
119
- def manage_buffer_changes
120
- @view.buffer.signal_connect "changed" do |buffer|
121
- @modified_css = buffer.get_text(buffer.start_iter,
122
- buffer.end_iter,
123
- false)
124
- begin
125
- @provider.load_from_data(@modified_css)
126
- rescue
127
- @provider.load_from_data(@default_css)
128
- end
129
-
130
- reload_custom_css_properties
131
- Gtk::StyleContext.reset_widgets
132
- style_scheme = nil
133
- if @sm.scheme_ids.include?(@window.css_editor_style)
134
- style_scheme = @sm.get_scheme(@window.css_editor_style)
135
- else
136
- style_scheme = @sm.get_scheme("classic")
137
- end
138
- @view.buffer.style_scheme = style_scheme
139
- @style_button.style_scheme = style_scheme
140
- end
141
- end
142
-
143
- def manage_css_errors
144
- @provider.signal_connect "parsing-error" do |_css_provider, section, error|
145
- # @start_i = @view.buffer.get_iter_at(:line => section.start_line,
146
- # :index => section.start_position)
147
- # @end_i = @view.buffer.get_iter_at(:line => section.end_line,
148
- # :index => section.end_position)
149
- # if error == Gtk::CssProviderError::DEPRECATED
150
- # else
151
- # end
152
- end
153
- end
154
-
155
- def reload_custom_css_properties
156
- reload_terminal_custom_css_properties
157
- reload_window_custom_css_properties
158
- end
159
-
160
- def reload_terminal_custom_css_properties
161
- @window.notebook.each do |tab|
162
- next unless tab.class == TopinambourTerminal
163
- colors = tab.css_colors unless colors
164
- tab.colors = colors
165
- tab.apply_colors
166
- end
167
- end
168
-
169
- def reload_window_custom_css_properties
170
- @window.load_css_properties
171
- end
172
- end
@@ -1,32 +0,0 @@
1
- # Copyright 2015-2016 Cedric 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
- class TopinambourResizeMessage < Gtk::Box
17
- def initialize(text)
18
- super(:vertical)
19
- text ||= ""
20
- add(Gtk::Label.new(text))
21
- set_halign(:end)
22
- set_valign(:end)
23
- set_border_width(4)
24
- show_all
25
- set_name("resize_box")
26
- end
27
-
28
- def text=(text)
29
- children[0].text = text
30
- show_all
31
- end
32
- end