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
@@ -0,0 +1,123 @@
1
+ # Copyright (c) 2016 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Assistant
6
+
7
+ Demonstrates a sample multi-step assistant. Assistants are used to divide
8
+ an operation into several simpler sequential steps, and to guide the user
9
+ through these steps.
10
+ =end
11
+ module AssistantDemo
12
+ def self.run_demo(main_window)
13
+ assistant = Gtk::Assistant.new
14
+ assistant.screen = main_window.screen
15
+
16
+ create_page1(assistant)
17
+ create_page2(assistant)
18
+ create_page3(assistant)
19
+ progress_bar = create_page4(assistant)
20
+
21
+ assistant.signal_connect("cancel", &:destroy)
22
+
23
+ assistant.signal_connect("close", &:destroy)
24
+
25
+ assistant.signal_connect "apply" do |widget|
26
+ GLib::Timeout.add(100) do
27
+ fraction = progress_bar.fraction + 0.05
28
+ if fraction < 1.0
29
+ progress_bar.fraction = fraction
30
+ else
31
+ widget.destroy
32
+ GLib::Source::REMOVE
33
+ end
34
+ end
35
+ end
36
+
37
+ assistant.signal_connect "prepare" do |widget, _page|
38
+ current_page = widget.current_page
39
+ n_pages = widget.n_pages
40
+
41
+ widget.title = "Sample assistant (#{current_page + 1} of #{n_pages}"
42
+
43
+ widget.commit if current_page == 3
44
+ end
45
+
46
+ if !assistant.visible?
47
+ assistant.show_all
48
+ else
49
+ assistant.destroy
50
+ end
51
+ assistant
52
+ end
53
+
54
+ def self.create_page1(assistant)
55
+ box = Gtk::Box.new(:horizontal, 12)
56
+ box.border_width = 12
57
+
58
+ label = Gtk::Label.new("You must fill out this entry to continue")
59
+ box.pack_start(label, :expand => true, :fill => true, :padding => 0)
60
+
61
+ entry = Gtk::Entry.new
62
+ entry.activates_default = true
63
+ box.pack_start(entry, :expand => true, :fill => true, :padding => 0)
64
+
65
+ entry.signal_connect "changed" do |widget|
66
+ page_number = assistant.current_page
67
+ current_page = assistant.get_nth_page(page_number)
68
+
69
+ if widget.text
70
+ assistant.set_page_complete(current_page, true)
71
+ else
72
+ assistant.set_page_complete(current_page, false)
73
+ end
74
+ end
75
+
76
+ box.show_all
77
+ assistant.append_page(box)
78
+ assistant.set_page_title(box, "Page 1")
79
+ assistant.set_page_type(box, :intro)
80
+ end
81
+
82
+ def self.create_page2(assistant)
83
+ box = Gtk::Box.new(:horizontal, 12)
84
+ box.border_width = 12
85
+
86
+ checkbutton = Gtk::CheckButton.new(<<-LABEL)
87
+ This is optional data, you may continue
88
+ even if you do not check this
89
+ LABEL
90
+ box.pack_start(checkbutton, :expand => false, :fill => false, :padding => 0)
91
+
92
+ box.show_all
93
+ assistant.append_page(box)
94
+ assistant.set_page_complete(box, true)
95
+ assistant.set_page_title(box, "Page 1")
96
+ end
97
+
98
+ def self.create_page3(assistant)
99
+ label = Gtk::Label.new("This is a confirmation page, press 'Apply' to apply changes")
100
+ label.show
101
+
102
+ assistant.append_page(label)
103
+ assistant.set_page_type(label, :confirm)
104
+ assistant.set_page_complete(label, true)
105
+ assistant.set_page_title(label, "Confirmation")
106
+ end
107
+
108
+ def self.create_page4(assistant)
109
+ progress_bar = Gtk::ProgressBar.new
110
+ progress_bar.halign = :center
111
+ progress_bar.valign = :center
112
+
113
+ progress_bar.show
114
+ assistant.append_page(progress_bar)
115
+ assistant.set_page_type(progress_bar, :progress)
116
+ assistant.set_page_title(progress_bar, "Applying changes")
117
+
118
+ # This prevents the assistant window from being
119
+ # closed while we're "busy" applying changes.
120
+ assistant.set_page_complete(progress_bar, false)
121
+ progress_bar
122
+ end
123
+ end
@@ -1,51 +1,88 @@
1
- # Copyright (c) 2008-2015 Ruby-GNOME2 Project Team
1
+ # Copyright (c) 2015 Ruby-GNOME2 Project Team
2
2
  # This program is licenced under the same licence as Ruby-GNOME2.
