gio2 0.90.3
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +60 -0
- data/README +34 -0
- data/Rakefile +76 -0
- data/ext/gio2/depend +5 -0
- data/ext/gio2/extconf.rb +91 -0
- data/ext/gio2/gappinfo.c +318 -0
- data/ext/gio2/gapplaunchcontext.c +79 -0
- data/ext/gio2/gasyncinitable.c +244 -0
- data/ext/gio2/gasyncresult.c +39 -0
- data/ext/gio2/gbufferedinputstream.c +184 -0
- data/ext/gio2/gbufferedoutputstream.c +82 -0
- data/ext/gio2/gcancellable.c +177 -0
- data/ext/gio2/gcharsetconverter.c +72 -0
- data/ext/gio2/gcontenttype.c +135 -0
- data/ext/gio2/gconverter.c +117 -0
- data/ext/gio2/gconverterinputstream.c +48 -0
- data/ext/gio2/gconverteroutputstream.c +48 -0
- data/ext/gio2/gdatainputstream.c +341 -0
- data/ext/gio2/gdataoutputstream.c +202 -0
- data/ext/gio2/gdesktopappinfo.c +90 -0
- data/ext/gio2/gdrive.c +267 -0
- data/ext/gio2/gemblem.c +71 -0
- data/ext/gio2/gemblemedicon.c +63 -0
- data/ext/gio2/gfile.c +2058 -0
- data/ext/gio2/gfileattribute.c +263 -0
- data/ext/gio2/gfileattributematcher.c +90 -0
- data/ext/gio2/gfiledescriptorbased.c +42 -0
- data/ext/gio2/gfileenumerator.c +167 -0
- data/ext/gio2/gfileicon.c +46 -0
- data/ext/gio2/gfileinfo.c +641 -0
- data/ext/gio2/gfileinputstream.c +92 -0
- data/ext/gio2/gfileiostream.c +98 -0
- data/ext/gio2/gfilemonitor.c +63 -0
- data/ext/gio2/gfilenamecompleter.c +72 -0
- data/ext/gio2/gfileoutputstream.c +100 -0
- data/ext/gio2/gfilterinputstream.c +56 -0
- data/ext/gio2/gfilteroutputstream.c +56 -0
- data/ext/gio2/gicon.c +69 -0
- data/ext/gio2/ginetaddress.c +188 -0
- data/ext/gio2/ginetsocketaddress.c +54 -0
- data/ext/gio2/ginitable.c +195 -0
- data/ext/gio2/ginputstream.c +341 -0
- data/ext/gio2/gio2.c +120 -0
- data/ext/gio2/gio2.def +2 -0
- data/ext/gio2/gio2.h +343 -0
- data/ext/gio2/gioerror.c +67 -0
- data/ext/gio2/giomodule.c +63 -0
- data/ext/gio2/gioscheduler.c +195 -0
- data/ext/gio2/giostream.c +129 -0
- data/ext/gio2/gloadableicon.c +91 -0
- data/ext/gio2/gmemoryinputstream.c +65 -0
- data/ext/gio2/gmemoryoutputstream.c +65 -0
- data/ext/gio2/gmount.c +283 -0
- data/ext/gio2/gmountoperation.c +168 -0
- data/ext/gio2/gnetworkaddress.c +71 -0
- data/ext/gio2/gnetworkservice.c +64 -0
- data/ext/gio2/goutputstream.c +343 -0
- data/ext/gio2/gresolver.c +230 -0
- data/ext/gio2/gseekable.c +89 -0
- data/ext/gio2/gsimpleasyncresult.c +153 -0
- data/ext/gio2/gsocket.c +451 -0
- data/ext/gio2/gsocketaddress.c +45 -0
- data/ext/gio2/gsocketclient.c +273 -0
- data/ext/gio2/gsocketconnectable.c +97 -0
- data/ext/gio2/gsocketconnection.c +82 -0
- data/ext/gio2/gsocketcontrolmessage.c +82 -0
- data/ext/gio2/gsocketlistener.c +239 -0
- data/ext/gio2/gsocketservice.c +64 -0
- data/ext/gio2/gsrvtarget.c +77 -0
- data/ext/gio2/gtcpconnection.c +48 -0
- data/ext/gio2/gthemedicon.c +86 -0
- data/ext/gio2/gthreadedsocketservice.c +39 -0
- data/ext/gio2/gunixconnection.c +69 -0
- data/ext/gio2/gunixfdlist.c +112 -0
- data/ext/gio2/gunixfdmessage.c +81 -0
- data/ext/gio2/gunixinputstream.c +73 -0
- data/ext/gio2/gunixmounts.c +346 -0
- data/ext/gio2/gunixoutputstream.c +73 -0
- data/ext/gio2/gunixsocketaddress.c +79 -0
- data/ext/gio2/gvfs.c +84 -0
- data/ext/gio2/gvolume.c +191 -0
- data/ext/gio2/gvolumemonitor.c +77 -0
- data/ext/gio2/gzlibcompressor.c +47 -0
- data/ext/gio2/gzlibdecompressor.c +43 -0
- data/ext/gio2/util.c +323 -0
- data/extconf.rb +49 -0
- data/lib/gio2.rb +141 -0
- metadata +184 -0
data/ChangeLog
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
2010-10-23 Kouhei Sutou <kou@cozmixng.org>
|
2
|
+
|
3
|
+
* README: Ruby/GIO -> Ruby/GIO2.
|
4
|
+
|
5
|
+
* ext/gio2/giomodule.c: remove needless g_io_module_load() and
|
6
|
+
g_io_module_unload() bindings.
|
7
|
+
|
8
|
+
2010-10-08 Guillaume Cottenceau
|
9
|
+
|
10
|
+
* RVAL2CSTR2 is deprecated, replace with RVAL2CSTR_ACCEPT_NIL
|
11
|
+
|
12
|
+
* CSTR2RVAL2 is deprecated, replace with CSTR2RVAL_FREE
|
13
|
+
|
14
|
+
2010-10-27 Nikolai Weibull
|
15
|
+
|
16
|
+
* ext/gio2/util.c (rbgio_define_domain_error): Add the Hash instance
|
17
|
+
variable that we need for rbgio_raise_error.
|
18
|
+
|
19
|
+
* ext/gio2/gfile.c: Do not undefine that which does not exist (File is
|
20
|
+
a module, not a class, so it doesn’t have an alloc function).
|
21
|
+
|
22
|
+
* lib/gio2.rb: Fix class/module “typos”.
|
23
|
+
|
24
|
+
2010-09-26 Kouhei Sutou <kou@cozmixng.org>
|
25
|
+
|
26
|
+
* ext/gio2/util.c (rbgio_raise_error): don't us dynamic string
|
27
|
+
as format string for security reason.
|
28
|
+
|
29
|
+
* ext/gio2/depend (install): fix a typo in .pc name.
|
30
|
+
[#3075619] Cann't install gio
|
31
|
+
Reported by O01eg. Thanks!!!
|
32
|
+
|
33
|
+
2010-09-23 Kouhei Sutou <kou@cozmixng.org>
|
34
|
+
|
35
|
+
* lib/gio2.rb: support bundled Windows DLL.
|
36
|
+
|
37
|
+
* ./: make buildable.
|
38
|
+
|
39
|
+
* src/: -> ext/gio2/.
|
40
|
+
|
41
|
+
* src/lib/: -> lib/.
|
42
|
+
|
43
|
+
* extconf.rb: support Ruby/GLib2 directory structure change.
|
44
|
+
|
45
|
+
2010-07-23 Nikolai Weibull
|
46
|
+
|
47
|
+
* src/: Use GOBJ2RVAL_UNREF where appropriate.
|
48
|
+
|
49
|
+
2010-07-12 Nikolai Weibull
|
50
|
+
|
51
|
+
* src/: Update to GIO 2.24.1.
|
52
|
+
|
53
|
+
2010-06-16 Nikolai Weibull
|
54
|
+
|
55
|
+
* src/: Remove macro use.
|
56
|
+
|
57
|
+
2009-09-23 Kouhei Sutou <kou@cozmixng.org>
|
58
|
+
|
59
|
+
* src/: add copyright header.
|
60
|
+
|
data/README
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Ruby/GIO2
|
2
|
+
=========
|
3
|
+
|
4
|
+
|
5
|
+
Ruby/GIO2 is a Ruby binding of gio-2.0.x.
|
6
|
+
|
7
|
+
Requirements
|
8
|
+
------------
|
9
|
+
|
10
|
+
Ruby: http://www.ruby-lang.org/
|
11
|
+
GIO: http://library.gnome.org/devel/gio/stable
|
12
|
+
|
13
|
+
Install
|
14
|
+
-------
|
15
|
+
|
16
|
+
0. install Ruby and GLib.
|
17
|
+
1. ruby extconf.rb
|
18
|
+
2. make
|
19
|
+
3. su
|
20
|
+
4. make install
|
21
|
+
|
22
|
+
Copying
|
23
|
+
-------
|
24
|
+
|
25
|
+
Copyright (c) 2008-2010 Ruby-GNOME2 Project Team
|
26
|
+
|
27
|
+
This program is free software.
|
28
|
+
You can distribute/modify this program under the terms of
|
29
|
+
the GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
|
30
|
+
|
31
|
+
Project Website
|
32
|
+
---------------
|
33
|
+
|
34
|
+
http://ruby-gnome2.sourceforge.jp/
|
data/Rakefile
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
require 'find'
|
5
|
+
require 'rubygems'
|
6
|
+
require 'rake/extensiontask'
|
7
|
+
|
8
|
+
@top_dir = Pathname(__FILE__).dirname.parent.expand_path
|
9
|
+
@rb_glib2_dir = @top_dir + "glib2"
|
10
|
+
|
11
|
+
task :default => :build
|
12
|
+
|
13
|
+
def version
|
14
|
+
@version ||= ENV["VERSION"] || guess_version
|
15
|
+
end
|
16
|
+
|
17
|
+
def guess_version
|
18
|
+
versions = {}
|
19
|
+
rbglib_h_path = @rb_glib2_dir + "ext" + "glib2" + "rbglib.h"
|
20
|
+
rbglib_h_path.open do |rbglib_h|
|
21
|
+
rbglib_h.each_line do |line|
|
22
|
+
if /#define\s+RBGLIB_([A-Z]+)_VERSION\s+(\d+)/ =~ line
|
23
|
+
versions[$1.downcase] = $2.to_i
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
["major", "minor", "micro"].collect {|type| versions[type]}.compact.join(".")
|
28
|
+
end
|
29
|
+
|
30
|
+
package_name = "gio2"
|
31
|
+
|
32
|
+
spec = Gem::Specification.new do |s|
|
33
|
+
s.name = package_name
|
34
|
+
s.summary = "Ruby/GIO2 is a Ruby binding of gio-2.x."
|
35
|
+
s.description = "Ruby/GIO2 is a Ruby binding of gio-2.x."
|
36
|
+
s.author = "The Ruby-GNOME2 Proejct Team"
|
37
|
+
s.email = "ruby-gnome2-devel-en@lists.sourceforge.net"
|
38
|
+
s.homepage = "http://ruby-gnome2.sourceforge.jp/"
|
39
|
+
s.version = version
|
40
|
+
s.platform = Gem::Platform::RUBY
|
41
|
+
s.add_dependency("cairo", ">= 1.10.0")
|
42
|
+
compatible_version = version.split(/\./)[0, 3].join(".")
|
43
|
+
s.add_dependency("glib2", ">= #{compatible_version}")
|
44
|
+
s.extensions = FileList["ext/#{package_name}/extconf.rb"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.files = FileList["ChangeLog", "README", "Rakefile", "extconf.rb",
|
47
|
+
"lib/**/*.rb", "ext/**/*"]
|
48
|
+
end
|
49
|
+
|
50
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
51
|
+
end
|
52
|
+
|
53
|
+
Rake::ExtensionTask.new(package_name, spec) do |ext|
|
54
|
+
ext.cross_compile = true
|
55
|
+
ext.cross_compiling do |spec|
|
56
|
+
if /mingw|mswin/ =~ spec.platform.to_s
|
57
|
+
win32_dir = File.join("vendor", "local")
|
58
|
+
win32_files = []
|
59
|
+
Find.find(win32_dir) do |file|
|
60
|
+
next if /\.zip\z/ =~ file
|
61
|
+
win32_files << file
|
62
|
+
end
|
63
|
+
spec.files += win32_files
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
namespace :win32 do
|
69
|
+
desc "download Windows binaries"
|
70
|
+
task :download do
|
71
|
+
$LOAD_PATH.unshift((@rb_glib2_dir + "lib").to_s)
|
72
|
+
require 'gnome2-win32-binary-downloader'
|
73
|
+
GNOME2Win32BinaryDownloader.download(:packages => ["glib"],
|
74
|
+
:dependencies => ["gettext-runtime"])
|
75
|
+
end
|
76
|
+
end
|
data/ext/gio2/depend
ADDED
data/ext/gio2/extconf.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
=begin
|
2
|
+
extconf.rb for Ruby/GIO extention library
|
3
|
+
=end
|
4
|
+
|
5
|
+
require 'pathname'
|
6
|
+
|
7
|
+
base_dir = Pathname(__FILE__).dirname.parent.parent.expand_path
|
8
|
+
top_dir = base_dir.parent.expand_path
|
9
|
+
top_build_dir = Pathname(".").parent.parent.parent.expand_path
|
10
|
+
|
11
|
+
mkmf_gnome2_dir = top_dir + "glib2" + 'lib'
|
12
|
+
version_suffix = ""
|
13
|
+
unless mkmf_gnome2_dir.exist?
|
14
|
+
if /(-\d+\.\d+\.\d+)(?:\.\d+)?\z/ =~ base_dir.basename.to_s
|
15
|
+
version_suffix = $1
|
16
|
+
mkmf_gnome2_dir = top_dir + "glib2#{version_suffix}" + 'lib'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
$LOAD_PATH.unshift(mkmf_gnome2_dir.to_s)
|
21
|
+
|
22
|
+
module_name = "gio2"
|
23
|
+
package_id = "gio-2.0"
|
24
|
+
|
25
|
+
require 'mkmf-gnome2'
|
26
|
+
|
27
|
+
win32 = setup_win32(module_name, base_dir)
|
28
|
+
|
29
|
+
defines = '-DRUBY_GIO2_COMPILATION'
|
30
|
+
|
31
|
+
PKGConfig.have_package(package_id) or exit 1
|
32
|
+
unless win32
|
33
|
+
PKGConfig.have_package('gio-unix-2.0') and defines += ' -DHAVE_GIO_UNIX'
|
34
|
+
end
|
35
|
+
PKGConfig.have_package('gobject-2.0') or exit 1
|
36
|
+
|
37
|
+
have_func('rb_exec_recursive')
|
38
|
+
|
39
|
+
["glib2"].each do |package|
|
40
|
+
directory = "#{package}#{version_suffix}"
|
41
|
+
build_dir = "#{directory}/tmp/#{RUBY_PLATFORM}/#{package}/#{RUBY_VERSION}"
|
42
|
+
add_depend_package(package, "#{directory}/ext/#{package}",
|
43
|
+
top_dir.to_s,
|
44
|
+
:top_build_dir => top_build_dir.to_s,
|
45
|
+
:target_build_dir => build_dir)
|
46
|
+
end
|
47
|
+
|
48
|
+
def try_compiler_option(opt, &block)
|
49
|
+
checking_for "#{opt} option to compiler" do
|
50
|
+
$CFLAGS += " #{opt}" if try_compile '', opt, &block
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
try_compiler_option '-finline-functions'
|
55
|
+
try_compiler_option '-fno-common'
|
56
|
+
try_compiler_option '-Wall'
|
57
|
+
try_compiler_option '-Waggregate-return'
|
58
|
+
try_compiler_option '-Wcast-align'
|
59
|
+
# NOTE: Generates way too many false positives.
|
60
|
+
# try_compiler_option '-Wconversion'
|
61
|
+
try_compiler_option '-Wextra'
|
62
|
+
try_compiler_option '-Wformat=2'
|
63
|
+
try_compiler_option '-Winit-self'
|
64
|
+
try_compiler_option '-Winline'
|
65
|
+
try_compiler_option '-Wlarger-than-65500'
|
66
|
+
try_compiler_option '-Wmissing-declarations'
|
67
|
+
try_compiler_option '-Wmissing-format-attribute'
|
68
|
+
try_compiler_option '-Wmissing-include-dirs'
|
69
|
+
try_compiler_option '-Wmissing-noreturn'
|
70
|
+
try_compiler_option '-Wmissing-prototypes'
|
71
|
+
try_compiler_option '-Wnested-externs'
|
72
|
+
try_compiler_option '-Wold-style-definition'
|
73
|
+
try_compiler_option '-Wpacked'
|
74
|
+
try_compiler_option '-Wp,-D_FORTIFY_SOURCE=2'
|
75
|
+
try_compiler_option '-Wpointer-arith'
|
76
|
+
# NOTE: ruby.h and intern.h have too many of these.
|
77
|
+
# try_compiler_option '-Wredundant-decls'
|
78
|
+
# NOTE: Complains about index, for example.
|
79
|
+
# try_compiler_option '-Wshadow'
|
80
|
+
try_compiler_option '-Wswitch-default'
|
81
|
+
try_compiler_option '-Wswitch-enum'
|
82
|
+
try_compiler_option '-Wundef'
|
83
|
+
# NOTE: Incredible amounts of false positives.
|
84
|
+
#try_compiler_option '-Wunreachable-code'
|
85
|
+
try_compiler_option '-Wunsafe-loop-optimizations'
|
86
|
+
try_compiler_option '-Wwrite-strings'
|
87
|
+
|
88
|
+
create_pkg_config_file("Ruby/GIO2", package_id)
|
89
|
+
|
90
|
+
$defs << defines
|
91
|
+
create_makefile(module_name)
|
data/ext/gio2/gappinfo.c
ADDED
@@ -0,0 +1,318 @@
|
|
1
|
+
/* -*- c-file-style: "ruby" -*- */
|
2
|
+
/*
|
3
|
+
* Ruby/GIO: a Ruby binding of gio-2.0.x.
|
4
|
+
* Copyright (C) 2008-2009 Ruby-GNOME2 Project Team
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "gio2.h"
|
22
|
+
|
23
|
+
#define _SELF(value) RVAL2GAPPINFO(value)
|
24
|
+
|
25
|
+
#define RVAL2GAPPINFOCREATEFLAGS(value) \
|
26
|
+
RVAL2GFLAGS((value), G_TYPE_APP_INFO_CREATE_FLAGS)
|
27
|
+
|
28
|
+
#define RVAL2GAPPINFOCREATEFLAGSDEFAULT(value) \
|
29
|
+
RVAL2TYPE_WITH_DEFAULT((value), \
|
30
|
+
RVAL2GAPPINFOCREATEFLAGS, \
|
31
|
+
G_APP_INFO_CREATE_NONE)
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
appinfo_create_from_commandline(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
35
|
+
{
|
36
|
+
VALUE commandline, application_name, flags;
|
37
|
+
GError *error = NULL;
|
38
|
+
GAppInfo *info;
|
39
|
+
|
40
|
+
rb_scan_args(argc, argv, "12", &commandline, &application_name, &flags);
|
41
|
+
info = g_app_info_create_from_commandline(RVAL2CSTR(commandline),
|
42
|
+
RVAL2CSTR_ACCEPT_NIL(application_name),
|
43
|
+
RVAL2GAPPINFOCREATEFLAGSDEFAULT(flags),
|
44
|
+
&error);
|
45
|
+
if (info == NULL)
|
46
|
+
rbgio_raise_error(error);
|
47
|
+
|
48
|
+
return GOBJ2RVAL_UNREF(info);
|
49
|
+
}
|
50
|
+
|
51
|
+
static VALUE
|
52
|
+
appinfo_reset_type_associations(VALUE self, VALUE content_type)
|
53
|
+
{
|
54
|
+
g_app_info_reset_type_associations(RVAL2CSTR(content_type));
|
55
|
+
|
56
|
+
return self;
|
57
|
+
}
|
58
|
+
|
59
|
+
static VALUE
|
60
|
+
appinfo_get_all_for_type(G_GNUC_UNUSED VALUE self, VALUE content_type)
|
61
|
+
{
|
62
|
+
return GLIST2ARY_FREE(g_app_info_get_all_for_type(RVAL2CSTR(content_type)));
|
63
|
+
}
|
64
|
+
|
65
|
+
static VALUE
|
66
|
+
appinfo_get_all(int argc, VALUE *argv, VALUE self)
|
67
|
+
{
|
68
|
+
VALUE content_type;
|
69
|
+
|
70
|
+
rb_scan_args(argc, argv, "01", &content_type);
|
71
|
+
if (!NIL_P(content_type))
|
72
|
+
return appinfo_get_all_for_type(self, content_type);
|
73
|
+
|
74
|
+
return GLIST2ARY_FREE(g_app_info_get_all());
|
75
|
+
}
|
76
|
+
|
77
|
+
static VALUE
|
78
|
+
appinfo_get_default_for_type(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
79
|
+
{
|
80
|
+
VALUE content_type, must_support_uris;
|
81
|
+
|
82
|
+
rb_scan_args(argc, argv, "11", &content_type, &must_support_uris);
|
83
|
+
|
84
|
+
return GOBJ2RVAL_UNREF(g_app_info_get_default_for_type(RVAL2CSTR(content_type),
|
85
|
+
RVAL2CBOOL(must_support_uris)));
|
86
|
+
}
|
87
|
+
|
88
|
+
static VALUE
|
89
|
+
appinfo_get_default_for_uri_scheme(G_GNUC_UNUSED VALUE self, VALUE uri_scheme)
|
90
|
+
{
|
91
|
+
return GOBJ2RVAL_UNREF(g_app_info_get_default_for_uri_scheme(RVAL2CSTR(uri_scheme)));
|
92
|
+
}
|
93
|
+
|
94
|
+
static VALUE
|
95
|
+
appinfo_launch_default_for_uri(int argc, VALUE *argv, VALUE self)
|
96
|
+
{
|
97
|
+
VALUE uri, launch_context;
|
98
|
+
GError *error;
|
99
|
+
|
100
|
+
rb_scan_args(argc, argv, "11", &uri, &launch_context);
|
101
|
+
if (!g_app_info_launch_default_for_uri(RVAL2CSTR(uri),
|
102
|
+
RVAL2GAPPLAUNCHCONTEXT(launch_context),
|
103
|
+
&error))
|
104
|
+
rbgio_raise_error(error);
|
105
|
+
|
106
|
+
return self;
|
107
|
+
}
|
108
|
+
|
109
|
+
static VALUE
|
110
|
+
appinfo_dup(VALUE self)
|
111
|
+
{
|
112
|
+
return GOBJ2RVAL_UNREF(g_app_info_dup(_SELF(self)));
|
113
|
+
}
|
114
|
+
|
115
|
+
static VALUE
|
116
|
+
appinfo_equal(VALUE self, VALUE other)
|
117
|
+
{
|
118
|
+
return CBOOL2RVAL(g_app_info_equal(_SELF(self), _SELF(other)));
|
119
|
+
}
|
120
|
+
|
121
|
+
static VALUE
|
122
|
+
appinfo_get_id(VALUE self)
|
123
|
+
{
|
124
|
+
return CSTR2RVAL(g_app_info_get_id(_SELF(self)));
|
125
|
+
}
|
126
|
+
|
127
|
+
static VALUE
|
128
|
+
appinfo_get_name(VALUE self)
|
129
|
+
{
|
130
|
+
return CSTR2RVAL(g_app_info_get_name(_SELF(self)));
|
131
|
+
}
|
132
|
+
|
133
|
+
static VALUE
|
134
|
+
appinfo_get_display_name(VALUE self)
|
135
|
+
{
|
136
|
+
return CSTR2RVAL(g_app_info_get_display_name(_SELF(self)));
|
137
|
+
}
|
138
|
+
|
139
|
+
static VALUE
|
140
|
+
appinfo_get_description(VALUE self)
|
141
|
+
{
|
142
|
+
return CSTR2RVAL(g_app_info_get_description(_SELF(self)));
|
143
|
+
}
|
144
|
+
|
145
|
+
static VALUE
|
146
|
+
appinfo_get_executable(VALUE self)
|
147
|
+
{
|
148
|
+
return CSTR2RVAL(g_app_info_get_executable(_SELF(self)));
|
149
|
+
}
|
150
|
+
|
151
|
+
static VALUE
|
152
|
+
appinfo_get_commandline(VALUE self)
|
153
|
+
{
|
154
|
+
return CSTR2RVAL(g_app_info_get_commandline(_SELF(self)));
|
155
|
+
}
|
156
|
+
|
157
|
+
static VALUE
|
158
|
+
appinfo_get_icon(VALUE self)
|
159
|
+
{
|
160
|
+
return GOBJ2RVAL(g_app_info_get_icon(_SELF(self)));
|
161
|
+
}
|
162
|
+
|
163
|
+
typedef gboolean (*LaunchMethod)(GAppInfo *,
|
164
|
+
GList *,
|
165
|
+
GAppLaunchContext *,
|
166
|
+
GError **);
|
167
|
+
|
168
|
+
static VALUE
|
169
|
+
launch_method(LaunchMethod method, int argc, VALUE *argv, VALUE self)
|
170
|
+
{
|
171
|
+
VALUE rbfiles, rblaunch_context;
|
172
|
+
GList *files;
|
173
|
+
GAppLaunchContext *launch_context;
|
174
|
+
GError *error = NULL;
|
175
|
+
gboolean launched;
|
176
|
+
|
177
|
+
rb_scan_args(argc, argv, "02", &rbfiles, &rblaunch_context);
|
178
|
+
launch_context = RVAL2GAPPLAUNCHCONTEXT(rblaunch_context);
|
179
|
+
files = GFILEARY2GLIST_ACCEPT_NIL(rbfiles);
|
180
|
+
launched = method(_SELF(self), files, launch_context, &error);
|
181
|
+
g_list_free(files);
|
182
|
+
|
183
|
+
if (!launched)
|
184
|
+
rbgio_raise_error(error);
|
185
|
+
|
186
|
+
return self;
|
187
|
+
}
|
188
|
+
|
189
|
+
static VALUE
|
190
|
+
appinfo_launch(int argc, VALUE *argv, VALUE self)
|
191
|
+
{
|
192
|
+
return launch_method(g_app_info_launch, argc, argv, self);
|
193
|
+
}
|
194
|
+
|
195
|
+
static VALUE
|
196
|
+
appinfo_supports_files(VALUE self)
|
197
|
+
{
|
198
|
+
return CBOOL2RVAL(g_app_info_supports_files(_SELF(self)));
|
199
|
+
}
|
200
|
+
|
201
|
+
static VALUE
|
202
|
+
appinfo_supports_uris(VALUE self)
|
203
|
+
{
|
204
|
+
return CBOOL2RVAL(g_app_info_supports_uris(_SELF(self)));
|
205
|
+
}
|
206
|
+
|
207
|
+
static VALUE
|
208
|
+
appinfo_launch_uris(int argc, VALUE *argv, VALUE self)
|
209
|
+
{
|
210
|
+
return launch_method(g_app_info_launch_uris, argc, argv, self);
|
211
|
+
}
|
212
|
+
|
213
|
+
static VALUE
|
214
|
+
appinfo_should_show(VALUE self)
|
215
|
+
{
|
216
|
+
return CBOOL2RVAL(g_app_info_should_show(_SELF(self)));
|
217
|
+
}
|
218
|
+
|
219
|
+
static VALUE
|
220
|
+
appinfo_can_delete(VALUE self)
|
221
|
+
{
|
222
|
+
return CBOOL2RVAL(g_app_info_can_delete(_SELF(self)));
|
223
|
+
}
|
224
|
+
|
225
|
+
static VALUE
|
226
|
+
appinfo_delete(VALUE self)
|
227
|
+
{
|
228
|
+
return CBOOL2RVAL(g_app_info_delete(_SELF(self)));
|
229
|
+
}
|
230
|
+
|
231
|
+
static VALUE
|
232
|
+
appinfo_set_as_default_for_type(VALUE self, VALUE value)
|
233
|
+
{
|
234
|
+
GError *error = NULL;
|
235
|
+
|
236
|
+
if (!g_app_info_set_as_default_for_type(_SELF(self), RVAL2CSTR(value), &error))
|
237
|
+
rbgio_raise_error(error);
|
238
|
+
|
239
|
+
return self;
|
240
|
+
}
|
241
|
+
|
242
|
+
static VALUE
|
243
|
+
appinfo_set_as_default_for_extension(VALUE self, VALUE value)
|
244
|
+
{
|
245
|
+
GError *error = NULL;
|
246
|
+
|
247
|
+
if (!g_app_info_set_as_default_for_extension(_SELF(self), RVAL2CSTR(value), &error))
|
248
|
+
rbgio_raise_error(error);
|
249
|
+
|
250
|
+
return self;
|
251
|
+
}
|
252
|
+
|
253
|
+
static VALUE
|
254
|
+
appinfo_add_supports_type(VALUE self, VALUE value)
|
255
|
+
{
|
256
|
+
GError *error = NULL;
|
257
|
+
|
258
|
+
if (!g_app_info_add_supports_type(_SELF(self), RVAL2CSTR(value), &error))
|
259
|
+
rbgio_raise_error(error);
|
260
|
+
|
261
|
+
return self;
|
262
|
+
}
|
263
|
+
|
264
|
+
static VALUE
|
265
|
+
appinfo_remove_supports_type(VALUE self, VALUE value)
|
266
|
+
{
|
267
|
+
GError *error = NULL;
|
268
|
+
|
269
|
+
if (!g_app_info_remove_supports_type(_SELF(self), RVAL2CSTR(value), &error))
|
270
|
+
rbgio_raise_error(error);
|
271
|
+
|
272
|
+
return self;
|
273
|
+
}
|
274
|
+
|
275
|
+
static VALUE
|
276
|
+
appinfo_can_remove_supports_type(VALUE self)
|
277
|
+
{
|
278
|
+
return CBOOL2RVAL(g_app_info_can_remove_supports_type(_SELF(self)));
|
279
|
+
}
|
280
|
+
|
281
|
+
void
|
282
|
+
Init_gappinfo(VALUE glib)
|
283
|
+
{
|
284
|
+
VALUE appinfo = G_DEF_INTERFACE(G_TYPE_APP_INFO, "AppInfo", glib);
|
285
|
+
|
286
|
+
G_DEF_CLASS(G_TYPE_APP_INFO_CREATE_FLAGS, "CreateFlags", appinfo);
|
287
|
+
G_DEF_CONSTANTS(appinfo, G_TYPE_APP_INFO_CREATE_FLAGS, "G_APP_INFO_");
|
288
|
+
|
289
|
+
rb_define_singleton_method(appinfo, "create_from_commandline", appinfo_create_from_commandline, -1);
|
290
|
+
rb_define_singleton_method(appinfo, "reset_type_associations", appinfo_reset_type_associations, -1);
|
291
|
+
rb_define_singleton_method(appinfo, "all", appinfo_get_all, 0);
|
292
|
+
rb_define_singleton_method(appinfo, "get_all_for_type", appinfo_get_all_for_type, 1);
|
293
|
+
rb_define_singleton_method(appinfo, "get_default_for_type", appinfo_get_default_for_type, -1);
|
294
|
+
rb_define_singleton_method(appinfo, "get_default_for_uri_scheme", appinfo_get_default_for_uri_scheme, 1);
|
295
|
+
rb_define_singleton_method(appinfo, "launch_default_for_uri", appinfo_launch_default_for_uri, 0);
|
296
|
+
|
297
|
+
rb_define_method(appinfo, "dup", appinfo_dup, 0);
|
298
|
+
rb_define_method(appinfo, "equal?", appinfo_equal, 1);
|
299
|
+
rb_define_method(appinfo, "id", appinfo_get_id, 0);
|
300
|
+
rb_define_method(appinfo, "name", appinfo_get_name, 0);
|
301
|
+
rb_define_method(appinfo, "display_name", appinfo_get_display_name, 0);
|
302
|
+
rb_define_method(appinfo, "description", appinfo_get_description, 0);
|
303
|
+
rb_define_method(appinfo, "executable", appinfo_get_executable, 0);
|
304
|
+
rb_define_method(appinfo, "commandline", appinfo_get_commandline, 0);
|
305
|
+
rb_define_method(appinfo, "icon", appinfo_get_icon, 0);
|
306
|
+
rb_define_method(appinfo, "launch", appinfo_launch, -1);
|
307
|
+
rb_define_method(appinfo, "supports_files?", appinfo_supports_files, 0);
|
308
|
+
rb_define_method(appinfo, "supports_uris?", appinfo_supports_uris, 0);
|
309
|
+
rb_define_method(appinfo, "launch_uris", appinfo_launch_uris, -1);
|
310
|
+
rb_define_method(appinfo, "should_show?", appinfo_should_show, 0);
|
311
|
+
rb_define_method(appinfo, "can_delete?", appinfo_can_delete, 0);
|
312
|
+
rb_define_method(appinfo, "delete", appinfo_delete, 0);
|
313
|
+
rb_define_method(appinfo, "set_as_default_for_type", appinfo_set_as_default_for_type, 1);
|
314
|
+
rb_define_method(appinfo, "set_as_default_for_extension", appinfo_set_as_default_for_extension, 1);
|
315
|
+
rb_define_method(appinfo, "add_supports_type", appinfo_add_supports_type, 1);
|
316
|
+
rb_define_method(appinfo, "can_remove_supports_type?", appinfo_can_remove_supports_type, 1);
|
317
|
+
rb_define_method(appinfo, "remove_supports_type", appinfo_remove_supports_type, 1);
|
318
|
+
}
|