gtk3 3.0.2 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f21d47fea19a0adea93eed76710e32dd1459ebe2
4
- data.tar.gz: 56ce6b8cec87d6b3efd5dbc7bf5a71845d51a2f4
3
+ metadata.gz: f8d5fef3bad7456ed5fa89fdc1fcc88291b198ba
4
+ data.tar.gz: 82dee84597660740e5081b7f01e2b9d43e844773
5
5
  SHA512:
6
- metadata.gz: 341791e3993716188f5e52be1618993862e23c10d074b8a6ddff699c2fe938b60bdc736497585c9384d6253acf012eff56eaa70e1011a91a102aa4a9114ef611
7
- data.tar.gz: 2a9ae3f1d4087015391e3c9b0606d4822315a2f6db6f9257ba4c5d882a45cc6f2d44d6e268abbdeeb209133ee904e72382359f165a8391b2bd75ec949624ae0c
6
+ metadata.gz: f8a70a5ad6e1bcf7f561a58ed7434c521ad4a2c9e77efa5929e3e160a080fd3be7cd09e3e7f8a7812dc2d1929eefa75e528bb7c3366fe5148941b47486f994e1
7
+ data.tar.gz: 964526fc4f3e94a00437c2cfadced241a38c116ac92a364beceed784a9d3d1d7464ef21a4d32cc6b24f9c436dde51003150dc6d73ce416cd2a8f575b92be34d6
@@ -19,14 +19,7 @@ require "atk"
19
19
  require "gdk3"
20
20
  require "gio2"
21
21
 
22
- base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
23
- vendor_dir = base_dir + "vendor" + "local"
24
- vendor_bin_dir = vendor_dir + "bin"
25
- GLib.prepend_dll_path(vendor_bin_dir)
26
- vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
27
- GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
28
-
29
- if vendor_dir.exist?
22
+ if /cygwin|mingw|mswin/ === RUBY_PLATFORM
30
23
  require "rsvg2"
31
24
  end
32
25
 
@@ -0,0 +1,32 @@
1
+ # Copyright (C) 2015 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module Gtk
18
+ class IconSize
19
+ class << self
20
+ alias_method :lookup_raw, :lookup
21
+ def lookup(size)
22
+ size = new(size) unless size.is_a?(self)
23
+ valid, width, height = lookup_raw(size)
24
+ if valid
25
+ [width, height]
26
+ else
27
+ nil
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -24,5 +24,15 @@ module Gtk
24
24
  end
25
25
  choose_icon_raw(icon_names, size, flags)
26
26
  end
27
+
28
+ alias_method :lookup_icon_raw, :lookup_icon
29
+ def lookup_icon(icon, size, flags)
30
+ case icon
31
+ when String, Symbol
32
+ lookup_icon_raw(icon.to_s, size, flags)
33
+ else
34
+ lookup_by_gicon(icon, size, flags)
35
+ end
36
+ end
27
37
  end
28
38
  end
@@ -87,10 +87,9 @@ module Gtk
87
87
 
88
88
  case size
89
89
  when String, Symbol
90
- size_name = size.to_s.gsub(/_/, "-")
91
- size = Gtk.icon_size_from_name("gtk-#{size_name}")
90
+ size = IconSize.new(size)
92
91
  else
93
- size ||= Gtk::IconSize::BUTTON
92
+ size ||= IconSize::BUTTON
94
93
  end
95
94
 
96
95
  if stock
@@ -110,6 +110,7 @@ module Gtk
110
110
  require "gtk3/file-chooser-dialog"
111
111
  require "gtk3/font-chooser-dialog"
112
112
  require "gtk3/gesture-multi-press"
113
+ require "gtk3/icon-size"
113
114
  require "gtk3/icon-theme"
114
115
  require "gtk3/icon-view"
115
116
  require "gtk3/image"
@@ -186,6 +187,10 @@ module Gtk
186
187
  define_method(info, Gdk::DragContext, method_name)
187
188
  when /\Abinding_/
188
189
  # Ignore because singleton methods are defined.
190
+ when /\Aicon_size_/
191
+ icon_size_class = @base_module.const_get(:IconSize)
192
+ method_name = rubyish_method_name(info, :prefix => "icon_size_")
193
+ define_singleton_method(icon_size_class, method_name, info)
189
194
  else