3
3
  #
4
4
  =begin
5
- = Interface Builder
5
+ = Builder
6
6
 
7
- Demonstrates an interface loaded from a XML description.
7
+ Demonstrates an interface loaded from a XML description.
8
8
  =end
9
+ module BuilderDemo
10
+ def self.run_demo(_main_window)
11
+ builder = Gtk::Builder.new(:resource => "/builder/demo.ui")
12
+ builder.connect_signals {}
9
13
 
10
- require 'common'
11
-
12
- module Demo
13
- class Dialog < Demo::BasicWindow
14
- def initialize
15
- super('Interface Builder')
16
-
17
- available = Gtk::Version.or_later?(2, 12, 0)
18
- if available
19
- label = Gtk::Label.new("Build an interface from XML description.")
20
- else
21
- label = Gtk::Label.new("You need GTK+ >= 2.12.0 to run this demo.")
22
- end
23
- add(label)
24
- return unless available
25
-
26
- @builder = Gtk::Builder.new
27
- filename = File.join(File.dirname(__FILE__), "demo.ui")
28
- @builder << filename
29
- @builder.connect_signals {|name| method(name)}
30
- @window = @builder["window1"]
31
- @window.show_all
32
-
33
- signal_connect("destroy") do
34
- @window.destroy unless @window.destroyed?
35
- end
14
+ window = builder["window1"]
15
+ toolbar = builder["toolbar1"]
16
+ toolbar.style_context.add_class("primary-toolbar")
17
+
18
+ actions = Gio::SimpleActionGroup.new
19
+
20
+ action = Gio::SimpleAction.new("quit")
21
+ action.signal_connect "activate" do |_simple_action, _parameter|
22
+ window.destroy
36
23
  end
24
+ actions.add_action(action)
37
25
 
38
- private
39
- def quit_activate
40
- @window.destroy
41
- destroy unless destroyed?
26
+ action = Gio::SimpleAction.new("about")
27
+ actions.add_action(action)
28
+ action.signal_connect "activate" do |_simple_action, _parameter|
29
+ about_dlg = builder["aboutdialog1"]
30
+ about_dlg.run
31
+ about_dlg.hide
42
32
  end
43
33
 
44
- def about_activate
45
- dialog = @builder["aboutdialog1"]
46
- dialog.run
47
- dialog.hide
34
+ action = Gio::SimpleAction.new("help")
35
+ actions.add_action(action)
36
+ action.signal_connect "activate" do |_simple_action, _parameter|
37
+ puts "Help not available"
48
38
  end
39
+
40
+ window.insert_action_group("win", actions)
41
+
42
+ accel_group = Gtk::AccelGroup.new
43
+ window.add_accel_group(accel_group)
44
+
45
+ builder["new_item"].add_accelerator("activate", accel_group,
46
+ Gdk::Keyval::KEY_n,
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,
59
+ Gdk::ModifierType::CONTROL_MASK,
60
+ Gtk::AccelFlags::VISIBLE)
61
+ builder["copy_item"].add_accelerator("activate", accel_group,
62
+ Gdk::Keyval::KEY_c,
63
+ Gdk::ModifierType::CONTROL_MASK,
64
+ Gtk::AccelFlags::VISIBLE)
65
+ builder["cut_item"].add_accelerator("activate", accel_group,
66
+ Gdk::Keyval::KEY_x,
67
+ Gdk::ModifierType::CONTROL_MASK,
68
+ Gtk::AccelFlags::VISIBLE)
69
+ builder["paste_item"].add_accelerator("activate", accel_group,
70
+ Gdk::Keyval::KEY_v,
71
+ Gdk::ModifierType::CONTROL_MASK,
72
+ Gtk::AccelFlags::VISIBLE)
73
+ builder["help_item"].add_accelerator("activate", accel_group,
74
+ Gdk::Keyval::KEY_F1,
75
+ 0,
76
+ Gtk::AccelFlags::VISIBLE)
77
+ builder["about_item"].add_accelerator("activate", accel_group,
78
+ Gdk::Keyval::KEY_F7,
79
+ 0,
80
+ Gtk::AccelFlags::VISIBLE)
81
+ if !window.visible?
82
+ window.show_all
83
+ else
84
+ window.destroy
85
+ end
86
+ window
49
87
  end
