gtk3 3.0.7-x86-mingw32 → 3.0.8-x86-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,44 @@
1
+ # Copyright (c) 2008-2015 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Entry/Entry Buffer
6
+
7
+ Gtk::EntryBuffer provides the text content in a Gtk::Entry.
8
+ Applications can provide their own buffer implementation,
9
+ e.g. to provide secure handling for passwords in memory.
10
+ =end
11
+ module EntryBufferDemo
12
+
13
+ def self.run_demo(main_window)
14
+ window = Gtk::Window.new(:toplevel)
15
+ window.screen = main_window.screen
16
+ window.set_title("Entry Buffer")
17
+ window.set_resizable(false)
18
+
19
+ vbox = Gtk::Box.new(:vertical, 5)
20
+ window.add(vbox)
21
+ vbox.set_border_width(5)
22
+
23
+ label = Gtk::Label.new
24
+ label.set_markup("Entries share a buffer. Typing in one is reflected in the other.")
25
+ vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
26
+
27
+ # Create the buffer that will be shared
28
+ buffer = Gtk::EntryBuffer.new
29
+
30
+ # first entry
31
+ entry = Gtk::Entry.new(buffer)
32
+ vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0)
33
+
34
+ # second entry
35
+ entry = Gtk::Entry.new(buffer)
36
+ vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0)
37
+
38
+ if !window.visible?
39
+ window.show_all
40
+ else
41
+ window.destroy
42
+ end
43
+ end
44
+ end
@@ -1,63 +1,51 @@
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
- # $Id: entry_completion.rb,v 1.3 2005/02/25 17:09:24 kzys Exp $
3
+ #
4
4
  =begin
5
- = Entry Completion (EntryCompletion)
5
+ = Entry/Entry Completion
6
6
 
7
7
  GtkEntryCompletion provides a mechanism for adding support for
8
8
  completion in GtkEntry.
9
9
  =end
10
-
11
- require 'common'
12
-
13
- module Demo
14
- class EntryCompletion < Gtk::Dialog
15
- def initialize
16
- super('GtkEntryCompletion',
17
- nil, # parent
18
- 0,
19
- [Gtk::Stock::CLOSE, Gtk::ResponseType::NONE])
20
-
21
- self.resizable = false
22
-
23
- signal_connect('response') do
24
- self.destroy
25
- end
26
-
27
- vbox = Gtk::VBox.new(false, 5)
28
- self.vbox.pack_start(vbox, :expand => true, :fill => true)
29
- vbox.border_width = 5
30
-
31
- label = Gtk::Label.new
32
- label.markup = 'Completion demo, try writing <b>total</b> or <b>gnome</b> for example'
33
- vbox.pack_start(label, :expand => false, :fill => false)
34
-
35
- # Create our entry
36
- entry = Gtk::Entry.new
37
- vbox.pack_start(entry, :expand => false, :fill => false)
38
-
39
- # Create the completion object
40
- completion = Gtk::EntryCompletion.new
41
-
42
- # Assign the completion to the entry
43
- entry.completion = completion
44
-
45
- # Create a tree model and use it as the completion model
46
- completion.model = create_completion_model
47
-
48
- # Use model column 0 as the text column
49
- completion.text_column = 0
10
+ module EntryCompletionDemo
11
+ def self.run_demo(main_window)
12
+ window = Gtk::Window.new(:toplevel)
13
+ window.screen = main_window.screen
14
+ window.set_title("Entry Completion")
15
+ window.set_resizable(true)
16
+
17
+ vbox = Gtk::Box.new(:vertical, 5)
18
+ window.add(vbox)
19
+ vbox.set_border_width(5)
20
+
21
+ label = Gtk::Label.new
22
+ label.set_markup("Completion demo, try writing <b>total</b> or <b>gnome</b> for example.")
23
+ vbox.pack_start(label, :expand => false, :fill => false, :padding => 0)
24
+
25
+ entry = Gtk::Entry.new
26
+ vbox.pack_start(entry, :expand => false, :fill => false, :padding => 0)
27
+
28
+ completion = Gtk::EntryCompletion.new
29
+ entry.completion = completion
30
+
31
+ completion.set_model(create_completion_model)
32
+ completion.set_text_column(0)
33
+
34
+ if !window.visible?
35
+ window.show_all
36
+ else
37
+ window.destroy
50
38
  end
