gtk3 3.0.7-x64-mingw32 → 3.0.8-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/ext/gtk3/extconf.rb +1 -0
  3. data/ext/gtk3/rb-gtk3-tree-view.c +4 -0
  4. data/ext/gtk3/rb-gtk3.c +245 -60
  5. data/lib/2.2/gtk3.so +0 -0
  6. data/lib/2.3/gtk3.so +0 -0
  7. data/lib/gtk3/box.rb +22 -0
  8. data/lib/gtk3/builder.rb +50 -29
  9. data/lib/gtk3/deprecated.rb +7 -0
  10. data/lib/gtk3/entry-buffer.rb +28 -0
  11. data/lib/gtk3/list-store.rb +2 -20
  12. data/lib/gtk3/loader.rb +6 -0
  13. data/lib/gtk3/menu-item.rb +8 -7
  14. data/lib/gtk3/tree-iter.rb +25 -1
  15. data/lib/gtk3/tree-model.rb +41 -0
  16. data/lib/gtk3/tree-store.rb +7 -6
  17. data/lib/gtk3/widget.rb +18 -1
  18. data/sample/gtk-demo/TODO +45 -39
  19. data/sample/gtk-demo/assistant.rb +123 -0
  20. data/sample/gtk-demo/builder.rb +75 -38
  21. data/sample/gtk-demo/button_box.rb +100 -0
  22. data/sample/gtk-demo/colorsel.rb +49 -65
  23. data/sample/gtk-demo/css_accordion.rb +33 -55
  24. data/sample/gtk-demo/css_basics.rb +55 -80
  25. data/sample/gtk-demo/css_multiplebgs.rb +112 -0
  26. data/sample/gtk-demo/css_pixbufs.rb +84 -0
  27. data/sample/gtk-demo/css_shadows.rb +101 -0
  28. data/sample/gtk-demo/cursors.rb +114 -0
  29. data/sample/gtk-demo/dialog.rb +105 -115
  30. data/sample/gtk-demo/entry_buffer.rb +44 -0
  31. data/sample/gtk-demo/entry_completion.rb +40 -52
  32. data/sample/gtk-demo/expander.rb +60 -26
  33. data/sample/gtk-demo/filtermodel.rb +119 -0
  34. data/sample/gtk-demo/font_features.rb +117 -0
  35. data/sample/gtk-demo/headerbar.rb +57 -0
  36. data/sample/gtk-demo/iconview_edit.rb +79 -0
  37. data/sample/gtk-demo/infobar.rb +75 -59
  38. data/sample/gtk-demo/links.rb +53 -40
  39. data/sample/gtk-demo/main.rb +353 -43
  40. data/sample/gtk-demo/main.ui +9 -9
  41. data/sample/gtk-demo/markup.rb +46 -0
  42. data/sample/gtk-demo/menus.rb +111 -162
  43. data/sample/gtk-demo/modelbutton.rb +47 -0
  44. data/sample/gtk-demo/overlay.rb +61 -0
  45. data/sample/gtk-demo/overlay2.rb +75 -0
  46. data/sample/gtk-demo/panes.rb +114 -133
  47. data/sample/gtk-demo/pickers.rb +70 -0
  48. data/sample/gtk-demo/popover.rb +110 -0
  49. data/sample/gtk-demo/printing.rb +68 -83
  50. data/sample/gtk-demo/revealer.rb +53 -0
  51. data/sample/gtk-demo/scale.rb +26 -0
  52. data/sample/gtk-demo/search_entry2.rb +107 -0
  53. data/sample/gtk-demo/sidebar.rb +68 -0
  54. data/sample/gtk-demo/sizegroup.rb +93 -105
  55. data/sample/gtk-demo/spinner.rb +53 -50
  56. data/sample/gtk-demo/stack.rb +28 -0
  57. data/sample/gtk-demo/test_mod.rb +22 -0
  58. data/sample/gtk-demo/textmask.rb +61 -0
  59. data/sample/gtk-demo/theming_style_classes.rb +16 -12
  60. data/sample/misc/app-menu.ui +19 -0
  61. data/sample/misc/button-menu.ui +19 -0
  62. data/sample/misc/icons-theme-viewer.rb +65 -0
  63. data/sample/misc/menu.rb +3 -3
  64. data/sample/misc/menus_from_resources.gresource.xml +8 -0
  65. data/sample/misc/menus_from_resources.rb +91 -0
  66. data/sample/misc/statusicon.rb +1 -1
  67. data/sample/misc/toolbar-menu.ui +23 -0
  68. data/sample/misc/treestore.rb +63 -0
  69. data/sample/tutorial/README.md +368 -6
  70. data/test/test-gtk-box.rb +13 -0
  71. data/test/test-gtk-builder.rb +1 -1
  72. data/test/test-gtk-clipboard.rb +124 -0
  73. data/test/test-gtk-container.rb +3 -3
  74. data/test/test-gtk-entry-buffer.rb +32 -0
  75. data/test/test-gtk-list-store.rb +30 -12
  76. data/test/test-gtk-menu.rb +32 -0
  77. data/test/test-gtk-tree-iter.rb +61 -5
  78. data/test/test-gtk-tree-path.rb +26 -1
  79. data/test/test-gtk-tree-sortable.rb +35 -0
  80. data/test/test-gtk-tree-store.rb +34 -0
  81. data/test/test-gtk-widget.rb +33 -2
  82. metadata +57 -22
  83. data/lib/2.0/gtk3.so +0 -0
  84. data/lib/2.1/gtk3.so +0 -0
  85. data/sample/gtk-demo/button-box.rb +0 -82
