glib2 3.4.4 → 3.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,154 @@
1
+
2
+ /* Generated by glib-mkenums.rb ($Id$) */
3
+
4
+ #ifndef __GLIB_ENUM_TYPES_H__
5
+ #define __GLIB_ENUM_TYPES_H__
6
+
7
+ #include <glib-object.h>
8
+
9
+ G_BEGIN_DECLS
10
+
11
+ /* enumerations from "/usr/include/glib-2.0/glib/gvariant.h" */
12
+ GType g_variant_class_get_type (void);
13
+ #define G_TYPE_VARIANT_CLASS (g_variant_class_get_type())
14
+ GType g_variant_parse_error_get_type (void);
15
+ #define G_TYPE_VARIANT_PARSE_ERROR (g_variant_parse_error_get_type())
16
+
17
+ /* enumerations from "/usr/include/glib-2.0/glib/gspawn.h" */
18
+ GType g_spawn_error_get_type (void);
19
+ #define G_TYPE_SPAWN_ERROR (g_spawn_error_get_type())
20
+ GType g_spawn_flags_get_type (void);
21
+ #define G_TYPE_SPAWN_FLAGS (g_spawn_flags_get_type())
22
+
23
+ /* enumerations from "/usr/include/glib-2.0/glib/gkeyfile.h" */
24
+ GType g_key_file_error_get_type (void);
25
+ #define G_TYPE_KEY_FILE_ERROR (g_key_file_error_get_type())
26
+ GType g_key_file_flags_get_type (void);
27
+ #define G_TYPE_KEY_FILE_FLAGS (g_key_file_flags_get_type())
28
+
29
+ /* enumerations from "/usr/include/glib-2.0/glib/gnode.h" */
30
+ GType g_traverse_flags_get_type (void);
31
+ #define G_TYPE_TRAVERSE_FLAGS (g_traverse_flags_get_type())
32
+ GType g_traverse_type_get_type (void);
33
+ #define G_TYPE_TRAVERSE_TYPE (g_traverse_type_get_type())
34
+
35
+ /* enumerations from "/usr/include/glib-2.0/glib/gshell.h" */
36
+ GType g_shell_error_get_type (void);
37
+ #define G_TYPE_SHELL_ERROR (g_shell_error_get_type())
38
+
39
+ /* enumerations from "/usr/include/glib-2.0/glib/gslice.h" */
40
+ GType g_slice_config_get_type (void);
41
+ #define G_TYPE_SLICE_CONFIG (g_slice_config_get_type())
42
+
43
+ /* enumerations from "/usr/include/glib-2.0/glib/gregex.h" */
44
+ GType g_regex_error_get_type (void);
45
+ #define G_TYPE_REGEX_ERROR (g_regex_error_get_type())
46
+ GType g_regex_compile_flags_get_type (void);
47
+ #define G_TYPE_REGEX_COMPILE_FLAGS (g_regex_compile_flags_get_type())
48
+ GType g_regex_match_flags_get_type (void);
49
+ #define G_TYPE_REGEX_MATCH_FLAGS (g_regex_match_flags_get_type())
50
+
51
+ /* enumerations from "/usr/include/glib-2.0/glib/gmarkup.h" */
52
+ GType g_markup_error_get_type (void);
53
+ #define G_TYPE_MARKUP_ERROR (g_markup_error_get_type())
54
+ GType g_markup_parse_flags_get_type (void);
55
+ #define G_TYPE_MARKUP_PARSE_FLAGS (g_markup_parse_flags_get_type())
56
+ GType g_markup_collect_type_get_type (void);
57
+ #define G_TYPE_MARKUP_COLLECT_TYPE (g_markup_collect_type_get_type())
58
+
59
+ /* enumerations from "/usr/include/glib-2.0/glib/gtestutils.h" */
60
+ GType g_test_trap_flags_get_type (void);
61
+ #define G_TYPE_TEST_TRAP_FLAGS (g_test_trap_flags_get_type())
62
+ GType g_test_subprocess_flags_get_type (void);
63
+ #define G_TYPE_TEST_SUBPROCESS_FLAGS (g_test_subprocess_flags_get_type())
64
+ GType g_test_log_type_get_type (void);
65
+ #define G_TYPE_TEST_LOG_TYPE (g_test_log_type_get_type())
66
+ GType g_test_file_type_get_type (void);
67
+ #define G_TYPE_TEST_FILE_TYPE (g_test_file_type_get_type())
68
+
69
+ /* enumerations from "/usr/include/glib-2.0/glib/gfileutils.h" */
70
+ GType g_file_error_get_type (void);
71
+ #define G_TYPE_FILE_ERROR (g_file_error_get_type())
72
+ GType g_file_test_get_type (void);
73
+ #define G_TYPE_FILE_TEST (g_file_test_get_type())
74
+
75
+ /* enumerations from "/usr/include/glib-2.0/glib/gtimezone.h" */
76
+ GType g_time_type_get_type (void);
77
+ #define G_TYPE_TIME_TYPE (g_time_type_get_type())
78
+
79
+ /* enumerations from "/usr/include/glib-2.0/glib/gdate.h" */
80
+ GType g_date_dm_y_get_type (void);
81
+ #define G_TYPE_DATE_DM_Y (g_date_dm_y_get_type())
82
+ GType g_date_weekday_get_type (void);
83
+ #define G_TYPE_DATE_WEEKDAY (g_date_weekday_get_type())
84
+ GType g_date_month_get_type (void);
85
+ #define G_TYPE_DATE_MONTH (g_date_month_get_type())
86
+
87
+ /* enumerations from "/usr/include/glib-2.0/glib/gunicode.h" */
88
+ GType g_unicode_type_get_type (void);
89
+ #define G_TYPE_UNICODE_TYPE (g_unicode_type_get_type())
90
+ GType g_unicode_break_type_get_type (void);
91
+ #define G_TYPE_UNICODE_BREAK_TYPE (g_unicode_break_type_get_type())
92
+ GType g_unicode_script_get_type (void);
93
+ #define G_TYPE_UNICODE_SCRIPT (g_unicode_script_get_type())
94
+ GType g_normalize_mode_get_type (void);
95
+ #define G_TYPE_NORMALIZE_MODE (g_normalize_mode_get_type())
96
+
97
+ /* enumerations from "/usr/include/glib-2.0/glib/ghook.h" */
98
+ GType g_hook_flag_mask_get_type (void);
99
+ #define G_TYPE_HOOK_FLAG_MASK (g_hook_flag_mask_get_type())
100
+
101
+ /* enumerations from "/usr/include/glib-2.0/glib/gthread.h" */
102
+ GType g_thread_error_get_type (void);
103
+ #define G_TYPE_THREAD_ERROR (g_thread_error_get_type())
104
+ GType g_once_status_get_type (void);
105
+ #define G_TYPE_ONCE_STATUS (g_once_status_get_type())
106
+
107
+ /* enumerations from "/usr/include/glib-2.0/glib/gstrfuncs.h" */
108
+ GType g_ascii_type_get_type (void);
109
+ #define G_TYPE_ASCII_TYPE (g_ascii_type_get_type())
110
+
111
+ /* enumerations from "/usr/include/glib-2.0/glib/gmessages.h" */
112
+ GType g_log_level_flags_get_type (void);
113
+ #define G_TYPE_LOG_LEVEL_FLAGS (g_log_level_flags_get_type())
114
+
115
+ /* enumerations from "/usr/include/glib-2.0/glib/gchecksum.h" */
116
+ GType g_checksum_type_get_type (void);
117
+ #define G_TYPE_CHECKSUM_TYPE (g_checksum_type_get_type())
118
+
119
+ /* enumerations from "/usr/include/glib-2.0/glib/gutils.h" */
120
+ GType g_user_directory_get_type (void);
121
+ #define G_TYPE_USER_DIRECTORY (g_user_directory_get_type())
122
+ GType g_format_size_flags_get_type (void);
123
+ #define G_TYPE_FORMAT_SIZE_FLAGS (g_format_size_flags_get_type())
124
+
125
+ /* enumerations from "/usr/include/glib-2.0/glib/goption.h" */
126
+ GType g_option_flags_get_type (void);
127
+ #define G_TYPE_OPTION_FLAGS (g_option_flags_get_type())
128
+ GType g_option_arg_get_type (void);
129
+ #define G_TYPE_OPTION_ARG (g_option_arg_get_type())
130
+ GType g_option_error_get_type (void);
131
+ #define G_TYPE_OPTION_ERROR (g_option_error_get_type())
132
+
133
+ /* enumerations from "/usr/include/glib-2.0/glib/gconvert.h" */
134
+ GType g_convert_error_get_type (void);
135
+ #define G_TYPE_CONVERT_ERROR (g_convert_error_get_type())
136
+
137
+ /* enumerations from "/usr/include/glib-2.0/glib/gbookmarkfile.h" */
138
+ GType g_bookmark_file_error_get_type (void);
139
+ #define G_TYPE_BOOKMARK_FILE_ERROR (g_bookmark_file_error_get_type())
140
+
141
+ /* enumerations from "/usr/include/glib-2.0/gobject/gsignal.h" */
142
+ GType g_signal_flags_get_type (void);
143
+ #define G_TYPE_SIGNAL_FLAGS (g_signal_flags_get_type())
144
+ GType g_connect_flags_get_type (void);
145
+ #define G_TYPE_CONNECT_FLAGS (g_connect_flags_get_type())
146
+ GType g_signal_match_type_get_type (void);
147
+ #define G_TYPE_SIGNAL_MATCH_TYPE (g_signal_match_type_get_type())
148
+
149
+ G_END_DECLS
150
+
151
+ #endif /* __GLIB_ENUM_TYPES_H__ */
152
+
153
+ /* Generated data ends here */
154
+
data/ext/glib2/glib2.def CHANGED
@@ -158,6 +158,7 @@ EXPORTS
158
158
  rbgutil_stop_callback_dispatch_thread
