xsettings-ruby 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +1 -0
- data/lib/xsettings/version.rb +1 -1
- metadata +48 -59
- data/ext/xsettings/extconf.rb +0 -114
- data/ext/xsettings/xsettings.c +0 -170
- data/ext/xsettings/xsettings.rd +0 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5657bb403279632e1397fa442a6c9bd7b57846c7
|
4
|
+
data.tar.gz: 857c3052ee58478994acdc0104959ac94b448dff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ae38404245ebb59f8464afc44620559bac7d328e2c46733d9f6a1c0b9c5f86553ae037c423245e02543cc04da51ddd905a636ad161a839fa1e23e43cd00cac1d
|
7
|
+
data.tar.gz: 02a7d094a76a330ab0f004f90301dbde82783ae4a19a6926ee098ba390e4d18fb04f5e5a8733ff4fae8c53241996336b332d88f9e184f01ec04d135c86f81d18
|
data/Rakefile
CHANGED
@@ -29,6 +29,7 @@ spec = Gem::Specification.new do |s|
|
|
29
29
|
s.homepage = "http://github.com/geoffyoungs/xsettings-ruby"
|
30
30
|
s.summary = "xsettings bindings using rubber-generate"
|
31
31
|
s.add_dependency("rubber-generate", ">= 0.0.17")
|
32
|
+
s.add_dependency("gtk2", ">= 2.0.0")
|
32
33
|
s.license = 'LGPL-2'
|
33
34
|
s.platform = Gem::Platform::RUBY
|
34
35
|
s.extensions = FileList["ext/*/extconf.rb"]
|
data/lib/xsettings/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,86 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: xsettings-ruby
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Geoff Youngs
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: rubber-generate
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.17
|
20
|
+
type: :runtime
|
22
21
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
26
24
|
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 61
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 0
|
32
|
-
- 17
|
25
|
+
- !ruby/object:Gem::Version
|
33
26
|
version: 0.0.17
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gtk2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.0.0
|
34
34
|
type: :runtime
|
35
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.0.0
|
36
41
|
description: |+
|
37
42
|
XSettings Manager bindings for ruby
|
38
|
-
|
43
|
+
|
39
44
|
e.g
|
40
45
|
require 'gtk2'
|
41
46
|
require 'xsettings-ruby'
|
42
|
-
|
47
|
+
|
43
48
|
email: git@intersect-uk.co.uk
|
44
49
|
executables: []
|
45
|
-
|
46
|
-
extensions:
|
47
|
-
- ext/xsettings/extconf.rb
|
50
|
+
extensions: []
|
48
51
|
extra_rdoc_files: []
|
49
|
-
|
50
|
-
|
52
|
+
files:
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
51
55
|
- ext/xsettings/xsettings-common.c
|
52
56
|
- ext/xsettings/xsettings-common.h
|
53
57
|
- ext/xsettings/xsettings-manager.c
|
54
58
|
- ext/xsettings/xsettings-manager.h
|
55
|
-
- ext/xsettings/xsettings.c
|
56
59
|
- ext/xsettings/xsettings.cr
|
57
|
-
- ext/xsettings/xsettings.rd
|
58
|
-
- Rakefile
|
59
|
-
- README.md
|
60
60
|
- lib/xsettings.rb
|
61
61
|
- lib/xsettings/version.rb
|
62
|
-
- ext/xsettings/extconf.rb
|
63
62
|
homepage: http://github.com/geoffyoungs/xsettings-ruby
|
64
|
-
licenses:
|
63
|
+
licenses:
|
65
64
|
- LGPL-2
|
65
|
+
metadata: {}
|
66
66
|
post_install_message:
|
67
67
|
rdoc_options: []
|
68
|
-
|
69
|
-
require_paths:
|
68
|
+
require_paths:
|
70
69
|
- lib
|
71
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
-
|
73
|
-
requirements:
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
74
72
|
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
version: "0"
|
80
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
83
77
|
- - ">="
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
86
|
-
segments:
|
87
|
-
- 0
|
88
|
-
version: "0"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
89
80
|
requirements: []
|
90
|
-
|
91
81
|
rubyforge_project:
|
92
|
-
rubygems_version:
|
82
|
+
rubygems_version: 2.5.1
|
93
83
|
signing_key:
|
94
|
-
specification_version:
|
84
|
+
specification_version: 4
|
95
85
|
summary: xsettings bindings using rubber-generate
|
96
86
|
test_files: []
|
97
|
-
|
data/ext/xsettings/extconf.rb
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
require 'mkmf'
|
2
|
-
use_gems = false
|
3
|
-
begin
|
4
|
-
require 'mkmf-gnome2'
|
5
|
-
rescue LoadError
|
6
|
-
use_gems = true
|
7
|
-
end
|
8
|
-
|
9
|
-
if use_gems or Object.const_defined?('Gem')
|
10
|
-
require 'rubygems'
|
11
|
-
gem 'glib2'
|
12
|
-
require 'mkmf-gnome2'
|
13
|
-
%w[rbglib.h rbgtk.h rbpango.h rbatk.h].each do |header|
|
14
|
-
Gem.find_files(header).each do |f|
|
15
|
-
$CFLAGS += " '-I#{File.dirname(f)}'"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
# Look for headers in {gem_root}/ext/{package}
|
20
|
-
if use_gems
|
21
|
-
%w[
|
22
|
-
glib2 gdk_pixbuf2 atk gtk2].each do |package|
|
23
|
-
require package
|
24
|
-
if Gem.loaded_specs[package]
|
25
|
-
$CFLAGS += " -I" + Gem.loaded_specs[package].full_gem_path + "/ext/" + package
|
26
|
-
else
|
27
|
-
if fn = $".find { |n| n.sub(/[.](so|rb)$/,'') == package }
|
28
|
-
dr = $:.find { |d| File.exist?(File.join(d, fn)) }
|
29
|
-
pt = File.join(dr,fn) if dr && fn
|
30
|
-
else
|
31
|
-
pt = "??"
|
32
|
-
end
|
33
|
-
STDERR.puts "require '" + package + "' loaded '"+pt+"' instead of the gem - trying to continue, but build may fail"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
if RbConfig::CONFIG.has_key?('rubyhdrdir')
|
38
|
-
$CFLAGS += " -I" + RbConfig::CONFIG['rubyhdrdir']+'/ruby'
|
39
|
-
end
|
40
|
-
|
41
|
-
$CFLAGS += " -I."
|
42
|
-
have_func("rb_errinfo")
|
43
|
-
PKGConfig.have_package("gtk+-2.0") or exit(-1)
|
44
|
-
have_header("gtk/gtk.h") or exit(-1)
|
45
|
-
have_header("gdk/gdk.h") or exit(-1)
|
46
|
-
have_header("gdk/gdkx.h") or exit(-1)
|
47
|
-
|
48
|
-
STDOUT.print("checking for new allocation framework... ") # for ruby-1.7
|
49
|
-
if Object.respond_to? :allocate
|
50
|
-
STDOUT.print "yes
|
51
|
-
"
|
52
|
-
$defs << "-DHAVE_OBJECT_ALLOCATE"
|
53
|
-
else
|
54
|
-
STDOUT.print "no
|
55
|
-
"
|
56
|
-
end
|
57
|
-
|
58
|
-
top = File.expand_path(File.dirname(__FILE__) + '/..') # XXX
|
59
|
-
$CFLAGS += " " + ['glib/src'].map{|d|
|
60
|
-
"-I" + File.join(top, d)
|
61
|
-
}.join(" ")
|
62
|
-
|
63
|
-
have_func("rb_define_alloc_func") # for ruby-1.8
|
64
|
-
|
65
|
-
#set_output_lib('libruby-xsettings.a')
|
66
|
-
if /cygwin|mingw/ =~ RUBY_PLATFORM
|
67
|
-
top = "../.."
|
68
|
-
[
|
69
|
-
["glib/src", "ruby-glib2"],
|
70
|
-
].each{|d,l|
|
71
|
-
$LDFLAGS << sprintf(" -L%s/%s", top, d)
|
72
|
-
$libs << sprintf(" -l%s", l)
|
73
|
-
}
|
74
|
-
end
|
75
|
-
begin
|
76
|
-
srcdir = File.expand_path(File.dirname($0))
|
77
|
-
|
78
|
-
begin
|
79
|
-
|
80
|
-
obj_ext = "."+$OBJEXT
|
81
|
-
|
82
|
-
$libs = $libs.split(/ /).uniq.join(' ')
|
83
|
-
$source_files = Dir.glob(sprintf("%s/*.c", srcdir)).map{|fname|
|
84
|
-
fname[0, srcdir.length+1] = ''
|
85
|
-
fname
|
86
|
-
}
|
87
|
-
$objs = $source_files.collect do |item|
|
88
|
-
item.gsub(/.c$/, obj_ext)
|
89
|
-
end
|
90
|
-
|
91
|
-
#
|
92
|
-
# create Makefile
|
93
|
-
#
|
94
|
-
$defs << "-DRUBY_XSETTINGS_COMPILATION"
|
95
|
-
# $CFLAGS << $defs.join(' ')
|
96
|
-
create_makefile("xsettings", srcdir)
|
97
|
-
raise Interrupt if not FileTest.exist? "Makefile"
|
98
|
-
|
99
|
-
File.open("Makefile", "a") do |mfile|
|
100
|
-
$source_files.each do |e|
|
101
|
-
mfile.print sprintf("%s: %s
|
102
|
-
", e.gsub(/.c$/, obj_ext), e)
|
103
|
-
end
|
104
|
-
end
|
105
|
-
ensure
|
106
|
-
#Dir.chdir ".."
|
107
|
-
end
|
108
|
-
|
109
|
-
#create_top_makefile()
|
110
|
-
rescue Interrupt
|
111
|
-
print " [error] " + $!.to_s + "
|
112
|
-
"
|
113
|
-
end
|
114
|
-
|
data/ext/xsettings/xsettings.c
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
2
|
-
/* Includes */
|
3
|
-
#include <ruby.h>
|
4
|
-
#include <stdlib.h>
|
5
|
-
#include <stdio.h>
|
6
|
-
#include <string.h>
|
7
|
-
#include "gtk/gtk.h"
|
8
|
-
#include "gdk/gdk.h"
|
9
|
-
#include "gdk/gdkx.h"
|
10
|
-
|
11
|
-
/* Setup types */
|
12
|
-
/* Try not to clash with other definitions of bool... */
|
13
|
-
typedef int rubber_bool;
|
14
|
-
#define bool rubber_bool
|
15
|
-
|
16
|
-
/* Prototypes */
|
17
|
-
#include "rbglib.h"
|
18
|
-
|
19
|
-
#include "rbgtk.h"
|
20
|
-
|
21
|
-
#if defined(G_PLATFORM_WIN32) && !defined(RUBY_GTK2_STATIC_COMPILATION)
|
22
|
-
# ifdef RUBY_GTK2_COMPILATION
|
23
|
-
# define RUBY_GTK2_VAR __declspec(dllexport)
|
24
|
-
# else
|
25
|
-
# define RUBY_GTK2_VAR extern __declspec(dllimport)
|
26
|
-
# endif
|
27
|
-
#else
|
28
|
-
# define RUBY_GTK2_VAR extern
|
29
|
-
#endif
|
30
|
-
|
31
|
-
RUBY_GTK2_VAR VALUE mGtk;
|
32
|
-
RUBY_GTK2_VAR VALUE mGdk;
|
33
|
-
|
34
|
-
#define RBGTK_INITIALIZE(obj,gtkobj) (rbgtk_initialize_gtkobject(obj, GTK_OBJECT(gtkobj)))
|
35
|
-
static VALUE mXSettings;
|
36
|
-
static VALUE cManager;
|
37
|
-
static VALUE
|
38
|
-
Manager_CLASS_exists_query(VALUE self);
|
39
|
-
static VALUE
|
40
|
-
Manager_CLASS___alloc__(VALUE self);
|
41
|
-
static VALUE
|
42
|
-
Manager_terminated(VALUE self);
|
43
|
-
static VALUE
|
44
|
-
Manager_destroy(VALUE self);
|
45
|
-
static VALUE
|
46
|
-
Manager_notify(VALUE self);
|
47
|
-
static VALUE
|
48
|
-
Manager__brace_brace_equals(VALUE self, VALUE __v_name, VALUE value);
|
49
|
-
|
50
|
-
/* Inline C code */
|
51
|
-
|
52
|
-
#include "xsettings-manager.h"
|
53
|
-
|
54
|
-
static XSettingsManager *
|
55
|
-
manager_unwrap(VALUE obj)
|
56
|
-
{
|
57
|
-
XSettingsManager *manager;
|
58
|
-
Data_Get_Struct(obj, XSettingsManager, manager);
|
59
|
-
return manager;
|
60
|
-
}
|
61
|
-
|
62
|
-
static void terminate_xsettings(void *value)
|
63
|
-
{
|
64
|
-
if (value)
|
65
|
-
{
|
66
|
-
VALUE obj = (VALUE)value;
|
67
|
-
rb_funcall(obj, rb_intern("terminated"),0);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
|
71
|
-
|
72
|
-
/* Code */
|
73
|
-
static VALUE
|
74
|
-
Manager_CLASS_exists_query(VALUE self)
|
75
|
-
{
|
76
|
-
VALUE __p_retval = Qnil;
|
77
|
-
|
78
|
-
#line 33 "/home/geoff/Projects/xsettings/ext/xsettings/xsettings.cr"
|
79
|
-
do { __p_retval = ((xsettings_manager_check_running(GDK_DISPLAY(), DefaultScreen(GDK_DISPLAY()))) ? Qtrue : Qfalse); goto out; } while(0);
|
80
|
-
out:
|
81
|
-
return __p_retval;
|
82
|
-
}
|
83
|
-
|
84
|
-
static VALUE
|
85
|
-
Manager_CLASS___alloc__(VALUE self)
|
86
|
-
{
|
87
|
-
VALUE __p_retval = Qnil;
|
88
|
-
|
89
|
-
#line 37 "/home/geoff/Projects/xsettings/ext/xsettings/xsettings.cr"
|
90
|
-
do { __p_retval = Data_Wrap_Struct(self, NULL, xsettings_manager_destroy, xsettings_manager_new(GDK_DISPLAY(), DefaultScreen(GDK_DISPLAY()), terminate_xsettings, (void*)self)); goto out; } while(0);
|
91
|
-
out:
|
92
|
-
return __p_retval;
|
93
|
-
}
|
94
|
-
|
95
|
-
static VALUE
|
96
|
-
Manager_terminated(VALUE self)
|
97
|
-
{
|
98
|
-
XSettingsManager *_self = manager_unwrap(self);
|
99
|
-
|
100
|
-
#line 44 "/home/geoff/Projects/xsettings/ext/xsettings/xsettings.cr"
|
101
|
-
_self = _self;
|
102
|
-
|
103
|
-
return Qnil;
|
104
|
-
}
|
105
|
-
|
106
|
-
static VALUE
|
107
|
-
Manager_destroy(VALUE self)
|
108
|
-
{
|
109
|
-
XSettingsManager *_self = manager_unwrap(self);
|
110
|
-
|
111
|
-
#line 47 "/home/geoff/Projects/xsettings/ext/xsettings/xsettings.cr"
|
112
|
-
xsettings_manager_destroy(_self);
|
113
|
-
|
114
|
-
return Qnil;
|
115
|
-
}
|
116
|
-
|
117
|
-
static VALUE
|
118
|
-
Manager_notify(VALUE self)
|
119
|
-
{
|
120
|
-
XSettingsManager *_self = manager_unwrap(self);
|
121
|
-
|
122
|
-
#line 50 "/home/geoff/Projects/xsettings/ext/xsettings/xsettings.cr"
|
123
|
-
xsettings_manager_notify(_self);
|
124
|
-
|
125
|
-
return Qnil;
|
126
|
-
}
|
127
|
-
|
128
|
-
static VALUE
|
129
|
-
Manager__brace_brace_equals(VALUE self, VALUE __v_name, VALUE value)
|
130
|
-
{
|
131
|
-
char * name; char * __orig_name;
|
132
|
-
XSettingsManager *_self = manager_unwrap(self);
|
133
|
-
__orig_name = name = ( NIL_P(__v_name) ? NULL : StringValuePtr(__v_name) );
|
134
|
-
|
135
|
-
#line 53 "/home/geoff/Projects/xsettings/ext/xsettings/xsettings.cr"
|
136
|
-
|
137
|
-
do {
|
138
|
-
switch(TYPE(value)) { case T_NIL: case T_TRUE: case T_FALSE: xsettings_manager_set_int(_self, name, RTEST(value));
|
139
|
-
break;
|
140
|
-
case T_FIXNUM: xsettings_manager_set_int(_self, name, NUM2INT(value));
|
141
|
-
break;
|
142
|
-
case T_STRING: xsettings_manager_set_string(_self, name, StringValuePtr(value));
|
143
|
-
break;
|
144
|
-
case T_ARRAY: if (RARRAY_LEN(value) == 4) { XSettingsColor col ;
|
145
|
-
col.red = NUM2INT(RARRAY_PTR(value)[0]);
|
146
|
-
col.green = NUM2INT(RARRAY_PTR(value)[1]);
|
147
|
-
col.blue = NUM2INT(RARRAY_PTR(value)[2]);
|
148
|
-
col.alpha = NUM2INT(RARRAY_PTR(value)[3]);
|
149
|
-
xsettings_manager_set_color(_self, name, &col);
|
150
|
-
} break;
|
151
|
-
}
|
152
|
-
|
153
|
-
} while(0);
|
154
|
-
|
155
|
-
return Qnil;
|
156
|
-
}
|
157
|
-
|
158
|
-
/* Init */
|
159
|
-
void
|
160
|
-
Init_xsettings(void)
|
161
|
-
{
|
162
|
-
mXSettings = rb_define_module("XSettings");
|
163
|
-
cManager = rb_define_class_under(mXSettings, "Manager", rb_cObject);
|
164
|
-
rb_define_singleton_method(cManager, "exists?", Manager_CLASS_exists_query, 0);
|
165
|
-
rb_define_alloc_func(cManager, Manager_CLASS___alloc__);
|
166
|
-
rb_define_method(cManager, "terminated", Manager_terminated, 0);
|
167
|
-
rb_define_method(cManager, "destroy", Manager_destroy, 0);
|
168
|
-
rb_define_method(cManager, "notify", Manager_notify, 0);
|
169
|
-
rb_define_method(cManager, "[]=", Manager__brace_brace_equals, 2);
|
170
|
-
}
|
data/ext/xsettings/xsettings.rd
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
= module XSettings
|
2
|
-
== class XSettings::Manager
|
3
|
-
--- XSettings::Manager.exists?
|
4
|
-
|
5
|
-
--- XSettings::Manager__alloc__()
|
6
|
-
|
7
|
-
|
8
|
-
--- XSettings::Manager#terminated
|
9
|
-
|
10
|
-
--- XSettings::Manager#destroy
|
11
|
-
|
12
|
-
--- XSettings::Manager#notify
|
13
|
-
|
14
|
-
--- XSettings::Manager#[]=(String name, value)
|
15
|
-
|
16
|
-
|