gio2 2.2.5 → 3.0.1

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: a485cf4ab6ef8555c57e552dc9029116a25693d2
4
- data.tar.gz: 83c0c2ce0a9edfb967e5df79fd3b67702927f725
3
+ metadata.gz: 08aa0b2ec12cbecf736185c296186a2402e3b1af
4
+ data.tar.gz: 9dd1864abc6b3c4e0c7ed4b4aa623c84fe2ac933
5
5
  SHA512:
6
- metadata.gz: 3e4d4b3751398d8fd60de994f86ced447419403abad96253337486562823362024dcf8b99e0fa67fa7e3cb47fc075c784e6edf1dbc0b49794f151bfd6b6a3b4f
7
- data.tar.gz: 653850c7628f74fa3c55a88a80765670277672db884bc7d486bc14181d0b6911ce1ce9be34d076fcefbb337bea39741494ccf8c8d1af50766f9654279c16270d
6
+ metadata.gz: 34beed6d9b9aaaf10c4d5d6596ef4cf2b0981620e0414b4e965738c107ccdcf87f9f33b376184422a9acc6780c067803ec8920229208075153c2fed523311aef
7
+ data.tar.gz: 8475639689b9e86af70941ee3f87f88069990b3d7b4a4cc8a117cafc667d1f49f383dc41d7d25432d2ebfdd14f17febd50ee4c8193d159be3633925e4d584494
@@ -0,0 +1,54 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2015 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gio2.h"
22
+
23
+ #define RG_TARGET_NAMESPACE cApplication
24
+
25
+ static VALUE
26
+ rg_open_signal_func(G_GNUC_UNUSED guint num, const GValue *values)
27
+ {
28
+ VALUE rb_files;
29
+ GFile **files;
30
+ gint i, n_files;
31
+
32
+ files = g_value_get_pointer(&(values[1]));
33
+ n_files = g_value_get_int(&(values[2]));
34
+ rb_files = rb_ary_new2(n_files);
35
+ for (i = 0; i < n_files; i++) {
36
+ GFile *file = files[i];
37
+ rb_ary_push(rb_files, GOBJ2RVAL(file));
38
+ }
39
+
40
+ return rb_ary_new3(3,
41
+ GVAL2RVAL(&values[0]),
42
+ rb_files,
43
+ GVAL2RVAL(&values[3]));
44
+ }
45
+
46
+ void
47
+ rb_gio2_init_application (VALUE mGio)
48
+ {
49
+ VALUE RG_TARGET_NAMESPACE;
50
+
51
+ RG_TARGET_NAMESPACE = rb_const_get(mGio, rb_intern("Application"));
52
+
53
+ G_DEF_SIGNAL_FUNC(RG_TARGET_NAMESPACE, "open", rg_open_signal_func);
54
+ }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2014 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -22,11 +22,58 @@
22
22
 
23
23
  #define RG_TARGET_NAMESPACE rb_mGio
24
24
 
25
+ static gboolean
26
+ name_equal(GIArgInfo *info, const gchar *target_name)
27
+ {
28
+ GITypeInfo type_info;
29
+ GIBaseInfo *interface_info;
30
+ const gchar *namespace;
31
+ const gchar *name;
32
+ gboolean equal_name_p = FALSE;
33
+
34
+ g_arg_info_load_type(info, &type_info);
35
+ interface_info = g_type_info_get_interface(&type_info);
36
+ namespace = g_base_info_get_namespace(interface_info);
37
+ name = g_base_info_get_name(interface_info);
38
+ if (strcmp(namespace, "Gio") == 0 && strcmp(name, target_name) == 0) {
39
+ equal_name_p = TRUE;
40
+ }
41
+ g_base_info_unref(interface_info);
42
+
43
+ return equal_name_p;
44
+ }
45
+
46
+ static void
47
+ rb_gio2_async_ready_callback_callback(GObject *source_object,
48
+ GAsyncResult *result,
49
+ gpointer user_data)
50
+ {
51
+ RBGICallbackData *callback_data = user_data;
52
+ ID id_call;
53
+
54
+ CONST_ID(id_call, "call");
55
+ rb_funcall(callback_data->rb_callback, id_call, 2,
56
+ GOBJ2RVAL(source_object), GOBJ2RVAL(result));
57
+ }
58
+
59
+ static gpointer
60
+ rb_gio2_async_ready_callback_finder(GIArgInfo *info)
61
+ {
62
+ if (!name_equal(info, "AsyncReadyCallback")) {
63
+ return NULL;
64
+ }
65
+ return rb_gio2_async_ready_callback_callback;
66
+ }
67
+
25
68
  void
26
69
  Init_gio2 (void)