159
159
  rbgutil_string_set_utf8_encoding
160
160
  rbgutil_key_equal
161
+ rbgerr_ruby_error_quark
161
162
  rbgerr_define_gerror
162
163
  rbgerr_gerror2exception
163
164
  rbgobj_convert_define
data/ext/glib2/rbglib.h CHANGED
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2002-2020 Ruby-GNOME Project Team
3
+ * Copyright (C) 2002-2021 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
@@ -33,7 +33,7 @@ G_BEGIN_DECLS
33
33
 
34
34
  #define RBGLIB_MAJOR_VERSION 3
35
35
  #define RBGLIB_MINOR_VERSION 4
36
- #define RBGLIB_MICRO_VERSION 4
36
+ #define RBGLIB_MICRO_VERSION 8
37
37
 
38
38
  #ifndef RB_ZALLOC
39
39
  # ifdef ZALLOC
@@ -222,6 +222,13 @@ extern VALUE rbg_check_hash_type(VALUE object);
222
222
  extern void rbg_scan_options(VALUE options, ...);
223
223
 
224
224
  /* rbgerror.h */
225
+ typedef enum {
226
+ RBG_RUBY_ERROR_UNKNOWN,
227
+ } RBGRubyError;
228
+
229
+ #define RBG_RUBY_ERROR rbgerr_ruby_error_quark()
230
+ extern GQuark rbgerr_ruby_error_quark(void);
231
+
225
232
  extern VALUE rbgerr_gerror2exception(GError *error);
