gtk3 3.0.9-x64-mingw32 → 3.1.0-x64-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/rb-gtk3-private.h +1 -0
  3. data/ext/gtk3/rb-gtk3-spin-button.c +85 -0
  4. data/ext/gtk3/rb-gtk3.c +3 -0
  5. data/lib/2.2/gtk3.so +0 -0
  6. data/lib/2.3/gtk3.so +0 -0
  7. data/lib/gtk3/deprecated.rb +0 -8
  8. data/lib/gtk3/loader.rb +1 -7
  9. data/lib/gtk3/tree-model.rb +2 -0
  10. data/sample/gtk-demo/TODO +10 -10
  11. data/sample/gtk-demo/assistant.rb +44 -39
  12. data/sample/gtk-demo/builder.rb +71 -50
  13. data/sample/gtk-demo/button_box.rb +39 -28
  14. data/sample/gtk-demo/clipboard.rb +139 -46
  15. data/sample/gtk-demo/colorsel.rb +50 -36
  16. data/sample/gtk-demo/css_accordion.rb +18 -17
  17. data/sample/gtk-demo/css_basics.rb +60 -47
  18. data/sample/gtk-demo/css_multiplebgs.rb +92 -71
  19. data/sample/gtk-demo/css_pixbufs.rb +61 -48
  20. data/sample/gtk-demo/css_shadows.rb +63 -50
  21. data/sample/gtk-demo/cursors.rb +95 -64
  22. data/sample/gtk-demo/dialog.rb +95 -78
  23. data/sample/gtk-demo/drawingarea.rb +138 -171
  24. data/sample/gtk-demo/editable_cells.rb +169 -130
  25. data/sample/gtk-demo/entry_buffer.rb +15 -13
  26. data/sample/gtk-demo/entry_completion.rb +22 -17
  27. data/sample/gtk-demo/expander.rb +39 -31
  28. data/sample/gtk-demo/filtermodel.rb +67 -63
  29. data/sample/gtk-demo/font_features.rb +91 -60
  30. data/sample/gtk-demo/glarea.rb +277 -0
  31. data/sample/gtk-demo/headerbar.rb +17 -15
  32. data/sample/gtk-demo/hypertext.rb +146 -167
  33. data/sample/gtk-demo/iconview.rb +132 -91
  34. data/sample/gtk-demo/iconview_edit.rb +49 -38
  35. data/sample/gtk-demo/infobar.rb +81 -62
  36. data/sample/gtk-demo/links.rb +35 -30
  37. data/sample/gtk-demo/list_store.rb +169 -114
  38. data/sample/gtk-demo/listbox.rb +183 -0
  39. data/sample/gtk-demo/main.rb +32 -21
  40. data/sample/gtk-demo/markup.rb +65 -52
  41. data/sample/gtk-demo/menus.rb +57 -58
  42. data/sample/gtk-demo/modelbutton.rb +11 -9
  43. data/sample/gtk-demo/modelbutton.ui +3 -0
  44. data/sample/gtk-demo/overlay.rb +39 -32
  45. data/sample/gtk-demo/overlay2.rb +68 -54
  46. data/sample/gtk-demo/panes.rb +56 -68
  47. data/sample/gtk-demo/pickers.rb +46 -45
  48. data/sample/gtk-demo/pixbufs.rb +27 -25
  49. data/sample/gtk-demo/popover.rb +70 -63
  50. data/sample/gtk-demo/printing.rb +94 -69
  51. data/sample/gtk-demo/revealer.rb +46 -38
  52. data/sample/gtk-demo/rotated_text.rb +75 -54
  53. data/sample/gtk-demo/scale.rb +10 -8
  54. data/sample/gtk-demo/search_entry.rb +195 -0
  55. data/sample/gtk-demo/search_entry2.rb +71 -59
  56. data/sample/gtk-demo/sidebar.rb +20 -19
  57. data/sample/gtk-demo/sizegroup.rb +36 -35
  58. data/sample/gtk-demo/spinbutton.rb +128 -0
  59. data/sample/gtk-demo/spinner.rb +55 -40
  60. data/sample/gtk-demo/stack.rb +11 -8
  61. data/sample/gtk-demo/textmask.rb +14 -13
  62. data/sample/gtk-demo/textscroll.rb +16 -12
  63. data/sample/gtk-demo/theming_style_classes.rb +14 -12
  64. data/sample/gtk-demo/transparent.rb +17 -13
  65. data/sample/misc/treemodelfilter.rb +1 -1
  66. metadata +24 -19
