topinambour 1.0.10 → 1.0.11

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: 0c375742bddecb003e389bb6cea4c6490caf71ad
4
- data.tar.gz: 1e5d10e6a5013656fef450706c6b2168ff3af3a4
3
+ metadata.gz: bd58ccf9a13dafa848a0091098256879687c5877
4
+ data.tar.gz: e6bf6b64542f156627325b9748a94007916d3b2d
5
5
  SHA512:
6
- metadata.gz: f3476123395d21c5fd0437e3eea3d6999136e312c1f999f1d527ed576926e5cf72e675b12ac38faa3263d73e5e5f119e434e197b8893a9c8912f09f14f5c80d1
7
- data.tar.gz: b11c2169ad5adbfe1cdeb5e825a2d545912f50b4c3675093f39d818a69dfec10d9874f0bbbfa6bba2473dcde6d86d73e2e626ffbab5f71b2e98748fd7c3a26b3
6
+ metadata.gz: 16387db255b4837972943be109094fe88ea1dbe4f4007b3206040115b6b02711be5871ac0d8dc00e443b9d167464ec84a44be1f7b8017d5dd8fcf2daf0c41580
7
+ data.tar.gz: 9816772c41dfc77d1202f8761e6488cf04592005852d162bdd2da5221a47fef33f8ab723c3bc65e70fb6fc56d2629d78f65fe715eca84b3a02ddbc449ae88510
data/README.md CHANGED
@@ -26,7 +26,13 @@ Topinambour is Terminal written with the Gtk3 and Vte3 ruby bindings from the pr
26
26
  * Topinambour allows users to modify existing modules. For example if a user copy the css_editor.rb in the directory *~/.config/topinambour/lib/css_editor.rb*, he should be able to modify it in order to fit its needs.
27
27
 
28
28
  ## TODO:
29
- * Name all the important widget so that they can be easily themed in Css.
29
+ * Name all the important widgets so that they can be easily themed in Css.
30
+ * `#topinambour-overview-box`
31
+ * `#topinambour-headerbar`
32
+ * `#topinambour-window`
33
+ * `#topinambour-scrollbar`
34
+ * `#topinambour-notebook`
35
+
30
36
  * Write a description of the widgets that have a Css name/Id.
31
37
  * Improve the Css editor with a part for the Css parsing error when the user writes. Add a color chooser widget in the related tab.
32
38
  * Make Topinambour allows users to easily create their own modules. For example create a tab that will act as a MPD client. There will be widgets that control a MPD server and a GtkTree widget that displays the playlist of the MPD server for example.
@@ -91,22 +97,32 @@ It can be found in the file `$HOME/.config/topinambour/topinambour.css` (Be care
91
97
  }
92
98
 
93
99
  TopinambourWindow headerbar entry{
94
- border-radius: 4px;
100
+ /*border-radius: 4px;*/
95
101
  }
96
102
 
97
- #OverviewBox {
103
+ #topinambour-overview-box {
98
104
  background-color: rgba(0,0,0,0.2);
99
105
  border: solid 1px rgba(49, 150, 188, 1);
100
106
  border-radius: 6px 0px 0px 6px;
101
107
  }
102
108
 
109
+ #topinambour-headerbar {
110
+ background-color: #323232;
111
+ border: none;
112
+ box-shadow: none;
113
+ }
114
+ #topinambour_headerbar:backdrop {
115
+ background-color: rgba(50,50,50,0.7);
116
+ border: none;
117
+ box-shadow: none;
118
+ }
103
119
  grid button {
104
120
  margin: 0px;
105
121
  padding: 0px;
106
122
 
107
123
  }
108
124
 