226
233
  extern VALUE rbgerr_define_gerror(GQuark domain, const gchar* name, VALUE module, VALUE parent, GType gtype);
227
234
 
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011-2017 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2021 Ruby-GNOME Project Team
4
4
  * Copyright (C) 2004 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -29,6 +29,8 @@ static VALUE gerror_table;
29
29
  static VALUE generic_error;
30
30
  static VALUE error_info;
31
31
 
32
+ G_DEFINE_QUARK(ruby-error-quark, rbgerr_ruby_error)
33
+
32
34
  VALUE
33
35
  rbgerr_gerror2exception(GError *error)
34
36
  {
@@ -107,9 +109,13 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
107
109
  {
108
110
  VALUE error_class;
109
111
  VALUE code_classes;
112
+ VALUE rb_domain = rb_str_new_cstr(g_quark_to_string(domain));
113
+ rbgutil_string_set_utf8_encoding(rb_domain);
110
114
 
111
115
  error_class = rb_define_class_under(module, name, parent);
112
- rb_include_module(error_class, error_info);
116
+ rb_ivar_set(error_class, id_code, Qnil);
117
+ rb_ivar_set(error_class, id_domain, rb_domain);
118
+ rb_prepend_module(error_class, error_info);
113
119
 
114
120
  rb_hash_aset(gerror_table, UINT2NUM(domain), error_class);
115
121
 
@@ -140,6 +146,8 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
140
146
  code_class_name,
141
147
  error_class);
142
148
  g_free(code_class_name);
149
+ rb_ivar_set(code_class, id_code, INT2NUM(entry->value));
150
+ rb_ivar_set(code_class, id_domain, rb_domain);
143
151
  rb_hash_aset(code_classes, INT2NUM(entry->value), code_class);
144
152
  }
