glib2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/glib2/extconf.rb +1 -0
- data/ext/glib2/glib2.def +23 -0
- data/ext/glib2/rbgcompat.h +19 -5
- data/ext/glib2/rbglib.c +607 -160
- data/ext/glib2/rbglib.h +81 -26
- data/ext/glib2/rbglib2conversions.h +57 -0
- data/ext/glib2/rbglib_bookmarkfile.c +117 -107
- data/ext/glib2/rbglib_completion.c +37 -26
- data/ext/glib2/rbglib_convert.c +42 -30
- data/ext/glib2/rbglib_error.c +20 -10
- data/ext/glib2/rbglib_fileutils.c +48 -37
- data/ext/glib2/rbglib_i18n.c +24 -14
- data/ext/glib2/rbglib_int64.c +24 -16
- data/ext/glib2/rbglib_iochannel.c +146 -204
- data/ext/glib2/rbglib_iochannel_win32_socket.c +56 -0
- data/ext/glib2/rbglib_iochannelerror.c +49 -0
- data/ext/glib2/rbglib_keyfile.c +171 -182
- data/ext/glib2/rbglib_maincontext.c +107 -92
- data/ext/glib2/rbglib_mainloop.c +34 -21
- data/ext/glib2/rbglib_messages.c +53 -44
- data/ext/glib2/rbglib_pollfd.c +37 -26
- data/ext/glib2/rbglib_shell.c +29 -22
- data/ext/glib2/rbglib_shellerror.c +34 -0
- data/ext/glib2/rbglib_source.c +49 -36
- data/ext/glib2/rbglib_spawn.c +50 -61
- data/ext/glib2/rbglib_spawnerror.c +53 -0
- data/ext/glib2/rbglib_threads.c +28 -16
- data/ext/glib2/rbglib_timer.c +35 -24
- data/ext/glib2/rbglib_ucs4.c +79 -0
- data/ext/glib2/rbglib_unichar.c +209 -0
- data/ext/glib2/rbglib_unicode.c +34 -584
- data/ext/glib2/rbglib_utf16.c +78 -0
- data/ext/glib2/rbglib_utf8.c +259 -0
- data/ext/glib2/rbglib_utils.c +95 -91
- data/ext/glib2/rbglib_win32.c +52 -45
- data/ext/glib2/rbglibdeprecated.c +56 -0
- data/ext/glib2/rbglibdeprecated.h +34 -0
- data/ext/glib2/rbgobj_boxed.c +40 -33
- data/ext/glib2/rbgobj_closure.c +45 -34
- data/ext/glib2/rbgobj_convert.c +19 -9
- data/ext/glib2/rbgobj_enumflags.c +109 -0
- data/ext/glib2/rbgobj_enums.c +67 -646
- data/ext/glib2/rbgobj_flags.c +522 -0
- data/ext/glib2/rbgobj_fundamental.c +19 -6
- data/ext/glib2/rbgobj_object.c +90 -81
- data/ext/glib2/rbgobj_param.c +78 -83
- data/ext/glib2/rbgobj_paramspecs.c +20 -12
- data/ext/glib2/rbgobj_signal.c +248 -193
- data/ext/glib2/rbgobj_strv.c +20 -10
- data/ext/glib2/rbgobj_type.c +153 -149
- data/ext/glib2/rbgobj_typeinstance.c +49 -39
- data/ext/glib2/rbgobj_typeinterface.c +37 -27
- data/ext/glib2/rbgobj_typemodule.c +39 -29
- data/ext/glib2/rbgobj_typeplugin.c +36 -26
- data/ext/glib2/rbgobj_value.c +41 -11
- data/ext/glib2/rbgobj_valuearray.c +59 -23
- data/ext/glib2/rbgobj_valuetypes.c +27 -17
- data/ext/glib2/rbgobject.c +26 -40
- data/ext/glib2/rbgobject.h +38 -20
- data/ext/glib2/rbgprivate.h +87 -5
- data/ext/glib2/rbgutil.c +52 -238
- data/ext/glib2/rbgutil.h +55 -42
- data/ext/glib2/rbgutil_callback.c +47 -12
- data/ext/glib2/rbgutil_list.c +173 -0
- data/ext/glib2/rbgutil_list.h +85 -0
- data/ext/glib2/rbgutildeprecated.c +252 -0
- data/ext/glib2/rbgutildeprecated.h +63 -0
- data/lib/glib-mkenums.rb +2 -2
- data/lib/glib2.rb +2 -25
- data/lib/glib2/deprecatable.rb +149 -0
- data/lib/gnome2-raketask.rb +45 -15
- data/lib/gnome2-win32-binary-downloader.rb +1 -1
- data/lib/mkmf-gnome2.rb +37 -18
- data/test/test_flags.rb +129 -0
- data/test/test_key_file.rb +6 -2
- data/test/test_spawn.rb +33 -0
- metadata +26 -7
- data/ChangeLog +0 -3513
@@ -1,13 +1,23 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2005 Masao Mutoh
|
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, or (at your option) any later version.
|
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., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
11
21
|
|
12
22
|
#include "rbgprivate.h"
|
13
23
|
|
@@ -21,12 +31,13 @@
|
|
21
31
|
# endif
|
22
32
|
#endif
|
23
33
|
|
34
|
+
GStaticPrivate rg_polling_key = G_STATIC_PRIVATE_INIT;
|
35
|
+
|
24
36
|
/*
|
25
37
|
static ID id_poll_func;
|
26
38
|
*/
|
27
39
|
static ID id_call;
|
28
40
|
|
29
|
-
|
30
41
|
static VALUE mGLibSource;
|
31
42
|
static ID id__callbacks__;
|
32
43
|
static GHashTable *callbacks_table;
|
@@ -75,7 +86,9 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
|
|
75
86
|
info.timeout = timeout;
|
76
87
|
info.result = 0;
|
77
88
|
|
89
|
+
g_static_private_set(&rg_polling_key, GINT_TO_POINTER(TRUE), NULL);
|
78
90
|
rb_thread_blocking_region(rg_poll_in_blocking, &info, RUBY_UBF_IO, NULL);
|
91
|
+
g_static_private_set(&rg_polling_key, GINT_TO_POINTER(FALSE), NULL);
|
79
92
|
|
80
93
|
return info.result;
|
81
94
|
}
|
@@ -101,7 +114,7 @@ rg_poll(GPollFD *ufds, guint nfsd, gint timeout)
|
|
101
114
|
#endif
|
102
115
|
|
103
116
|
static void
|
104
|
-
restore_poll_func(VALUE data)
|
117
|
+
restore_poll_func(G_GNUC_UNUSED VALUE data)
|
105
118
|
{
|
106
119
|
if (g_main_context_get_poll_func(NULL) == (GPollFunc)rg_poll) {
|
107
120
|
g_main_context_set_poll_func(NULL, default_poll_func);
|
@@ -112,11 +125,11 @@ restore_poll_func(VALUE data)
|
|
112
125
|
static guint ruby_source_id = 0;
|
113
126
|
|
114
127
|
/* from eval.c */
|
115
|
-
#define WAIT_FD
|
116
|
-
#define WAIT_SELECT
|
117
|
-
#define WAIT_TIME
|
118
|
-
#define WAIT_JOIN
|
119
|
-
#define WAIT_PID
|
128
|
+
#define WAIT_FD (1<<0)
|
129
|
+
#define WAIT_SELECT (1<<1)
|
130
|
+
#define WAIT_TIME (1<<2)
|
131
|
+
#define WAIT_JOIN (1<<3)
|
132
|
+
#define WAIT_PID (1<<4)
|
120
133
|
|
121
134
|
#define DELAY_INFTY 1E30
|
122
135
|
|
@@ -130,7 +143,7 @@ static guint ruby_source_id = 0;
|
|
130
143
|
#endif
|
131
144
|
|
132
145
|
static double
|
133
|
-
timeofday()
|
146
|
+
timeofday(void)
|
134
147
|
{
|
135
148
|
struct timeval tv;
|
136
149
|
#if CHECK_RUBY_RELEASE_DATE(2009, 1, 7)
|
@@ -153,7 +166,7 @@ timeofday()
|
|
153
166
|
struct timespec tp;
|
154
167
|
|
155
168
|
if (clock_gettime(CLOCK_MONOTONIC, &tp) == 0) {
|
156
|
-
|
169
|
+
return (double)tp.tv_sec + (double)tp.tv_nsec * 1e-9;
|
157
170
|
}
|
158
171
|
# endif
|
159
172
|
#endif
|
@@ -322,7 +335,9 @@ source_check(GSource *source)
|
|
322
335
|
}
|
323
336
|
|
324
337
|
static gboolean
|
325
|
-
source_dispatch(GSource *source,
|
338
|
+
source_dispatch(G_GNUC_UNUSED GSource *source,
|
339
|
+
G_GNUC_UNUSED GSourceFunc callback,
|
340
|
+
G_GNUC_UNUSED gpointer user_data)
|
326
341
|
{
|
327
342
|
TRAP_BEG;
|
328
343
|
rb_thread_schedule();
|
@@ -358,7 +373,9 @@ static GSourceFuncs source_funcs = {
|
|
358
373
|
source_prepare,
|
359
374
|
source_check,
|
360
375
|
source_dispatch,
|
361
|
-
source_finalize
|
376
|
+
source_finalize,
|
377
|
+
NULL,
|
378
|
+
NULL
|
362
379
|
};
|
363
380
|
|
364
381
|
static GSource *
|
@@ -378,7 +395,7 @@ ruby_source_new(void)
|
|
378
395
|
}
|
379
396
|
|
380
397
|
static VALUE
|
381
|
-
ruby_source_set_priority
|
398
|
+
ruby_source_set_priority(G_GNUC_UNUSED VALUE self, VALUE priority)
|
382
399
|
{
|
383
400
|
GSource *ruby_source = NULL;
|
384
401
|
|
@@ -393,7 +410,7 @@ ruby_source_set_priority (VALUE self, VALUE priority)
|
|
393
410
|
#endif
|
394
411
|
|
395
412
|
static VALUE
|
396
|
-
source_remove(VALUE self, VALUE tag)
|
413
|
+
source_remove(G_GNUC_UNUSED VALUE self, VALUE tag)
|
397
414
|
{
|
398
415
|
VALUE callback;
|
399
416
|
callback = G_GET_RELATIVE(mGLibSource, id__callbacks__, tag);
|
@@ -404,7 +421,7 @@ source_remove(VALUE self, VALUE tag)
|
|
404
421
|
|
405
422
|
#if GLIB_CHECK_VERSION(2,12,0)
|
406
423
|
static VALUE
|
407
|
-
source_current_source(VALUE self)
|
424
|
+
source_current_source(G_GNUC_UNUSED VALUE self)
|
408
425
|
{
|
409
426
|
return BOXED2RVAL(g_main_current_source, G_TYPE_SOURCE);
|
410
427
|
}
|
@@ -422,8 +439,8 @@ invoke_source_func(gpointer data)
|
|
422
439
|
return ret;
|
423
440
|
}
|
424
441
|
|
425
|
-
|
426
442
|
/*****************************************/
|
443
|
+
#if !GLIB_CHECK_VERSION(2,30,0)
|
427
444
|
GType
|
428
445
|
g_main_context_get_type(void)
|
429
446
|
{
|
@@ -434,12 +451,14 @@ g_main_context_get_type(void)
|
|
434
451
|
(GBoxedFreeFunc)g_main_context_unref);
|
435
452
|
return our_type;
|
436
453
|
}
|
454
|
+
#endif
|
437
455
|
/*****************************************/
|
438
456
|
|
457
|
+
#define RG_TARGET_NAMESPACE cMainContext
|
439
458
|
#define _SELF(s) ((GMainContext*)RVAL2BOXED(s, G_TYPE_MAIN_CONTEXT))
|
440
459
|
|
441
460
|
static VALUE
|
442
|
-
|
461
|
+
rg_initialize(VALUE self)
|
443
462
|
{
|
444
463
|
GMainContext *context;
|
445
464
|
|
@@ -460,25 +479,25 @@ mc_initialize(VALUE self)
|
|
460
479
|
}
|
461
480
|
|
462
481
|
static VALUE
|
463
|
-
|
482
|
+
rg_s_default(G_GNUC_UNUSED VALUE self)
|
464
483
|
{
|
465
484
|
return BOXED2RVAL(g_main_context_default(), G_TYPE_MAIN_CONTEXT);
|
466
485
|
}
|
467
486
|
|
468
487
|
static VALUE
|
469
|
-
|
488
|
+
rg_iteration(VALUE self, VALUE may_block)
|
470
489
|
{
|
471
490
|
return CBOOL2RVAL(g_main_context_iteration(_SELF(self), RVAL2CBOOL(may_block)));
|
472
491
|
}
|
473
492
|
|
474
493
|
static VALUE
|
475
|
-
|
494
|
+
rg_pending_p(VALUE self)
|
476
495
|
{
|
477
496
|
return CBOOL2RVAL(g_main_context_pending(_SELF(self)));
|
478
497
|
}
|
479
498
|
|
480
499
|
static VALUE
|
481
|
-
|
500
|
+
rg_find_source(VALUE self, VALUE source_id)
|
482
501
|
{
|
483
502
|
GSource* src = g_main_context_find_source_by_id(_SELF(self), NUM2UINT(source_id));
|
484
503
|
return BOXED2RVAL(src, G_TYPE_SOURCE);
|
@@ -495,20 +514,20 @@ GSource* g_main_context_find_source_by_funcs_user_data
|
|
495
514
|
*/
|
496
515
|
|
497
516
|
static VALUE
|
498
|
-
|
517
|
+
rg_wakeup(VALUE self)
|
499
518
|
{
|
500
519
|
g_main_context_wakeup(_SELF(self));
|
501
520
|
return self;
|
502
521
|
}
|
503
522
|
|
504
523
|
static VALUE
|
505
|
-
|
524
|
+
rg_acquire(VALUE self)
|
506
525
|
{
|
507
526
|
return CBOOL2RVAL(g_main_context_acquire(_SELF(self)));
|
508
527
|
}
|
509
528
|
|
510
529
|
static VALUE
|
511
|
-
|
530
|
+
rg_release(VALUE self)
|
512
531
|
{
|
513
532
|
g_main_context_release(_SELF(self));
|
514
533
|
return self;
|
@@ -516,7 +535,7 @@ mc_release(VALUE self)
|
|
516
535
|
|
517
536
|
#if GLIB_CHECK_VERSION(2,10,0)
|
518
537
|
static VALUE
|
519
|
-
|
538
|
+
rg_owner_p(VALUE self)
|
520
539
|
{
|
521
540
|
return CBOOL2RVAL(g_main_context_is_owner(_SELF(self)));
|
522
541
|
}
|
@@ -529,7 +548,7 @@ gboolean g_main_context_wait (GMainContext *context,
|
|
529
548
|
*/
|
530
549
|
|
531
550
|
static VALUE
|
532
|
-
|
551
|
+
rg_prepare(VALUE self)
|
533
552
|
{
|
534
553
|
gint priority;
|
535
554
|
gboolean ret = g_main_context_prepare(_SELF(self), &priority);
|
@@ -538,9 +557,9 @@ mc_prepare(VALUE self)
|
|
538
557
|
}
|
539
558
|
|
540
559
|
struct mc_query_body_args {
|
541
|
-
GPollFD *fds;
|
542
560
|
gint timeout_;
|
543
|
-
|
561
|
+
GPollFD *fds;
|
562
|
+
gint n_fds;
|
544
563
|
};
|
545
564
|
|
546
565
|
static VALUE
|
@@ -550,9 +569,9 @@ mc_query_body(VALUE value)
|
|
550
569
|
gint i;
|
551
570
|
VALUE ary = rb_ary_new();
|
552
571
|
|
553
|
-
for (i = 0; i < args->
|
572
|
+
for (i = 0; i < args->n_fds; i++)
|
554
573
|
rb_ary_push(ary, BOXED2RVAL(&args->fds[i], G_TYPE_POLL_FD));
|
555
|
-
|
574
|
+
|
556
575
|
return rb_assoc_new(INT2NUM(args->timeout_), ary);
|
557
576
|
}
|
558
577
|
|
@@ -564,38 +583,36 @@ mc_query_ensure(VALUE value)
|
|
564
583
|
return Qnil;
|
565
584
|
}
|
566
585
|
|
586
|
+
#define QUERY_DEFAULT_FDS 100
|
587
|
+
|
567
588
|
static VALUE
|
568
|
-
|
589
|
+
rg_query(VALUE self, VALUE rbmax_priority)
|
569
590
|
{
|
591
|
+
GMainContext *context = _SELF(self);
|
592
|
+
gint max_priority = NUM2INT(rbmax_priority);
|
570
593
|
gint timeout_;
|
594
|
+
GPollFD *fds;
|
595
|
+
gint n_fds;
|
571
596
|
struct mc_query_body_args args;
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
&timeout_,
|
577
|
-
fds,
|
578
|
-
100);
|
579
|
-
if (ret > 100) {
|
597
|
+
|
598
|
+
fds = g_new(GPollFD, QUERY_DEFAULT_FDS);
|
599
|
+
n_fds = g_main_context_query(context, max_priority, &timeout_, fds, QUERY_DEFAULT_FDS);
|
600
|
+
if (n_fds > QUERY_DEFAULT_FDS) {
|
580
601
|
g_free(fds);
|
581
|
-
fds = g_new(GPollFD,
|
582
|
-
g_main_context_query(
|
583
|
-
NUM2INT(max_priority),
|
584
|
-
&timeout_,
|
585
|
-
fds,
|
586
|
-
ret);
|
602
|
+
fds = g_new(GPollFD, n_fds);
|
603
|
+
g_main_context_query(context, max_priority, &timeout_, fds, n_fds);
|
587
604
|
}
|
588
605
|
|
589
|
-
args.fds = fds;
|
590
606
|
args.timeout_ = timeout_;
|
591
|
-
args.
|
607
|
+
args.fds = fds;
|
608
|
+
args.n_fds = n_fds;
|
592
609
|
return rb_ensure(mc_query_body, (VALUE)&args,
|
593
610
|
mc_query_ensure, (VALUE)fds);
|
594
611
|
}
|
595
612
|
|
596
613
|
/* How can I implement this?
|
597
614
|
static VALUE
|
598
|
-
|
615
|
+
rg_check(VALUE self, VALUE max_priority)
|
599
616
|
{
|
600
617
|
gint i, timeout_;
|
601
618
|
VALUE ary;
|
@@ -610,7 +627,7 @@ mc_check(VALUE self, VALUE max_priority)
|
|
610
627
|
|
611
628
|
g_free(fds);
|
612
629
|
fds = g_new (GPollFD, n_fds);
|
613
|
-
|
630
|
+
|
614
631
|
ret = g_main_context_check(_SELF(self), NUM2INT(max_priority),
|
615
632
|
fds, n_fds);
|
616
633
|
printf("ret = %d\n", ret);
|
@@ -624,7 +641,7 @@ mc_check(VALUE self, VALUE max_priority)
|
|
624
641
|
*/
|
625
642
|
|
626
643
|
static VALUE
|
627
|
-
|
644
|
+
rg_dispatch(VALUE self)
|
628
645
|
{
|
629
646
|
g_main_context_dispatch(_SELF(self));
|
630
647
|
return self;
|
@@ -642,7 +659,7 @@ poll_func(GPollFD *ufds, guint nfsd, gint timeout_)
|
|
642
659
|
}
|
643
660
|
|
644
661
|
static VALUE
|
645
|
-
|
662
|
+
rg_set_poll_func(VALUE self)
|
646
663
|
{
|
647
664
|
rb_ivar_set(self, id_poll_func, rb_block_proc());
|
648
665
|
g_main_context_set_poll_func(_SELF(self), (GPollFunc)poll_func);
|
@@ -656,7 +673,7 @@ GPollFunc g_main_context_get_poll_func (GMainContext *context);
|
|
656
673
|
*/
|
657
674
|
|
658
675
|
static VALUE
|
659
|
-
|
676
|
+
rg_add_poll(VALUE self, VALUE fd, VALUE priority)
|
660
677
|
{
|
661
678
|
g_main_context_add_poll(_SELF(self), RVAL2BOXED(fd, G_TYPE_POLL_FD),
|
662
679
|
NUM2INT(priority));
|
@@ -664,7 +681,7 @@ mc_add_poll(VALUE self, VALUE fd, VALUE priority)
|
|
664
681
|
}
|
665
682
|
|
666
683
|
static VALUE
|
667
|
-
|
684
|
+
rg_remove_poll(VALUE self, VALUE fd)
|
668
685
|
{
|
669
686
|
g_main_context_remove_poll(_SELF(self), RVAL2BOXED(fd, G_TYPE_POLL_FD));
|
670
687
|
return self;
|
@@ -672,28 +689,27 @@ mc_remove_poll(VALUE self, VALUE fd)
|
|
672
689
|
|
673
690
|
#ifdef HAVE_G_MAIN_DEPTH
|
674
691
|
static VALUE
|
675
|
-
|
692
|
+
rg_s_depth(VALUE self)
|
676
693
|
{
|
677
694
|
return INT2NUM(g_main_depth());
|
678
695
|
}
|
679
696
|
#endif
|
680
697
|
|
681
|
-
|
682
698
|
static VALUE
|
683
|
-
timeout_source_new(VALUE self, VALUE interval)
|
699
|
+
timeout_source_new(G_GNUC_UNUSED VALUE self, VALUE interval)
|
684
700
|
{
|
685
701
|
return BOXED2RVAL(g_timeout_source_new(NUM2UINT(interval)), G_TYPE_SOURCE);
|
686
702
|
}
|
687
703
|
#if GLIB_CHECK_VERSION(2,14,0)
|
688
704
|
static VALUE
|
689
|
-
timeout_source_new_seconds(VALUE self, VALUE interval)
|
705
|
+
timeout_source_new_seconds(G_GNUC_UNUSED VALUE self, VALUE interval)
|
690
706
|
{
|
691
707
|
return BOXED2RVAL(g_timeout_source_new_seconds(NUM2UINT(interval)), G_TYPE_SOURCE);
|
692
708
|
}
|
693
709
|
#endif
|
694
710
|
|
695
711
|
static VALUE
|
696
|
-
timeout_add(int argc, VALUE *argv, VALUE self)
|
712
|
+
timeout_add(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
697
713
|
{
|
698
714
|
VALUE interval, rb_priority, func, rb_id;
|
699
715
|
gint priority;
|
@@ -717,7 +733,7 @@ timeout_add(int argc, VALUE *argv, VALUE self)
|
|
717
733
|
|
718
734
|
#if GLIB_CHECK_VERSION(2,14,0)
|
719
735
|
static VALUE
|
720
|
-
timeout_add_seconds(int argc, VALUE *argv, VALUE self)
|
736
|
+
timeout_add_seconds(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
721
737
|
{
|
722
738
|
VALUE interval, rb_priority, func, rb_id;
|
723
739
|
gint priority;
|
@@ -743,13 +759,13 @@ timeout_add_seconds(int argc, VALUE *argv, VALUE self)
|
|
743
759
|
#endif
|
744
760
|
|
745
761
|
static VALUE
|
746
|
-
idle_source_new(VALUE self)
|
762
|
+
idle_source_new(G_GNUC_UNUSED VALUE self)
|
747
763
|
{
|
748
764
|
return BOXED2RVAL(g_idle_source_new(), G_TYPE_SOURCE);
|
749
765
|
}
|
750
766
|
|
751
767
|
static VALUE
|
752
|
-
idle_add(gint argc, VALUE *argv, VALUE self)
|
768
|
+
idle_add(gint argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
|
753
769
|
{
|
754
770
|
VALUE arg1, arg2, func, rb_id;
|
755
771
|
callback_info_t *info;
|
@@ -779,7 +795,7 @@ idle_add(gint argc, VALUE *argv, VALUE self)
|
|
779
795
|
}
|
780
796
|
|
781
797
|
static VALUE
|
782
|
-
idle_remove(VALUE self, VALUE func)
|
798
|
+
idle_remove(G_GNUC_UNUSED VALUE self, VALUE func)
|
783
799
|
{
|
784
800
|
callback_info_t *info;
|
785
801
|
|
@@ -791,7 +807,7 @@ idle_remove(VALUE self, VALUE func)
|
|
791
807
|
|
792
808
|
#if GLIB_CHECK_VERSION(2,4,0)
|
793
809
|
static VALUE
|
794
|
-
child_watch_source_new(VALUE self, VALUE pid)
|
810
|
+
child_watch_source_new(G_GNUC_UNUSED VALUE self, VALUE pid)
|
795
811
|
{
|
796
812
|
return BOXED2RVAL(g_child_watch_source_new((GPid)NUM2INT(pid)), G_TYPE_SOURCE);
|
797
813
|
}
|
@@ -814,7 +830,7 @@ child_watch_add(VALUE self, VALUE pid)
|
|
814
830
|
|
815
831
|
#ifndef HAVE_RB_THREAD_BLOCKING_REGION
|
816
832
|
static void
|
817
|
-
ruby_source_remove(VALUE data)
|
833
|
+
ruby_source_remove(G_GNUC_UNUSED VALUE data)
|
818
834
|
{
|
819
835
|
if (ruby_source_id != 0) {
|
820
836
|
g_source_remove(ruby_source_id);
|
@@ -824,9 +840,9 @@ ruby_source_remove(VALUE data)
|
|
824
840
|
#endif
|
825
841
|
|
826
842
|
void
|
827
|
-
Init_glib_main_context()
|
843
|
+
Init_glib_main_context(void)
|
828
844
|
{
|
829
|
-
VALUE
|
845
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_CONTEXT, "MainContext", mGLib);
|
830
846
|
|
831
847
|
VALUE timeout = rb_define_module_under(mGLib, "Timeout");
|
832
848
|
VALUE idle = rb_define_module_under(mGLib, "Idle");
|
@@ -851,30 +867,30 @@ Init_glib_main_context()
|
|
851
867
|
/*
|
852
868
|
id_poll_func = rb_intern("__poll_func__");
|
853
869
|
*/
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
870
|
+
RG_DEF_METHOD(initialize, 0);
|
871
|
+
RG_DEF_SMETHOD(default, 0);
|
872
|
+
RG_DEF_METHOD(iteration, 1);
|
873
|
+
RG_DEF_METHOD_P(pending, 0);
|
874
|
+
RG_DEF_METHOD(find_source, 1);
|
875
|
+
RG_DEF_METHOD(wakeup, 0);
|
876
|
+
RG_DEF_METHOD(acquire, 0);
|
877
|
+
RG_DEF_METHOD(release, 0);
|
862
878
|
#if GLIB_CHECK_VERSION(2,10,0)
|
863
|
-
|
879
|
+
RG_DEF_METHOD_P(owner, 0);
|
864
880
|
#endif
|
865
|
-
|
866
|
-
|
881
|
+
RG_DEF_METHOD(prepare, 0);
|
882
|
+
RG_DEF_METHOD(query, 1);
|
867
883
|
/*
|
868
|
-
|
884
|
+
RG_DEF_METHOD(check, 1);
|
869
885
|
*/
|
870
|
-
|
886
|
+
RG_DEF_METHOD(dispatch, 0);
|
871
887
|
/*
|
872
|
-
|
888
|
+
RG_DEF_METHOD(set_poll_func, 0);
|
873
889
|
*/
|
874
|
-
|
875
|
-
|
890
|
+
RG_DEF_METHOD(add_poll, 2);
|
891
|
+
RG_DEF_METHOD(remove_poll, 1);
|
876
892
|
#ifdef HAVE_G_MAIN_DEPTH
|
877
|
-
|
893
|
+
RG_DEF_SMETHOD(depth, 0);
|
878
894
|
#endif
|
879
895
|
rb_define_module_function(timeout, "source_new", timeout_source_new, 1);
|
880
896
|
#if GLIB_CHECK_VERSION(2,14,0)
|
@@ -893,7 +909,6 @@ Init_glib_main_context()
|
|
893
909
|
rb_define_module_function(child_watch, "add", child_watch_add, 1);
|
894
910
|
#endif
|
895
911
|
|
896
|
-
|
897
912
|
default_poll_func = g_main_context_get_poll_func(NULL);
|
898
913
|
g_main_context_set_poll_func(NULL, rg_poll);
|
899
914
|
rb_set_end_proc(restore_poll_func, Qnil);
|