39
+ window
40
+ end
51
41
 
52
-
53
- def create_completion_model
54
- store = Gtk::ListStore.new(String)
55
- %w(GNOME total totally).each do |word|
56
- iter = store.append
57
- iter[0] = word
58
- end
59
-
60
- store
42
+ def self.create_completion_model
43
+ store = Gtk::ListStore.new(String)
44
+ %w(GNOME total totally).each do |word|
45
+ iter = store.append
46
+ iter[0] = word
61
47
  end
48
+
49
+ store
62
50
  end
63
51
  end
@@ -1,42 +1,76 @@
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
- # $Id: expander.rb,v 1.2 2005/02/25 17:09:25 kzys Exp $
3
+ #
4
4
  =begin
5
- = Expander (Expander)
5
+ = Expander
6
6
 
7
7
  GtkExpander allows to provide additional content that is initially hidden.
8
8
  This is also known as "disclosure triangle".
9
+
10
+ This example also shows how to make the window resizable only if the expander is expanded.
9
11
  =end
12
+ module ExpanderDemo
13
+ def self.run_demo(main_window)
14
+ toplevel = main_window.toplevel
15
+ message = "<big><b>Something went wrong</b></big>"
16
+ window = Gtk::MessageDialog.new(:parent => toplevel,
17
+ :flags => :destroy_with_parent,
18
+ :type => :error,
19
+ :buttons_type => :close,
20
+ :message => message)
21
+
22
+ window.set_use_markup(true)
23
+
24
+ message = "Here are some more details but not the full story."
25
+ window.set_secondary_text(message)
26
+
27
+ area = window.message_area
28
+ box = area.parent
29
+ box.parent.child_set_property(box, "expand", true)
30
+ box.parent.child_set_property(box, "fill", true)
10
31
 
11
- require 'common'
32
+ area.each do |child|
33
+ child.parent.child_set_property(child, "expand", false)
34
+ end
35
+
36
+ expander = Gtk::Expander.new("Details:")
37
+ sw = Gtk::ScrolledWindow.new
38
+ sw.set_min_content_height(100)
39
+ sw.set_shadow_type(:in)
40
+ sw.set_policy(:never, :automatic)
12
41
 
13
- module Demo
14
- class Expander < Gtk::Dialog
15
- def initialize
16
- # as opposed to the GTK2 dialog, the buttons have to be enclodes by brackeds
17
- # together with their ResponseType AND all groups have to bracketed together
18
- super(:title => 'GtkExpander',
19
- :parent => nil,
20
- :flags => 0,
21
- :buttons => [[Gtk::Stock::CLOSE, Gtk::ResponseType::NONE]])
22
- self.resizable = false
42
+ tv = Gtk::TextView.new
43
+ tv.set_editable(false)
44
+ tv.set_wrap_mode(:word)
45
+ tv.buffer.text = <<TEXT
46
+ Finally, the full story with all details.
47
+ And all the inside information, including
48
+ error codes, etc etc. Pages of information,
49
+ you might have to scroll down to read it all,
50
+ or even resize the window - it works !
23
51
 
24
- signal_connect('response') do
25
- self.destroy
26
- end
52
+ A second paragraph will contain even more
53
+ innuendo, just to make you scroll down or
54
+ resize the window. Do it already !"
55
+ TEXT
27
56
 
28
- vbox = Gtk::Box.new(:vertical, 5)
29
- self.child.pack_start(vbox, :expand => true, :fill => true)
30
- vbox.border_width = 5
57
+ sw.add(tv)
58
+ expander.add(sw)
59
+ area.pack_end(expander, :expand => true, :fill => true, :padding => 0)
60
+ expander.show_all
31
61
 
32
- label = Gtk::Label.new('Expander demo. CLick on the triangle for details.')
33
- vbox.pack_start(label, :expand => false, :fill => false)
62
+ expander.signal_connect "notify::expanded" do
63
+ window.set_resizable(expander.expanded?)
64
+ end
34
65
 
35
- # Create the expander
36
- expander = Gtk::Expander.new('Details')
37
- vbox.pack_start(expander, :expand => false, :fill => false)
66
+ window.signal_connect "response" do |dialog, _response_id|
67
+ dialog.destroy
68
+ end
38
69
 
