topinambour 2.0.4 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -138,3 +138,12 @@ module TopinambourRegex
138
138
  REGEX_NEWS_MAN = "(?i:news:|man:|info:)[-[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+"
139
139
  include ColorRegexes
140
140
  end
141
+
142
+ module Pcre2
143
+ # PCRE2_UTF | PCRE2_NO_UTF_CHECK | PCRE2_MULTILINE
144
+ UTF = "0x00080000".to_i(16)
145
+ NO_UTF_CHECK = "0x40000000".to_i(16)
146
+ MULTILINE = "0x00000400".to_i(16)
147
+ ALL_FLAGS = UTF | NO_UTF_CHECK | MULTILINE
148
+
149
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,25 @@
1
+ # Copyright 2018 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
+
17
+ ## Module that stores the version information for About class and
18
+ # the gemspec.
19
+ module Version
20
+ MAJOR = 2
21
+ MINOR = 0
22
+ MICRO = 6
23
+
24
+ STRING = "#{MAJOR}.#{MINOR}.#{MICRO}".freeze
25
+ end
data/lib/window.rb CHANGED
@@ -14,137 +14,109 @@
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
- class TopinambourWindow < Gtk::ApplicationWindow
18
- attr_reader :bar, :overlay, :terminal
19
- def initialize(application)
20
- super(application)
21
- set_icon_name("utilities-terminal-symbolic")
22
- set_name("topinambour-window")
23
- load_settings
24
- set_position(:center)
25
- create_header_bar
26
- @overlay = Gtk::Overlay.new
27
- add(@overlay)
28
- show_all
29
- signal_connect "key-press-event" do |widget, event|
30
- TopinambourShortcuts.handle_key_press(widget, event)
31
- end
32
- end
33
-
34
- def add_terminal(cmd = nil)
35
- cmd = cmd || application.settings["default-shell"]
36
-
37
- terminal = TopinambourTermBox.new(cmd)
38
- @overlay.add(terminal)
39
- @terminal = terminal.term
40
- terminal.term.load_settings
41
- end
42
-
17
+ ## Actions of the window that will be called throught the Application instance.
18
+ # or throught terminal signals.
19
+ module TopinambourWindowActions
43
20
  def quit_gracefully
44
- application.quit
21
+ @application.quit
45
22
  end
46
23
 
47
24
  def show_color_selector
48
- toggle_overlay(TopinambourColorSelector)
25
+ @overlay.toggle_overlay(TopinambourColorSelector)
49
26
  end
50
27
 
51
28
  def show_font_selector
52
- toggle_overlay(TopinambourFontSelector)
53
- end
54
-
55
- def exit_overlay_mode
56
- @overlay.children[1].destroy if in_overlay_mode?
29
+ @overlay.toggle_overlay(TopinambourFontSelector)
57
30
  end
58
31
 
59
32
  def display_about
60
- Gtk::AboutDialog.show(self,
61
- "authors" => ["Cedric Le Moigne <cedlemo@gmx.com>"],
62
- "comments" => "Terminal Emulator based on the ruby bindings of Gtk3 and Vte3",
63
- "copyright" => "Copyright (C) 2015-2018 Cedric Le Moigne",
64
- "license" => "This program is licenced under the licence GPL-3.0 and later.",
65
- "logo_icon_name" => "utilities-terminal-symbolic",
66
- "program_name" => "Topinambour",
67
- "version" => "2.0.4",
68
- "website" => "https://github.com/cedlemo/topinambour",
69
- "website_label" => "Topinambour github repository"
70
- )
71
- end
72
-
73
- def in_overlay_mode?
74
- @overlay.children.size > 1 ? true : false
75
- end
76
-
77
- def toggle_shrink
78
- w, h = size
79
- if @shrink_saved_height
80
- resize(w, @shrink_saved_height)
81
- @shrink_saved_height = nil
82
- else
83
- resize(w, 1)
84
- @shrink_saved_height = h
85
- end
33
+ About.dialog(self)
86
34
  end
87
35
 
88
36
  def show_shortcuts