145
153
 
@@ -149,6 +157,15 @@ rbgerr_define_gerror(GQuark domain, const gchar *name, VALUE module, VALUE paren
149
157
  return error_class;
150
158
  }
151
159
 
160
+ static VALUE
161
+ rg_initialize(int argc, VALUE *argv, VALUE self)
162
+ {
163
+ VALUE klass = rb_obj_class(self);
164
+ rb_ivar_set(self, id_code, rb_ivar_get(klass, id_code));
165
+ rb_ivar_set(self, id_domain, rb_ivar_get(klass, id_domain));
166
+ return rb_call_super(argc, argv);
167
+ }
168
+
152
169
  static VALUE
153
170
  rbg_error_to_ruby(const GValue *from)
154
171
  {
@@ -166,9 +183,11 @@ Init_glib_error(void)
166
183
  gerror_table = rb_hash_new();
167
184
  rb_global_variable(&gerror_table);
168
185
 
186
+ #define RG_TARGET_NAMESPACE error_info
169
187
  error_info = rb_define_module_under(mGLib, "ErrorInfo");
170
188
  rb_define_attr(error_info, "code", TRUE, FALSE);
171
189
  rb_define_attr(error_info, "domain", TRUE, FALSE);
190
+ RG_DEF_METHOD(initialize, -1);
172
191
 
173
192
  generic_error = rb_define_class_under(mGLib, "Error", rb_eRuntimeError);
174
193
  rb_include_module(generic_error, error_info);
@@ -70,11 +70,10 @@ rbglib_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gcha
70
70
  if (rb_during_gc()) {
71
71
  g_printerr("\tfrom %s:%d\n", rb_sourcefile(), rb_sourceline());
72
72
  } else {
73
- VALUE backtrace;
74
-
75
- backtrace = rb_funcall(rb_mKernel, rb_intern("caller"), 0);
76
- rb_iterate(rb_each, backtrace,
77
- rbg_printerr, Qnil);
73
+ VALUE backtrace = rb_funcall(rb_mKernel, rb_intern("caller"), 0);
74
+ ID id_each;
75
+ CONST_ID(id_each, "each");
76
+ rb_block_call(backtrace, id_each, 0, NULL, rbg_printerr, Qnil);
78
77
  }
79
78
  } else {
80
79
  g_log_default_handler(log_domain, log_level, message, user_data);
@@ -364,7 +364,9 @@ static VALUE
364
364
  gobj_new_body(VALUE rb_arg)
365
365
  {
366
366
  struct param_setup_arg *arg = (struct param_setup_arg *)rb_arg;
367
- rb_iterate(rb_each, (VALUE)arg->params_hash, _params_setup, (VALUE)arg);
367
+ ID id_each;
368
+ CONST_ID(id_each, "each");
369
+ rb_block_call(arg->params_hash, id_each, 0, NULL, _params_setup, (VALUE)arg);
368
370
  return (VALUE)g_object_newv(G_TYPE_FROM_CLASS(arg->gclass),
369
371
  arg->param_size, arg->params);
370
372
  }
@@ -26,8 +26,6 @@
26
26
  static VALUE RG_TARGET_NAMESPACE;
27
27
  VALUE rbgobj_signal_wrap(guint sig_id);
28
28
 
29
- #define default_handler_method_prefix "signal_do_"
30
-
31
29
  /**********************************************************************/
32
30
 
33
31
  static const rb_data_type_t rg_glib_signal_type = {
@@ -235,20 +233,13 @@ gobj_s_define_signal(int argc, VALUE* argv, VALUE self)
235
233
  signal_flags = RVAL2GFLAGS(rbsignal_flags, G_TYPE_SIGNAL_FLAGS);
236
234
 
237
235
  {
238
- VALUE rb_method_name;
239
- VALUE proc;
240
- ID method_id;
241
-
242
- rb_method_name =
243
- rb_str_concat(rb_str_new_cstr(default_handler_method_prefix),
244
- rbsignal_name);
245
- method_id = rb_to_id(rb_method_name);
246
-
247
- proc = rb_funcall(mMetaInterface, rb_intern("signal_callback"), 2,
248
- self, ID2SYM(method_id));
249
-
236
+ VALUE proc = rb_funcall(mMetaInterface,
237
+ rb_intern("signal_callback"),
238
+ 2,
239
+ self,
240
+ rbsignal_name);
250
241
  class_closure = g_rclosure_new(proc, Qnil, NULL);
251
- g_rclosure_set_tag(class_closure, RVAL2CSTR(rb_method_name));
242
+ g_rclosure_set_tag(class_closure, RVAL2CSTR(rbsignal_name));
252
243
  }
253
244
 
254
245
  return_type = rbgobj_gtype_from_ruby(rbreturn_type);
@@ -722,39 +713,25 @@ gobj_sig_chain_from_overridden(int argc, VALUE *argv, VALUE self)
722
713
  }
723
714
 
724
715
  static VALUE
725
- gobj_s_method_added(VALUE klass, VALUE id)
716
+ gobj_s_signal_handler_attach(VALUE klass,
717
+ VALUE rb_signal,
718
+ VALUE rb_handler_name)
726
719
  {
727
- const RGObjClassInfo* cinfo = rbgobj_lookup_class(klass);
728
- const char* name = rb_id2name(SYM2ID(id));
729
- const int prefix_len = strlen(default_handler_method_prefix);
730
- guint signal_id;
731
-
732
- if (cinfo->klass != klass) return Qnil;
733
- if (strncmp(default_handler_method_prefix, name, prefix_len)) return Qnil;
734
-
735
- signal_id = g_signal_lookup(name + prefix_len, cinfo->gtype);
736
- if (!signal_id) return Qnil;
737
-
738
- {
739
- GSignalQuery query;
740
- g_signal_query(signal_id, &query);
741
- if (query.itype == cinfo->gtype)
742
- return Qnil;
743
- }
744
-
745
- {
746
- VALUE proc = rb_funcall(mMetaInterface, rb_intern("signal_callback"), 2,
747
- klass, id);
748
- GClosure* rclosure = g_rclosure_new(proc, Qnil,
749
- rbgobj_get_signal_func(signal_id));
750
- g_rclosure_attach((GClosure *)rclosure, klass);
751
- g_signal_override_class_closure(signal_id, cinfo->gtype, rclosure);
752
- }
720
+ const RGObjClassInfo *cinfo = rbgobj_lookup_class(klass);
721
+ guint signal_id = rbgobj_signal_get_raw(rb_signal)->signal_id;
722
+ const gchar *handler_name = RVAL2CSTR(rb_handler_name);
723
+ VALUE proc = rb_block_proc();
724
+ GClosure* rclosure = g_rclosure_new(proc,
725
+ Qnil,
726
+ rbgobj_get_signal_func(signal_id));
727
+ g_rclosure_set_tag(rclosure, handler_name);
728
+ g_rclosure_attach((GClosure *)rclosure, klass);
729
+ g_signal_override_class_closure(signal_id, cinfo->gtype, rclosure);
753
730
 
754
731
  {
755
732
  VALUE mod = rb_define_module_under(klass, RubyGObjectHookModule);
756
733
  rb_include_module(klass, mod);
757
- rbg_define_method(mod, name, gobj_sig_chain_from_overridden, -1);
734
+ rbg_define_method(mod, handler_name, gobj_sig_chain_from_overridden, -1);
758
735
  }
759
736
 
760
737
  return Qnil;
@@ -1059,6 +1036,8 @@ Init_gobject_gsignal(void)
1059
1036
  rbg_define_method(cInstantiatable, "signal_handler_is_connected?",
1060
1037
  gobj_sig_handler_is_connected, 1);
1061
1038
 
1062
- rbg_define_singleton_method(cInstantiatable, "method_added",
1063
- gobj_s_method_added, 1);
1039
+ rbg_define_singleton_method(cInstantiatable,
1040
+ "signal_handler_attach",
1041
+ gobj_s_signal_handler_attach,
1042
+ 2);
1064
1043
  }
@@ -1,7 +1,7 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011,2017 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011,2021 Ruby-GNOME Project Team
4
+ * Copyright (C) 2002-2006 Ruby-GNOME Project Team
5
5
  * Copyright (C) 2002,2003 Masahiro Sakai
6
6
  *
7
7
  * This library is free software; you can redistribute it and/or
@@ -35,6 +35,41 @@ rg_append_features(G_GNUC_UNUSED VALUE self, VALUE klass)
35
35
  return rb_call_super(1, &klass);
36
36
  }