190
195
  super
191
196
  end
@@ -219,13 +224,13 @@ module Gtk
219
224
  def define_enum(info)
220
225
  case info.name
221
226
  when /\AArrow/
222
- self.class.define_class(info.gtype, $POSTMATCH, Gtk::Arrow)
227
+ self.class.define_class(info.gtype, $POSTMATCH, Arrow)
223
228
  when /\ALevelBar/
224
- self.class.define_class(info.gtype, $POSTMATCH, Gtk::LevelBar)
229
+ self.class.define_class(info.gtype, $POSTMATCH, LevelBar)
225
230
  when /\ARevealer/
226
- self.class.define_class(info.gtype, $POSTMATCH, Gtk::Revealer)
231
+ self.class.define_class(info.gtype, $POSTMATCH, Revealer)
227
232
  when /\AStack/
228
- self.class.define_class(info.gtype, $POSTMATCH, Gtk::Stack)
233
+ self.class.define_class(info.gtype, $POSTMATCH, Stack)
229
234
  else
230
235
  super
231
236
  end
@@ -18,7 +18,7 @@ module Gtk
18
18
  class SpinButton
19
19
  alias_method :initialize_raw, :initialize
20
20
  def initialize(arg0, arg1=nil, arg2=nil)
21
- if arg0.is_a?(Gtk::Adjustment)
21
+ if arg0.is_a?(Adjustment)
22
22
  adjustment = arg0
23
23
  climb_rate = arg1 || 0.0
24
24
  digits = arg2 || 0
@@ -34,8 +34,10 @@ module Gtk
34
34
  x_options=nil, y_options=nil,
35
35
  x_space=nil, y_space=nil)
36
36
  attach_raw(child, left, right, top, bottom,
37
- x_options, y_options,
38
- x_space || 0, y_space || 0)
37
+ x_options || [:expand, :fill],
38
+ y_options || [:expand, :fill],
39
+ x_space || 0,
40
+ y_space || 0)
39
41
  end
40
42
  end
41
43
  end
@@ -18,8 +18,8 @@ module Gtk
18
18
  class TargetEntry
19
19
  alias_method :initialize_raw, :initialize
20
20
  def initialize(target, flags, info)
21
- unless flags.is_a?(Gtk::TargetFlags)
22
- flags = Gtk::TargetFlags.new(flags)
21
+ unless flags.is_a?(TargetFlags)
22
+ flags = TargetFlags.new(flags)
23
23
  end
24
24
  initialize_raw(target, flags.to_i, info)
25
25
  end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2014 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -47,6 +47,10 @@ module Gtk
47
47
  @model.iter_next(self)
48
48
  end
49
49
 
50
+ def parent
51
+ @model.iter_parent(self)
52
+ end
53
+
50
54
  def ==(other)
51
55
  other.is_a?(self.class) and
52
56
  @model == other.model and
@@ -43,6 +43,17 @@ module Gtk
43
43
  end
44
44
  end
45
45
 
46
+ alias_method :iter_parent_raw, :iter_parent
47
+ def iter_parent(iter)
48
+ got, iter = iter_parent_raw(iter)
49
+ if got
50
+ setup_iter(iter)
51
+ iter
52
+ else
53
+ nil
54
+ end
55
+ end
56
+
46
57
  alias_method :get_value_raw, :get_value
47
58
  def get_value(iter, column)
48
59
  get_value_raw(iter, column).value
@@ -24,6 +24,10 @@ module Gtk
24
24
  @have_template ||= false
25
25
  end
26
26
 
27
+ def template_children
28
+ @template_children ||= []
29
+ end
30
+
27
31
  if method_defined?(:set_template)
28
32
  alias_method :set_template_raw, :set_template
29
33
  def set_template(template)
@@ -41,8 +45,7 @@ module Gtk
41
45
  internal_child = options[:internal_child]
42
46
  internal_child = false if internal_child.nil?
43
47
  bind_template_child_full(name, internal_child, 0)
44
- @template_children ||= []
45
- @template_children << name
48
+ template_children << name
46
49
  attr_reader(name)
47
50
  end
48
51
  end
@@ -97,6 +100,12 @@ module Gtk
97
100
  value.value
98
101
  end
99
102
 