109
- grid button image {
125
+ grid button image {
110
126
  border: solid 3px rgba(0, 0, 0, 0.0);
111
127
  margin: 0px;
112
128
  padding: 0px;
data/data/headerbar.ui CHANGED
@@ -112,6 +112,25 @@ default label for the current tab
112
112
  <property name="position">5</property>
113
113
  </packing>
114
114
  </child>
115
+ <child>
116
+ <object class="GtkButton" id="css_reload_button">
117
+ <property name="visible">True</property>
118
+ <property name="can_focus">True</property>
119
+ <property name="receives_default">True</property>
120
+ <property name="tooltip_text" translatable="yes">Reload the Css file</property>
121
+ <child>
122
+ <object class="GtkImage">
123
+ <property name="visible">True</property>
124
+ <property name="can_focus">False</property>
125
+ <property name="icon_name">view-refresh-symbolic</property>
126
+ </object>
127
+ </child>
128
+ </object>
129
+ <packing>
130
+ <property name="pack_type">end</property>
131
+ <property name="position">6</property>
132
+ </packing>
133
+ </child>
115
134
  <child>
116
135
  <object class="GtkButton" id="font_sel_button">
117
136
  <property name="visible">True</property>
data/data/topinambour.css CHANGED
@@ -25,24 +25,49 @@
25
25
  -TopinambourWindow-width: 1000;*/
26
26
  }
27
27
 
28
- TopinambourWindow headerbar entry{
29
- /*border-radius: 4px;*/
28
+ #topinambour-overview-box {
29
+ background-color: rgba(43,45,54,0.95);
30
+ border-radius: 6px 0px 0px 6px;
30
31
  }
31
32
 
32
- #overview-main-box {
33
- background-color: rgba(0,0,0,0.2);
34
- border: solid 1px rgba(49, 150, 188, 1);
35
- border-radius: 6px 0px 0px 6px;
33
+ #topinambour-headerbar {
34
+ background-color: #323232;
35
+ border: none;
36
+ box-shadow: none;
36
37
  }
37
38
 
38
- grid button {
39
- margin: 0px;
40
- padding: 0px;
39
+ #topinambour-headerbar:backdrop {
40
+ background-color: rgba(50,50,50,0.7);
41
+ border: none;
42
+ box-shadow: none;
43
+ }
44
+
45
+ #topinambour-scrollbar{
46
+ background-color: rgba(0,0,0,0);
47
+ border: none;
48
+ }
41
49
 
50
+ #topinambour-scrollbar trough{
51
+ background-color: rgba(0,0,0,0);
52
+ border: none;
42
53
  }
43
54
 
44
- grid button image {
55
+ #topinambour-scrollbar slider{
56
+ margin-left: 8px;
57
+ background-color: rgba(49,150,188,0.5);
58
+ }
59
+
60
+ #topinambour-tab-term {
61
+ background-color: rgba(0,0,0,0);
62
+ }
63
+
64
+ grid button image {
45
65
  border: solid 3px rgba(0, 0, 0, 0.0);
46
66
  margin: 0px;
47
67
  padding: 0px;
48
68
  }
69
+
70
+ grid button {
71
+ margin: 0px;
72
+ padding: 0px;
73
+ }
Binary file
data/lib/actions.rb CHANGED
@@ -47,9 +47,9 @@ module TopinambourActions
47
47
  def self.generate_preferences_action(application)
48
48
  action = generate_action("preferences") do |_act, _param|
49
49
  dialog = TopinambourPreferences.generate_dialog(application.windows.first)
50
-
50
+
51
51
  dialog.run
52
- application.windows.first.notebook.current.grab_focus
52
+ application.windows.first.notebook.current.term.grab_focus
53
53
  end
54
54
  action
55
55
  end
@@ -63,9 +63,9 @@ module TopinambourActions
63
63
 
64
64
  def self.generate_term_copy_action(application)
65
65
  action = generate_action("term_copy") do |_act, _param|
66
- term = application.windows[0].notebook.current
66
+ term = application.windows[0].notebook.current.term
67
67
  event = Gtk.current_event
68
-
68
+
69
69
  _match, regex_type = term.match_check_event(event)
70
70
  if term.has_selection? || regex_type == -1
71
71
  term.copy_clipboard
@@ -79,7 +79,7 @@ module TopinambourActions
79
79
 
80
80
  def self.generate_term_paste_action(application)
81
81
  action = generate_action("term_paste") do |_act, _param|
82
- application.windows[0].notebook.current.paste_clipboard
82
+ application.windows[0].notebook.current.term.paste_clipboard
83
83
  end
84
84
  action
85
85
  end
data/lib/application.rb CHANGED
@@ -15,7 +15,7 @@
15
15
  # along with Topinambour. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
17
  class TopinambourApplication < Gtk::Application