@@ -1,80 +1,41 @@
1
- # Copyright (c) 2008 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
+ #
3
4
  =begin
4
- = Printing
5
+ = Printing/Printing
5
6
 
6
- Gtk::PrintOperation offers a simple API to support printing
7
- in a cross-platform way.
8
- =end
9
-
10
- require 'common'
11
-
12
- module Demo
13
- class Printing < BasicWindow
14
- Data = Struct.new(:font_size, :lines_per_page, :lines, :n_pages)
15
- HEADER_HEIGHT = 10 * 72 / 25.4
16
- HEADER_GAP = 3 * 72 / 25.4
17
-
18
- def initialize
19
- super('Printing')
20
-
21
- button = Gtk::Button.new("Print...")
22
- button.signal_connect("clicked") do
23
- begin
24
- run_print_operation
25
- rescue
26
- dialog = Gtk::MessageDialog.new(self, :destroy_with_parent, :error,
27
- :close, $!.message)
28
- dialog.signal_connect("response") do
29
- dialog.destroy
30
- true
31
- end
32
- dialog.show
33
- end
34
- true
35
- end
36
- add(button)
37
- end
38
-
39
- private
40
- def run_print_operation
41
- operation = Gtk::PrintOperation.new
7
+ GtkPrintOperation offers a simple API to support printing
8
+ in a cross-platform way.
42
9
 
43
- data = Data.new
44
- data.font_size = 12.0
45
- operation.signal_connect("begin-print") do |_operation, context|
46
- on_begin_print(_operation, context, data)
47
- end
48
- operation.signal_connect("draw-page") do |_operation, context, page_number|
49
- on_draw_page(_operation, context, page_number, data)
50
- end
51
- operation.signal_connect("end-print") do |_operation, context|
52
- on_end_print(_operation, context, data)
53
- end
10
+ =end
11
+ module PrintingDemo
12
+ HEADER_HEIGHT = 10 * 72 / 25.4
13
+ HEADER_GAP = 3 * 72 / 25.4
54
14
 
55
- operation.use_full_page = false
56
- operation.unit = :points
15
+ def self.run_demo(main_window)
16
+ print_operation = Gtk::PrintOperation.new
57
17
 
58
- operation.run(:print_dialog, self)
59
- end
18
+ resource_name = File.expand_path(__FILE__)
19
+ font_size = 12.0
20
+ num_pages = 0
21
+ lines_per_page = 0
22
+ lines = []
60
23
 
61
- def on_begin_print(operation, context, data)
24
+ print_operation.signal_connect "begin-print" do |operation, context|
62
25
  height = context.height - HEADER_HEIGHT - HEADER_GAP