103
+ alias_method :render_icon_pixbuf_raw, :render_icon_pixbuf
104
+ def render_icon_pixbuf(stock_id, size)
105
+ size = IconSize.new(size) unless size.is_a?(IconSize)
106
+ render_icon_pixbuf_raw(stock_id, size)
107
+ end
108
+
100
109
  private
101
110
  def initialize_post
102
111
  klass = self.class
@@ -105,8 +114,7 @@ module Gtk
105
114
 
106
115
  init_template
107
116
  gtype = klass.gtype
108
- child_names = klass.instance_variable_get(:@template_children)
109
- child_names.each do |name|
117
+ klass.template_children.each do |name|
110
118
  instance_variable_set("@#{name}", get_template_child(gtype, name))
111
119
  end
112
120
  end
@@ -0,0 +1,18 @@
1
+ <?xml version="1.0"?>
2
+ <interface>
3
+ <!-- interface-requires gtk+ 3.0 -->
4
+ <menu id="appmenu">
5
+ <section>
6
+ <item>
7
+ <attribute name="label" translatable="yes">_Preferences</attribute>
8
+ <attribute name="action">app.preferences</attribute>
9
+ </item>
10
+ </section>
11
+ <section>
12
+ <item>
13
+ <attribute name="label" translatable="yes">_Quit</attribute>
14
+ <attribute name="action">app.quit</attribute>
15
+ </item>
16
+ </section>
17
+ </menu>
18
+ </interface>
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <gresources>
3
+ <gresource prefix="/org/gtk/exampleapp">
4
+ <file preprocess="xml-stripblanks">window.ui</file>
5
+ <file preprocess="xml-stripblanks">app-menu.ui</file>
6
+ <file preprocess="xml-stripblanks">gears-menu.ui</file>
7
+ <file preprocess="xml-stripblanks">prefs.ui</file>
8
+ </gresource>
9
+ </gresources>
@@ -0,0 +1,267 @@
1
+ # Copyright (C) 2015 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+ #
17
+ # Original:
18
+ # * URL: https://git.gnome.org/browse/gtk+/tree/examples/application10/
19
+ # * License: LGPL 2
20
+
21
+ require "gtk3"
22
+
23
+ require "fileutils"
24
+
25
+ current_path = File.expand_path(File.dirname(__FILE__))
26
+ gresource_bin = "#{current_path}/exampleapp.gresource"
27
+ gresource_xml = "#{current_path}/exampleapp.gresource.xml"
28
+
29
+ system("glib-compile-resources",
30
+ "--target", gresource_bin,
31
+ "--sourcedir", current_path,
32
+ gresource_xml)
33
+
34
+ gschema_bin = "#{current_path}/gschemas.compiled"
35
+
36
+ system("glib-compile-schemas", current_path)
37
+
38
+ at_exit do
39
+ FileUtils.rm_f([gresource_bin, gschema_bin])
40
+ end
41
+
42
+ resource = Gio::Resource.load(gresource_bin)
43
+ Gio::Resources.register(resource)
44
+
45
+ ENV["GSETTINGS_SCHEMA_DIR"] = current_path
46
+
47
+ def update_words(win)
48
+ tab = win.stack.visible_child
49
+ return unless tab
50
+ view = tab.child
51
+ buffer = view.buffer
52
+ iter = buffer.start_iter
53
+ strings = []
54
+ done = false
55
+ until iter.end?
56
+ until iter.starts_word
57
+ unless iter.forward_char
58
+ done = true
59
+ break
60
+ end
61
+ end
62
+ break if done
63
+ word_end = iter.clone
64
+ break unless word_end.forward_word_end
65
+ strings << buffer.get_text(iter, word_end, false)
66
+ iter = word_end
67
+ end
68
+ children = win.words.children
69
+ children.each { |c| win.words.remove(c) } unless children.empty?
70
+ strings.each do |s|
71
+ row = Gtk::Button.new(:label => s)
72
+ row.signal_connect("clicked") { |_widget| win.searchentry.text = s }
73
+ row.show
74
+ win.words.add(row)
75
+ end
76
+ end
77
+
78
+ def update_lines(win)
79
+ tab = win.stack.visible_child
80
+ return unless tab
81
+ view = tab.child
82
+ buffer = view.buffer
83
+ iter = buffer.start_iter
84
+ count = 0
85
+ until iter.end?
86
+ count += 1
87
+ break unless iter.forward_line
88
+ end
89
+ win.lines.text = count.to_s
90
+ end
91
+
92
+ class ExampleAppPrefs < Gtk::Dialog
93
+ type_register
94
+
95
+ class << self
96
+ def init
97
+ set_template(:resource => "/org/gtk/exampleapp/prefs.ui")
98
+ bind_template_child("font")
99
+ bind_template_child("transition")
100
+ end
101
+ end
102
+
103
+ def initialize(args)
104
+ parent = args[:transient_for]
105
+ super(:transient_for => parent, :use_header_bar => 1)
106
+ settings = Gio::Settings.new("org.gtk.exampleapp")
107
+ settings.bind("font",
108
+ font,
109
+ "font",
110
+ Gio::SettingsBindFlags::DEFAULT)
111
+ settings.bind("transition",
112
+ transition,
113
+ "active-id",
114
+ Gio::SettingsBindFlags::DEFAULT)
115
+ end
116
+ end
117
+
118
+ class ExampleAppWindow < Gtk::ApplicationWindow
119
+ type_register
120
+ class << self
121
+ def init
122
+ set_template(:resource => "/org/gtk/exampleapp/window.ui")
123
+ bind_template_child("stack")
124
+ bind_template_child("search")
125
+ bind_template_child("searchbar")
126
+ bind_template_child("searchentry")
127
+ bind_template_child("gears")
128
+ bind_template_child("words")
129
+ bind_template_child("sidebar")
130
+ bind_template_child("lines")
131
+ bind_template_child("lines_label")
132
+
133
+ set_connect_func do |name|
134
+ method(name)
135
+ end
136
+ end
137
+
138
+ private
139
+
140
+ def search_text_changed(search_entry)
141
+ text = search_entry.text
142
+ return if text.empty?
143
+
144
+ win = search_entry.toplevel
145
+ tab = win.stack.visible_child
146
+ view = tab.child
147
+ buffer = view.buffer
148
+ range = buffer.start_iter.forward_search(text,
149
+ Gtk::TextSearchFlags::CASE_INSENSITIVE)
150
+ return unless range
151
+ buffer.select_range(range[0], range[1])
152
+ view.scroll_to_iter(range[0], 0.0, false, 0.0, 0.0)
153
+ end
154
+
155
+ def visible_child_changed(stack, params)
156
+ return if stack.in_destruction?
157
+ win = stack.toplevel
158
+ win.searchbar.set_search_mode(false)
159
+ update_words(win)
160
+ update_lines(win)
161
+ end
162
+ end
163
+
164
+ def initialize(application)
165
+ super(:application => application)
166
+ @settings = Gio::Settings.new("org.gtk.exampleapp")
167
+ @settings.bind("transition",
168
+ stack,
169
+ "transition-type",
170
+ Gio::SettingsBindFlags::DEFAULT)
171
+ search.bind_property("active", searchbar, "search-mode-enabled", :bidirectional)
172
+ @settings.bind("show-words",
173
+ sidebar,
174
+ "reveal-child",
175
+ Gio::SettingsBindFlags::DEFAULT)
176
+ sidebar.signal_connect "notify::reveal-child" do |_sidebar, _gparamspec|
177
+ update_words(self)
178
+ end
179
+ builder = Gtk::Builder.new(:resource => "/org/gtk/exampleapp/gears-menu.ui")
180
+ menu = builder.get_object("menu")
181
+ gears.set_menu_model(menu)
182
+ action = @settings.create_action("show-words")
183
+ add_action(action)
184
+ action = Gio::PropertyAction.new("show-lines", lines, "visible")
185
+ add_action(action)
186
+ lines.bind_property("visible", lines_label, "visible", :default)
187
+ end
188
+
189
+ def open(file)
190
+ basename = file.basename
191
+
192
+ scrolled = Gtk::ScrolledWindow.new
193
+ scrolled.show
194
+ scrolled.set_hexpand(true)
195
+ scrolled.set_vexpand(true)
196
+
197
+ view = Gtk::TextView.new
198
+ view.set_editable(false)
199
+ view.set_cursor_visible(false)
200
+ view.show
201
+ scrolled.add(view)
202
+
203
+ stack.add_titled(scrolled, basename, basename)
204
+
205
+ stream = file.read
206
+ buffer = view.buffer
207
+ buffer.text = stream.read
208
+ tag = buffer.create_tag
209
+ @settings.bind("font", tag, "font", Gio::SettingsBindFlags::DEFAULT)
210
+ buffer.apply_tag(tag, buffer.start_iter, buffer.end_iter)
211
+ search.sensitive = true
212
+ update_words(self)
213
+ update_lines(self)
214
+ end
215
+ end
216
+
217
+ class ExampleApp < Gtk::Application
218
+ def initialize
219
+ super("org.gtk.exampleapp", :handles_open)
220
+
221
+ signal_connect "startup" do |application|
222
+ quit_accels = ["<Ctrl>Q"]
223
+ action = Gio::SimpleAction.new("quit")
224
+ action.signal_connect("activate") do |_action, _parameter|
225
+ application.quit
226
+ end
227
+ application.add_action(action)
228
+ application.set_accels_for_action("app.quit", quit_accels)
229
+
230
+ action = Gio::SimpleAction.new("preferences")
231
+ action.signal_connect("activate") do |_action, _parameter|
232
+ win = application.windows.first
233
+ prefs = ExampleAppPrefs.new(:transient_for => win,
234
+ :use_header_bar => true)
235
+ prefs.present
236
+ end
237
+ application.add_action(action)
238
+
239
+ builder = Gtk::Builder.new(:resource => "/org/gtk/exampleapp/app-menu.ui")
240
+ app_menu = builder.get_object("appmenu")
241
+ application.set_app_menu(app_menu)
242
+ end
243
+
244
+ signal_connect "activate" do |application|
245
+ window = ExampleAppWindow.new(application)
246
+ window.present
247
+ end
248
+
249
+ signal_connect "open" do |application, files, _hint|
250
+ windows = application.windows
251
+ win = nil
252
+ if windows.empty?
253
+ win = ExampleAppWindow.new(application)
254
+ else
255
+ win = windows.first
256
+ end
257
+
258
+ files.each { |file| win.open(file) }
259
+
260
+ win.present
261
+ end
262
+ end
263
+ end
264
+
265
+ app = ExampleApp.new
266
+
267
+ puts app.run([$PROGRAM_NAME] + ARGV)
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0"?>
2
+ <interface>
3
+ <!-- interface-requires gtk+ 3.0 -->
4
+ <menu id="menu">
5
+ <section>
6
+ <item>
7
+ <attribute name="label" translatable="yes">_Words</attribute>
8
+ <attribute name="action">win.show-words</attribute>
9
+ </item>
10
+ <item>
11
+ <attribute name="label" translatable="yes">_Lines</attribute>
12
+ <attribute name="action">win.show-lines</attribute>
13
+ </item>
14
+ </section>
15
+ </menu>
16
+ </interface>
@@ -0,0 +1,25 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <schemalist>
3
+ <schema path="/org/gtk/exampleapp/" id="org.gtk.exampleapp">
4
+ <key name="font" type="s">
5
+ <default>'Monospace 12'</default>
6
+ <summary>Font</summary>
7
+ <description>The font to be used for content.</description>
8
+ </key>
9
+ <key name="transition" type="s">
10
+ <choices>
11
+ <choice value='none'/>
12
+ <choice value='crossfade'/>
13
+ <choice value='slide-left-right'/>
14
+ </choices>
15
+ <default>'none'</default>
16
+ <summary>Transition</summary>
17
+ <description>The transition to use when switching tabs.</description>
18
+ </key>
19
+ <key name="show-words" type="b">
20
+ <default>false</default>
21
+ <summary>Show words</summary>
22
+ <description>Whether to show a word list in the sidebar</description>
23
+ </key>
24
+ </schema>
25
+ </schemalist>
@@ -0,0 +1,70 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <!-- interface-requires gtk+ 3.8 -->
4
+ <template class="ExampleAppPrefs" parent="GtkDialog">
5
+ <property name="title" translatable="yes">Preferences</property>
6
+ <property name="resizable">False</property>
7
+ <property name="modal">True</property>
8
+ <child internal-child="vbox">
9
+ <object class="GtkBox" id="vbox">
10
+ <child>
11
+ <object class="GtkGrid" id="grid">
12
+ <property name="visible">True</property>
13
+ <property name="margin">6</property>
14
+ <property name="row-spacing">12</property>
15
+ <property name="column-spacing">6</property>
16
+ <child>
17
+ <object class="GtkLabel" id="fontlabel">
18
+ <property name="visible">True</property>
19
+ <property name="label">_Font:</property>
20
+ <property name="use-underline">True</property>
21
+ <property name="mnemonic-widget">font</property>
22
+ <property name="xalign">1</property>
23
+ </object>
24
+ <packing>
25
+ <property name="left-attach">0</property>
26
+ <property name="top-attach">0</property>
27
+ </packing>
28
+ </child>
29
+ <child>
30
+ <object class="GtkFontButton" id="font">
31
+ <property name="visible">True</property>
32
+ </object>
33
+ <packing>
34
+ <property name="left-attach">1</property>
35
+ <property name="top-attach">0</property>
36
+ </packing>
37
+ </child>
38
+ <child>
39
+ <object class="GtkLabel" id="transitionlabel">
40
+ <property name="visible">True</property>
41
+ <property name="label">_Transition:</property>
42
+ <property name="use-underline">True</property>
43
+ <property name="mnemonic-widget">transition</property>
44
+ <property name="xalign">1</property>
45
+ </object>
46
+ <packing>
47
+ <property name="left-attach">0</property>
48
+ <property name="top-attach">1</property>
49
+ </packing>
50
+ </child>
51
+ <child>
52
+ <object class="GtkComboBoxText" id="transition">
53
+ <property name="visible">True</property>
54
+ <items>
55
+ <item translatable="yes" id="none">None</item>
56
+ <item translatable="yes" id="crossfade">Fade</item>
57
+ <item translatable="yes" id="slide-left-right">Slide</item>
58
+ </items>
59
+ </object>
60
+ <packing>
61
+ <property name="left-attach">1</property>
62
+ <property name="top-attach">1</property>
63
+ </packing>
64
+ </child>
65
+ </object>
66
+ </child>
67
+ </object>
68
+ </child>
69
+ </template>
70
+ </interface>
@@ -0,0 +1,118 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <!-- interface-requires gtk+ 3.8 -->
4
+ <template class="ExampleAppWindow" parent="GtkApplicationWindow">
5
+ <property name="title" translatable="yes">Example Application</property>
6
+ <property name="default-width">600</property>
7
+ <property name="default-height">400</property>
8
+ <child type="titlebar">
9
+ <object class="GtkHeaderBar" id="header">
10
+ <property name="visible">True</property>
11
+ <property name="show-close-button">True</property>
12
+ <child>
13
+ <object class="GtkLabel" id="lines_label">
14
+ <property name="visible">False</property>
15
+ <property name="label" translatable="yes">Lines:</property>
16
+ </object>
17
+ <packing>
18
+ <property name="pack-type">start</property>
19
+ </packing>
20
+ </child>
21
+ <child>
22
+ <object class="GtkLabel" id="lines">
23
+ <property name="visible">False</property>
24
+ </object>
25
+ <packing>
26
+ <property name="pack-type">start</property>
27
+ </packing>
28
+ </child>
29
+ <child type="title">
30
+ <object class="GtkStackSwitcher" id="tabs">
31
+ <property name="visible">True</property>
32
+ <property name="margin">6</property>
33
+ <property name="stack">stack</property>
34
+ </object>
35
+ </child>
36
+ <child>
37
+ <object class="GtkToggleButton" id="search">
38
+ <property name="visible">True</property>
39
+ <property name="sensitive">False</property>
40
+ <style>
41
+ <class name="image-button"/>
42
+ </style>
43
+ <child>
44
+ <object class="GtkImage" id="search-icon">
45
+ <property name="visible">True</property>
46
+ <property name="icon-name">edit-find-symbolic</property>
47
+ <property name="icon-size">1</property>
48
+ </object>
49
+ </child>
50
+ </object>
51
+ <packing>
52
+ <property name="pack-type">end</property>
53
+ </packing>
54
+ </child>
55
+ <child>
56
+ <object class="GtkMenuButton" id="gears">
57
+ <property name="visible">True</property>
58
+ <property name="direction">none</property>
59
+ <property name="use-popover">True</property>
60
+ <style>
61
+ <class name="image-button"/>
62
+ </style>
63
+ </object>
64
+ <packing>
65
+ <property name="pack-type">end</property>
66
+ </packing>
67
+ </child>
68
+ </object>
69
+ </child>
70
+ <child>
71
+ <object class="GtkBox" id="content_box">
72
+ <property name="visible">True</property>
73
+ <property name="orientation">vertical</property>
74
+ <child>
75
+ <object class="GtkSearchBar" id="searchbar">
76
+ <property name="visible">True</property>
77
+ <child>
78
+ <object class="GtkSearchEntry" id="searchentry">
79
+ <signal name="search-changed" handler="search_text_changed"/>
80
+ <property name="visible">True</property>
81
+ </object>
82
+ </child>
83
+ </object>
84
+ </child>
85
+ <child>
86
+ <object class="GtkBox" id="hbox">
87
+ <property name="visible">True</property>
88
+ <child>
89
+ <object class="GtkRevealer" id="sidebar">
90
+ <property name="visible">True</property>
91
+ <property name="transition-type">slide-right</property>
92
+ <child>
93
+ <object class="GtkScrolledWindow" id="sidebar-sw">
94
+ <property name="visible">True</property>
95
+ <property name="hscrollbar-policy">never</property>
96
+ <property name="vscrollbar-policy">automatic</property>
97
+ <child>
98
+ <object class="GtkListBox" id="words">
99
+ <property name="visible">True</property>
100
+ <property name="selection-mode">none</property>
101
+ </object>
102
+ </child>
103
+ </object>
104
+ </child>
105
+ </object>
106
+ </child>
107
+ <child>
108
+ <object class="GtkStack" id="stack">
109
+ <signal name="notify::visible-child" handler="visible_child_changed"/>
110
+ <property name="visible">True</property>
111
+ </object>
112
+ </child>
113
+ </object>
114
+ </child>
115
+ </object>
116
+ </child>
117
+ </template>
118
+ </interface>
@@ -0,0 +1,32 @@
1
+ # Copyright (C) 2015 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestGtkIconSize < Test::Unit::TestCase
18
+ include GtkTestUtils
19
+
20
+ sub_test_case "class methods" do
21
+ sub_test_case ".lookup" do
22
+ test "valid" do
23
+ assert_equal([16, 16],
24
+ Gtk::IconSize.lookup(:menu))
25
+ end
26
+
27
+ test "invalid" do
28
+ assert_nil(Gtk::IconSize.lookup(:invalid))
29
+ end
30
+ end
31
+ end
32
+ end
@@ -28,4 +28,23 @@ class TestGtkIconTheme < Test::Unit::TestCase
28
28
  assert_operator(@theme.icons("Actions"), :include?, "find")