89
- resource_file = "/com/github/cedlemo/topinambour/shortcuts.ui"
90
- builder = Gtk::Builder.new(:resource => resource_file)
91
- shortcuts_win = builder["shortcuts-window"]
37
+ resource_file = '/com/github/cedlemo/topinambour/shortcuts.ui'
38
+ builder = Gtk::Builder.new(resource: resource_file)
39
+ shortcuts_win = builder['shortcuts-window']
92
40
  shortcuts_win.transient_for = self
93
41
  shortcuts_win.show
94
42
  end
95
- private
43
+ end
96
44
 
97
- def load_settings
98
- height = application.settings["height"]
99
- width = application.settings["width"]
100
- resize(width, height)
45
+ ## Main window of Topinambour
46
+ #
47
+ class TopinambourWindow < Gtk::ApplicationWindow
48
+ attr_reader :terminal, :overlay
49
+ include TopinambourWindowActions
50
+
51
+ def initialize(application)
52
+ super(application)
53
+ @application = application
54
+ set_icon_name('utilities-terminal-symbolic')
55
+ set_name('topinambour-window')
56
+ set_position(:center)
57
+ @overlay = TopinambourOverlay.new
58
+ create_header_bar
59
+
60
+ signal_connect 'key-press-event' do |widget, event|
61
+ TopinambourShortcuts.handle_key_press(widget, event)
62
+ end
63
+
64
+ add(@overlay)
101
65
  end
102
66
 
103
- def add_overlay(widget)
104
- @overlay.add_overlay(widget)
105
- @overlay.set_overlay_pass_through(widget, false)
67
+ def add_terminal(cmd = '/usr/bin/zsh')
68
+ terminal = TopinambourTermBox.new(cmd, self)
69
+ @terminal = terminal.term
70
+ @overlay.add_main_widget(terminal)
106
71
  end
107
72
 
108
73
  def create_header_bar
109
74
  headerbar = Gtk::HeaderBar.new
110
- headerbar.name = "topinambour-headerbar"
75
+ headerbar.name = 'topinambour-headerbar'
111
76
  headerbar.show_close_button = true
112
77
  set_titlebar(headerbar)
113
78
  end
114
79
 
115
- def main_menu_signal(builder)
116
- button = builder["menu_button"]
117
- ui_file = "/com/github/cedlemo/topinambour/main-menu-popover.ui"
118
- menu_builder = Gtk::Builder.new(:resource => ui_file)
119
- main_menu = menu_builder["main_menu_popover"]
120
- button.set_popover(main_menu)
121
- button.popover.modal = true
122
- add_theme_menu_buttons_signals(menu_builder)
80
+ def exit_overlay_mode
81
+ @overlay.exit_overlay_mode
123
82
  end
83
+ end
124
84
 
125
- def add_theme_menu_buttons_signals(builder)
126
- builder["css_reload_button"].signal_connect "clicked" do
127
- application.reload_css_config
128
- queue_draw
129
- end
85
+ ## This overlay contains the main terminal and allows another widgets to be
86
+ # displayed on top of it.
87
+ class TopinambourOverlay < Gtk::Overlay
88
+ def initialize
89
+ super()
90
+ end
130
91
 
131
- builder["font_sel_button"].signal_connect "clicked" do
132
- show_font_selector
133
- end
92
+ def add_main_widget(terminal)
93
+ @terminal = terminal
94
+ add(@terminal)
95
+ end
134
96
 
135
- builder["colors_sel_button"].signal_connect "clicked" do
136
- show_color_selector
137
- end
97
+ # Add a widget over the main widget of the overlay.
98
+ def add_secondary_widget(widget)
99
+ add_overlay(widget)
100
+ set_overlay_pass_through(widget, false)
101
+ end
102
+
103
+ # Check if there is a widget displayed on top of the main widget.
104
+ def in_overlay_mode?
105
+ children.size > 1
106
+ end
107
+
108
+ # Display only the main widget.
109
+ def exit_overlay_mode
110
+ children[1].destroy if in_overlay_mode?
138
111
  end
139
112
 
140
113
  def toggle_overlay(klass)
114
+ exit_overlay_mode
141
115
  if in_overlay_mode? && @overlay.children[1].class == klass
142
- exit_overlay_mode
143
- @terminal.grab_focus
116
+ @terminal.term.grab_focus
144
117
  else
