[DRE-commits] [ruby-gnome2] 08/31: New upstream version 3.0.3
Daisuke Higuchi
dai at moszumanska.debian.org
Mon Oct 10 13:40:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
dai pushed a commit to branch exp/debian
in repository ruby-gnome2.
commit 570c82235a671b6f5a8c9b681feaf36d1e516d39
Author: HIGUCHI Daisuke (VDR dai) <dai at debian.org>
Date: Sun Oct 9 21:56:26 2016 +0900
New upstream version 3.0.3
---
NEWS | 2 +-
atk/test/atk-test-utils.rb | 1 -
cairo-gobject/test/cairo-gobject-test-utils.rb | 1 -
.../test/clutter-gstreamer-test-utils.rb | 1 -
clutter-gtk/test/clutter-gtk-test-utils.rb | 1 -
clutter/test/clutter-test-utils.rb | 1 -
gdk3-no-gi/test/gdk-test-utils.rb | 1 -
gdk3/test/gdk-test-utils.rb | 1 -
gio2/test/gio2-test-utils.rb | 1 -
glib2/ext/glib2/rbglib.h | 2 +-
.../ext/gobject-introspection/rb-gi-repository.c | 19 ++
gobject-introspection/lib/gobject-introspection.rb | 9 +-
.../test/gobject-introspection-test-utils.rb | 1 -
gobject-introspection/test/test-repository.rb | 13 +-
gtk3/lib/gtk3.rb | 9 +-
gtk3/lib/gtk3/{target-entry.rb => icon-size.rb} | 17 +-
gtk3/lib/gtk3/icon-theme.rb | 10 +
gtk3/lib/gtk3/image.rb | 5 +-
gtk3/lib/gtk3/loader.rb | 13 +-
gtk3/lib/gtk3/spin-button.rb | 2 +-
gtk3/lib/gtk3/table.rb | 6 +-
gtk3/lib/gtk3/target-entry.rb | 4 +-
gtk3/lib/gtk3/tree-iter.rb | 6 +-
gtk3/lib/gtk3/tree-model.rb | 11 +
gtk3/lib/gtk3/widget.rb | 16 +-
gtk3/sample/tutorial/exampleapp10/app-menu.ui | 18 ++
.../tutorial/exampleapp10/exampleapp.gresource.xml | 9 +
gtk3/sample/tutorial/exampleapp10/exampleapp.rb | 267 +++++++++++++++++++++
gtk3/sample/tutorial/exampleapp10/gears-menu.ui | 16 ++
.../exampleapp10/org.gtk.exampleapp.gschema.xml | 25 ++
gtk3/sample/tutorial/exampleapp10/prefs.ui | 70 ++++++
gtk3/sample/tutorial/exampleapp10/window.ui | 118 +++++++++
.../icon-theme.rb => test/test-gtk-icon-size.rb} | 20 +-
gtk3/test/test-gtk-icon-theme.rb | 19 ++
gtk3/test/test-gtk-image.rb | 2 +-
gtk3/test/test-gtk-tree-iter.rb | 4 +
gtk3/test/test-gtk-widget.rb | 42 ++++
rsvg2/test/rsvg2-test-utils.rb | 1 -
vte3/test/vte3-test-utils.rb | 1 -
webkit-gtk/test/webkit-gtk-test-utils.rb | 1 -
webkit-gtk2/test/webkit-gtk-test-utils.rb | 1 -
41 files changed, 708 insertions(+), 59 deletions(-)
diff --git a/NEWS b/NEWS
index a0bc444..13464bd 100644
--- a/NEWS
+++ b/NEWS
@@ -84,7 +84,7 @@ It is a compatibility improvement release of 3.0.1.
* Improvements
* Windows: Added missing Ruby/Pango dependency.
- * Windows: Updated loaders.cache for gdk-pixbuf automatically.
+ * Windows: Updated loaders.cache for gdk-pixbuf automatically.
==== Ruby/GStreamer
diff --git a/atk/test/atk-test-utils.rb b/atk/test/atk-test-utils.rb
index aae01c7..3b95463 100644
--- a/atk/test/atk-test-utils.rb
+++ b/atk/test/atk-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module AtkTestUtils
end
diff --git a/cairo-gobject/test/cairo-gobject-test-utils.rb b/cairo-gobject/test/cairo-gobject-test-utils.rb
index 7dc3411..12413bd 100644
--- a/cairo-gobject/test/cairo-gobject-test-utils.rb
+++ b/cairo-gobject/test/cairo-gobject-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module CairoGObjectTestUtils
end
diff --git a/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb b/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb
index 615d835..417a5de 100644
--- a/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb
+++ b/clutter-gstreamer/test/clutter-gstreamer-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module ClutterGStreamerTestUtils
def later_version?(major, minor, micro=nil)
diff --git a/clutter-gtk/test/clutter-gtk-test-utils.rb b/clutter-gtk/test/clutter-gtk-test-utils.rb
index 04ddebc..1a6ebf6 100644
--- a/clutter-gtk/test/clutter-gtk-test-utils.rb
+++ b/clutter-gtk/test/clutter-gtk-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module ClutterGtkTestUtils
end
diff --git a/clutter/test/clutter-test-utils.rb b/clutter/test/clutter-test-utils.rb
index 0ab2042..e971909 100644
--- a/clutter/test/clutter-test-utils.rb
+++ b/clutter/test/clutter-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module ClutterTestUtils
private
diff --git a/gdk3-no-gi/test/gdk-test-utils.rb b/gdk3-no-gi/test/gdk-test-utils.rb
index f9ef9c2..2298af5 100644
--- a/gdk3-no-gi/test/gdk-test-utils.rb
+++ b/gdk3-no-gi/test/gdk-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module GdkTestUtils
end
diff --git a/gdk3/test/gdk-test-utils.rb b/gdk3/test/gdk-test-utils.rb
index 6cf8eac..8d5c5fe 100644
--- a/gdk3/test/gdk-test-utils.rb
+++ b/gdk3/test/gdk-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module GdkTestUtils
private
diff --git a/gio2/test/gio2-test-utils.rb b/gio2/test/gio2-test-utils.rb
index e943c24..bb16a29 100644
--- a/gio2/test/gio2-test-utils.rb
+++ b/gio2/test/gio2-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
require "gio2-test-utils/fixture"
require "gio2-test-utils/omissions"
diff --git a/glib2/ext/glib2/rbglib.h b/glib2/ext/glib2/rbglib.h
index 278bbf1..70c4a97 100644
--- a/glib2/ext/glib2/rbglib.h
+++ b/glib2/ext/glib2/rbglib.h
@@ -36,7 +36,7 @@ extern "C" {
#define RBGLIB_MAJOR_VERSION 3
#define RBGLIB_MINOR_VERSION 0
-#define RBGLIB_MICRO_VERSION 2
+#define RBGLIB_MICRO_VERSION 3
#ifndef RSTRING_PTR
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
diff --git a/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c b/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c
index b007dde..f7cbd3d 100644
--- a/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c
+++ b/gobject-introspection/ext/gobject-introspection/rb-gi-repository.c
@@ -46,6 +46,19 @@ rg_s_default(G_GNUC_UNUSED VALUE klass)
return GOBJ2RVAL(g_irepository_get_default());
}
+static VALUE
+rg_s_prepend_search_path(VALUE klass, VALUE rb_path)
+{
+ g_irepository_prepend_search_path(RVAL2CSTR(rb_path));
+ return klass;
+}
+
+static VALUE
+rg_s_search_path(G_GNUC_UNUSED VALUE klass)
+{
+ return FILENAMEGSLIST2RVAL(g_irepository_get_search_path());
+}
+
/* Force the namespace to be loaded if it isn't already. If namespace is not
* loaded, this function will search for a ".typelib" file using the repository
@@ -101,6 +114,10 @@ rg_get_dependencies(VALUE self, VALUE rb_namespace)
repository = SELF(self);
namespace_ = RVAL2CSTR(rb_namespace);
dependencies = g_irepository_get_dependencies(repository, namespace_);
+ if (!dependencies) {
+ return Qnil;
+ }
+
rb_dependencies = rb_ary_new();
for (i = 0; dependencies[i]; i++) {
rb_ary_push(rb_dependencies, CSTR2RVAL(dependencies[i]));
@@ -234,6 +251,8 @@ rb_gi_repository_init(VALUE rb_mGI)
RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_IREPOSITORY, "Repository", rb_mGI);
RG_DEF_SMETHOD(default, 0);
+ RG_DEF_SMETHOD(prepend_search_path, 1);
+ RG_DEF_SMETHOD(search_path, 0);
RG_DEF_METHOD(require, -1);
RG_DEF_METHOD(get_dependencies, 1);
RG_DEF_METHOD(loaded_namespaces, 0);
diff --git a/gobject-introspection/lib/gobject-introspection.rb b/gobject-introspection/lib/gobject-introspection.rb
index 9e77abb..348aa85 100644
--- a/gobject-introspection/lib/gobject-introspection.rb
+++ b/gobject-introspection/lib/gobject-introspection.rb
@@ -19,7 +19,14 @@ require "glib2"
module GObjectIntrospection
class << self
def prepend_typelib_path(path)
- GLib.prepend_path_to_environment_variable(path, "GI_TYPELIB_PATH")
+ path = Pathname(path) unless path.is_a?(Pathname)
+ return unless path.exist?
+
+ dir = path.to_s
+ dir = dir.gsub("/", File::ALT_SEPARATOR) if File::ALT_SEPARATOR
+ return if Repository.search_path.include?(dir)
+
+ Repository.prepend_search_path(dir)
end
end
end
diff --git a/gobject-introspection/test/gobject-introspection-test-utils.rb b/gobject-introspection/test/gobject-introspection-test-utils.rb
index 49ecfb3..d472bcb 100644
--- a/gobject-introspection/test/gobject-introspection-test-utils.rb
+++ b/gobject-introspection/test/gobject-introspection-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module GObjectIntrospectionTestUtils
def require_version(major, minor, micro)
diff --git a/gobject-introspection/test/test-repository.rb b/gobject-introspection/test/test-repository.rb
index 7dd2903..1c1795d 100644
--- a/gobject-introspection/test/test-repository.rb
+++ b/gobject-introspection/test/test-repository.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
+# Copyright (C) 2012-2015 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -23,6 +23,13 @@ class TestRepository < Test::Unit::TestCase
@repository.require("Gio")
end
+ def test_search_path
+ path = GObjectIntrospection::Repository.search_path
+ GObjectIntrospection::Repository.prepend_search_path(__dir__)
+ assert_equal([__dir__] + path,
+ GObjectIntrospection::Repository.search_path)
+ end
+
def test_get_n_infos
assert_kind_of(Integer, @repository.get_n_infos("GObject"))
end
@@ -34,8 +41,8 @@ class TestRepository < Test::Unit::TestCase
def test_get_dependencies
require_version(1, 36, 0)
- assert_equal(["GObject-2.0"].sort,
- @repository.get_dependencies("Gio").sort)
+ assert_equal(["GLib-2.0"].sort,
+ @repository.get_dependencies("GObject").sort)
end
def test_loaded_namespaces
diff --git a/gtk3/lib/gtk3.rb b/gtk3/lib/gtk3.rb
index 1901ed6..014e2eb 100644
--- a/gtk3/lib/gtk3.rb
+++ b/gtk3/lib/gtk3.rb
@@ -19,14 +19,7 @@ require "atk"
require "gdk3"
require "gio2"
-base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
-vendor_dir = base_dir + "vendor" + "local"
-vendor_bin_dir = vendor_dir + "bin"
-GLib.prepend_dll_path(vendor_bin_dir)
-vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
-GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
-
-if vendor_dir.exist?
+if /cygwin|mingw|mswin/ === RUBY_PLATFORM
require "rsvg2"
end
diff --git a/gtk3/lib/gtk3/target-entry.rb b/gtk3/lib/gtk3/icon-size.rb
similarity index 74%
copy from gtk3/lib/gtk3/target-entry.rb
copy to gtk3/lib/gtk3/icon-size.rb
index 39a7295..79f2dfa 100644
--- a/gtk3/lib/gtk3/target-entry.rb
+++ b/gtk3/lib/gtk3/icon-size.rb
@@ -15,13 +15,18 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
module Gtk
- class TargetEntry
- alias_method :initialize_raw, :initialize
- def initialize(target, flags, info)
- unless flags.is_a?(Gtk::TargetFlags)
- flags = Gtk::TargetFlags.new(flags)
+ class IconSize
+ class << self
+ alias_method :lookup_raw, :lookup
+ def lookup(size)
+ size = new(size) unless size.is_a?(self)
+ valid, width, height = lookup_raw(size)
+ if valid
+ [width, height]
+ else
+ nil
+ end
end
- initialize_raw(target, flags.to_i, info)
end
end
end
diff --git a/gtk3/lib/gtk3/icon-theme.rb b/gtk3/lib/gtk3/icon-theme.rb
index 2f0d00f..1eba214 100644
--- a/gtk3/lib/gtk3/icon-theme.rb
+++ b/gtk3/lib/gtk3/icon-theme.rb
@@ -24,5 +24,15 @@ module Gtk
end
choose_icon_raw(icon_names, size, flags)
end
+
+ alias_method :lookup_icon_raw, :lookup_icon
+ def lookup_icon(icon, size, flags)
+ case icon
+ when String, Symbol
+ lookup_icon_raw(icon.to_s, size, flags)
+ else
+ lookup_by_gicon(icon, size, flags)
+ end
+ end
end
end
diff --git a/gtk3/lib/gtk3/image.rb b/gtk3/lib/gtk3/image.rb
index 703566c..d31492c 100644
--- a/gtk3/lib/gtk3/image.rb
+++ b/gtk3/lib/gtk3/image.rb
@@ -87,10 +87,9 @@ module Gtk
case size
when String, Symbol
- size_name = size.to_s.gsub(/_/, "-")
- size = Gtk.icon_size_from_name("gtk-#{size_name}")
+ size = IconSize.new(size)
else
- size ||= Gtk::IconSize::BUTTON
+ size ||= IconSize::BUTTON
end
if stock
diff --git a/gtk3/lib/gtk3/loader.rb b/gtk3/lib/gtk3/loader.rb
index 9417bc3..b08e98d 100644
--- a/gtk3/lib/gtk3/loader.rb
+++ b/gtk3/lib/gtk3/loader.rb
@@ -110,6 +110,7 @@ module Gtk
require "gtk3/file-chooser-dialog"
require "gtk3/font-chooser-dialog"
require "gtk3/gesture-multi-press"
+ require "gtk3/icon-size"
require "gtk3/icon-theme"
require "gtk3/icon-view"
require "gtk3/image"
@@ -186,6 +187,10 @@ module Gtk
define_method(info, Gdk::DragContext, method_name)
when /\Abinding_/
# Ignore because singleton methods are defined.
+ when /\Aicon_size_/
+ icon_size_class = @base_module.const_get(:IconSize)
+ method_name = rubyish_method_name(info, :prefix => "icon_size_")
+ define_singleton_method(icon_size_class, method_name, info)
else
super
end
@@ -219,13 +224,13 @@ module Gtk
def define_enum(info)
case info.name
when /\AArrow/
- self.class.define_class(info.gtype, $POSTMATCH, Gtk::Arrow)
+ self.class.define_class(info.gtype, $POSTMATCH, Arrow)
when /\ALevelBar/
- self.class.define_class(info.gtype, $POSTMATCH, Gtk::LevelBar)
+ self.class.define_class(info.gtype, $POSTMATCH, LevelBar)
when /\ARevealer/
- self.class.define_class(info.gtype, $POSTMATCH, Gtk::Revealer)
+ self.class.define_class(info.gtype, $POSTMATCH, Revealer)
when /\AStack/
- self.class.define_class(info.gtype, $POSTMATCH, Gtk::Stack)
+ self.class.define_class(info.gtype, $POSTMATCH, Stack)
else
super
end
diff --git a/gtk3/lib/gtk3/spin-button.rb b/gtk3/lib/gtk3/spin-button.rb
index 3721049..22235cd 100644
--- a/gtk3/lib/gtk3/spin-button.rb
+++ b/gtk3/lib/gtk3/spin-button.rb
@@ -18,7 +18,7 @@ module Gtk
class SpinButton
alias_method :initialize_raw, :initialize
def initialize(arg0, arg1=nil, arg2=nil)
- if arg0.is_a?(Gtk::Adjustment)
+ if arg0.is_a?(Adjustment)
adjustment = arg0
climb_rate = arg1 || 0.0
digits = arg2 || 0
diff --git a/gtk3/lib/gtk3/table.rb b/gtk3/lib/gtk3/table.rb
index db20c22..13248b1 100644
--- a/gtk3/lib/gtk3/table.rb
+++ b/gtk3/lib/gtk3/table.rb
@@ -34,8 +34,10 @@ module Gtk
x_options=nil, y_options=nil,
x_space=nil, y_space=nil)
attach_raw(child, left, right, top, bottom,
- x_options, y_options,
- x_space || 0, y_space || 0)
+ x_options || [:expand, :fill],
+ y_options || [:expand, :fill],
+ x_space || 0,
+ y_space || 0)
end
end
end
diff --git a/gtk3/lib/gtk3/target-entry.rb b/gtk3/lib/gtk3/target-entry.rb
index 39a7295..dacdcde 100644
--- a/gtk3/lib/gtk3/target-entry.rb
+++ b/gtk3/lib/gtk3/target-entry.rb
@@ -18,8 +18,8 @@ module Gtk
class TargetEntry
alias_method :initialize_raw, :initialize
def initialize(target, flags, info)
- unless flags.is_a?(Gtk::TargetFlags)
- flags = Gtk::TargetFlags.new(flags)
+ unless flags.is_a?(TargetFlags)
+ flags = TargetFlags.new(flags)
end
initialize_raw(target, flags.to_i, info)
end
diff --git a/gtk3/lib/gtk3/tree-iter.rb b/gtk3/lib/gtk3/tree-iter.rb
index 269dfd5..bf052df 100644
--- a/gtk3/lib/gtk3/tree-iter.rb
+++ b/gtk3/lib/gtk3/tree-iter.rb
@@ -1,4 +1,4 @@
-# Copyright (C) 2014 Ruby-GNOME2 Project Team
+# Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -47,6 +47,10 @@ module Gtk
@model.iter_next(self)
end
+ def parent
+ @model.iter_parent(self)
+ end
+
def ==(other)
other.is_a?(self.class) and
@model == other.model and
diff --git a/gtk3/lib/gtk3/tree-model.rb b/gtk3/lib/gtk3/tree-model.rb
index e93784a..6919249 100644
--- a/gtk3/lib/gtk3/tree-model.rb
+++ b/gtk3/lib/gtk3/tree-model.rb
@@ -43,6 +43,17 @@ module Gtk
end
end
+ alias_method :iter_parent_raw, :iter_parent
+ def iter_parent(iter)
+ got, iter = iter_parent_raw(iter)
+ if got
+ setup_iter(iter)
+ iter
+ else
+ nil
+ end
+ end
+
alias_method :get_value_raw, :get_value
def get_value(iter, column)
get_value_raw(iter, column).value
diff --git a/gtk3/lib/gtk3/widget.rb b/gtk3/lib/gtk3/widget.rb
index d6bcd72..1529f52 100644
--- a/gtk3/lib/gtk3/widget.rb
+++ b/gtk3/lib/gtk3/widget.rb
@@ -24,6 +24,10 @@ module Gtk
@have_template ||= false
end
+ def template_children
+ @template_children ||= []
+ end
+
if method_defined?(:set_template)
alias_method :set_template_raw, :set_template
def set_template(template)
@@ -41,8 +45,7 @@ module Gtk
internal_child = options[:internal_child]
internal_child = false if internal_child.nil?
bind_template_child_full(name, internal_child, 0)
- @template_children ||= []
- @template_children << name
+ template_children << name
attr_reader(name)
end
end
@@ -97,6 +100,12 @@ module Gtk
value.value
end
+ alias_method :render_icon_pixbuf_raw, :render_icon_pixbuf
+ def render_icon_pixbuf(stock_id, size)
+ size = IconSize.new(size) unless size.is_a?(IconSize)
+ render_icon_pixbuf_raw(stock_id, size)
+ end
+
private
def initialize_post
klass = self.class
@@ -105,8 +114,7 @@ module Gtk
init_template
gtype = klass.gtype
- child_names = klass.instance_variable_get(:@template_children)
- child_names.each do |name|
+ klass.template_children.each do |name|
instance_variable_set("@#{name}", get_template_child(gtype, name))
end
end
diff --git a/gtk3/sample/tutorial/exampleapp10/app-menu.ui b/gtk3/sample/tutorial/exampleapp10/app-menu.ui
new file mode 100644
index 0000000..e1e131c
--- /dev/null
+++ b/gtk3/sample/tutorial/exampleapp10/app-menu.ui
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <menu id="appmenu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Preferences</attribute>
+ <attribute name="action">app.preferences</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Quit</attribute>
+ <attribute name="action">app.quit</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
diff --git a/gtk3/sample/tutorial/exampleapp10/exampleapp.gresource.xml b/gtk3/sample/tutorial/exampleapp10/exampleapp.gresource.xml
new file mode 100644
index 0000000..ace59c8
--- /dev/null
+++ b/gtk3/sample/tutorial/exampleapp10/exampleapp.gresource.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+ <gresource prefix="/org/gtk/exampleapp">
+ <file preprocess="xml-stripblanks">window.ui</file>
+ <file preprocess="xml-stripblanks">app-menu.ui</file>
+ <file preprocess="xml-stripblanks">gears-menu.ui</file>
+ <file preprocess="xml-stripblanks">prefs.ui</file>
+ </gresource>
+</gresources>
diff --git a/gtk3/sample/tutorial/exampleapp10/exampleapp.rb b/gtk3/sample/tutorial/exampleapp10/exampleapp.rb
new file mode 100644
index 0000000..c52635e
--- /dev/null
+++ b/gtk3/sample/tutorial/exampleapp10/exampleapp.rb
@@ -0,0 +1,267 @@
+# Copyright (C) 2015 Ruby-GNOME2 Project Team
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Original:
+# * URL: https://git.gnome.org/browse/gtk+/tree/examples/application10/
+# * License: LGPL 2
+
+require "gtk3"
+
+require "fileutils"
+
+current_path = File.expand_path(File.dirname(__FILE__))
+gresource_bin = "#{current_path}/exampleapp.gresource"
+gresource_xml = "#{current_path}/exampleapp.gresource.xml"
+
+system("glib-compile-resources",
+ "--target", gresource_bin,
+ "--sourcedir", current_path,
+ gresource_xml)
+
+gschema_bin = "#{current_path}/gschemas.compiled"
+
+system("glib-compile-schemas", current_path)
+
+at_exit do
+ FileUtils.rm_f([gresource_bin, gschema_bin])
+end
+
+resource = Gio::Resource.load(gresource_bin)
+Gio::Resources.register(resource)
+
+ENV["GSETTINGS_SCHEMA_DIR"] = current_path
+
+def update_words(win)
+ tab = win.stack.visible_child
+ return unless tab
+ view = tab.child
+ buffer = view.buffer
+ iter = buffer.start_iter
+ strings = []
+ done = false
+ until iter.end?
+ until iter.starts_word
+ unless iter.forward_char
+ done = true
+ break
+ end
+ end
+ break if done
+ word_end = iter.clone
+ break unless word_end.forward_word_end
+ strings << buffer.get_text(iter, word_end, false)
+ iter = word_end
+ end
+ children = win.words.children
+ children.each { |c| win.words.remove(c) } unless children.empty?
+ strings.each do |s|
+ row = Gtk::Button.new(:label => s)
+ row.signal_connect("clicked") { |_widget| win.searchentry.text = s }
+ row.show
+ win.words.add(row)
+ end
+end
+
+def update_lines(win)
+ tab = win.stack.visible_child
+ return unless tab
+ view = tab.child
+ buffer = view.buffer
+ iter = buffer.start_iter
+ count = 0
+ until iter.end?
+ count += 1
+ break unless iter.forward_line
+ end
+ win.lines.text = count.to_s
+end
+
+class ExampleAppPrefs < Gtk::Dialog
+ type_register
+
+ class << self
+ def init
+ set_template(:resource => "/org/gtk/exampleapp/prefs.ui")
+ bind_template_child("font")
+ bind_template_child("transition")
+ end
+ end
+
+ def initialize(args)
+ parent = args[:transient_for]
+ super(:transient_for => parent, :use_header_bar => 1)
+ settings = Gio::Settings.new("org.gtk.exampleapp")
+ settings.bind("font",
+ font,
+ "font",
+ Gio::SettingsBindFlags::DEFAULT)
+ settings.bind("transition",
+ transition,
+ "active-id",
+ Gio::SettingsBindFlags::DEFAULT)
+ end
+end
+
+class ExampleAppWindow < Gtk::ApplicationWindow
+ type_register
+ class << self
+ def init
+ set_template(:resource => "/org/gtk/exampleapp/window.ui")
+ bind_template_child("stack")
+ bind_template_child("search")
+ bind_template_child("searchbar")
+ bind_template_child("searchentry")
+ bind_template_child("gears")
+ bind_template_child("words")
+ bind_template_child("sidebar")
+ bind_template_child("lines")
+ bind_template_child("lines_label")
+
+ set_connect_func do |name|
+ method(name)
+ end
+ end
+
+ private
+
+ def search_text_changed(search_entry)
+ text = search_entry.text
+ return if text.empty?
+
+ win = search_entry.toplevel
+ tab = win.stack.visible_child
+ view = tab.child
+ buffer = view.buffer
+ range = buffer.start_iter.forward_search(text,
+ Gtk::TextSearchFlags::CASE_INSENSITIVE)
+ return unless range
+ buffer.select_range(range[0], range[1])
+ view.scroll_to_iter(range[0], 0.0, false, 0.0, 0.0)
+ end
+
+ def visible_child_changed(stack, params)
+ return if stack.in_destruction?
+ win = stack.toplevel
+ win.searchbar.set_search_mode(false)
+ update_words(win)
+ update_lines(win)
+ end
+ end
+
+ def initialize(application)
+ super(:application => application)
+ @settings = Gio::Settings.new("org.gtk.exampleapp")
+ @settings.bind("transition",
+ stack,
+ "transition-type",
+ Gio::SettingsBindFlags::DEFAULT)
+ search.bind_property("active", searchbar, "search-mode-enabled", :bidirectional)
+ @settings.bind("show-words",
+ sidebar,
+ "reveal-child",
+ Gio::SettingsBindFlags::DEFAULT)
+ sidebar.signal_connect "notify::reveal-child" do |_sidebar, _gparamspec|
+ update_words(self)
+ end
+ builder = Gtk::Builder.new(:resource => "/org/gtk/exampleapp/gears-menu.ui")
+ menu = builder.get_object("menu")
+ gears.set_menu_model(menu)
+ action = @settings.create_action("show-words")
+ add_action(action)
+ action = Gio::PropertyAction.new("show-lines", lines, "visible")
+ add_action(action)
+ lines.bind_property("visible", lines_label, "visible", :default)
+ end
+
+ def open(file)
+ basename = file.basename
+
+ scrolled = Gtk::ScrolledWindow.new
+ scrolled.show
+ scrolled.set_hexpand(true)
+ scrolled.set_vexpand(true)
+
+ view = Gtk::TextView.new
+ view.set_editable(false)
+ view.set_cursor_visible(false)
+ view.show
+ scrolled.add(view)
+
+ stack.add_titled(scrolled, basename, basename)
+
+ stream = file.read
+ buffer = view.buffer
+ buffer.text = stream.read
+ tag = buffer.create_tag
+ @settings.bind("font", tag, "font", Gio::SettingsBindFlags::DEFAULT)
+ buffer.apply_tag(tag, buffer.start_iter, buffer.end_iter)
+ search.sensitive = true
+ update_words(self)
+ update_lines(self)
+ end
+end
+
+class ExampleApp < Gtk::Application
+ def initialize
+ super("org.gtk.exampleapp", :handles_open)
+
+ signal_connect "startup" do |application|
+ quit_accels = ["<Ctrl>Q"]
+ action = Gio::SimpleAction.new("quit")
+ action.signal_connect("activate") do |_action, _parameter|
+ application.quit
+ end
+ application.add_action(action)
+ application.set_accels_for_action("app.quit", quit_accels)
+
+ action = Gio::SimpleAction.new("preferences")
+ action.signal_connect("activate") do |_action, _parameter|
+ win = application.windows.first
+ prefs = ExampleAppPrefs.new(:transient_for => win,
+ :use_header_bar => true)
+ prefs.present
+ end
+ application.add_action(action)
+
+ builder = Gtk::Builder.new(:resource => "/org/gtk/exampleapp/app-menu.ui")
+ app_menu = builder.get_object("appmenu")
+ application.set_app_menu(app_menu)
+ end
+
+ signal_connect "activate" do |application|
+ window = ExampleAppWindow.new(application)
+ window.present
+ end
+
+ signal_connect "open" do |application, files, _hint|
+ windows = application.windows
+ win = nil
+ if windows.empty?
+ win = ExampleAppWindow.new(application)
+ else
+ win = windows.first
+ end
+
+ files.each { |file| win.open(file) }
+
+ win.present
+ end
+ end
+end
+
+app = ExampleApp.new
+
+puts app.run([$PROGRAM_NAME] + ARGV)
diff --git a/gtk3/sample/tutorial/exampleapp10/gears-menu.ui b/gtk3/sample/tutorial/exampleapp10/gears-menu.ui
new file mode 100644
index 0000000..fb0e929
--- /dev/null
+++ b/gtk3/sample/tutorial/exampleapp10/gears-menu.ui
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<interface>
+ <!-- interface-requires gtk+ 3.0 -->
+ <menu id="menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">_Words</attribute>
+ <attribute name="action">win.show-words</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_Lines</attribute>
+ <attribute name="action">win.show-lines</attribute>
+ </item>
+ </section>
+ </menu>
+</interface>
diff --git a/gtk3/sample/tutorial/exampleapp10/org.gtk.exampleapp.gschema.xml b/gtk3/sample/tutorial/exampleapp10/org.gtk.exampleapp.gschema.xml
new file mode 100644
index 0000000..a6929a8
--- /dev/null
+++ b/gtk3/sample/tutorial/exampleapp10/org.gtk.exampleapp.gschema.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schemalist>
+ <schema path="/org/gtk/exampleapp/" id="org.gtk.exampleapp">
+ <key name="font" type="s">
+ <default>'Monospace 12'</default>
+ <summary>Font</summary>
+ <description>The font to be used for content.</description>
+ </key>
+ <key name="transition" type="s">
+ <choices>
+ <choice value='none'/>
+ <choice value='crossfade'/>
+ <choice value='slide-left-right'/>
+ </choices>
+ <default>'none'</default>
+ <summary>Transition</summary>
+ <description>The transition to use when switching tabs.</description>
+ </key>
+ <key name="show-words" type="b">
+ <default>false</default>
+ <summary>Show words</summary>
+ <description>Whether to show a word list in the sidebar</description>
+ </key>
+ </schema>
+</schemalist>
diff --git a/gtk3/sample/tutorial/exampleapp10/prefs.ui b/gtk3/sample/tutorial/exampleapp10/prefs.ui
new file mode 100644
index 0000000..95e1cb8
--- /dev/null
+++ b/gtk3/sample/tutorial/exampleapp10/prefs.ui
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.8 -->
+ <template class="ExampleAppPrefs" parent="GtkDialog">
+ <property name="title" translatable="yes">Preferences</property>
+ <property name="resizable">False</property>
+ <property name="modal">True</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="vbox">
+ <child>
+ <object class="GtkGrid" id="grid">
+ <property name="visible">True</property>
+ <property name="margin">6</property>
+ <property name="row-spacing">12</property>
+ <property name="column-spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="fontlabel">
+ <property name="visible">True</property>
+ <property name="label">_Font:</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">font</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFontButton" id="font">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="transitionlabel">
+ <property name="visible">True</property>
+ <property name="label">_Transition:</property>
+ <property name="use-underline">True</property>
+ <property name="mnemonic-widget">transition</property>
+ <property name="xalign">1</property>
+ </object>
+ <packing>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxText" id="transition">
+ <property name="visible">True</property>
+ <items>
+ <item translatable="yes" id="none">None</item>
+ <item translatable="yes" id="crossfade">Fade</item>
+ <item translatable="yes" id="slide-left-right">Slide</item>
+ </items>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/gtk3/sample/tutorial/exampleapp10/window.ui b/gtk3/sample/tutorial/exampleapp10/window.ui
new file mode 100644
index 0000000..d5512fd
--- /dev/null
+++ b/gtk3/sample/tutorial/exampleapp10/window.ui
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.8 -->
+ <template class="ExampleAppWindow" parent="GtkApplicationWindow">
+ <property name="title" translatable="yes">Example Application</property>
+ <property name="default-width">600</property>
+ <property name="default-height">400</property>
+ <child type="titlebar">
+ <object class="GtkHeaderBar" id="header">
+ <property name="visible">True</property>
+ <property name="show-close-button">True</property>
+ <child>
+ <object class="GtkLabel" id="lines_label">
+ <property name="visible">False</property>
+ <property name="label" translatable="yes">Lines:</property>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="lines">
+ <property name="visible">False</property>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ </packing>
+ </child>
+ <child type="title">
+ <object class="GtkStackSwitcher" id="tabs">
+ <property name="visible">True</property>
+ <property name="margin">6</property>
+ <property name="stack">stack</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="search">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ <child>
+ <object class="GtkImage" id="search-icon">
+ <property name="visible">True</property>
+ <property name="icon-name">edit-find-symbolic</property>
+ <property name="icon-size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="gears">
+ <property name="visible">True</property>
+ <property name="direction">none</property>
+ <property name="use-popover">True</property>
+ <style>
+ <class name="image-button"/>
+ </style>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="content_box">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkSearchBar" id="searchbar">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkSearchEntry" id="searchentry">
+ <signal name="search-changed" handler="search_text_changed"/>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox" id="hbox">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkRevealer" id="sidebar">
+ <property name="visible">True</property>
+ <property name="transition-type">slide-right</property>
+ <child>
+ <object class="GtkScrolledWindow" id="sidebar-sw">
+ <property name="visible">True</property>
+ <property name="hscrollbar-policy">never</property>
+ <property name="vscrollbar-policy">automatic</property>
+ <child>
+ <object class="GtkListBox" id="words">
+ <property name="visible">True</property>
+ <property name="selection-mode">none</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkStack" id="stack">
+ <signal name="notify::visible-child" handler="visible_child_changed"/>
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/gtk3/lib/gtk3/icon-theme.rb b/gtk3/test/test-gtk-icon-size.rb
similarity index 71%
copy from gtk3/lib/gtk3/icon-theme.rb
copy to gtk3/test/test-gtk-icon-size.rb
index 2f0d00f..e053c71 100644
--- a/gtk3/lib/gtk3/icon-theme.rb
+++ b/gtk3/test/test-gtk-icon-size.rb
@@ -14,15 +14,19 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-module Gtk
- class IconTheme
- alias_method :choose_icon_raw, :choose_icon
- def choose_icon(icon_names, size, flags=nil)
- icon_names = [icon_names] unless icon_names.is_a?(Array)
- if flags.nil?
- flags = :generic_fallback
+class TestGtkIconSize < Test::Unit::TestCase
+ include GtkTestUtils
+
+ sub_test_case "class methods" do
+ sub_test_case ".lookup" do
+ test "valid" do
+ assert_equal([16, 16],
+ Gtk::IconSize.lookup(:menu))
+ end
+
+ test "invalid" do
+ assert_nil(Gtk::IconSize.lookup(:invalid))
end
- choose_icon_raw(icon_names, size, flags)
end
end
end
diff --git a/gtk3/test/test-gtk-icon-theme.rb b/gtk3/test/test-gtk-icon-theme.rb
index 223930f..1904ce4 100644
--- a/gtk3/test/test-gtk-icon-theme.rb
+++ b/gtk3/test/test-gtk-icon-theme.rb
@@ -28,4 +28,23 @@ class TestGtkIconTheme < Test::Unit::TestCase
assert_operator(@theme.icons("Actions"), :include?, "find")
end
end
+
+ sub_test_case "#lookup_icon" do
+ sub_test_case "icon" do
+ test "String" do
+ assert_not_nil(@theme.lookup_icon("search",
+ 16, :generic_fallback))
+ end
+
+ test "Symbol" do
+ assert_not_nil(@theme.lookup_icon("search",
+ 16, :generic_fallback))
+ end
+
+ test "Gio::Icon" do
+ icon = Gio::ThemedIcon.new("search")
+ assert_not_nil(@theme.lookup_icon(icon, 16, :generic_fallback))
+ end
+ end
+ end
end
diff --git a/gtk3/test/test-gtk-image.rb b/gtk3/test/test-gtk-image.rb
index 162195c..8820768 100644
--- a/gtk3/test/test-gtk-image.rb
+++ b/gtk3/test/test-gtk-image.rb
@@ -29,7 +29,7 @@ class TestGtkImage < Test::Unit::TestCase
end
test "icon" do
- icon = Gio::ThemedIcon.new("gtk-open")
+ icon = Gio::ThemedIcon.new("document-open")
image = Gtk::Image.new(:icon => icon,
:size => :dialog)
assert_equal([
diff --git a/gtk3/test/test-gtk-tree-iter.rb b/gtk3/test/test-gtk-tree-iter.rb
index a24e025..4b79c56 100644
--- a/gtk3/test/test-gtk-tree-iter.rb
+++ b/gtk3/test/test-gtk-tree-iter.rb
@@ -59,4 +59,8 @@ class TestGtkTreeIter < Test::Unit::TestCase
@iter.next!
assert_equal("second", @iter[0])
end
+
+ test "#parent" do
+ # TODO
+ end
end
diff --git a/gtk3/test/test-gtk-widget.rb b/gtk3/test/test-gtk-widget.rb
index 081b7ed..7049ff6 100644
--- a/gtk3/test/test-gtk-widget.rb
+++ b/gtk3/test/test-gtk-widget.rb
@@ -145,4 +145,46 @@ class TestGtkWidget < Test::Unit::TestCase
end
end
end
+
+ sub_test_case "#render_icon_pixbuf" do
+ test "size: symbol" do
+ window = Gtk::Window.new
+ window.render_icon_pixbuf(:directory, :menu)
+ end
+ end
+
+ sub_test_case ".bind_template_child" do
+ setup do
+ only_gtk_version(3, 10, 0)
+ @resource_data = File.read(fixture_path("simple_window.ui"))
+ end
+
+ test "nothing" do
+ data = @resource_data
+ widget_class = Class.new(Gtk::Window) do
+ type_register "BindTemplateChildNothing"
+
+ singleton_class.send(:define_method, :init) do
+ set_template(:data => data)
+ end
+ end
+ widget = widget_class.new
+ assert_nil(widget.get_template_child(widget_class, :label))
+ end
+
+ test "bind" do
+ data = @resource_data
+ widget_class = Class.new(Gtk::Window) do
+ type_register "BindTemplateChildBind"
+
+ singleton_class.send(:define_method, :init) do
+ set_template(:data => data)
+ bind_template_child(:label)
+ end
+ end
+ widget = widget_class.new
+ assert_equal(Gtk::Label,
+ widget.get_template_child(widget_class, :label).class)
+ end
+ end
end
diff --git a/rsvg2/test/rsvg2-test-utils.rb b/rsvg2/test/rsvg2-test-utils.rb
index bfd803d..de86c70 100644
--- a/rsvg2/test/rsvg2-test-utils.rb
+++ b/rsvg2/test/rsvg2-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
require "fileutils"
diff --git a/vte3/test/vte3-test-utils.rb b/vte3/test/vte3-test-utils.rb
index 03ca8aa..3c30150 100644
--- a/vte3/test/vte3-test-utils.rb
+++ b/vte3/test/vte3-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
module VteTestUtils
private
diff --git a/webkit-gtk/test/webkit-gtk-test-utils.rb b/webkit-gtk/test/webkit-gtk-test-utils.rb
index fd3649a..48aa51f 100644
--- a/webkit-gtk/test/webkit-gtk-test-utils.rb
+++ b/webkit-gtk/test/webkit-gtk-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
require "webkit-gtk-test-utils/omissions"
diff --git a/webkit-gtk2/test/webkit-gtk-test-utils.rb b/webkit-gtk2/test/webkit-gtk-test-utils.rb
index 4420e91..e8b05cd 100644
--- a/webkit-gtk2/test/webkit-gtk-test-utils.rb
+++ b/webkit-gtk2/test/webkit-gtk-test-utils.rb
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
require "test-unit"
-require "test/unit/notify"
require "webkit-gtk-test-utils/omissions"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-gnome2.git
More information about the Pkg-ruby-extras-commits
mailing list