50
88
  end
51
-
@@ -0,0 +1,100 @@
1
+ # Copyright (c) 2015 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Button Boxes
6
+
7
+ The Button Box widgets are used to arrange buttons with padding.
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)
15
+
16
+ main_vbox = Gtk::Box.new(:vertical, 0)
17
+ window.add(main_vbox)
18
+
19
+ frame_horz = Gtk::Frame.new("Horizontal Button Boxes")
20
+ main_vbox.pack_start(frame_horz, :expand => true, :fill => true, :padding => 10)
21
+
22
+ vbox = Gtk::Box.new(:vertical, 0)
23
+ vbox.set_border_width(10)
24
+ frame_horz.add(vbox)
25
+
26
+ bbox = create_bbox(true, "Spread", 40, :spread)
27
+ vbox.pack_start(bbox, :expand => true, :fill => true, :padding => 0)
28
+
29
+ bbox = create_bbox(true, "Edge", 40, :edge)
30
+ vbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
31
+
32
+ bbox = create_bbox(true, "Start", 40, :start)
33
+ vbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
34
+
35
+ bbox = create_bbox(true, "End", 40, :end)
36
+ vbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
37
+
38
+ bbox = create_bbox(true, "Center", 40, :center)
39
+ vbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
40
+
41
+ bbox = create_bbox(true, "Expand", 0, :expand)
42
+ vbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
43
+
44
+ frame_vert = Gtk::Frame.new("Vertical Button Boxes")
45
+ main_vbox.pack_start(frame_vert, :expand => true, :fill => true, :padding => 10)
46
+
47
+ hbox = Gtk::Box.new(:horizontal, 0)
48
+ hbox.set_border_width(10)
49
+
50
+ frame_vert.add(hbox)
51
+
52
+ bbox = create_bbox(false, "Spread", 10, :spread)
53
+ hbox.pack_start(bbox, :expand => true, :fill => true, :padding => 0)
54
+
55
+ bbox = create_bbox(false, "Edge", 10, :edge)
56
+ hbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
57
+
58
+ bbox = create_bbox(false, "Start", 10, :start)
59
+ hbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
60
+
61
+ bbox = create_bbox(false, "End", 10, :end)
62
+ hbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
63
+
64
+ bbox = create_bbox(false, "Center", 10, :center)
65
+ hbox.pack_start(bbox, :expand => true, :fill => true, :padding => 5)
66
+
67
+ bbox = create_bbox(false, "Expand", 0, :expand)
68
+ 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
76
+ end
77
+
78
+ def self.create_bbox(horizontal, title, spacing, layout)
79
+ frame = Gtk::Frame.new(title)
80
+ bbox = nil
81
+
82
+ if horizontal
83
+ bbox = Gtk::ButtonBox.new(:horizontal)
84
+ else
85
+ bbox = Gtk::ButtonBox.new(:vertical)
86
+ end
87
+
88
+ bbox.set_border_width(5)
89
+ frame.add(bbox)
90
+ bbox.set_layout(layout)
91
+ bbox.set_spacing(spacing)
92
+
93
+ %w(OK(_O) Cancel(_C) Help(_H)).each do |name|
94
+ button = Gtk::Button.new(:label => name, :use_underline => true)
95
+ bbox.add(button)
96
+ end
97
+
98
+ frame
99
+ end
100
+ end
@@ -1,82 +1,66 @@
1
- # Copyright (c) 2003-2005 Ruby-GNOME2 Project Team
1
+ # Copyright (c) 2015 Ruby-GNOME2 Project Team
2
2
  # This program is licenced under the same licence as Ruby-GNOME2.