@@ -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,21 +6,39 @@
6
6
 
7
7
  The Button Box widgets are used to arrange buttons with padding.
8
8
  =end
9
- module ButtonBoxDemo
10
- def self.run_demo(main_window)
11
- window = Gtk::Window.new(:toplevel)
12
- window.screen = main_window.screen
13
- window.set_title("Button Boxes")
14
- window.set_border_width(10)
9
+ class ButtonBoxDemo
10
+ def initialize(main_window)
11
+ @window = Gtk::Window.new(:toplevel)
12
+ @window.screen = main_window.screen
13
+ @window.title = "Button Boxes"
14
+ @window.border_width = 10
15
15
 
16
16
  main_vbox = Gtk::Box.new(:vertical, 0)
17
- window.add(main_vbox)
17
+ @window.add(main_vbox)
18
+ frame_horz = generate_horizontal_frame
19
+ main_vbox.pack_start(frame_horz,
20
+ :expand => true, :fill => true, :padding => 10)
21
+ frame_vert = generate_vertical_frame
22
+ main_vbox.pack_start(frame_vert,
23
+ :expand => true, :fill => true, :padding => 10)
24
+ end
25
+
26
+ def run
27
+ if !@window.visible?
28
+ @window.show_all
29
+ else
30
+ @window.destroy
31
+ end
32
+ @window
33
+ end
34
+
35
+ private
18
36
 
37
+ def generate_horizontal_frame
19
38
  frame_horz = Gtk::Frame.new("Horizontal Button Boxes")
20
- main_vbox.pack_start(frame_horz, :expand => true, :fill => true, :padding => 10)
21
39
 
22
40
  vbox = Gtk::Box.new(:vertical, 0)
23
- vbox.set_border_width(10)
41
+ vbox.border_width = 10
24
42
  frame_horz.add(vbox)
25
43
 
26
44
  bbox = create_bbox(true, "Spread", 40, :spread)
@@ -40,12 +58,14 @@ module ButtonBoxDemo
40
58
 
41
59
  bbox = create_bbox(true, "Expand", 0, :expand)
42
60
  vbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
61
+ frame_horz
62
+ end
43
63
 
64
+ def generate_vertical_frame
44
65
  frame_vert = Gtk::Frame.new("Vertical Button Boxes")
45
- main_vbox.pack_start(frame_vert, :expand => true, :fill => true, :padding => 10)
46
66
 
47
67
  hbox = Gtk::Box.new(:horizontal, 0)
48
- hbox.set_border_width(10)
68
+ hbox.border_width = 10
49
69
 
50
70
  frame_vert.add(hbox)
51
71
 
@@ -66,29 +86,20 @@ module ButtonBoxDemo
66
86
 
67
87
  bbox = create_bbox(false, "Expand", 0, :expand)
68
88
  hbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
69
-
70
- if !window.visible?
71
- window.show_all
72
- else
73
- window.destroy
74
- end
75
- window
89
+ frame_vert
76
90
  end
77
91
 
78
- def self.create_bbox(horizontal, title, spacing, layout)
92
+ def create_bbox(horizontal, title, spacing, layout)
79
93
  frame = Gtk::Frame.new(title)
80
94
  bbox = nil
81
95
 
