gtk3 3.0.9 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/gtk3/rb-gtk3-private.h +1 -0
- data/ext/gtk3/rb-gtk3-spin-button.c +85 -0
- data/ext/gtk3/rb-gtk3.c +3 -0
- data/lib/gtk3/deprecated.rb +0 -8
- data/lib/gtk3/loader.rb +1 -7
- data/lib/gtk3/tree-model.rb +2 -0
- data/sample/gtk-demo/TODO +10 -10
- data/sample/gtk-demo/assistant.rb +44 -39
- data/sample/gtk-demo/builder.rb +71 -50
- data/sample/gtk-demo/button_box.rb +39 -28
- data/sample/gtk-demo/clipboard.rb +139 -46
- data/sample/gtk-demo/colorsel.rb +50 -36
- data/sample/gtk-demo/css_accordion.rb +18 -17
- data/sample/gtk-demo/css_basics.rb +60 -47
- data/sample/gtk-demo/css_multiplebgs.rb +92 -71
- data/sample/gtk-demo/css_pixbufs.rb +61 -48
- data/sample/gtk-demo/css_shadows.rb +63 -50
- data/sample/gtk-demo/cursors.rb +95 -64
- data/sample/gtk-demo/dialog.rb +95 -78
- data/sample/gtk-demo/drawingarea.rb +138 -171
- data/sample/gtk-demo/editable_cells.rb +169 -130
- data/sample/gtk-demo/entry_buffer.rb +15 -13
- data/sample/gtk-demo/entry_completion.rb +22 -17
- data/sample/gtk-demo/expander.rb +39 -31
- data/sample/gtk-demo/filtermodel.rb +67 -63
- data/sample/gtk-demo/font_features.rb +91 -60
- data/sample/gtk-demo/glarea.rb +277 -0
- data/sample/gtk-demo/headerbar.rb +17 -15
- data/sample/gtk-demo/hypertext.rb +146 -167
- data/sample/gtk-demo/iconview.rb +132 -91
- data/sample/gtk-demo/iconview_edit.rb +49 -38
- data/sample/gtk-demo/infobar.rb +81 -62
- data/sample/gtk-demo/links.rb +35 -30
- data/sample/gtk-demo/list_store.rb +169 -114
- data/sample/gtk-demo/listbox.rb +183 -0
- data/sample/gtk-demo/main.rb +32 -21
- data/sample/gtk-demo/markup.rb +65 -52
- data/sample/gtk-demo/menus.rb +57 -58
- data/sample/gtk-demo/modelbutton.rb +11 -9
- data/sample/gtk-demo/modelbutton.ui +3 -0
- data/sample/gtk-demo/overlay.rb +39 -32
- data/sample/gtk-demo/overlay2.rb +68 -54
- data/sample/gtk-demo/panes.rb +56 -68
- data/sample/gtk-demo/pickers.rb +46 -45
- data/sample/gtk-demo/pixbufs.rb +27 -25
- data/sample/gtk-demo/popover.rb +70 -63
- data/sample/gtk-demo/printing.rb +94 -69
- data/sample/gtk-demo/revealer.rb +46 -38
- data/sample/gtk-demo/rotated_text.rb +75 -54
- data/sample/gtk-demo/scale.rb +10 -8
- data/sample/gtk-demo/search_entry.rb +195 -0
- data/sample/gtk-demo/search_entry2.rb +71 -59
- data/sample/gtk-demo/sidebar.rb +20 -19
- data/sample/gtk-demo/sizegroup.rb +36 -35
- data/sample/gtk-demo/spinbutton.rb +128 -0
- data/sample/gtk-demo/spinner.rb +55 -40
- data/sample/gtk-demo/stack.rb +11 -8
- data/sample/gtk-demo/textmask.rb +14 -13
- data/sample/gtk-demo/textscroll.rb +16 -12
- data/sample/gtk-demo/theming_style_classes.rb +14 -12
- data/sample/gtk-demo/transparent.rb +17 -13
- data/sample/misc/treemodelfilter.rb +1 -1
- metadata +21 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 276f1e2ef9d9e91f3c04d827a2ab1a472d8b0788
|
4
|
+
data.tar.gz: 65e77162cd83602533a1a57854ede3d7a3578101
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d4ed22bc6427981361addd4dfb89049c8f420373291d5aaa710c29c13c8d8fbb9803ac8b61fc9c5846de40b656f8770a3e48cd661fd24c9e372e4c6b3aeb058
|
7
|
+
data.tar.gz: bddf33752de735f70bfc1dcbe8ad1072c7ab527524c94cb3b15611e881128da833ef7f989941b2fcb6553eca7e7494e2919b01b6ea358b2ec60f5a41f76b311e
|
data/ext/gtk3/rb-gtk3-private.h
CHANGED
@@ -28,6 +28,7 @@ G_GNUC_INTERNAL void rbgtk3_initialize(VALUE self);
|
|
28
28
|
|
29
29
|
G_GNUC_INTERNAL void rbgtk3_cell_layout_init(void);
|
30
30
|
G_GNUC_INTERNAL void rbgtk3_container_init(void);
|
31
|
+
G_GNUC_INTERNAL void rbgtk3_spin_button_init(void);
|
31
32
|
G_GNUC_INTERNAL void rbgtk3_tree_model_init(void);
|
32
33
|
G_GNUC_INTERNAL void rbgtk3_tree_view_init(void);
|
33
34
|
G_GNUC_INTERNAL void rbgtk3_widget_init(void);
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2016 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rb-gtk3-private.h"
|
22
|
+
|
23
|
+
typedef struct {
|
24
|
+
RGClosureCallData *data;
|
25
|
+
VALUE args;
|
26
|
+
double *new_value;
|
27
|
+
} InputData;
|
28
|
+
|
29
|
+
static VALUE
|
30
|
+
rb_gtk3_spin_button_input_body(VALUE user_data)
|
31
|
+
{
|
32
|
+
InputData *input_data = (InputData *)user_data;
|
33
|
+
VALUE new_value;
|
34
|
+
|
35
|
+
new_value = rb_apply(input_data->data->callback,
|
36
|
+
rb_intern("call"),
|
37
|
+
input_data->args);
|
38
|
+
if (NIL_P(new_value)) {
|
39
|
+
g_value_set_int(input_data->data->return_value, FALSE);
|
40
|
+
} else {
|
41
|
+
g_value_set_int(input_data->data->return_value, TRUE);
|
42
|
+
*(input_data->new_value) = NUM2DBL(new_value);
|
43
|
+
}
|
44
|
+
|
45
|
+
return Qnil;
|
46
|
+
}
|
47
|
+
|
48
|
+
static VALUE
|
49
|
+
rb_gtk3_spin_button_input_rescue(VALUE user_data)
|
50
|
+
{
|
51
|
+
InputData *input_data = (InputData *)user_data;
|
52
|
+
g_value_set_int(input_data->data->return_value, GTK_INPUT_ERROR);
|
53
|
+
return Qnil;
|
54
|
+
}
|
55
|
+
|
56
|
+
static void
|
57
|
+
rb_gtk3_spin_button_input(RGClosureCallData *data)
|
58
|
+
{
|
59
|
+
InputData input_data;
|
60
|
+
VALUE args;
|
61
|
+
|
62
|
+
args = rb_ary_new_from_args(1, GVAL2RVAL(&(data->param_values[0])));
|
63
|
+
if (!NIL_P(data->extra_args)) {
|
64
|
+
rb_ary_concat(args, data->extra_args);
|
65
|
+
}
|
66
|
+
input_data.data = data;
|
67
|
+
input_data.args = args;
|
68
|
+
input_data.new_value = g_value_get_pointer(&(data->param_values[1]));
|
69
|
+
rb_rescue(rb_gtk3_spin_button_input_body, (VALUE)&input_data,
|
70
|
+
rb_gtk3_spin_button_input_rescue, (VALUE)&input_data);
|
71
|
+
}
|
72
|
+
|
73
|
+
void
|
74
|
+
rbgtk3_spin_button_init(void)
|
75
|
+
{
|
76
|
+
VALUE mGtk;
|
77
|
+
VALUE RG_TARGET_NAMESPACE;
|
78
|
+
|
79
|
+
mGtk = rb_const_get(rb_cObject, rb_intern("Gtk"));
|
80
|
+
RG_TARGET_NAMESPACE = rb_const_get(mGtk, rb_intern("SpinButton"));
|
81
|
+
|
82
|
+
rbgobj_set_signal_call_func(RG_TARGET_NAMESPACE,
|
83
|
+
"input",
|
84
|
+
rb_gtk3_spin_button_input);
|
85
|
+
}
|
data/ext/gtk3/rb-gtk3.c
CHANGED
@@ -19,6 +19,7 @@
|
|
19
19
|
*/
|
20
20
|
|
21
21
|
#include "rb-gtk3-private.h"
|
22
|
+
#include <locale.h>
|
22
23
|
|
23
24
|
static ID id_call;
|
24
25
|
static VALUE cGdkAtom;
|
@@ -634,9 +635,11 @@ Init_gtk3(void)
|
|
634
635
|
|
635
636
|
rbgtk3_cell_layout_init();
|
636
637
|
rbgtk3_container_init();
|
638
|
+
rbgtk3_spin_button_init();
|
637
639
|
rbgtk3_tree_model_init();
|
638
640
|
rbgtk3_tree_view_init();
|
639
641
|
rbgtk3_widget_init();
|
640
642
|
|
641
643
|
rbgobj_boxed_not_copy_obj(GTK_TYPE_SELECTION_DATA);
|
644
|
+
setlocale(LC_NUMERIC, "C");
|
642
645
|
}
|
data/lib/gtk3/deprecated.rb
CHANGED
@@ -711,14 +711,6 @@ module Gtk
|
|
711
711
|
alias :update_policy= :set_update_policy
|
712
712
|
end
|
713
713
|
|
714
|
-
module RC
|
715
|
-
extend GLib::Deprecatable
|
716
|
-
define_deprecated_const :Flags, "Gtk::RCFlags"
|
717
|
-
define_deprecated_flags :RCFlags
|
718
|
-
define_deprecated_const :TokenType, "Gtk::RCTokenType"
|
719
|
-
define_deprecated_enums :RCTokenType, 'TOKEN'
|
720
|
-
end
|
721
|
-
|
722
714
|
class RecentAction
|
723
715
|
extend GLib::Deprecatable
|
724
716
|
define_deprecated_method_by_hash_args :initialize,
|
data/lib/gtk3/loader.rb
CHANGED
@@ -35,7 +35,7 @@ module Gtk
|
|
35
35
|
arguments = [
|
36
36
|
[$0] + @init_arguments,
|
37
37
|
]
|
38
|
-
succeeded, argv = init_check.invoke(
|
38
|
+
succeeded, argv = init_check.invoke(arguments)
|
39
39
|
@init_arguments.replace(argv[1..-1])
|
40
40
|
raise InitError, "failed to initialize GTK+" unless succeeded
|
41
41
|
end
|
@@ -401,12 +401,6 @@ module Gtk
|
|
401
401
|
end
|
402
402
|
end
|
403
403
|
|
404
|
-
def initialize_post(object)
|
405
|
-
super
|
406
|
-
return unless object.is_a?(GLib::Object)
|
407
|
-
self.class.reference_gobject(object, :sink => true)
|
408
|
-
end
|
409
|
-
|
410
404
|
def setup_pending_constants
|
411
405
|
@pending_constants = []
|
412
406
|
end
|
data/lib/gtk3/tree-model.rb
CHANGED
data/sample/gtk-demo/TODO
CHANGED
@@ -10,7 +10,7 @@ assistant.c ok ok
|
|
10
10
|
builder.c ok ok
|
11
11
|
button_box.c ok ok
|
12
12
|
changedisplay.c ok no
|
13
|
-
clipboard.c ok
|
13
|
+
clipboard.c ok ok
|
14
14
|
colorsel.c ok ok
|
15
15
|
combobox.c no no
|
16
16
|
css_accordion.c ok ok
|
@@ -20,8 +20,8 @@ css_pixbufs.c ok ok
|
|
20
20
|
css_shadows.c ok ok
|
21
21
|
cursors.c ok ok
|
22
22
|
dialog.c ok ok
|
23
|
-
drawingarea.c ok
|
24
|
-
editable_cells.c ok
|
23
|
+
drawingarea.c ok ok
|
24
|
+
editable_cells.c ok ok
|
25
25
|
entry_buffer.c ok ok
|
26
26
|
entry_completion.c ok ok
|
27
27
|
event_axes.c no no
|
@@ -31,16 +31,16 @@ flowbox.c no no
|
|
31
31
|
font_features.c ok ok
|
32
32
|
foreigndrawing no no
|
33
33
|
gestures.c no no
|
34
|
-
glarea.c
|
34
|
+
glarea.c ok ok
|
35
35
|
headerbar.c ok ok
|
36
|
-
hypertext.c ok
|
37
|
-
iconview.c ok
|
36
|
+
hypertext.c ok ok
|
37
|
+
iconview.c ok ok
|
38
38
|
iconview_edit.c ok ok
|
39
39
|
images.c ok no
|
40
40
|
infobar.c ok ok
|
41
41
|
links.c ok ok
|
42
|
-
listbox.c
|
43
|
-
list_store.c ok
|
42
|
+
listbox.c ok ok
|
43
|
+
list_store.c ok ok
|
44
44
|
markup.c ok ok
|
45
45
|
menus.c ok ok
|
46
46
|
modelbutton.c ok ok
|
@@ -56,12 +56,12 @@ printing.c ok ok
|
|
56
56
|
revealer.c ok ok
|
57
57
|
rotated_text.c ok ok
|
58
58
|
scale.c ok ok
|
59
|
-
search_entry.c
|
59
|
+
search_entry.c ok ok
|
60
60
|
search_entry2.c ok ok
|
61
61
|
shortcuts.c no no
|
62
62
|
sidebar.c ok ok
|
63
63
|
sizegroup.c ok ok
|
64
|
-
spinbutton.c
|
64
|
+
spinbutton.c ok ok
|
65
65
|
spinner.c ok ok
|
66
66
|
stack.c ok ok
|
67
67
|
textmask.c ok ok
|
@@ -8,21 +8,21 @@
|
|
8
8
|
an operation into several simpler sequential steps, and to guide the user
|
9
9
|
through these steps.
|
10
10
|
=end
|
11
|
-
|
12
|
-
def
|
13
|
-
assistant = Gtk::Assistant.new
|
14
|
-
assistant.screen = main_window.screen
|
11
|
+
class AssistantDemo
|
12
|
+
def initialize(main_window)
|
13
|
+
@assistant = Gtk::Assistant.new
|
14
|
+
@assistant.screen = main_window.screen
|
15
15
|
|
16
|
-
create_page1
|
17
|
-
create_page2
|
18
|
-
create_page3
|
19
|
-
progress_bar = create_page4
|
16
|
+
create_page1
|
17
|
+
create_page2
|
18
|
+
create_page3
|
19
|
+
progress_bar = create_page4
|
20
20
|
|
21
|
-
assistant.signal_connect("cancel", &:destroy)
|
21
|
+
@assistant.signal_connect("cancel", &:destroy)
|
22
22
|
|
23
|
-
assistant.signal_connect("close", &:destroy)
|
23
|
+
@assistant.signal_connect("close", &:destroy)
|
24
24
|
|
25
|
-
assistant.signal_connect "apply" do |widget|
|
25
|
+
@assistant.signal_connect "apply" do |widget|
|
26
26
|
GLib::Timeout.add(100) do
|
27
27
|
fraction = progress_bar.fraction + 0.05
|
28
28
|
if fraction < 1.0
|
@@ -34,7 +34,7 @@ module AssistantDemo
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
assistant.signal_connect "prepare" do |widget, _page|
|
37
|
+
@assistant.signal_connect "prepare" do |widget, _page|
|
38
38
|
current_page = widget.current_page
|
39
39
|
n_pages = widget.n_pages
|
40
40
|
|
@@ -42,16 +42,20 @@ module AssistantDemo
|
|
42
42
|
|
43
43
|
widget.commit if current_page == 3
|
44
44
|
end
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
-
|
47
|
+
def run
|
48
|
+
if !@assistant.visible?
|
49
|
+
@assistant.show_all
|
48
50
|
else
|
49
|
-
assistant.destroy
|
51
|
+
@assistant.destroy
|
50
52
|
end
|
51
|
-
assistant
|
53
|
+
@assistant
|
52
54
|
end
|
53
55
|
|
54
|
-
|
56
|
+
private
|
57
|
+
|
58
|
+
def create_page1
|
55
59
|
box = Gtk::Box.new(:horizontal, 12)
|
56
60
|
box.border_width = 12
|
57
61
|
|
@@ -64,23 +68,23 @@ module AssistantDemo
|
|
64
68
|
box.pack_start(entry, :expand => true, :fill => true, :padding => 0)
|
65
69
|
|
66
70
|
entry.signal_connect "changed" do |widget|
|
67
|
-
page_number = assistant.current_page
|
68
|
-
current_page = assistant.get_nth_page(page_number)
|
71
|
+
page_number = @assistant.current_page
|
72
|
+
current_page = @assistant.get_nth_page(page_number)
|
69
73
|
|
70
74
|
if widget.text
|
71
|
-
assistant.set_page_complete(current_page, true)
|
75
|
+
@assistant.set_page_complete(current_page, true)
|
72
76
|
else
|
73
|
-
assistant.set_page_complete(current_page, false)
|
77
|
+
@assistant.set_page_complete(current_page, false)
|
74
78
|
end
|
75
79
|
end
|
76
80
|
|
77
81
|
box.show_all
|
78
|
-
assistant.append_page(box)
|
79
|
-
assistant.set_page_title(box, "Page 1")
|
80
|
-
assistant.set_page_type(box, :intro)
|
82
|
+
@assistant.append_page(box)
|
83
|
+
@assistant.set_page_title(box, "Page 1")
|
84
|
+
@assistant.set_page_type(box, :intro)
|
81
85
|
end
|
82
86
|
|
83
|
-
def
|
87
|
+
def create_page2
|
84
88
|
box = Gtk::Box.new(:horizontal, 12)
|
85
89
|
box.border_width = 12
|
86
90
|
|
@@ -91,34 +95,35 @@ LABEL
|
|
91
95
|
box.pack_start(checkbutton, :expand => false, :fill => false, :padding => 0)
|
92
96
|
|
93
97
|
box.show_all
|
94
|
-
assistant.append_page(box)
|
95
|
-
assistant.set_page_complete(box, true)
|
96
|
-
assistant.set_page_title(box, "Page 1")
|
98
|
+
@assistant.append_page(box)
|
99
|
+
@assistant.set_page_complete(box, true)
|
100
|
+
@assistant.set_page_title(box, "Page 1")
|
97
101
|
end
|
98
102
|
|
99
|
-
def
|
100
|
-
|
103
|
+
def create_page3
|
104
|
+
message = "This is a confirmation page, press 'Apply' to apply changes"
|
105
|
+
label = Gtk::Label.new(message)
|
101
106
|
label.show
|
102
107
|
|
103
|
-
assistant.append_page(label)
|
104
|
-
assistant.set_page_type(label, :confirm)
|
105
|
-
assistant.set_page_complete(label, true)
|
106
|
-
assistant.set_page_title(label, "Confirmation")
|
108
|
+
@assistant.append_page(label)
|
109
|
+
@assistant.set_page_type(label, :confirm)
|
110
|
+
@assistant.set_page_complete(label, true)
|
111
|
+
@assistant.set_page_title(label, "Confirmation")
|
107
112
|
end
|
108
113
|
|
109
|
-
def
|
114
|
+
def create_page4
|
110
115
|
progress_bar = Gtk::ProgressBar.new
|
111
116
|
progress_bar.halign = :center
|
112
117
|
progress_bar.valign = :center
|
113
118
|
|
114
119
|
progress_bar.show
|
115
|
-
assistant.append_page(progress_bar)
|
116
|
-
assistant.set_page_type(progress_bar, :progress)
|
117
|
-
assistant.set_page_title(progress_bar, "Applying changes")
|
120
|
+
@assistant.append_page(progress_bar)
|
121
|
+
@assistant.set_page_type(progress_bar, :progress)
|
122
|
+
@assistant.set_page_title(progress_bar, "Applying changes")
|
118
123
|
|
119
124
|
# This prevents the assistant window from being
|
120
125
|
# closed while we're "busy" applying changes.
|
121
|
-
assistant.set_page_complete(progress_bar, false)
|
126
|
+
@assistant.set_page_complete(progress_bar, false)
|
122
127
|
progress_bar
|
123
128
|
end
|
124
129
|
end
|
data/sample/gtk-demo/builder.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2015 Ruby-GNOME2 Project Team
|
1
|
+
# Copyright (c) 2015-2016 Ruby-GNOME2 Project Team
|
2
2
|
# This program is licenced under the same licence as Ruby-GNOME2.
|
3
3
|
#
|
4
4
|
=begin
|
@@ -6,83 +6,104 @@
|
|
6
6
|
|
7
7
|
Demonstrates an interface loaded from a XML description.
|
8
8
|
=end
|
9
|
-
|
10
|
-
def
|
11
|
-
builder = Gtk::Builder.new(:resource => "/builder/demo.ui")
|
12
|
-
builder.connect_signals {}
|
9
|
+
class BuilderDemo
|
10
|
+
def initialize(_main_window)
|
11
|
+
@builder = Gtk::Builder.new(:resource => "/builder/demo.ui")
|
12
|
+
@builder.connect_signals {}
|
13
13
|
|
14
|
-
window = builder["window1"]
|
15
|
-
toolbar = builder["toolbar1"]
|
14
|
+
@window = @builder["window1"]
|
15
|
+
toolbar = @builder["toolbar1"]
|
16
16
|
toolbar.style_context.add_class("primary-toolbar")
|
17
17
|
|
18
|
+
|
19
|
+
add_actions
|
20
|
+
add_accelerators
|
21
|
+
end
|
22
|
+
|
23
|
+
def run
|
24
|
+
if !@window.visible?
|
25
|
+
@window.show_all
|
26
|
+
else
|
27
|
+
@window.destroy
|
28
|
+
end
|
29
|
+
@window
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def add_actions
|
18
35
|
actions = Gio::SimpleActionGroup.new
|
36
|
+
actions.add_action(quit_action)
|
37
|
+
actions.add_action(about_action)
|
38
|
+
actions.add_action(help_action)
|
39
|
+
@window.insert_action_group("win", actions)
|
40
|
+
end
|
19
41
|
|
42
|
+
def quit_action
|
20
43
|
action = Gio::SimpleAction.new("quit")
|
21
44
|
action.signal_connect "activate" do |_simple_action, _parameter|
|
22
|
-
window.destroy
|
45
|
+
@window.destroy
|
23
46
|
end
|
24
|
-
|
47
|
+
action
|
48
|
+
end
|
25
49
|
|
50
|
+
def about_action
|
26
51
|
action = Gio::SimpleAction.new("about")
|
27
|
-
actions.add_action(action)
|
28
52
|
action.signal_connect "activate" do |_simple_action, _parameter|
|
29
|
-
about_dlg = builder["aboutdialog1"]
|
53
|
+
about_dlg = @builder["aboutdialog1"]
|
30
54
|
about_dlg.run
|
31
55
|
about_dlg.hide
|
32
56
|
end
|
57
|
+
action
|
58
|
+
end
|
33
59
|
|
60
|
+
def help_action
|
34
61
|
action = Gio::SimpleAction.new("help")
|
35
|
-
actions.add_action(action)
|
36
62
|
action.signal_connect "activate" do |_simple_action, _parameter|
|
37
63
|
puts "Help not available"
|
38
64
|
end
|
65
|
+
action
|
66
|
+
end
|
39
67
|
|
40
|
-
|
41
|
-
|
68
|
+
def add_accelerators
|
42
69
|
accel_group = Gtk::AccelGroup.new
|
43
|
-
window.add_accel_group(accel_group)
|
44
70
|
|
45
|
-
builder["new_item"].add_accelerator("activate", accel_group,
|
46
|
-
|
47
|
-
Gdk::ModifierType::CONTROL_MASK,
|
48
|
-
Gtk::AccelFlags::VISIBLE)
|
49
|
-
builder["open_item"].add_accelerator("activate", accel_group,
|
50
|
-
Gdk::Keyval::KEY_o,
|
51
|
-
Gdk::ModifierType::CONTROL_MASK,
|
52
|
-
Gtk::AccelFlags::VISIBLE)
|
53
|
-
builder["save_item"].add_accelerator("activate", accel_group,
|
54
|
-
Gdk::Keyval::KEY_s,
|
55
|
-
Gdk::ModifierType::CONTROL_MASK,
|
56
|
-
Gtk::AccelFlags::VISIBLE)
|
57
|
-
builder["quit_item"].add_accelerator("activate", accel_group,
|
58
|
-
Gdk::Keyval::KEY_q,
|
71
|
+
@builder["new_item"].add_accelerator("activate", accel_group,
|
72
|
+
Gdk::Keyval::KEY_n,
|
59
73
|
Gdk::ModifierType::CONTROL_MASK,
|
60
74
|
Gtk::AccelFlags::VISIBLE)
|
61
|
-
builder["
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
builder["
|
66
|
-
|
67
|
-
Gdk::ModifierType::CONTROL_MASK,
|
68
|
-
Gtk::AccelFlags::VISIBLE)
|
69
|
-
builder["paste_item"].add_accelerator("activate", accel_group,
|
70
|
-
Gdk::Keyval::KEY_v,
|
75
|
+
@builder["open_item"].add_accelerator("activate", accel_group,
|
76
|
+
Gdk::Keyval::KEY_o,
|
77
|
+
Gdk::ModifierType::CONTROL_MASK,
|
78
|
+
Gtk::AccelFlags::VISIBLE)
|
79
|
+
@builder["save_item"].add_accelerator("activate", accel_group,
|
80
|
+
Gdk::Keyval::KEY_s,
|
71
81
|
Gdk::ModifierType::CONTROL_MASK,
|
72
82
|
Gtk::AccelFlags::VISIBLE)
|
73
|
-
builder["
|
74
|
-
|
75
|
-
|
83
|
+
@builder["quit_item"].add_accelerator("activate", accel_group,
|
84
|
+
Gdk::Keyval::KEY_q,
|
85
|
+
Gdk::ModifierType::CONTROL_MASK,
|
86
|
+
Gtk::AccelFlags::VISIBLE)
|
87
|
+
@builder["copy_item"].add_accelerator("activate", accel_group,
|
88
|
+
Gdk::Keyval::KEY_c,
|
89
|
+
Gdk::ModifierType::CONTROL_MASK,
|
90
|
+
Gtk::AccelFlags::VISIBLE)
|
91
|
+
@builder["cut_item"].add_accelerator("activate", accel_group,
|
92
|
+
Gdk::Keyval::KEY_x,
|
93
|
+
Gdk::ModifierType::CONTROL_MASK,
|
76
94
|
Gtk::AccelFlags::VISIBLE)
|
77
|
-
builder["
|
78
|
-
|
95
|
+
@builder["paste_item"].add_accelerator("activate", accel_group,
|
96
|
+
Gdk::Keyval::KEY_v,
|
97
|
+
Gdk::ModifierType::CONTROL_MASK,
|
98
|
+
Gtk::AccelFlags::VISIBLE)
|
99
|
+
@builder["help_item"].add_accelerator("activate", accel_group,
|
100
|
+
Gdk::Keyval::KEY_F1,
|
79
101
|
0,
|
80
102
|
Gtk::AccelFlags::VISIBLE)
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
window
|
103
|
+
@builder["about_item"].add_accelerator("activate", accel_group,
|
104
|
+
Gdk::Keyval::KEY_F7,
|
105
|
+
0,
|
106
|
+
Gtk::AccelFlags::VISIBLE)
|
107
|
+
@window.add_accel_group(accel_group)
|
87
108
|
end
|
88
109
|
end
|