18
- attr_reader :provider, :css_file, :css_content # :css_content really needed ?
18
+ attr_reader :provider, :css_file, :css_content
19
19
  def initialize
20
20
  super("com.github.cedlemo.topinambour", :non_unique)
21
21
 
@@ -33,7 +33,7 @@ class TopinambourApplication < Gtk::Application
33
33
  window = TopinambourWindow.new(application)
34
34
  window.present
35
35
  window.add_terminal
36
- window.notebook.current.grab_focus
36
+ window.notebook.current.term.grab_focus
37
37
  end
38
38
  end
39
39
 
@@ -65,6 +65,37 @@ class TopinambourApplication < Gtk::Application
65
65
  @css_content = new_conf
66
66
  end
67
67
 
68
+ def reload_css_config
69
+ error_popup = nil
70
+ bad_css = nil
71
+ if File.exist?(USR_CSS)
72
+ @provider.signal_connect "parsing-error" do |css_provider, section, error|
73
+ buf = Gtk::TextBuffer.new
74
+ buf.text = @css_content
75
+ start_i = buf.get_iter_at(:line => section.start_line,
76
+ :index => section.start_position)
77
+ end_i = buf.get_iter_at(:line => section.start_line + 10,
78
+ :index => section.end_position)
79
+ bad_css = ""
80
+ buf.get_text(start_i, end_i, true).lines.each_with_index do |line, i|
81
+ bad_css += "#{section.start_line + 1 + i} #{line}"
82
+ end
83
+ end
84
+ css_backup = @css_content
85
+
86
+ begin
87
+ load_custom_css_config
88
+ rescue => e
89
+ error_popup = TopinambourCssErrorPopup.new(self.windows.first)
90
+ error_popup.message = e.message + "\n\n" + bad_css
91
+ error_popup.show_all
92
+
93
+ @css_content = css_backup
94
+ @provider.load(:data => @css_content)
95
+ end
96
+ end
97
+ end
98
+
68
99
  private
69
100
 
70
101
  def load_menu_ui_in(application)
@@ -92,6 +123,9 @@ class TopinambourApplication < Gtk::Application
92
123
  load_custom_css_config
93
124
  rescue => e
94
125
  puts "Bad css file using default css #{e.message}"
126
+ error_popup = TopinambourCssErrorPopup.new(self.windows.first)
127
+ error_popup.message = e.message + "\n\nBad css file using default css"
128
+ error_popup.show_all
95
129
  load_default_css_config
96
130
  end
97
131
  else
@@ -100,7 +134,33 @@ class TopinambourApplication < Gtk::Application
100
134
  end
101
135
  end
102
136
 
137
+ def write_down_default_css
138
+ File.open(USR_CSS, "w") { |file| file.write(@css_content) }
139
+ end
140
+
103
141
  def check_and_create_if_no_config_dir
104
142
  Dir.mkdir(CONFIG_DIR) unless Dir.exist?(CONFIG_DIR)
105
143
  end
106
144
  end
145
+
146
+ class TopinambourCssErrorPopup < Gtk::MessageDialog
147
+
148
+ def initialize(parent)
149
+ super(:parent => parent, :flags => 0,
150
+ :type => Gtk::MessageType::ERROR,
151
+ :buttons_type => Gtk::ButtonsType::CLOSE,
152
+ :message => "Css Error")
153
+
154
+ @message = Gtk::Label.new("")
155
+ content_area.add(@message)
156
+ signal_connect("response") { |widget| widget.destroy }
157
+ end
158
+
159
+ def message=(message)
160
+ @message.text = message
161
+ end
162
+
163
+ def message
164
+ @message.text
165
+ end
166
+ end
@@ -37,7 +37,7 @@ class TopinambourColorSelector < Gtk::Box
37
37
  private
38
38
 
39
39
  def initialize_default_colors
40
- @default_colors = @window.notebook.current.css_colors
40
+ @default_colors = @window.notebook.current.term.css_colors
41
41
  @colors = @default_colors.dup
42
42
  end
43
43
 
@@ -77,7 +77,8 @@ class TopinambourColorSelector < Gtk::Box
77
77
  def add_color_selectors
78
78
  TERMINAL_COLOR_NAMES.each_with_index do |name, i|