82
- if horizontal
83
- bbox = Gtk::ButtonBox.new(:horizontal)
84
- else
85
- bbox = Gtk::ButtonBox.new(:vertical)
86
- end
96
+ orientation = horizontal ? :horizontal : :vertical
97
+ bbox = Gtk::ButtonBox.new(orientation)
87
98
 
88
- bbox.set_border_width(5)
99
+ bbox.border_width = 5
89
100
  frame.add(bbox)
90
- bbox.set_layout(layout)
91
- bbox.set_spacing(spacing)
101
+ bbox.layout = layout
102
+ bbox.spacing = spacing
92
103
 
93
104
  %w(OK(_O) Cancel(_C) Help(_H)).each do |name|
94
105
  button = Gtk::Button.new(:label => name, :use_underline => true)
@@ -1,67 +1,160 @@
1
- # Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
1
+ # Copyright (c) 2016 Ruby-GNOME2 Project Team
2
2
  # This program is licenced under the same licence as Ruby-GNOME2.
3
- # $Id: clipboard.rb,v 1.3 2005/07/28 14:30:38 mutoh Exp $
3
+ #
4
4
  =begin
5
- = Clipboard
5
+ = Clipboard
6
6
 
7
- GtkClipboard is used for clipboard handling. This demo shows how to
8
- copy and paste text to and from the clipboard.
7
+ GtkClipboard is used for clipboard handling. This demo shows how to
8
+ copy and paste text to and from the clipboard.
9
+
10
+ It also shows how to transfer images via the clipboard or via
11
+ drag-and-drop, and how to make clipboard contents persist after
12
+ the application exits. Clipboard persistence requires a clipboard
13
+ manager to run.
9
14
  =end
15
+ class ClipboardDemo
16
+ def initialize(main_window)
17
+ @window = Gtk::Window.new(:toplevel)
18
+ @window.screen = main_window.screen
19
+ @window.title = "Clipboard"
20
+
21
+ @vbox = Gtk::Box.new(:vertical, 0)
22
+ @vbox.border_width = 0
23
+ @window.add(@vbox)
24
+
25
+ text = "\"Copy\" will copy the text\nin the entry to the clipboard"
26
+ generate_entry(text, "_Copy") do |entry|
27
+ clipboard = entry.get_clipboard(Gdk::Selection::CLIPBOARD)
28
+ clipboard.text = entry.text
29
+ end
10
30
 
11
- require 'common'
31
+ text = "\"Paste\" will paste the text from the clipboard to the entry"
32
+ generate_entry(text, "_Paste") do |entry|
33
+ clipboard = entry.get_clipboard(Gdk::Selection::CLIPBOARD)
34
+ clipboard.request_text { |_clip, entry_text| entry.text = entry_text }
35
+ end
12
36
 
13
- module Demo
14
- class Clipboard < Demo::BasicWindow
15
- def initialize
16
- super('Clipboard')
37
+ text = "Images can be transferred via the clipboard, too"
38
+ label = Gtk::Label.new(text)
39
+ @vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
17
40
 
18
- vbox = Gtk::Box.new(:vertical)
19
- vbox.border_width = 8
41
+ @hbox = Gtk::Box.new(:horizontal, 4)
42
+ @hbox.border_width = 8
43
+ @vbox.pack_start(@hbox, :expand => false, :fill => false, :padding => 0)
20
44
 
21
- add(vbox)
45
+ # Create the first image
46
+ generate_image("dialog-warning")
22
47
 
23
- label = Gtk::Label.new(%Q["Copy" will copy the text\nin the entry to the clipboard])
48
+ # Create the second image
49
+ generate_image("process-stop")
24
50
 
25
- vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
51
+ # Tell the clipboard manager to make the data persistent
52
+ clipboard = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
53
+ clipboard.set_can_store([])
54
+ end
26
55
 
