glib2 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/glib2/glib2.def +2 -0
- data/ext/glib2/rbglib.h +1 -1
- data/ext/glib2/rbgobj_closure.c +24 -3
- data/ext/glib2/rbgobj_signal.c +28 -2
- data/ext/glib2/rbgobject.h +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7d1eb0a21b97c5152d4f792de24a5fc4c12074f1f38e1c0eb220d63e68c1adf
|
4
|
+
data.tar.gz: 792084386504df0ca97a1a8dcd0f5c5fae4cc0909ae93daf0699225d1a9bb52a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68b6c0da8fac487e6267dfcf77b5695b838a8244702c241032f6a21a180cb7b9e403c642353efbec236d0fd5a2a9ffd6b6d241d85123fcc50038432b95599456
|
7
|
+
data.tar.gz: 7f369ff1a891dc192546b6c690ac819ad36610f13c3a69d68897607c41af214fb84d77312229c9c74c7777e9419c0ec06297d1c63939874c7d3e1deef015cf2c
|
data/ext/glib2/glib2.def
CHANGED
data/ext/glib2/rbglib.h
CHANGED
data/ext/glib2/rbgobj_closure.c
CHANGED
@@ -234,6 +234,8 @@ g_rclosure_new_raw(VALUE callback_proc,
|
|
234
234
|
rclosure);
|
235
235
|
rclosure->tag[0] = '\0';
|
236
236
|
|
237
|
+
g_closure_ref(closure);
|
238
|
+
g_closure_sink(closure);
|
237
239
|
g_closure_set_marshal(closure, &rclosure_marshal);
|
238
240
|
g_closure_add_finalize_notifier(closure, NULL, rclosure_finalize);
|
239
241
|
|
@@ -271,7 +273,10 @@ void
|
|
271
273
|
g_rclosure_attach(GClosure *closure, VALUE object)
|
272
274
|
{
|
273
275
|
GRClosure *rclosure = (GRClosure *)closure;
|
274
|
-
|
276
|
+
rbgobj_add_relative_removable(object,
|
277
|
+
Qnil,
|
278
|
+
id_closures,
|
279
|
+
rclosure->rb_holder);
|
275
280
|
}
|
276
281
|
|
277
282
|
void
|
@@ -286,6 +291,24 @@ g_rclosure_attach_gobject(GClosure *closure, VALUE object)
|
|
286
291
|
rclosure->objects = g_list_prepend(rclosure->objects, gobject);
|
287
292
|
}
|
288
293
|
|
294
|
+
void
|
295
|
+
g_rclosure_detach(GClosure *closure, VALUE object)
|
296
|
+
{
|
297
|
+
GRClosure *rclosure = (GRClosure *)closure;
|
298
|
+
rbgobj_remove_relative(object, id_closures, rclosure->rb_holder);
|
299
|
+
}
|
300
|
+
|
301
|
+
void
|
302
|
+
g_rclosure_detach_gobject(GClosure *closure, VALUE object)
|
303
|
+
{
|
304
|
+
GRClosure *rclosure = (GRClosure *)closure;
|
305
|
+
g_rclosure_detach(closure, object);
|
306
|
+
|
307
|
+
GObject *gobject = RVAL2GOBJ(object);
|
308
|
+
g_object_weak_unref(gobject, rclosure_weak_notify, rclosure);
|
309
|
+
rclosure_weak_notify(rclosure, gobject);
|
310
|
+
}
|
311
|
+
|
289
312
|
void
|
290
313
|
g_rclosure_set_tag(GClosure *closure, const gchar *tag)
|
291
314
|
{
|
@@ -321,8 +344,6 @@ rg_initialize(VALUE self)
|
|
321
344
|
{
|
322
345
|
GClosure *closure = g_rclosure_new(rb_block_proc(), Qnil, NULL);
|
323
346
|
G_INITIALIZE(self, closure);
|
324
|
-
g_closure_ref(closure);
|
325
|
-
g_closure_sink(closure);
|
326
347
|
return self;
|
327
348
|
}
|
328
349
|
|
data/ext/glib2/rbgobj_signal.c
CHANGED
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
#define RG_TARGET_NAMESPACE cSignal
|
25
25
|
|
26
|
+
static ID id_connected_closures;
|
26
27
|
static VALUE RG_TARGET_NAMESPACE;
|
27
28
|
VALUE rbgobj_signal_wrap(guint sig_id);
|
28
29
|
|
@@ -415,9 +416,19 @@ gobj_sig_connect_impl(gboolean after, int argc, VALUE *argv, VALUE self)
|
|
415
416
|
g_free(tag);
|
416
417
|
handler_id = g_signal_connect_closure_by_id(g_object, signal_id, detail,
|
417
418
|
rclosure, after);
|
418
|
-
|
419
|
+
VALUE rb_handler_id = ULONG2NUM(handler_id);
|
420
|
+
if (handler_id != 0) {
|
421
|
+
VALUE rb_connected_closures = rb_ivar_get(self, id_connected_closures);
|
422
|
+
if (NIL_P(rb_connected_closures)) {
|
423
|
+
rb_connected_closures = rb_hash_new();
|
424
|
+
rb_ivar_set(self, id_connected_closures, rb_connected_closures);
|
425
|
+
}
|
426
|
+
rb_hash_aset(rb_connected_closures,
|
427
|
+
rb_handler_id,
|
428
|
+
POINTER2NUM(rclosure));
|
429
|
+
}
|
419
430
|
|
420
|
-
return
|
431
|
+
return rb_handler_id;
|
421
432
|
}
|
422
433
|
|
423
434
|
static VALUE
|
@@ -604,6 +615,19 @@ static VALUE
|
|
604
615
|
gobj_sig_handler_disconnect(VALUE self, VALUE id)
|
605
616
|
{
|
606
617
|
g_signal_handler_disconnect(RVAL2GOBJ(self), NUM2ULONG(id));
|
618
|
+
VALUE rb_connected_closures = rb_ivar_get(self, id_connected_closures);
|
619
|
+
if (NIL_P(rb_connected_closures)) {
|
620
|
+
return self;
|
621
|
+
}
|
622
|
+
VALUE rb_rclosure_pointer = rb_hash_aref(rb_connected_closures, id);
|
623
|
+
if (NIL_P(rb_rclosure_pointer)) {
|
624
|
+
return self;
|
625
|
+
}
|
626
|
+
GClosure *rclosure = NUM2POINTER(rb_rclosure_pointer);
|
627
|
+
if (!rclosure) {
|
628
|
+
return self;
|
629
|
+
}
|
630
|
+
g_rclosure_detach_gobject(rclosure, self);
|
607
631
|
return self;
|
608
632
|
}
|
609
633
|
|
@@ -971,6 +995,8 @@ rbgobj_define_action_methods(VALUE klass)
|
|
971
995
|
void
|
972
996
|
Init_gobject_gsignal(void)
|
973
997
|
{
|
998
|
+
id_connected_closures = rb_intern("connected_closures");
|
999
|
+
|
974
1000
|
VALUE cSignalFlags, cSignalMatchType;
|
975
1001
|
|
976
1002
|
RG_TARGET_NAMESPACE = rb_define_class_under(rbg_mGLib(), "Signal", rb_cObject);
|
data/ext/glib2/rbgobject.h
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
2
|
/*
|
3
|
-
* Copyright (C) 2003-
|
3
|
+
* Copyright (C) 2003-2022 Ruby-GNOME Project Team
|
4
4
|
* Copyright (C) 2002,2003 Masahiro Sakai
|
5
5
|
*
|
6
6
|
* This library is free software; you can redistribute it and/or
|
@@ -238,6 +238,8 @@ extern GClosure* g_rclosure_new_call(VALUE callback_proc,
|
|
238
238
|
RGClosureCallFunc func);
|
239
239
|
extern void g_rclosure_attach(GClosure *closure, VALUE object);
|
240
240
|
extern void g_rclosure_attach_gobject(GClosure *closure, VALUE object);
|
241
|
+
extern void g_rclosure_detach(GClosure *closure, VALUE object);
|
242
|
+
extern void g_rclosure_detach_gobject(GClosure *closure, VALUE object);
|
241
243
|
extern void g_rclosure_set_tag(GClosure *closure, const gchar *tag);
|
242
244
|
|
243
245
|
/* rbgobj_value.c */
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Ruby-GNOME Project Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pkg-config
|