79
79
  color_sel = Gtk::ColorButton.new(@default_colors[i])
80
- color_sel.set_title(name.to_s)
80
+ color_sel.title = name.to_s
81
+ color_sel.tooltip_text = name.to_s
81
82
  color_sel.signal_connect "color-set" do
82
83
  @colors[i] = color_sel.rgba
83
84
  apply_new_colors
@@ -87,7 +88,7 @@ class TopinambourColorSelector < Gtk::Box
87
88
  end
88
89
 
89
90
  def apply_new_colors
90
- @window.notebook.current.colors = @colors
91
- @window.notebook.current.apply_colors
91
+ @window.notebook.current.term.colors = @colors
92
+ @window.notebook.current.term.apply_colors
92
93
  end
93
94
  end
data/lib/font_selector.rb CHANGED
@@ -17,13 +17,13 @@ class TopinambourFontSelector < Gtk::Box
17
17
  attr_reader :font
18
18
  def initialize(window)
19
19
  @window = window
20
- @font = @window.notebook.current.font
20
+ @font = @window.notebook.current.term.font
21
21
  super(:horizontal, 0)
22
22
 
23
23
  reset_button = Gtk::Button.new(:label => "Reset")
24
24
  reset_button.signal_connect "clicked" do
25
25
  font_desc = Pango::FontDescription.new(@font)
26
- @window.notebook.current.set_font(font_desc)
26
+ @window.notebook.current.term.set_font(font_desc)
27
27
  end
28
28
  pack_start(reset_button, :expand => false, :fill => false, :padding => 0)
29
29
 
@@ -35,14 +35,14 @@ class TopinambourFontSelector < Gtk::Box
35
35
  font_button.set_use_size(false)
36
36
  font_button.signal_connect "font-set" do
37
37
  font_desc = Pango::FontDescription.new(font_button.font_name)
38
- @window.notebook.current.set_font(font_desc)
38
+ @window.notebook.current.term.set_font(font_desc)
39
39
  end
40
40
  pack_start(font_button, :expand => false, :fill => false, :padding => 0)
41
41
 
42
42
  save_button = Gtk::Button.new(:label => "Save")
43
43
  save_button.signal_connect "clicked" do
44
44
  new_props = {}
45
- font = @window.notebook.current.font
45
+ font = @window.notebook.current.term.font
46
46
  new_props["-TopinambourTerminal-font"] = font.to_s
47
47
  toplevel.application.update_css(new_props)
48
48
  toplevel.notebook.send_to_all_terminals("set_font", font)
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
29
+ toplevel.current_label.text = next_page.term.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
@@ -38,7 +38,7 @@ class TopinambourNotebook < Gtk::Notebook
38
38
  signal_connect "page-removed" do
39
39
  toplevel.current_tab.text = "#{page + 1}/#{n_pages}" if toplevel.class == TopinambourWindow
40
40
  end
41
-
41
+ set_name("topinambour-notebook")
42
42
  set_show_tabs(false)
43
43
  set_show_border(false)
44
44
  end
@@ -67,7 +67,7 @@ class TopinambourNotebook < Gtk::Notebook
67
67
  toplevel.quit_gracefully
68
68
  else
69
69
  remove(current)
70
- current.grab_focus
70
+ current.term.grab_focus
71
71
  end
72
72
  end
73
73
 
@@ -76,13 +76,13 @@ class TopinambourNotebook < Gtk::Notebook
76
76
  end
77
77
 
78
78
  def generate_tab_preview
79
- _x, _y, w, h = current.allocation.to_a
79
+ _x, _y, w, h = current.term.allocation.to_a
80
80
  surface = Cairo::ImageSurface.new(Cairo::FORMAT_ARGB32,
81
81
  w, h)
82
82
  cr = Cairo::Context.new(surface)
83
- current.draw(cr)
83
+ current.term.draw(cr)
84
84
  pix = surface.to_pixbuf(0, 0, w, h)
85
- current.preview = pix if pix
85
+ current.term.preview = pix if pix
86
86
  end
87
87
 
88
88
  def send_to_all_terminals(method_name, values)
data/lib/preferences.rb CHANGED
@@ -67,7 +67,7 @@ module TopinambourPreferences
67
67
 
68
68
  def self.gen_switch_actions(property_name, builder, parent)