3
3
  #
4
- # $Id: colorsel.rb,v 1.4 2005/02/12 23:02:43 kzys Exp $
5
4
  =begin
6
- = Color Selector
5
+ = Color Chooser
7
6
 
8
- Gtk::ColorSelection lets the user choose a color. Gtk::ColorSelectionDialog
9
- is a prebuilt dialog containing a Gtk::ColorSelection.
7
+ A GtkColorChooser lets the user choose a color. There are several
8
+ implementations of the GtkColorChooser interface in GTK+. The
9
+ GtkColorChooserDialog is a prebuilt dialog containing a
10
+ GtkColorChooserWidget.
10
11
  =end
11
- require 'common'
12
-
13
- module Demo
14
- class ColorSel < BasicWindow
15
- def initialize
16
- super('Color Selection')
17
-
18
- @color = Gdk::RGBA.new(0, 0, 1, 1)
12
+ module ColorselDemo
13
+ def self.run_demo(main_window)
14
+ color = Gdk::RGBA.new(0, 0, 1, 1)
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)
20
+
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)
27
+ vbox.pack_start(frame, :expand => true, :fill => true, :padding => 0)
28
+
29
+ da = Gtk::DrawingArea.new
30
+ da.signal_connect "draw" do |_widget, cr|
31
+ cr.set_source(color.to_a)
32
+ cr.paint
33
+ end
19
34
 
20
- set_border_width(8)
35
+ da.set_size_request(200, 200)
21
36
 
22
- vbox = Gtk::Box.new(:vertical, 0)
23
- vbox.set_border_width(8)
24
- add(vbox)
37
+ frame.add(da)
25
38
 
26
- ## Create the color swatch area
27
- @frame = Gtk::Frame.new
28
- @frame.set_shadow_type(:in)
29
- vbox.pack_start(@frame, :expand => true, :fill => true, :padding => 0)
39
+ button = Gtk::Button.new(:mnemonic => "_Change the above color")
40
+ button.set_halign(:end)
41
+ button.set_valign(:center)
30
42
 
31
- @da = Gtk::DrawingArea.new
43
+ vbox.pack_start(button, :expand => false, :fill => false, :padding => 0)
44
+ 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)
32
49
 
33
- @da.signal_connect('draw') do |widget, event|
34
- if widget.window
35
- context = widget.style_context
36
- background_color = context.get_background_color(:normal)
37
- event.set_source_rgba(background_color.to_a)
38
- event.paint
39
- end
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
40
54
  end
41
55
 
42
- # set a minimum size
43
- @da.set_size_request(200, 200)
44
- # set the color
45
- @da.override_background_color(:normal, @color)
46
-
47
- @frame.add(@da)
48
-
49
- alignment = Gtk::Alignment.new(1.0, 0.5, 0.0, 0.0)
50
-
51
- button = Gtk::Button.new(:mnemonic => '_Change the above color')
52
- alignment.add(button)
53
-
54
- vbox.pack_start(alignment, :expand => false, :fill => false, :padding => 0)
55
-
56
- button.signal_connect('clicked') do
57
- change_color_callback
58
- end
56
+ dialog.show_all
59
57
  end
60
58
 
61
- def change_color_callback
62
- dialog = Gtk::ColorSelectionDialog.new(:title => 'Changing color')
63
-
64
- dialog.set_transient_for(self)
65
-
66
- colorsel = dialog.color_selection
67
-
68
- colorsel.set_previous_rgba(@color)
69
- colorsel.set_current_rgba(@color)
70
- colorsel.set_has_palette(true)
71
-
72
- response = dialog.run
73
-
74
- if response == Gtk::ResponseType::OK
75
- @color = colorsel.current_rgba
76
- @da.override_background_color(:normal, @color)
77
- end
78
-
79
- dialog.destroy
59
+ if !window.visible?
60
+ window.show_all
61
+ else
62
+ window.destroy
80
63
  end
64
+ window
81
65
  end
82
66
  end