27
- hbox = Gtk::Box.new(:horizontal, 0)
28
- hbox.border_width = 8
29
- vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0)
56
+ def run
57
+ if !@window.visible?
58
+ @window.show_all
59
+ else
60
+ @window.destroy
61
+ end
62
+ @window
63
+ end
30
64
 
31
- # Create the first entry
32
- entry = Gtk::Entry.new
33
- hbox.pack_start(entry, :expand => true, :fill => true, :padding => 0)
65
+ private
34
66
 
35
- # Create the button
36
- button = Gtk::Button.new(:stock_id => :copy)
37
- hbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
38
- button.signal_connect('clicked', entry) do |w, e|
39
- clipboard = e.get_clipboard(Gdk::Selection::CLIPBOARD)
40
- clipboard.text = e.text
41
- end
67
+ def get_image_pixbuf(image)
68
+ return image.pixbuf if image.storage_type == :pixbuf
42
69
 
43
- label = Gtk::Label.new(%Q["Paste" will paste the text from the clipboard to the entry])
44
- vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
70
+ if image.storage_type == :icon_name
71
+ icon_name, size = image.icon_name
72
+ icon_theme = Gtk::IconTheme.get_for_screen(image.screen)
73
+ width, _height = Gtk::IconSize.lookup(size)
74
+ return icon_theme.load_icon(icon_name, width, :generic_fallback)
75
+ else
76
+ puts "Image storage type #{image.storage_type.to_i} not handled"
77
+ end
78
+ end
45
79
 
46
- hbox = Gtk::Box.new(:horizontal, 4)
47
- hbox.border_width = 8
48
- vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0)
80
+ def generate_entry(text, action_name)
81
+ label = Gtk::Label.new(text)
82
+ @vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
49
83
 
50
- # Create the second entry
51
- entry = Gtk::Entry.new
52
- hbox.pack_start(entry, :expand => true, :fill => true, :padding => 0)
84
+ hbox = Gtk::Box.new(:horizontal, 4)
85
+ hbox.border_width = 8
86
+ @vbox.pack_start(hbox, :expand => false, :fill => false, :padding => 0)
53
87
 
54
- # Create the button
55
- button = Gtk::Button.new(:stock_id => :paste)
56
- hbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
57
- button.signal_connect('clicked', entry) do |w, e|
58
- clipboard = e.get_clipboard(Gdk::Selection::CLIPBOARD)
59
- clipboard.request_text do |board, text, data|
60
- e.text = text
61
- end
62
- end
88
+ # Create the first entry
89
+ entry = Gtk::Entry.new
90
+ hbox.pack_start(entry, :expand => true, :fill => true, :padding => 0)
63
91
 
92
+ # Create the button
93
+ button = Gtk::Button.new(:label => action_name, :use_underline => true)
94
+ hbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
95
+ button.signal_connect "clicked" do
96
+ yield(entry) if block_given?
64
97
  end
65
98
  end
66
- end
67
99
 