69
69
  switch = builder["#{property_name}_switch"]
70
- switch.active = parent.notebook.current.send("#{property_name}?")
70
+ switch.active = parent.notebook.current.term.send("#{property_name}?")
71
71
  switch.signal_connect "state-set" do |_widget, state|
72
72
  parent.notebook.send_to_all_terminals("#{property_name}=", state)
73
73
  false
@@ -89,7 +89,7 @@ module TopinambourPreferences
89
89
 
90
90
  def self.gen_combobox_actions(property_name, builder, parent)
91
91
  combobox = builder["#{property_name}_sel"]
92
- id = parent.notebook.current.send("#{property_name}").nick + "_id"
92
+ id = parent.notebook.current.term.send("#{property_name}").nick + "_id"
93
93
  combobox.active_id = id
94
94
  combobox.signal_connect "changed" do |widget|
95
95
  value = widget.active_id.gsub(/_id/, "").to_sym
data/lib/searchbar.rb CHANGED
@@ -30,19 +30,16 @@ class TopinambourSearchBar < Gtk::SearchBar
30
30
 
31
31
  def generate_search_entry(window)
32
32
  @entry = Gtk::SearchEntry.new
33
- term = window.notebook.current
33
+ term = window.notebook.current.term
34
34
  @entry.signal_connect "next-match" do |entry|
35
- puts "next-match"
36
35
  term.search_find_next if @regex
37
36
  end
38
37
 
39
- @entry.signal_connect "previous-match" do |entry|
40
- puts "prev match"
38
+ @entry.signal_connect("previous-match") do |entry|
41
39
  term.search_find_previous if @regex
42
40
  end
43
41
 
44
42
  @entry.signal_connect "search-changed" do |entry|
45
- puts "search changed"
46
43
  pattern = entry.buffer.text
47
44
  if pattern != ""
48
45
  @regex = GLib::Regex.new(pattern)
data/lib/shortcuts.rb CHANGED
@@ -27,7 +27,7 @@ module TopinambourShortcuts
27
27
  when Gdk::Keyval::KEY_Escape # escape from overlay mode
28
28
  if window.in_overlay_mode?
29
29
  window.exit_overlay_mode
30
- window.notebook.current.grab_focus
30
+ window.notebook.current.term.grab_focus
31
31
  true
32
32
  end
33
33
  end
@@ -116,6 +116,38 @@ class TopinambourTerminal < Vte::Terminal
116
116
  %w(cursor_shape cursor_blink_mode backspace_binding delete_binding).each do |prop|
117
117
  send("#{prop}=", style_get_property(prop.gsub(/_/,"-")))
118
118
  end
119
+ @colors = css_colors
120
+ apply_colors
121
+ set_font(css_font)
122
+ end
123
+
124
+ def parse_css_color(color_name)
125
+ color_index = TERMINAL_COLOR_NAMES.index(color_name.to_sym)
126
+ color_value = DEFAULT_TERMINAL_COLORS[color_index]
127
+ default_color = Gdk::RGBA.parse(color_value)
128
+ color_from_css = style_get_property(color_name)
129
+ color = color_from_css ? color_from_css : default_color
130
+ color
131
+ end
132
+
133
+ def css_colors
134
+ colors = []
135
+ background = parse_css_color(TERMINAL_COLOR_NAMES[0].to_s)
136
+ foreground = parse_css_color(TERMINAL_COLOR_NAMES[1].to_s)
137
+ TERMINAL_COLOR_NAMES[2..-1].each do |c|
138
+ colors << parse_css_color(c.to_s)
139
+ end
140
+ [background, foreground] + colors
141
+ end
142
+
143
+ def css_font
144
+ font = style_get_property("font")
145
+ font = Pango::FontDescription.new(DEFAULT_TERMINAL_FONT) unless font
146
+ font
147
+ end
148
+
149
+ def apply_colors
150
+ set_colors(@colors[0], @colors[1], @colors[2..-1])
119
151
  end
120
152
  end
121
153
 
@@ -125,9 +157,15 @@ class TopinambourWindow < Gtk::ApplicationWindow
125
157
  install_style("string", "shell", "/usr/bin/fish")
126
158
  install_style("int", "width", [-1, 2000, 1000])