37
37
 
38
+ static void
39
+ interface_init(G_GNUC_UNUSED gpointer g_iface,
40
+ G_GNUC_UNUSED gpointer iface_data)
41
+ {
42
+ }
43
+
44
+ static VALUE
45
+ rg_included(VALUE self, VALUE class_or_module)
46
+ {
47
+ const GInterfaceInfo interface_info = {
48
+ interface_init, NULL, NULL
49
+ };
50
+ const RGObjClassInfo *interface_cinfo;
51
+ const RGObjClassInfo *class_cinfo;
52
+ if (RVAL2CBOOL(rb_obj_is_instance_of(class_or_module, rb_cModule))) {
53
+ rb_raise(rb_eTypeError,
54
+ "GLib::Interface based module (%" PRIsVALUE ") "
55
+ "must be included into a class directly: %" PRIsVALUE,
56
+ self,
57
+ class_or_module);
58
+ }
59
+ interface_cinfo = rbgobj_lookup_class(self);
60
+ class_cinfo = rbgobj_lookup_class(class_or_module);
61
+ if (class_cinfo->klass != class_or_module) {
62
+ return Qnil;
63
+ }
64
+ if (g_type_is_a(class_cinfo->gtype, interface_cinfo->gtype)) {
65
+ return Qnil;
66
+ }
67
+ g_type_add_interface_static(class_cinfo->gtype,
68
+ interface_cinfo->gtype,
69
+ &interface_info);
70
+ return Qnil;
71
+ }
72
+
38
73
  static VALUE
39
74
  rg_install_property(VALUE self, VALUE pspec_obj)
40
75
  {
@@ -141,6 +176,7 @@ Init_gobject_typeinterface(void)
141
176
  RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "MetaInterface");
142
177
  rbg_define_method(RG_TARGET_NAMESPACE, "gtype", generic_s_gtype, 0);
143
178
  RG_DEF_METHOD(append_features, 1);
179
+ RG_DEF_METHOD(included, 1);
144
180
  RG_DEF_METHOD(install_property, 1);
145
181
  RG_DEF_METHOD(property, 1);
146
182
  RG_DEF_METHOD(properties, -1);