100
+ def generate_image(icon_name)
101
+ # Create the first image
102
+ image = Gtk::Image.new(:icon_name => icon_name, :size => :button)
103
+ ebox = Gtk::EventBox.new
104
+ ebox.add(image)
105
+ @hbox.add(ebox)
106
+
107
+ # Make ebox a drag source
108
+ ebox.drag_source_set(Gdk::ModifierType::BUTTON1_MASK, [], :copy)
109
+ ebox.drag_source_add_image_targets
110
+ ebox.signal_connect "drag-begin" do |_widget, context|
111
+ pixbuf = get_image_pixbuf(image1)
112
+ context.set_icon_pixbuf(pixbuf, -2, -2)
113
+ end
114
+
115
+ ebox.signal_connect "drag-data-get" do |_widget, _context, selection_data|
116
+ pixbuf = get_image_pixbuf(image)
117
+ selection_data.pixbuf = pixbuf
118
+ end
119
+
120
+ # Accept drops on ebox
121
+ ebox.drag_dest_set(Gtk::DestDefaults::ALL, [], Gdk::DragAction::COPY)
122
+ ebox.drag_dest_add_image_targets
123
+ ebox.signal_connect "drag-data-received" do |_w, _c, _x, _y, selection_data|
124
+ pixbuf = selection_data.pixbuf
125
+ image.from_pixbuf = pixbuf
126
+ end
127
+
128
+ # Context menu on ebox
129
+ ebox.signal_connect "button-press-event" do |_widget, button|
130
+ manage_button_press_event(image, button)
131
+ true
132
+ end
133
+ end
134
+
135
+ def manage_button_press_event(image, button)
136
+ return false unless button.button == Gdk::BUTTON_SECONDARY
137
+ menu = Gtk::Menu.new
138
+ generate_menu_item(menu, "_Copy") do
139
+ clipboard = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
140
+ pixbuf = get_image_pixbuf(image)
141
+ clipboard.image = pixbuf
142
+ end
143
+
144
+ generate_menu_item(menu, "_Paste") do
145
+ clipboard = Gtk::Clipboard.get(Gdk::Selection::CLIPBOARD)
146
+ pixbuf = clipboard.wait_for_image
147
+ image.from_pixbuf = pixbuf if pixbuf
148
+ end
149
+ menu.popup(nil, nil, 3, button.time)
150
+ end
151
+
152
+ def generate_menu_item(menu, label)
153
+ item = Gtk::MenuItem.new(:label => label, :use_underline => true)
154
+ item.signal_connect "activate" do
155
+ yield if block_given?
156
+ end
157
+ item.show
158
+ menu.append(item)
159
+ end
160
+ end
@@ -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
@@ -9,58 +9,72 @@ implementations of the GtkColorChooser interface in GTK+. The
9
9
  GtkColorChooserDialog is a prebuilt dialog containing a
10
10
  GtkColorChooserWidget.
11
11
  =end
12
- module ColorselDemo
13
- def self.run_demo(main_window)
14
- color = Gdk::RGBA.new(0, 0, 1, 1)
12
+ class ColorselDemo
13
+ def initialize(main_window)
14
+ @color = Gdk::RGBA.new(0, 0, 1, 1)
15
15
 
16
- window = Gtk::Window.new(:toplevel)
17
- window.screen = main_window.screen
18
- window.set_title("Color Chooser")
19
- window.set_border_width(8)
16
+ @window = Gtk::Window.new(:toplevel)
17
+ @window.screen = main_window.screen
18
+ @window.title = "Color Chooser"
19
+ @window.border_width = 8
20
20
 
21
21
  vbox = Gtk::Box.new(:vertical, 8)
22
- vbox.set_border_width(8)
23
- window.add(vbox)
24
-
25
- frame = Gtk::Frame.new
26
- frame.set_shadow_type(:in)
22
+ vbox.border_width = 8
23
+ @window.add(vbox)
24
+ frame = initialize_drawing_area_frame
27
25
  vbox.pack_start(frame, :expand => true, :fill => true, :padding => 0)
28
26
 
29
- da = Gtk::DrawingArea.new
30
- da.signal_connect "draw" do |_widget, cr|
31
- cr.set_source(color.to_a)
32
- cr.paint
27
+ button = initialize_color_chooser_button
28
+ vbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
29
+ end
30
+
31
+ def run
32
+ if !@window.visible?
33
+ @window.show_all
34
+ else
35
+ @window.destroy
33
36
  end
37
+ @window
38
+ end
34
39
 
35
- da.set_size_request(200, 200)
40
+ private
36
41
 
37
- frame.add(da)
42
+ def initialize_drawing_area_frame
43
+ frame = Gtk::Frame.new
44
+ frame.shadow_type = :in
45
+ @da = Gtk::DrawingArea.new
46
+ @da.signal_connect "draw" do |_widget, cr|
47
+ cr.set_source(@color.to_a)
48
+ cr.paint
49
+ end
50
+ @da.set_size_request(200, 200)
51
+ frame.add(@da)
52
+ frame
53
+ end
38
54
 