27
70
  {
28
71
  VALUE RG_TARGET_NAMESPACE;
29
72
 
30
73
  RG_TARGET_NAMESPACE = rb_define_module("Gio");
74
+
75
+ rb_gio2_init_application(RG_TARGET_NAMESPACE);
31
76
  rb_gio2_init_pollable_source(RG_TARGET_NAMESPACE);
77
+
78
+ rb_gi_callback_register_finder(rb_gio2_async_ready_callback_finder);
32
79
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2014 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2014-2015 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -23,4 +23,5 @@
23
23
  #include <rb-gobject-introspection.h>
24
24
 
25
25
  extern void Init_gio2 (void);
26
+ G_GNUC_INTERNAL extern void rb_gio2_init_application (VALUE rb_mGio);
26
27
  G_GNUC_INTERNAL extern void rb_gio2_init_pollable_source (VALUE rb_mGio);
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2013-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
@@ -24,7 +24,6 @@ GLib.prepend_dll_path(vendor_bin_dir)
24
24
  vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
25
25
  GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
26
26
 
27
- require "gio2/deprecated"
28
27
  require "gio2/loader"
29
28
 
30
29
  module Gio
@@ -0,0 +1,57 @@
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 Gio
18
+ module ActionMap
19
+ alias_method :add_action_raw, :add_action
20
+ def add_action(action)
21
+ action = convert_to_action(action) unless action.is_a?(Action)
22
+ add_action_raw(action)
23
+ actions[action.name] = action
24
+ end
25
+
26
+ alias_method :remove_action_raw, :remove_action
27
+ def remove_action(name)
28
+ remove_action_raw(name)
29
+ actions.delete(name)
30
+ end
31
+
32
+ def add_actions(actions)
33
+ actions.each do |action|
34
+ add_action(action)
35
+ end
36
+ end
37
+
38
+ private
39
+ def actions
40
+ @acitions ||= {}
41
+ end
42
+
43
+ def convert_to_action(definition)
44
+ name = definition[:name]
45
+ parameter_type = definition[:parameter_type]
46
+ callback = definition[:callback]
47
+
48
+ action = SimpleAction.new(name, parameter_type)
49
+ if callback
50
+ action.signal_connect("activate") do |*args|
51
+ callback.call(*args)
52
+ end
53
+ end
54
+ action
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,30 @@
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 Gio
18
+ module Action
19
+ alias_method :activate_raw, :activate
20
+ def activate(parameter=nil)
21
+ case parameter
22
+ when nil, GLib::Variant
23
+ # do nothing
24
+ else
25
+ parameter = GLib::Variant.new(parameter)
26
+ end
27
+ activate_raw(parameter)
28
+ end
29
+ end
30
+ end
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2013-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
@@ -50,11 +50,16 @@ module Gio
50
50
  end
51
51
 
52
52
  def require_libraries
53
- require "gio2/resources"
53
+ require "gio2/action"
54
+ require "gio2/action-map"
54
55
  require "gio2/inet-address"
55
56
  require "gio2/input-stream"
56
57
  require "gio2/pollable-input-stream"
57
58
  require "gio2/pollable-output-stream"
59
+ require "gio2/resources"
60
+ require "gio2/simple-action"
61
+
62
+ require "gio2/deprecated"
58
63
  end
59
64
 
60
65
  def define_content_type_class
@@ -183,7 +188,6 @@ module Gio
183
188
  case klass.name
184
189
  when "Gio::File"
185
190
  load_function_infos_file(infos, klass)
186
- super
187
191
  else
188
192
  super
189
193
  end
@@ -0,0 +1,27 @@
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 Gio
18
+ class SimpleAction
19
+ alias_method :initialize_raw, :initialize
20
+ def initialize(name, parameter_type=nil, state=nil)
21
+ if parameter_type.is_a?(String)
22
+ parameter_type = GLib::VariantType.new(parameter_type)
23
+ end
24
+ initialize_raw(name, parameter_type, state)
25
+ end
26
+ end
27
+ end
@@ -38,11 +38,13 @@ modules.each do |target, module_name|
38
38
  $LOAD_PATH.unshift(File.join(target, "lib"))
39
39
  end
40
40
 
41
+ Dir.chdir(File.join(gio2_base, "test", "fixture", "resource")) do
42
+ system("rake") or exit(false)
43
+ end
44
+
41
45
  $LOAD_PATH.unshift(File.join(glib_base, "test"))
42
46
  require "glib-test-init"
43
47
 
44
- $VERBOSE = false # TODO: remove me
45
-
46
48
  $LOAD_PATH.unshift(File.join(gio2_base, "test"))
47
49
  require "gio2-test-utils"
48
50
 
@@ -0,0 +1,51 @@
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
+
18
+ class TestActionMap < Test::Unit::TestCase
19
+ def setup
20
+ @map = Gio::SimpleActionGroup.new
21
+ end
22
+
23
+ sub_test_case "#add_actions" do
24
+ test "name" do
25
+ @map.add_actions([
26
+ {
27
+ :name => "open",
28
+ }
29
+ ])
30
+ action = @map.lookup_action("open")
31
+ assert_equal("open", action.name)
32
+ end
33
+
34
+ test "parameter_type" do
35
+ args = nil
36
+ callback = lambda do |*callback_args|
37
+ args = callback_args
38
+ end
39
+ @map.add_actions([
40
+ {
41
+ :name => "open",
42
+ :parameter_type => "s",
43
+ :callback => callback,
44
+ }
45
+ ])
46
+ action = @map.lookup_action("open")
47
+ action.activate("X")
48
+ assert_equal([action, "X"], args)
49
+ end
50
+ end
51
+ end
@@ -17,17 +17,15 @@
17
17
  class TestFileMonitor < Test::Unit::TestCase
18
18
  class Flags < self
19
19
  def test_file_monitor_flags
20
- assert_nothing_raised do
21
- Gio::FileMonitorFlags.new(Gio::FileMonitorFlags::SEND_MOVED)
22
- end
20
+ assert_equal("send-moved",
21
+ Gio::FileMonitorFlags::SEND_MOVED.nick)
23
22
  end
24
23
  end
25
24
 
26
25
  class Event < self
27
26
  def test_file_monitor_event
28
- assert_nothing_raised do
29
- Gio::FileMonitorEvent.new(Gio::FileMonitorEvent::CHANGED)
30
- end
27
+ assert_equal("changed",
28
+ Gio::FileMonitorEvent::CHANGED.nick)
31
29
  end
32
30
  end
33
31
  end
@@ -0,0 +1,23 @@
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 TestMount < Test::Unit::TestCase
18
+ def test_can_unmount
19
+ assert do
20
+ Gio::Mount.method_defined?(:can_unmount?)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,44 @@
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
+
18
+ class TestSimpleAction < Test::Unit::TestCase
19
+ sub_test_case "#initialize" do
20
+ sub_test_case "parameter type" do
21
+ test "omit" do
22
+ action = Gio::SimpleAction.new("open")
23
+ assert_nil(action.parameter_type)
24
+ end
25
+
26
+ test "nil" do
27
+ action = Gio::SimpleAction.new("open", nil)
28
+ assert_nil(action.parameter_type)
29
+ end
30
+
31
+ test "String" do
32
+ action = Gio::SimpleAction.new("open", "s")
33
+ assert_equal(GLib::VariantType::STRING,
34
+ action.parameter_type)
35
+ end
36
+
37
+ test "GLib::VariantType" do
38
+ action = Gio::SimpleAction.new("open", GLib::VariantType::STRING)
39
+ assert_equal(GLib::VariantType::STRING,
40
+ action.parameter_type)
41
+ end
42
+ end
43
+ end
44
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gio2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 3.0.1
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-04-24 00:00:00.000000000 Z
11
+ date: 2015-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: glib2
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.5
19
+ version: 3.0.1
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: 2.2.5
26
+ version: 3.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gobject-introspection
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.5
33
+ version: 3.0.1
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: 2.2.5
40
+ version: 3.0.1
41
41
  description: Ruby/GIO2 is a Ruby binding of gio-2.x.
42
42
  email: ruby-gnome2-devel-en@lists.sourceforge.net
43
43
  executables: []
@@ -48,11 +48,14 @@ files:
48
48
  - Rakefile
49
49
  - ext/gio2/depend
50
50
  - ext/gio2/extconf.rb
51
+ - ext/gio2/rb-gio2-application.c
51
52
  - ext/gio2/rb-gio2-pollable-source.c
52
53
  - ext/gio2/rb-gio2.c
53
54
  - ext/gio2/rb-gio2.h
54
55
  - extconf.rb
55
56
  - lib/gio2.rb
57
+ - lib/gio2/action-map.rb
58
+ - lib/gio2/action.rb
56
59
  - lib/gio2/deprecated.rb
57
60
  - lib/gio2/inet-address.rb
58
61
  - lib/gio2/input-stream.rb
@@ -60,16 +63,17 @@ files:
60
63
  - lib/gio2/pollable-input-stream.rb
61
64
  - lib/gio2/pollable-output-stream.rb
62
65
  - lib/gio2/resources.rb
66
+ - lib/gio2/simple-action.rb
63
67
  - test/fixture/content-type/x-content/unix-software/autorun.sh
64
68
  - test/fixture/resource/Rakefile
65
69
  - test/fixture/resource/logo.png
66
- - test/fixture/resource/ruby-gio2.gresource
67
70
  - test/fixture/resource/ruby-gio2.gresource.xml
68
71
  - test/gio2-test-utils.rb
69
72
  - test/gio2-test-utils/fixture.rb
70
73
  - test/gio2-test-utils/omissions.rb
71
74
  - test/gio2-test-utils/socket-client.rb
72
75
  - test/run-test.rb
76
+ - test/test-action-map.rb
73
77
  - test/test-buffered-input-stream.rb
74
78
  - test/test-charset-converter.rb
75
79
  - test/test-content-type.rb
@@ -82,10 +86,12 @@ files:
82
86
  - test/test-input-stream.rb
83
87
  - test/test-memory-input-stream.rb
84
88
  - test/test-memory-output-stream.rb
89
+ - test/test-mount.rb
85
90
  - test/test-output-stream.rb
86
91
  - test/test-pollable-input-stream.rb
87
92
  - test/test-pollable-output-stream.rb
88
93
  - test/test-resources.rb
94
+ - test/test-simple-action.rb
89
95
  homepage: http://ruby-gnome2.sourceforge.jp/
90
96
  licenses:
91
97
  - LGPLv2.1 or later