145
- exit_overlay_mode
146
- add_overlay(klass.new(self))
147
- @overlay.children[1].show_all
118
+ add_secondary_widget(klass.new(@terminal.toplevel))
119
+ children[1].show_all
148
120
  end
149
121
  end
150
122
  end
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: topinambour
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.6
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: 2018-02-08 00:00:00.000000000 Z
11
+ date: 2019-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gtk3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 3.2.6
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '3.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 3.2.6
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: vte3
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -30,8 +50,7 @@ dependencies:
30
50
  - - ">="
31
51
  - !ruby/object:Gem::Version
32
52
  version: 3.1.0
33
- description: Terminal Emulator based on the libs vte3 and gtk3 from the ruby-gnome2
34
- project
53
+ description: Terminal Emulator based on the ruby bindings of Gtk3 and Vte3
35
54
  email: cedlemo@gmx.com
36
55
  executables:
37
56
  - topinambour
@@ -53,16 +72,18 @@ files:
53
72
  - data/topinambour.gresource.xml
54
73
  - data/topinambour.gschema.xml
55
74
  - data/window-menu.ui
56
- - data/window.ui
75
+ - lib/about.rb
57
76
  - lib/actions.rb
58
77
  - lib/application.rb
59
78
  - lib/color_selector.rb
60
79
  - lib/font_selector.rb
61
80
  - lib/preferences.rb
81
+ - lib/profile.rb
62
82
  - lib/rgb_names_regexes.rb
63
83
  - lib/shortcuts.rb
64
84
  - lib/terminal.rb
65
85
  - lib/terminal_regex.rb
86
+ - lib/version.rb
66
87
  - lib/window.rb
67
88
  homepage: https://github.com/cedlemo/topinambour
68
89
  licenses:
@@ -83,9 +104,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
104
  - !ruby/object:Gem::Version
84
105
  version: '0'
85
106
  requirements: []
86
- rubyforge_project:
87
- rubygems_version: 2.7.3
107
+ rubygems_version: 3.0.3
88
108
  signing_key:
89
109
  specification_version: 4
90
- summary: Ruby-gnome2 Terminal emulator
110
+ summary: Vte3 Terminal emulator in ruby.
91
111
  test_files: []
data/data/window.ui DELETED
@@ -1,58 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Generated with glade 3.18.3 -->
3
- <interface>
4
- <requires lib="gtk+" version="3.12"/>
5
- <template class="window" parent="GtkWindow">
6
- <property name="can_focus">False</property>
7
- <child>
8
- <object class="GtkNotebook" id="notebook">
9
- <property name="visible">True</property>
10
- <property name="can_focus">True</property>
11
- <property name="show_border">False</property>
12
- <property name="scrollable">True</property>
13
- <property name="enable_popup">True</property>
14
- <child>
15
- <placeholder/>
16
- </child>
17
- <child type="tab">
18
- <object class="GtkLabel" id="label1">
19
- <property name="visible">True</property>
20
- <property name="can_focus">False</property>
21
- <property name="label" translatable="yes">page 1</property>
22
- </object>
23
- <packing>
24
- <property name="tab_fill">False</property>
25
- </packing>
26
- </child>
27
- <child>
28
- <placeholder/>
29
- </child>
30
- <child type="tab">
31
- <object class="GtkLabel" id="label2">
32
- <property name="visible">True</property>
33
- <property name="can_focus">False</property>
34
- <property name="label" translatable="yes">page 2</property>
35
- </object>
36
- <packing>
37
- <property name="position">1</property>
38
- <property name="tab_fill">False</property>
39
- </packing>
40
- </child>
41
- <child>
42
- <placeholder/>
43
- </child>
44
- <child type="tab">
45
- <object class="GtkLabel" id="label3">
46
- <property name="visible">True</property>
47
- <property name="can_focus">False</property>
48
- <property name="label" translatable="yes">page 3</property>
49
- </object>
50
- <packing>
51
- <property name="position">2</property>
52
- <property name="tab_fill">False</property>
53
- </packing>
54
- </child>
55
- </object>
56
- </child>
57
- </template>
58
- </interface>