127
159
  install_style("int", "height", [-1, 2000, 500])
128
- install_style("string", "css-editor-style", "classic")
129
160
 
130
161
  def load_properties
131
-
162
+ _w, _h = self.size
163
+ w = style_get_property("width")
164
+ h = style_get_property("height")
165
+ w = _w if w == -1
166
+ h = _h if h == -1
167
+ self.resize(w, h)
168
+ self.set_default_size(w, h)
169
+ @shell = style_get_property("shell")
132
170
  end
133
171
  end
data/lib/terminal.rb CHANGED
@@ -14,6 +14,21 @@
14
14
  # You should have received a copy of the GNU General Public License
15
15
  # along with Topinambour. If not, see <http://www.gnu.org/licenses/>.
16
16
 
17
+ ## The main full tab Gtk::Box + Vte::Terminal + Gtk::Scrollbar
18
+ #
19
+
20
+ class TopinambourTabTerm < Gtk::Box
21
+ attr_reader :term
22
+ def initialize(command_string, working_dir=nil)
23
+ super(:horizontal, 0)
24
+ set_name("topinambour-tab-term")
25
+ @term = TopinambourTerminal.new(command_string, working_dir)
26
+ @scrollbar = Gtk::Scrollbar.new(:vertical, @term.vadjustment)
27
+ @scrollbar.name = "topinambour-scrollbar"
28
+ pack_start(@term, :expand => true, :fill => true, :padding => 0)
29
+ pack_start(@scrollbar)
30
+ end
31
+ end
17
32
  ##
18
33
  # The default vte terminal customized
19
34
  class TopinambourTerminal
@@ -31,14 +46,17 @@ class TopinambourTerminal
31
46
  :spawn_flags => GLib::Spawn::SEARCH_PATH)
32
47
 
33
48
  signal_connect "child-exited" do |widget|
34
- notebook = widget.parent
35
- current_page = notebook.page_num(widget)
49
+ tabterm = widget.parent
50
+ notebook = tabterm.parent
51
+ current_page = notebook.page_num(tabterm)
36
52
  notebook.remove_page(current_page)
37
53
  notebook.toplevel.application.quit unless notebook.n_pages >= 1
38
54
  end
39
55
 
40
- signal_connect "window-title-changed" do
41
- when_terminal_title_change if parent && parent.current == self
56
+ signal_connect "window-title-changed" do |widget|
57
+ tabterm = widget.parent
58
+ notebook = tabterm.parent
59
+ when_terminal_title_change if notebook && notebook.current.term == self
42
60
  end
43
61
 