55
+ def initialize_color_chooser_button
39
56
  button = Gtk::Button.new(:mnemonic => "_Change the above color")
40
57
  button.set_halign(:end)
41
58
  button.set_valign(:center)
42
59
 
43
- vbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
44
60
  button.signal_connect "clicked" do |_widget|
45
- dialog = Gtk::ColorChooserDialog.new(:title => "Changing Color",
46
- :parent => window)
47
- dialog.set_modal(true)
48
- dialog.set_rgba(color)
61
+ generate_color_chooser_dialog
62
+ end
63
+ button
64
+ end
49
65
 
50
- dialog.signal_connect "response" do |widget, response_id|
51
- color = widget.rgba if response_id == Gtk::ResponseType::OK
52
- da.queue_draw # force da to use the new color now
53
- widget.destroy
54
- end
66
+ def generate_color_chooser_dialog
67
+ dialog = Gtk::ColorChooserDialog.new(:title => "Changing Color",
68
+ :parent => @window)
69
+ dialog.modal = true
70
+ dialog.rgba = @color
55
71
 
56
- dialog.show_all
72
+ dialog.signal_connect "response" do |widget, response_id|
73
+ @color = widget.rgba if response_id == Gtk::ResponseType::OK
74
+ @da.queue_draw # force da to use the new color now
75
+ widget.destroy
57
76
  end
58
77
 
59
- if !window.visible?
60
- window.show_all
61
- else
62
- window.destroy
63
- end
64
- window
78
+ dialog.show_all
65
79
  end
66
80
  end
@@ -6,19 +6,18 @@
6
6
 
7
7
  A simple accordion demo written using CSS transitions and multiple backgrounds
8
8
  =end
9
- module CssAccordionDemo
10
- def self.run_demo(main_window)
11
- window = Gtk::Window.new(:toplevel)
12
- window.screen = main_window.screen
13
-
14
- window.set_title("CSS Accordion")
15
- window.set_default_size(600, 300)
9
+ class CssAccordionDemo
10
+ def initialize(main_window)
11
+ @window = Gtk::Window.new(:toplevel)
12
+ @window.screen = main_window.screen
13
+ @window.title = "CSS Accordion"
14
+ @window.set_default_size(600, 300)
16
15
 
17
16
  container = Gtk::Box.new(:horizontal, 0)
18
- container.set_halign(:center)
19
- container.set_valign(:center)
17
+ container.halign = :center
18
+ container.valign = :center
20
19
 
21
- window.add(container)
20
+ @window.add(container)
22
21
 
23
22
  %w(This Is A CSS Accordion :-).each do |label|
24
23
  child = Gtk::Button.new(:label => label)
@@ -28,21 +27,23 @@ module CssAccordionDemo
28
27
  provider = Gtk::CssProvider.new
29
28
  provider.load_from_resource("/css_accordion/css_accordion.css")
30
29
 
31
- style_context = window.style_context
30
+ style_context = @window.style_context
32
31
  style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
33
32
 
34
- apply_style(window, provider)
33
+ apply_style(@window, provider)
34
+ end
35
35
 
36
- if !window.visible?
37
- window.show_all
36
+ def run
37
+ if !@window.visible?
38
+ @window.show_all
38
39
  else
39
- window.destroy
40
+ @window.destroy
40
41
  end
41
42
 
42
- window
43
+ @window
43
44
  end
44
45
 
45
- def self.apply_style(widget, provider)
46
+ def apply_style(widget, provider)
46
47
  style_context = widget.style_context
47
48
  style_context.add_provider(provider, Gtk::StyleProvider::PRIORITY_USER)
48
49
  return unless widget.respond_to?(:children)