63
- data.lines_per_page = (height / data.font_size).floor
64
- data.lines = File.readlines(__FILE__)
65
- data.n_pages = (data.lines.size - 1) / data.lines_per_page + 1
66
- operation.set_n_pages(data.n_pages)
26
+ lines_per_page = (height / font_size).floor
27
+ File.open(resource_name, "r") do |file|
28
+ file.each_line do |line|
29
+ lines << line
30
+ end
31
+ end
32
+ num_pages = lines.size / (lines_per_page + 1)
33
+ operation.n_pages = num_pages
67
34
  end
68
35
 
69
- def on_draw_page(operation, context, page_number, data)
36
+ print_operation.signal_connect "draw-page" do |_operation, context, page_nr|
70
37
  cr = context.cairo_context
71
- draw_header(cr, operation, context, page_number, data)
72
- draw_body(cr, operation, context, page_number, data)
73
- end
74
-
75
- def draw_header(cr, operation, context, page_number, data)
76
38
  width = context.width
77
-
78
39
  cr.rectangle(0, 0, width, HEADER_HEIGHT)
79
40
  cr.set_source_rgb(0.8, 0.8, 0.8)
80
41
  cr.fill_preserve
@@ -84,45 +45,69 @@ module Demo
84
45
  cr.stroke
85
46
 
86
47
  layout = context.create_pango_layout
87
- layout.font_description = "sans 14"
48
+ desc = Pango::FontDescription.new("sans 14")
49
+ layout.font_description = desc
88
50
 
89
- layout.text = File.basename(__FILE__)
51
+ layout.text = resource_name
90
52
  text_width, text_height = layout.pixel_size
91
53
 
92
- if (text_width > width)
54
+ if text_width > width
93
55
  layout.width = width
94
56
  layout.ellipsize = :start
95
57
  text_width, text_height = layout.pixel_size
96
58
  end
97
-
98
- y = (HEADER_HEIGHT - text_height) / 2
99
-
100
- cr.move_to((width - text_width) / 2, y)
59
+ cr.move_to((width - text_width) / 2,
60
+ (HEADER_HEIGHT - text_height) / 2)
101
61
  cr.show_pango_layout(layout)
102
62
 
103
- layout.text = "#{page_number + 1}/#{data.n_pages}"
63
+ layout.text = "#{page_nr + 1}/#{num_pages}"
104
64
  layout.width = -1
105
65
  text_width, text_height = layout.pixel_size
106
- cr.move_to(width - text_width - 4, y)
66
+
67
+ cr.move_to(width - text_width - 4,
68
+ (HEADER_HEIGHT - text_height) / 2)
107
69
  cr.show_pango_layout(layout)
108
- end
109
70
 
110
- def draw_body(cr, operation, context, page_number, data)
111
71
  layout = context.create_pango_layout
112
- description = Pango::FontDescription.new("monosapce")
113
- description.size = data.font_size * Pango::SCALE
114
- layout.font_description = description
72
+ desc = Pango::FontDescription.new("monospace")
73
+ desc.size = font_size * Pango::SCALE
74
+ layout.font_description = desc
115
75
 
116
76
  cr.move_to(0, HEADER_HEIGHT + HEADER_GAP)
117
- start_line = page_number * data.lines_per_page
118
- data.lines[start_line, data.lines_per_page].each do |line|
77
+ start_line = page_nr * lines_per_page
78
+
79
+ lines[start_line, lines_per_page].each do |line|
119
80
  layout.text = line
120
81
  cr.show_pango_layout(layout)
121
- cr.rel_move_to(0, data.font_size)
82
+ cr.rel_move_to(0, font_size)
122
83
  end
123
84
  end
124
85
 
125
- def on_end_print(operation, context, data)
86
+ print_operation.signal_connect "end-print" do
87
+ puts "End of print"
88
+ end
89
+
90
+ print_operation.use_full_page = false
91
+ print_operation.unit = :points
92
+ print_operation.embed_page_setup = true
93
+
94
+ settings = Gtk::PrintSettings.new
95
+ settings.set(:ouput_basename, "gtk-demo")
96
+
97
+ print_operation.print_settings = settings
98
+
99
+ begin
100
+ print_operation.run(:print_dialog, main_window)
101
+ rescue => error
102
+ dialog = Gtk::MessageDialog.new(:parent => main_window,
103
+ :flags => :destroy_with_parent,
104
+ :type => :error,
105
+ :buttons => :close,
106
+ :message => error.message)
107
+ dialog.signal_connect "response" do
108
+ dialog.destroy
109
+ end
110
+ dialog.show
126
111
  end