39
- expander.add(Gtk::Label.new('Details can be shown or hidden.'))
70
+ if !window.visible?
71
+ window.show_all
72
+ else
73
+ window.destroy
40
74
  end
41
75
  end
42
76
  end
@@ -0,0 +1,119 @@
1
+ # Copyright (c) 2016 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Tree View/Filter Model
6
+
7
+ This example demonstrates how GtkTreeModelFilter can be used not
8
+ just to show a subset of the rows, but also to compute columns
9
+ that are not actually present in the underlying model.
10
+ =end
11
+ module FiltermodelDemo
12
+ WIDTH_COLUMN = 0
13
+ HEIGHT_COLUMN = 1
14
+ AREA_COLUMN = 2
15
+ SQUARE_COLUMN = 3
16
+
17
+ def self.run_demo(main_window)
18
+ builder = Gtk::Builder.new(:resource => "/filtermodel/filtermodel.ui")
19
+ builder.connect_signals {}
20
+
21
+ window = builder["window1"]
22
+ window.screen = main_window.screen
23
+
24
+ column = builder["treeviewcolumn1"]
25
+ cell = builder["cellrenderertext1"]
26
+ column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
27
+ num = current_iter[WIDTH_COLUMN]
28
+ current_cell.text = num.to_s
29
+ end
30
+
31
+ column = builder["treeviewcolumn2"]
32
+ cell = builder["cellrenderertext2"]
33
+ column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
34
+ num = current_iter[HEIGHT_COLUMN]
35
+ current_cell.text = num.to_s
36
+ end
37
+
38
+ column = builder["treeviewcolumn3"]
39
+ cell = builder["cellrenderertext3"]
40
+ column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
41
+ num = current_iter[WIDTH_COLUMN]
42
+ current_cell.text = num.to_s
43
+ end
44
+
45
+ column = builder["treeviewcolumn4"]
46
+ cell = builder["cellrenderertext4"]
47
+ column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
48
+ num = current_iter[HEIGHT_COLUMN]
49
+ current_cell.text = num.to_s
50
+ end
51
+
52
+ column = builder["treeviewcolumn5"]
53
+ cell = builder["cellrenderertext5"]
54
+ column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
55
+ num = current_iter[AREA_COLUMN]
56
+ current_cell.text = num.to_s
57
+ end
58
+
59
+ column = builder["treeviewcolumn6"]
60
+ cell = builder["cellrendererpixbuf1"]
61
+ column.add_attribute(cell, "visible", SQUARE_COLUMN)
62
+
63
+ store = builder["liststore1"]
64
+ tree = builder["treeview2"]
65
+
66
+ types = [Integer, Integer, Integer, TrueClass]
67
+
68
+ model = Gtk::TreeModelFilter.new(store)
69
+ model.set_modify_func(*types) do |filter_model, filter_iter, filter_column|
70
+ value = nil
71
+ child_iter = filter_model.convert_iter_to_child_iter(filter_iter)
72
+ width = child_iter[WIDTH_COLUMN]
73
+ height = child_iter[HEIGHT_COLUMN]
74
+ case filter_column
75
+ when WIDTH_COLUMN
76
+ value = width
77
+ when HEIGHT_COLUMN
78
+ value = height
79
+ when AREA_COLUMN
80
+ value = width * height
81
+ when SQUARE_COLUMN
82
+ value = (width == height)
83
+ end
84
+ value
85
+ end
86
+
87
+ tree.model = model
88
+
89
+ column = builder["treeviewcolumn7"]
90
+ cell = builder["cellrenderertext6"]
91
+ column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
92
+ num = current_iter[WIDTH_COLUMN]
93
+ current_cell.text = num.to_s
94
+ end
95
+
96
+ column = builder["treeviewcolumn8"]
97
+ cell = builder["cellrenderertext7"]
98
+ column.set_cell_data_func(cell) do |_column, current_cell, _current_model, current_iter|
99
+ num = current_iter[HEIGHT_COLUMN]
100
+ current_cell.text = num.to_s
101
+ end
102
+
103
+ tree = builder["treeview3"]
104
+
105
+ model = Gtk::TreeModelFilter.new(store)
106
+ model.set_visible_func do |_current_model, current_iter|
107
+ current_iter[WIDTH_COLUMN] < 10
108
+ end
109
+
110
+ tree.model = model
111
+
112
+ if !window.visible?
113
+ window.show_all
114
+ else
115
+ window.destroy
116
+ end
117
+ window
118
+ end
119
+ end
@@ -0,0 +1,117 @@
1
+ # Copyright (c) 2016 Ruby-GNOME2 Project Team
2
+ # This program is licenced under the same licence as Ruby-GNOME2.
3
+ #
4
+ =begin
5
+ = Pango/Font Features
6
+
7
+ This demonstrates support for OpenType font features with
8
+ Pango attributes. The attributes can be used manually or
9
+ via Pango markup.
10
+ =end
11
+ module FontFeaturesDemo
12
+ def self.run_demo(main_window)
13
+ builder = Gtk::Builder.new(:resource => "/font-features/font-features.ui")
14
+ window = builder["window"]
15
+ label = builder["label"]
16
+ settings = builder["settings"]
17
+ resetbutton = builder["reset"]
18
+ font = builder["font"]
19
+ numcasedefault = builder["numcasedefault"]
20
+ numspacedefault = builder["numspacedefault"]
21
+ fractiondefault = builder["fractiondefault"]
22
+ stack = builder["stack"]
23
+ entry = builder["entry"]
24
+ toggle = []
25
+
26
+ %w(kern liga dlig hlig clig smcp c2sc lnum onum pnum tnum frac afrc zero
27
+ nalt swsh calt hist salt ss01 ss02 ss03 ss04 ss05).each do |name|
28
+ toggle << builder[name]
29
+ end
30
+ text = nil
31
+
32
+ builder.connect_signals do |name|
33
+ case name
34
+ when "reset"
35
+ proc do |button|
36
+ numcasedefault.active = true
37
+ numspacedefault.active = true
38
+ fractiondefault.active = true
39
+ toggle.each do |widget|
40
+ if widget.class != Gtk::RadioButton
41
+ widget.active = false
42
+ widget.sensitive = false
43
+ end
44
+ end
45
+ end
46
+ when "update"
47
+ proc do
48
+ update(toggle, entry, font, settings, label)
49
+ end
50
+ when "switch_to_entry"
51
+ proc do
52
+ text = entry.text
53
+ stack.visible_child_name = "entry"
54
+ end
55
+ when "switch_to_label"
56
+ proc do
57
+ text = nil
58
+ stack.set_visible_child_name("label")
59
+ update(toggle, entry, font, settings, label)
60
+ end
61
+ when "entry_key_press"
62
+ proc do |entry, event|
63
+ if event.keyval == Gdk::Keyval::KEY_Escape
64
+ entry.text = text
65
+ text = nil
66
+ stack.set_visible_child_name("label")
67
+ update(toggle, entry, font, settings, label)
68
+ end
69
+ Gdk::Event::PROPAGATE
70
+ end
71
+ end
72
+ end
73
+
74
+ update(toggle, entry, font, settings, label)
75
+
76
+ if !window.visible?
77
+ window.show_all
78
+ else
79
+ window.destroy
80
+ end
81
+ window
82
+ end
83
+
84
+ def self.update(toggle, entry, font, settings, label)
85
+ text = entry.text
86
+ font_desc = font.font
87
+ s = ""
88
+ has_feature = false
89
+
90
+ toggle.each do |widget|
91
+ next unless widget.sensitive?
92
+
93
+ if widget.class == Gtk::RadioButton
94
+ if widget.active?
95
+ s += ", " if has_feature
96
+ s += widget.builder_name
97
+ s += " 1"
98
+ has_feature = true
99
+ end
100
+ else
101
+ s += ", " if has_feature
102
+ s += widget.builder_name
103
+ if widget.active?
104
+ s += " 1"
105
+ else
106
+ s += " 0"
107
+ end
108
+ has_feature = true
109
+ end
110
+ end
111
+ font_settings = s
112
+ settings.text = font_settings
113
+
114
+ s = "<span font_desc='#{font_desc}' font_features='#{font_settings}'>#{text}</span>"
115
+ label.markup = s
116
+ end
117
+ end