29
29
  end
30
30
  end
31
+
32
+ sub_test_case "#lookup_icon" do
33
+ sub_test_case "icon" do
34
+ test "String" do
35
+ assert_not_nil(@theme.lookup_icon("search",
36
+ 16, :generic_fallback))
37
+ end
38
+
39
+ test "Symbol" do
40
+ assert_not_nil(@theme.lookup_icon("search",
41
+ 16, :generic_fallback))
42
+ end
43
+
44
+ test "Gio::Icon" do
45
+ icon = Gio::ThemedIcon.new("search")
46
+ assert_not_nil(@theme.lookup_icon(icon, 16, :generic_fallback))
47
+ end
48
+ end
49
+ end
31
50
  end
@@ -29,7 +29,7 @@ class TestGtkImage < Test::Unit::TestCase
29
29
  end
30
30
 
31
31
  test "icon" do
32
- icon = Gio::ThemedIcon.new("gtk-open")
32
+ icon = Gio::ThemedIcon.new("document-open")
33
33
  image = Gtk::Image.new(:icon => icon,
34
34
  :size => :dialog)
35
35
  assert_equal([
@@ -59,4 +59,8 @@ class TestGtkTreeIter < Test::Unit::TestCase
59
59
  @iter.next!
60
60
  assert_equal("second", @iter[0])
61
61
  end
62
+
63
+ test "#parent" do
64
+ # TODO
65
+ end
62
66
  end
@@ -145,4 +145,46 @@ class TestGtkWidget < Test::Unit::TestCase
145
145
  end
146
146
  end
147
147
  end
148
+
149
+ sub_test_case "#render_icon_pixbuf" do
150
+ test "size: symbol" do
151
+ window = Gtk::Window.new
152
+ window.render_icon_pixbuf(:directory, :menu)
153
+ end
154
+ end
155
+
156
+ sub_test_case ".bind_template_child" do
157
+ setup do
158
+ only_gtk_version(3, 10, 0)
159
+ @resource_data = File.read(fixture_path("simple_window.ui"))
160
+ end
161
+
162
+ test "nothing" do
163
+ data = @resource_data
164
+ widget_class = Class.new(Gtk::Window) do
165
+ type_register "BindTemplateChildNothing"
166
+
167
+ singleton_class.send(:define_method, :init) do
168
+ set_template(:data => data)
169
+ end
170
+ end
171
+ widget = widget_class.new
172
+ assert_nil(widget.get_template_child(widget_class, :label))
173
+ end
174
+
175
+ test "bind" do
176
+ data = @resource_data
177
+ widget_class = Class.new(Gtk::Window) do
178
+ type_register "BindTemplateChildBind"
179
+
180
+ singleton_class.send(:define_method, :init) do
181
+ set_template(:data => data)
182
+ bind_template_child(:label)
183
+ end
184
+ end
185
+ widget = widget_class.new
186
+ assert_equal(Gtk::Label,
187
+ widget.get_template_child(widget_class, :label).class)
188
+ end
189
+ end
148
190
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk3
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-13 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glib2
@@ -16,98 +16,98 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.2
19
+ version: 3.0.3
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 3.0.2
26
+ version: 3.0.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gio2
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.2
33
+ version: 3.0.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.2
40
+ version: 3.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: atk
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.2
47
+ version: 3.0.3
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.2
54
+ version: 3.0.3
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pango
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 3.0.2
61
+ version: 3.0.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 3.0.2
68
+ version: 3.0.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: gdk_pixbuf2
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 3.0.2
75
+ version: 3.0.3
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 3.0.2
82
+ version: 3.0.3
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: gdk3
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 3.0.2
89
+ version: 3.0.3
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 3.0.2
96
+ version: 3.0.3
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: gobject-introspection
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: 3.0.2
103
+ version: 3.0.3
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: 3.0.2
110
+ version: 3.0.3
111
111
  description: Ruby/GTK3 is a Ruby binding of GTK+-3.x.
112
112
  email: ruby-gnome2-devel-en@lists.sourceforge.net
113
113
  executables: []
@@ -148,6 +148,7 @@ files:
148
148
  - lib/gtk3/font-chooser-dialog.rb
149
149
  - lib/gtk3/gdk-drag-context.rb
150
150
  - lib/gtk3/gesture-multi-press.rb
151
+ - lib/gtk3/icon-size.rb
151
152
  - lib/gtk3/icon-theme.rb
152
153
  - lib/gtk3/icon-view.rb
153
154
  - lib/gtk3/image-menu-item.rb
@@ -360,6 +361,13 @@ files:
360
361
  - sample/tutorial/exampleapp.desktop
361
362
  - sample/tutorial/exampleapp.png
362
363
  - sample/tutorial/exampleapp1/exampleapp.rb
364
+ - sample/tutorial/exampleapp10/app-menu.ui
365
+ - sample/tutorial/exampleapp10/exampleapp.gresource.xml
366
+ - sample/tutorial/exampleapp10/exampleapp.rb
367
+ - sample/tutorial/exampleapp10/gears-menu.ui
368
+ - sample/tutorial/exampleapp10/org.gtk.exampleapp.gschema.xml
369
+ - sample/tutorial/exampleapp10/prefs.ui
370
+ - sample/tutorial/exampleapp10/window.ui
363
371
  - sample/tutorial/exampleapp2/exampleapp.gresource.xml
364
372
  - sample/tutorial/exampleapp2/exampleapp.rb
365
373
  - sample/tutorial/exampleapp2/window.ui
@@ -445,6 +453,7 @@ files:
445
453
  - test/test-gtk-gesture-single.rb
446
454
  - test/test-gtk-gesture.rb
447
455
  - test/test-gtk-header-bar.rb
456
+ - test/test-gtk-icon-size.rb
448
457
  - test/test-gtk-icon-theme.rb
449
458
  - test/test-gtk-icon-view.rb
450
459
  - test/test-gtk-image.rb