44
62
  builder = Gtk::Builder.new(:resource =>
@@ -66,41 +84,12 @@ class TopinambourTerminal
66
84
  File.readlink("/proc/#{@pid}/cwd")
67
85
  end
68
86
 
69
- def css_colors
70
- colors = []
71
- background = parse_css_color(TERMINAL_COLOR_NAMES[0].to_s)
72
- foreground = parse_css_color(TERMINAL_COLOR_NAMES[1].to_s)
73
- TERMINAL_COLOR_NAMES[2..-1].each do |c|
74
- colors << parse_css_color(c.to_s)
75
- end
76
- [background, foreground] + colors
77
- end
78
-
79
- def css_font
80
- font = style_get_property("font")
81
- font = Pango::FontDescription.new(DEFAULT_TERMINAL_FONT) unless font
82
- font
83
- end
84
-
85
- def apply_colors
86
- set_colors(@colors[0], @colors[1], @colors[2..-1])
87
- end
88
-
89
87
  def terminal_title
90
88
  @custom_title.class == String ? @custom_title : window_title.to_s
91
89
  end
92
90
 
93
91
  private
94
92
 
95
- def parse_css_color(color_name)
96
- color_index = TERMINAL_COLOR_NAMES.index(color_name.to_sym)
97
- color_value = DEFAULT_TERMINAL_COLORS[color_index]
98
- default_color = Gdk::RGBA.parse(color_value)
99
- color_from_css = style_get_property(color_name)
100
- color = color_from_css ? color_from_css : default_color
101
- color
102
- end
103
-
104
93
  def configure
105
94
  set_rewrap_on_resize(true)
106
95
  set_scrollback_lines(-1)
@@ -27,10 +27,10 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
27
27
  fill_grid
28
28
 
29
29
  @box = Gtk::Box.new(:vertical, 4)
30
- @box.name = "overview-main-box"
30
+ @box.name = "topinambour-overview-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
+ set_size_request(-1, @window.notebook.current.term.allocation.to_a[3] - 8)
34
34
  end
35
35
 
36
36
  private
@@ -43,7 +43,7 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
43
43
 
44
44
  def fill_grid
45
45
  @window.notebook.children.each_with_index do |child, i|
46
- generate_row_grid(child, i)
46
+ generate_row_grid(child.term, i)
47
47
  end
48
48
  @grid.attach(generate_separator, 0, @window.notebook.n_pages, 2, 1)
49
49
  button = generate_quit_button
@@ -137,19 +137,18 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
137
137
  @window.notebook.remove(tab)
138
138
  @grid.remove_row(n)
139
139
  last_tab = @window.notebook.n_pages - 1
140
- update_preview_button_tooltip(n..last_tab)
140
+ update_tab_num_label(n..last_tab)
141
141
  end
142
142
 
143
- def update_preview_button_tooltip(range)
143
+ def update_tab_num_label(range)
144
144
  range.each do |j|
145
- @grid.get_child_at(0, j).tooltip_text = j.to_s
145
+ @grid.get_child_at(0, j).text = "tab. #{(j + 1)}"
146
146
  end
147
147
  end
148
148
 
149
149
  def generate_preview_button(child, i)
150
150
  button = Gtk::Button.new
151
151
  button.image = generate_preview_image(child.preview)
152
- button.set_tooltip_text((i + 1).to_s)
153
152
  button.signal_connect("clicked") { @window.notebook.current_page = i }
154
153
  button
155
154
  end
@@ -247,8 +246,8 @@ class TopinambourTermChooser < Gtk::ScrolledWindow
247
246
  dragged = @window.notebook.get_nth_page(src_index)
248
247
  @window.notebook.reorder_child(dragged, dest_index)
249
248
  @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
249
+ @grid.get_child_at(1, i).image = generate_preview_image(child.term.preview)
250
+ @grid.get_child_at(2, i).label = child.term.terminal_title
252
251
  end
253
252
  end
254
253
 
data/lib/window.rb CHANGED
@@ -20,7 +20,8 @@ class TopinambourWindow
20
20
  def initialize(application)
21
21
  super(:application => application)
22
22
  set_icon_name("utilities-terminal-symbolic")
23
- load_css_properties
23
+ set_name("topinambour-window")
24
+ load_properties
24
25
  set_position(:center)
25
26
  create_header_bar
26
27
  create_containers
@@ -36,14 +37,15 @@ class TopinambourWindow
36
37
  def add_terminal(cmd = @shell)
37
38
  exit_overlay_mode
38
39
  working_dir = nil
39
- working_dir = @notebook.current.pid_dir if @notebook.current
40
+ working_dir = @notebook.current.term.pid_dir if @notebook.current
41
+
42
+ terminal = TopinambourTabTerm.new(cmd, working_dir)
43
+ terminal.show_all
40
44
 
41
- terminal = TopinambourTerminal.new(cmd, working_dir)
42
- terminal.show
43
45
  @notebook.append_page(terminal)
44
46
  @notebook.set_tab_reorderable(terminal, true)
45
47
  @notebook.set_page(@notebook.n_pages - 1)
46
- @notebook.current.grab_focus
48
+ @notebook.current.term.grab_focus
47
49
  end
48
50
 
49
51
  def quit_gracefully
@@ -59,13 +61,13 @@ class TopinambourWindow
59
61
  def show_prev_tab
60
62
  exit_overlay_mode
61
63
  @notebook.cycle_prev_page
62
- @notebook.current.grab_focus
64
+ @notebook.current.term.grab_focus
63
65
  end
64
66
 
65
67
  def show_next_tab
66
68
  exit_overlay_mode
67
69
  @notebook.cycle_next_page
68
- @notebook.current.grab_focus
70
+ @notebook.current.term.grab_focus
69
71
  end
70
72
 
71
73
  def show_font_selector
@@ -84,13 +86,6 @@ class TopinambourWindow
84
86
  @overlay.children[1].destroy if in_overlay_mode?
85
87
  end
86
88
 
87
- def load_css_properties
88
- @default_width = style_get_property("width")
89
- @default_height = style_get_property("height")
90
- set_default_size(@default_width, @default_height)
91
- @shell = style_get_property("shell")
92
- end
93
-
94
89
  def display_about
95
90
  Gtk::AboutDialog.show(self,
96
91
  "authors" => ["Cedric Le Moigne <cedlemo@gmx.com>"],
@@ -99,7 +94,7 @@ class TopinambourWindow
99
94
  "license" => "This program is licenced under the licence GPL-3.0 and later.",
100
95
  "logo_icon_name" => "utilities-terminal-symbolic",
101
96
  "program_name" => "Topinambour",
102
- "version" => "1.0.9",
97
+ "version" => "1.0.11",
103
98
  "website" => "https://github.com/cedlemo/topinambour",
104
99
  "website_label" => "Topinambour github repository"
105
100
  )
@@ -148,27 +143,30 @@ class TopinambourWindow
148
143
  def create_header_bar
149
144
  resource_file = "/com/github/cedlemo/topinambour/headerbar.ui"
150
145
  builder = Gtk::Builder.new(:resource => resource_file)
151
- set_titlebar(builder["headerbar"])
146
+ headerbar = builder["headerbar"]
147
+ headerbar.name = "topinambour-headerbar"
148
+ set_titlebar(headerbar)
152
149
  @current_label = builder["current_label"]
153
150
  current_label_signals
154
151
  @current_tab = builder["current_tab"]
155
152
  next_prev_new_signals(builder)
156
153
  overview_font_color_signals(builder)
157
154
  main_menu_signal(builder)
155
+ reload_css_conf_signal(builder)
158
156
  end
159
157
 
160
158
  def current_label_signals
161
159
  @current_label.signal_connect "activate" do |entry|
162
- @notebook.current.custom_title = entry.text
163
- @notebook.current.grab_focus
160
+ @notebook.current.term.custom_title = entry.text
161
+ @notebook.current.term.grab_focus
164
162
  end
165
163
 
166
164
  @current_label.signal_connect "icon-release" do |entry, position|
167
165
  if position == :primary
168
166
  close_current_tab
169
167
  elsif position == :secondary
170
- @notebook.current.custom_title = nil
171
- entry.text = @notebook.current.window_title
168
+ @notebook.current.term.custom_title = nil
169
+ entry.text = @notebook.current.term.window_title
172
170
  end
173
171
  end
174
172
  end
@@ -217,10 +215,20 @@ class TopinambourWindow
217
215
  end
218
216
  end
219
217
 
218
+ def reload_css_conf_signal(builder)
219
+ button = builder["css_reload_button"]
220
+ button.signal_connect "clicked" do
221
+ application.reload_css_config
222
+ notebook.each { |tab| tab.term.load_properties }
223
+ load_properties
224
+ queue_draw
225
+ end
226
+ end
227
+
220
228
  def toggle_overlay(klass)
221
229
  if in_overlay_mode? && @overlay.children[1].class == klass
222
230
  exit_overlay_mode
223
- @notebook.current.grab_focus
231
+ @notebook.current.term.grab_focus
224
232
  else
225
233
  exit_overlay_mode
226
234
  add_overlay(klass.new(self))
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.10
4
+ version: 1.0.11
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-09-04 00:00:00.000000000 Z
11
+ date: 2016-11-25 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.9
22
+ version: 3.1.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,27 +29,7 @@ dependencies:
29
29
  version: '3.0'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 3.0.9
33
- - !ruby/object:Gem::Dependency
34
- name: gtksourceview3
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '3.0'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 3.0.9
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '3.0'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 3.0.9
32
+ version: 3.1.0
53
33
  - !ruby/object:Gem::Dependency
54
34
  name: sass
55
35
  requirement: !ruby/object:Gem::Requirement
@@ -134,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
114
  version: '0'
135
115
  requirements: []
136
116
  rubyforge_project:
137
- rubygems_version: 2.5.1
117
+ rubygems_version: 2.5.2
138
118
  signing_key:
139
119
  specification_version: 4
140
120
  summary: Ruby-gnome2 Terminal emulator