127
112
  end
128
113
  end
@@ -0,0 +1,53 @@
1
+ # Copyright (c) 2015 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Revealer
6
+
7
+ GtkRevealer is a container that animates showing and hiding
8
+ of its sole child with nice transitions.
9
+ =end
10
+ module RevealerDemo
11
+ def self.run_demo(main_window)
12
+ builder = Gtk::Builder.new(:resource => "/revealer/revealer.ui")
13
+ builder.connect_signals {}
14
+
15
+ timeout = nil
16
+ count = 0
17
+
18
+ window = builder["window"]
19
+ window.screen = main_window.screen
20
+ window.signal_connect "destroy" do
21
+ if timeout
22
+ GLib::Source.remove(timeout)
23
+ timeout = nil
24
+ end
25
+ end
26
+
27
+ if !window.visible?
28
+ timeout = GLib::Timeout.add(690) do
29
+ name = "revealer#{count}"
30
+
31
+ revealer = builder[name]
32
+ revealer.set_reveal_child(true)
33
+
34
+ revealer.signal_connect "notify::child-revealed" do |widget|
35
+ revealed = widget.child_revealed?
36
+ widget.set_reveal_child(!revealed)
37
+ end
38
+
39
+ count += 1
40
+ if count >= 9
41
+ timeout = nil
42
+ false
43
+ else
44
+ true
45
+ end
46
+ end
47
+ window.show_all
48
+ else
49
+ window.destroy
50
+ end
51
+ window
52
+ end
53
+ end
@@ -0,0 +1,26 @@
1
+ # Copyright (c) 2015 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Scale
6
+
7
+ GtkScale is a way to select a value from a range.
8
+ Scales can have marks to help pick special values,
9
+ and they can also restrict the values that can be
10
+ chosen.
11
+ =end
12
+
13
+ module ScaleDemo
14
+ def self.run_demo(main_window)
15
+ builder = Gtk::Builder.new(:resource => "/scale/scale.ui")
16
+ builder.connect_signals {}
17
+ window = builder["window1"]
18
+ window.screen = main_window.screen
19
+
20
+ if !window.visible?
21
+ window.show_all
22
+ else
23
+ window.destroy
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,107 @@
1
+ # Copyright (c) 2015 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Entry/Delayed Search Entry
6
+
7
+ GtkSearchEntry sets up GtkEntries ready for search. Search entries
8
+ have their "changed" signal delayed and should be used
9
+ when the searched operation is slow such as loads of entries
10
+ to search, or online searches.
11
+ =end
12
+ module SearchEntry2Demo
13
+ def self.run_demo(main_window)
14
+ window = Gtk::Window.new(:toplevel)
15
+ window.title = "Delayed Search Entry"
16
+ window.transient_for = main_window
17
+ window.resizable = true
18
+ window.set_size_request(200, -1)
19
+
20
+ vbox = Gtk::Box.new(:vertical, 0)
21
+ window.add(vbox)
22
+ vbox.border_width = 0
23
+
24
+ entry = Gtk::SearchEntry.new
25
+ container = Gtk::Box.new(:horizontal, 10)
26
+ container.halign = :center
27
+ container.pack_start(entry, :expand => false, :fill => false, :padding => 0)
28
+
29
+ searchbar = Gtk::SearchBar.new
30
+ searchbar.connect_entry(entry)
31
+ searchbar.show_close_button = false
32
+ searchbar.add(container)
33
+ vbox.pack_start(searchbar, :expand => false, :fill => false, :padding => 0)
34
+
35
+ # Hook the search bar to key presses
36
+ window.signal_connect("key-press-event") do |_widget, event|
37
+ searchbar.handle_event(event)
38
+ end
39
+
40
+ # Help
41
+ label = Gtk::Label.new("Start Typing to search")
42
+ vbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
43
+
44
+ # Toggle button
45
+ button = Gtk::ToggleButton.new(:label => "Search")
46
+ button.bind_property("active", searchbar, "search-mode-enabled", :bidirectional)
47
+ vbox.pack_start(button, :expand => true, :fill => true, :padding => 0)
48
+
49
+ # Result
50
+ hbox = Gtk::Box.new(:horizontal, 10)
51
+ vbox.pack_start(hbox, :expand => true, :fill => true, :padding => 0)
52
+ hbox.border_width = 0
53
+
54
+ label = Gtk::Label.new("Result:")
55
+ label.xalign = 0.0
56
+ label.margin_start = 6
57
+ hbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
58
+
59
+ label = Gtk::Label.new("")
60
+ hbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
61
+
62
+ entry.signal_connect("search-changed") do |widget|
63
+ puts "search changed: #{widget.text || ''}"
64
+ label.text = widget.text || ""
65
+ end
66
+
67
+ entry.signal_connect("changed") do |_widget|
68
+ puts "changed: #{label.text || ''}"
69
+ end
70
+
71
+ hbox = Gtk::Box.new(:horizontal, 10)
72
+ vbox.pack_start(hbox, :expand => true, :fill => true, :padding => 0)
73
+ hbox.border_width = 0
74
+
75
+ label = Gtk::Label.new("Signal:")
76
+ label.xalign = 0.0
77
+ label.margin_start = 6
78
+ hbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
79
+
80
+ label = Gtk::Label.new("")
81
+ hbox.pack_start(label, :expand => true, :fill => true, :padding => 0)
82
+
83
+ entry.signal_connect("search-changed") do |widget|
84
+ puts "search changed: #{widget.text || ''}"
85
+ label.text = widget.text || ""
86
+ end
87
+
88
+ entry.signal_connect("next-match") do |_widget|
89
+ label.text = "next-match"
90
+ end
91
+
92
+ entry.signal_connect("previous-match") do |_widget|
93
+ label.text = "previous-match"
94
+ end
95
+
96
+ entry.signal_connect("stop-search") do |_widget|
97
+ label.text = "stop-search"
98
+ end
99
+
100
+ if !window.visible?
101
+ window.show_all
102
+ else
103
+ window.destroy
104
+ end
105
+ window
106
+ end
107
+ end
@@ -0,0 +1,68 @@
1
+ # Copyright (c) 2015 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Stack Sidebar
6
+
7
+ GtkStackSidebar provides an automatic sidebar widget to control
8
+ navigation of a GtkStack object. This widget automatically updates it
9
+ content based on what is presently available in the GtkStack object,
10
+ and using the "title" child property to set the display labels.
11
+ =end
12
+ module SidebarDemo
13
+ def self.run_demo(_main_window)
14
+ window = Gtk::Window.new(:toplevel)
15
+ window.set_resizable(true)
16
+ window.set_size_request(500, 350)
17
+
18
+ header = Gtk::HeaderBar.new
19
+ header.set_show_close_button(true)
20
+ window.set_titlebar(header)
21
+ window.set_title("Stack Sidebar")
22
+
23
+ box = Gtk::Box.new(:horizontal, 0)
24
+ sidebar = Gtk::StackSidebar.new
25
+ box.pack_start(sidebar, :expand => false, :fill => false, :padding => 0)
26
+
27
+ stack = Gtk::Stack.new
28
+ stack.set_transition_type(:slide_up_down)
29
+ sidebar.set_stack(stack)
30
+
31
+ widget = Gtk::Separator.new(:vertical)
32
+ box.pack_start(widget, :expand => false, :fill => false, :padding => 0)
33
+
34
+ box.pack_start(stack, :expand => true, :fill => true, :padding => 0)
35
+
36
+ pages = ["Welcome to GTK+",
37
+ "GtkStackSidebar Widget",
38
+ "Automatic navigation",
39
+ "Consistent appearance",
40
+ "Scrolling",
41
+ "Page 6",
42
+ "Page 7",
43
+ "Page 8",
44
+ "Page 9"
45
+ ]
46
+
47
+ pages.each_with_index do |page_string, i|
48
+ child = nil
49
+ if i == 0
50
+ child = Gtk::Image.new(:icon_name => "help-about", :size => :menu)
51
+ child.set_pixel_size(256)
52
+ else
53
+ child = Gtk::Label.new(page_string)
54
+ end
55
+
56
+ stack.add_named(child, page_string)
57
+ stack.child_set_property(child, "title", page_string)
58
+ end
59
+
60
+ window.add(box)
61
+
62
+ if !window.visible?
63
+ window.show_all
64
+ else
65
+ window.destroy
66
+ end
67
+ end
68
+ end