changed collect_format, collect_value() and lcopy_format, lcopy_value() in
[platform/upstream/glib.git] / gobject / gvaluetypes.c
1 /* GObject - GLib Type, Object, Parameter and Signal Library
2  * Copyright (C) 1997, 1998, 1999, 2000 Tim Janik and Red Hat, Inc.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General
15  * Public License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 /*
21  * MT safe
22  */
23
24 #include        "gvaluetypes.h"
25
26 #include        "gvaluecollector.h"
27 #include        <string.h>
28
29
30 /* --- value functions --- */
31 static void
32 value_long0_init (GValue *value)
33 {
34   value->data[0].v_long = 0;
35 }
36
37 static void
38 value_long0_copy (const GValue *src_value,
39                   GValue       *dest_value)
40 {
41   dest_value->data[0].v_long = src_value->data[0].v_long;
42 }
43
44 static gchar*
45 value_char_lcopy_value (const GValue *value,
46                         guint         n_collect_values,
47                         GTypeCValue  *collect_values,
48                         guint         collect_flags)
49 {
50   gint8 *int8_p = collect_values[0].v_pointer;
51   
52   if (!int8_p)
53     return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
54   
55   *int8_p = value->data[0].v_int;
56   
57   return NULL;
58 }
59
60 static gchar*
61 value_boolean_lcopy_value (const GValue *value,
62                            guint         n_collect_values,
63                            GTypeCValue  *collect_values,
64                            guint         collect_flags)
65 {
66   gboolean *bool_p = collect_values[0].v_pointer;
67   
68   if (!bool_p)
69     return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
70   
71   *bool_p = value->data[0].v_int;
72   
73   return NULL;
74 }
75
76 static gchar*
77 value_int_collect_value (GValue      *value,
78                          guint        n_collect_values,
79                          GTypeCValue *collect_values,
80                          guint        collect_flags)
81 {
82   value->data[0].v_int = collect_values[0].v_int;
83   
84   return NULL;
85 }
86
87 static gchar*
88 value_int_lcopy_value (const GValue *value,
89                        guint         n_collect_values,
90                        GTypeCValue  *collect_values,
91                        guint         collect_flags)
92 {
93   gint *int_p = collect_values[0].v_pointer;
94   
95   if (!int_p)
96     return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
97   
98   *int_p = value->data[0].v_int;
99   
100   return NULL;
101 }
102
103 static gchar*
104 value_long_collect_value (GValue      *value,
105                           guint        n_collect_values,
106                           GTypeCValue *collect_values,
107                           guint        collect_flags)
108 {
109   value->data[0].v_long = collect_values[0].v_long;
110   
111   return NULL;
112 }
113
114 static gchar*
115 value_long_lcopy_value (const GValue *value,
116                         guint         n_collect_values,
117                         GTypeCValue  *collect_values,
118                         guint         collect_flags)
119 {
120   glong *long_p = collect_values[0].v_pointer;
121   
122   if (!long_p)
123     return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
124   
125   *long_p = value->data[0].v_long;
126   
127   return NULL;
128 }
129
130 static void
131 value_float_init (GValue *value)
132 {
133   value->data[0].v_float = 0.0;
134 }
135
136 static void
137 value_float_copy (const GValue *src_value,
138                   GValue       *dest_value)
139 {
140   dest_value->data[0].v_float = src_value->data[0].v_float;
141 }
142
143 static gchar*
144 value_float_collect_value (GValue      *value,
145                            guint        n_collect_values,
146                            GTypeCValue *collect_values,
147                            guint        collect_flags)
148 {
149   value->data[0].v_float = collect_values[0].v_double;
150   
151   return NULL;
152 }
153
154 static gchar*
155 value_float_lcopy_value (const GValue *value,
156                          guint         n_collect_values,
157                          GTypeCValue  *collect_values,
158                          guint         collect_flags)
159 {
160   gfloat *float_p = collect_values[0].v_pointer;
161   
162   if (!float_p)
163     return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
164   
165   *float_p = value->data[0].v_float;
166   
167   return NULL;
168 }
169
170 static void
171 value_double_init (GValue *value)
172 {
173   value->data[0].v_double = 0.0;
174 }
175
176 static void
177 value_double_copy (const GValue *src_value,
178                    GValue       *dest_value)
179 {
180   dest_value->data[0].v_double = src_value->data[0].v_double;
181 }
182
183 static gchar*
184 value_double_collect_value (GValue      *value,
185                             guint        n_collect_values,
186                             GTypeCValue *collect_values,
187                             guint        collect_flags)
188 {
189   value->data[0].v_double = collect_values[0].v_double;
190   
191   return NULL;
192 }
193
194 static gchar*
195 value_double_lcopy_value (const GValue *value,
196                           guint         n_collect_values,
197                           GTypeCValue  *collect_values,
198                           guint         collect_flags)
199 {
200   gdouble *double_p = collect_values[0].v_pointer;
201   
202   if (!double_p)
203     return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
204   
205   *double_p = value->data[0].v_double;
206   
207   return NULL;
208 }
209
210 static void
211 value_string_init (GValue *value)
212 {
213   value->data[0].v_pointer = NULL;
214 }
215
216 static void
217 value_string_free_value (GValue *value)
218 {
219   if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
220     g_free (value->data[0].v_pointer);
221 }
222
223 static void
224 value_string_copy_value (const GValue *src_value,
225                          GValue       *dest_value)
226 {
227   dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
228 }
229
230 static gchar*
231 value_string_collect_value (GValue      *value,
232                             guint        n_collect_values,
233                             GTypeCValue *collect_values,
234                             guint        collect_flags)
235 {
236   if (!collect_values[0].v_pointer)
237     value->data[0].v_pointer = NULL;
238   else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
239     {
240       value->data[0].v_pointer = collect_values[0].v_pointer;
241       value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
242     }
243   else
244     value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
245   
246   return NULL;
247 }
248
249 static gchar*
250 value_string_lcopy_value (const GValue *value,
251                           guint         n_collect_values,
252                           GTypeCValue  *collect_values,
253                           guint         collect_flags)
254 {
255   gchar **string_p = collect_values[0].v_pointer;
256   
257   if (!string_p)
258     return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
259   
260   if (!value->data[0].v_pointer)
261     *string_p = NULL;
262   else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
263     *string_p = value->data[0].v_pointer;
264   else
265     *string_p = g_strdup (value->data[0].v_pointer);
266   
267   return NULL;
268 }
269
270 static void
271 value_pointer_init (GValue *value)
272 {
273   value->data[0].v_pointer = NULL;
274 }
275
276 static void
277 value_pointer_copy (const GValue *src_value,
278                     GValue       *dest_value)
279 {
280   dest_value->data[0].v_pointer = src_value->data[0].v_pointer;
281 }
282
283 static gpointer
284 value_pointer_peek_pointer (const GValue *value)
285 {
286   return value->data[0].v_pointer;
287 }
288
289 static gchar*
290 value_pointer_collect_value (GValue      *value,
291                              guint        n_collect_values,
292                              GTypeCValue *collect_values,
293                              guint        collect_flags)
294 {
295   value->data[0].v_pointer = collect_values[0].v_pointer;
296
297   return NULL;
298 }
299
300 static gchar*
301 value_pointer_lcopy_value (const GValue *value,
302                            guint         n_collect_values,
303                            GTypeCValue  *collect_values,
304                            guint         collect_flags)
305 {
306   gpointer *pointer_p = collect_values[0].v_pointer;
307
308   if (!pointer_p)
309     return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
310
311   *pointer_p = value->data[0].v_pointer;
312
313   return NULL;
314 }
315
316 static void
317 value_ccallback_init (GValue *value)
318 {
319   value->data[0].v_pointer = NULL;
320   value->data[1].v_pointer = NULL;
321 }
322
323 static void
324 value_ccallback_copy (const GValue *src_value,
325                       GValue       *dest_value)
326 {
327   dest_value->data[0].v_pointer = src_value->data[0].v_pointer;
328   dest_value->data[1].v_pointer = src_value->data[1].v_pointer;
329 }
330
331 static gchar*
332 value_ccallback_collect_value (GValue      *value,
333                                guint        n_collect_values,
334                                GTypeCValue *collect_values,
335                                guint        collect_flags)
336 {
337   gchar *error = NULL;
338
339   if (!collect_values[0].v_pointer)
340     error = g_strconcat ("invalid (NULL) pointer callback function for value type `",
341                          G_VALUE_TYPE_NAME (value),
342                          "'",
343                          NULL);
344   value->data[0].v_pointer = collect_values[0].v_pointer;
345   value->data[1].v_pointer = collect_values[1].v_pointer;
346
347   return error;
348 }
349
350 static gchar*
351 value_ccallback_lcopy_value (const GValue *value,
352                              guint         n_collect_values,
353                              GTypeCValue  *collect_values,
354                              guint         collect_flags)
355 {
356   gpointer *callback_p = collect_values[0].v_pointer;
357   gpointer *data_p = collect_values[1].v_pointer;
358
359   if (!callback_p || !data_p)
360     return g_strdup_printf ("%s location for `%s' passed as NULL",
361                             callback_p ? "data" : "callback",
362                             G_VALUE_TYPE_NAME (value));
363   *callback_p = value->data[0].v_pointer;
364   *data_p = value->data[1].v_pointer;
365
366   return NULL;
367 }
368
369
370 /* --- type initialization --- */
371 void
372 g_value_types_init (void)  /* sync with gtype.c */
373 {
374   GTypeInfo info = {
375     0,                          /* class_size */
376     NULL,                       /* base_init */
377     NULL,                       /* base_destroy */
378     NULL,                       /* class_init */
379     NULL,                       /* class_destroy */
380     NULL,                       /* class_data */
381     0,                          /* instance_size */
382     0,                          /* n_preallocs */
383     NULL,                       /* instance_init */
384     NULL,                       /* value_table */
385   };
386   const GTypeFundamentalInfo finfo = { G_TYPE_FLAG_DERIVABLE, };
387   GType type;
388   
389   /* G_TYPE_CHAR / G_TYPE_UCHAR
390    */
391   {
392     static const GTypeValueTable value_table = {
393       value_long0_init,         /* value_init */
394       NULL,                     /* value_free */
395       value_long0_copy,         /* value_copy */
396       NULL,                     /* value_peek_pointer */
397       "i",                      /* collect_format */
398       value_int_collect_value,  /* collect_value */
399       "p",                      /* lcopy_format */
400       value_char_lcopy_value,   /* lcopy_value */
401     };
402     info.value_table = &value_table;
403     type = g_type_register_fundamental (G_TYPE_CHAR, "gchar", &info, &finfo, 0);
404     g_assert (type == G_TYPE_CHAR);
405     type = g_type_register_fundamental (G_TYPE_UCHAR, "guchar", &info, &finfo, 0);
406     g_assert (type == G_TYPE_UCHAR);
407   }
408
409   /* G_TYPE_BOOLEAN
410    */
411   {
412     static const GTypeValueTable value_table = {
413       value_long0_init,          /* value_init */
414       NULL,                      /* value_free */
415       value_long0_copy,          /* value_copy */
416       NULL,                      /* value_peek_pointer */
417       "i",                       /* collect_format */
418       value_int_collect_value,   /* collect_value */
419       "p",                       /* lcopy_format */
420       value_boolean_lcopy_value, /* lcopy_value */
421     };
422     info.value_table = &value_table;
423     type = g_type_register_fundamental (G_TYPE_BOOLEAN, "gboolean", &info, &finfo, 0);
424     g_assert (type == G_TYPE_BOOLEAN);
425   }
426   
427   /* G_TYPE_INT / G_TYPE_UINT
428    */
429   {
430     static const GTypeValueTable value_table = {
431       value_long0_init,         /* value_init */
432       NULL,                     /* value_free */
433       value_long0_copy,         /* value_copy */
434       NULL,                     /* value_peek_pointer */
435       "i",                      /* collect_format */
436       value_int_collect_value,  /* collect_value */
437       "p",                      /* lcopy_format */
438       value_int_lcopy_value,    /* lcopy_value */
439     };
440     info.value_table = &value_table;
441     type = g_type_register_fundamental (G_TYPE_INT, "gint", &info, &finfo, 0);
442     g_assert (type == G_TYPE_INT);
443     type = g_type_register_fundamental (G_TYPE_UINT, "guint", &info, &finfo, 0);
444     g_assert (type == G_TYPE_UINT);
445   }
446
447   /* G_TYPE_LONG / G_TYPE_ULONG
448    */
449   {
450     static const GTypeValueTable value_table = {
451       value_long0_init,         /* value_init */
452       NULL,                     /* value_free */
453       value_long0_copy,         /* value_copy */
454       NULL,                     /* value_peek_pointer */
455       "l",                      /* collect_format */
456       value_long_collect_value, /* collect_value */
457       "p",                      /* lcopy_format */
458       value_long_lcopy_value,   /* lcopy_value */
459     };
460     info.value_table = &value_table;
461     type = g_type_register_fundamental (G_TYPE_LONG, "glong", &info, &finfo, 0);
462     g_assert (type == G_TYPE_LONG);
463     type = g_type_register_fundamental (G_TYPE_ULONG, "gulong", &info, &finfo, 0);
464     g_assert (type == G_TYPE_ULONG);
465   }
466   
467   /* G_TYPE_FLOAT
468    */
469   {
470     static const GTypeValueTable value_table = {
471       value_float_init,          /* value_init */
472       NULL,                      /* value_free */
473       value_float_copy,          /* value_copy */
474       NULL,                      /* value_peek_pointer */
475       "d",                       /* collect_format */
476       value_float_collect_value, /* collect_value */
477       "p",                       /* lcopy_format */
478       value_float_lcopy_value,   /* lcopy_value */
479     };
480     info.value_table = &value_table;
481     type = g_type_register_fundamental (G_TYPE_FLOAT, "gfloat", &info, &finfo, 0);
482     g_assert (type == G_TYPE_FLOAT);
483   }
484   
485   /* G_TYPE_DOUBLE
486    */
487   {
488     static const GTypeValueTable value_table = {
489       value_double_init,          /* value_init */
490       NULL,                       /* value_free */
491       value_double_copy,          /* value_copy */
492       NULL,                       /* value_peek_pointer */
493       "d",                        /* collect_format */
494       value_double_collect_value, /* collect_value */
495       "p",                        /* lcopy_format */
496       value_double_lcopy_value,   /* lcopy_value */
497     };
498     info.value_table = &value_table;
499     type = g_type_register_fundamental (G_TYPE_DOUBLE, "gdouble", &info, &finfo, 0);
500     g_assert (type == G_TYPE_DOUBLE);
501   }
502
503   /* G_TYPE_STRING
504    */
505   {
506     static const GTypeValueTable value_table = {
507       value_string_init,          /* value_init */
508       value_string_free_value,    /* value_free */
509       value_string_copy_value,    /* value_copy */
510       value_pointer_peek_pointer, /* value_peek_pointer */
511       "p",                        /* collect_format */
512       value_string_collect_value, /* collect_value */
513       "p",                        /* lcopy_format */
514       value_string_lcopy_value,   /* lcopy_value */
515     };
516     info.value_table = &value_table;
517     type = g_type_register_fundamental (G_TYPE_STRING, "gstring", &info, &finfo, 0);
518     g_assert (type == G_TYPE_STRING);
519   }
520
521   /* G_TYPE_POINTER
522    */
523   {
524     static const GTypeValueTable value_table = {
525       value_pointer_init,          /* value_init */
526       NULL,                        /* value_free */
527       value_pointer_copy,          /* value_copy */
528       value_pointer_peek_pointer,  /* value_peek_pointer */
529       "p",                         /* collect_format */
530       value_pointer_collect_value, /* collect_value */
531       "p",                         /* lcopy_format */
532       value_pointer_lcopy_value,   /* lcopy_value */
533     };
534     info.value_table = &value_table;
535     type = g_type_register_fundamental (G_TYPE_POINTER, "gpointer", &info, &finfo, 0);
536     g_assert (type == G_TYPE_POINTER);
537   }
538
539   /* G_TYPE_CCALLBACK
540    */
541   {
542     static const GTypeValueTable value_table = {
543       value_ccallback_init,          /* value_init */
544       NULL,                          /* value_free */
545       value_ccallback_copy,          /* value_copy */
546       NULL,                          /* value_peek_pointer */
547       "pp",                          /* collect_format */
548       value_ccallback_collect_value, /* collect_value */
549       "pp",                          /* lcopy_format */
550       value_ccallback_lcopy_value,   /* lcopy_value */
551     };
552     info.value_table = &value_table;
553     type = g_type_register_fundamental (G_TYPE_CCALLBACK, "GCCallback", &info, &finfo, 0);
554     g_assert (type == G_TYPE_CCALLBACK);
555   }
556 }
557
558
559 /* --- GValue functions --- */
560 void
561 g_value_set_char (GValue *value,
562                   gint8   v_char)
563 {
564   g_return_if_fail (G_IS_VALUE_CHAR (value));
565   
566   value->data[0].v_int = v_char;
567 }
568
569 gint8
570 g_value_get_char (const GValue *value)
571 {
572   g_return_val_if_fail (G_IS_VALUE_CHAR (value), 0);
573   
574   return value->data[0].v_int;
575 }
576
577 void
578 g_value_set_uchar (GValue *value,
579                    guint8  v_uchar)
580 {
581   g_return_if_fail (G_IS_VALUE_UCHAR (value));
582   
583   value->data[0].v_uint = v_uchar;
584 }
585
586 guint8
587 g_value_get_uchar (const GValue *value)
588 {
589   g_return_val_if_fail (G_IS_VALUE_UCHAR (value), 0);
590   
591   return value->data[0].v_uint;
592 }
593
594 void
595 g_value_set_boolean (GValue  *value,
596                      gboolean v_boolean)
597 {
598   g_return_if_fail (G_IS_VALUE_BOOLEAN (value));
599   
600   value->data[0].v_int = v_boolean;
601 }
602
603 gboolean
604 g_value_get_boolean (const GValue *value)
605 {
606   g_return_val_if_fail (G_IS_VALUE_BOOLEAN (value), 0);
607   
608   return value->data[0].v_int;
609 }
610
611 void
612 g_value_set_int (GValue *value,
613                  gint    v_int)
614 {
615   g_return_if_fail (G_IS_VALUE_INT (value));
616   
617   value->data[0].v_int = v_int;
618 }
619
620 gint
621 g_value_get_int (const GValue *value)
622 {
623   g_return_val_if_fail (G_IS_VALUE_INT (value), 0);
624   
625   return value->data[0].v_int;
626 }
627
628 void
629 g_value_set_uint (GValue *value,
630                   guint   v_uint)
631 {
632   g_return_if_fail (G_IS_VALUE_UINT (value));
633   
634   value->data[0].v_uint = v_uint;
635 }
636
637 guint
638 g_value_get_uint (const GValue *value)
639 {
640   g_return_val_if_fail (G_IS_VALUE_UINT (value), 0);
641   
642   return value->data[0].v_uint;
643 }
644
645 void
646 g_value_set_long (GValue *value,
647                   glong   v_long)
648 {
649   g_return_if_fail (G_IS_VALUE_LONG (value));
650   
651   value->data[0].v_long = v_long;
652 }
653
654 glong
655 g_value_get_long (const GValue *value)
656 {
657   g_return_val_if_fail (G_IS_VALUE_LONG (value), 0);
658   
659   return value->data[0].v_long;
660 }
661
662 void
663 g_value_set_ulong (GValue *value,
664                    gulong  v_ulong)
665 {
666   g_return_if_fail (G_IS_VALUE_ULONG (value));
667   
668   value->data[0].v_ulong = v_ulong;
669 }
670
671 gulong
672 g_value_get_ulong (const GValue *value)
673 {
674   g_return_val_if_fail (G_IS_VALUE_ULONG (value), 0);
675   
676   return value->data[0].v_ulong;
677 }
678
679 void
680 g_value_set_float (GValue *value,
681                    gfloat  v_float)
682 {
683   g_return_if_fail (G_IS_VALUE_FLOAT (value));
684   
685   value->data[0].v_float = v_float;
686 }
687
688 gfloat
689 g_value_get_float (const GValue *value)
690 {
691   g_return_val_if_fail (G_IS_VALUE_FLOAT (value), 0);
692   
693   return value->data[0].v_float;
694 }
695
696 void
697 g_value_set_double (GValue *value,
698                     gdouble v_double)
699 {
700   g_return_if_fail (G_IS_VALUE_DOUBLE (value));
701   
702   value->data[0].v_double = v_double;
703 }
704
705 gdouble
706 g_value_get_double (const GValue *value)
707 {
708   g_return_val_if_fail (G_IS_VALUE_DOUBLE (value), 0);
709   
710   return value->data[0].v_double;
711 }
712
713 void
714 g_value_set_string (GValue      *value,
715                     const gchar *v_string)
716 {
717   g_return_if_fail (G_IS_VALUE_STRING (value));
718   
719   if (value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS)
720     value->data[1].v_uint = 0;
721   else
722     g_free (value->data[0].v_pointer);
723   value->data[0].v_pointer = g_strdup (v_string);
724 }
725
726 void
727 g_value_set_static_string (GValue      *value,
728                            const gchar *v_string)
729 {
730   g_return_if_fail (G_IS_VALUE_STRING (value));
731   
732   if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
733     g_free (value->data[0].v_pointer);
734   value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
735   value->data[0].v_pointer = (gchar*) v_string;
736 }
737
738 gchar*
739 g_value_get_string (const GValue *value)
740 {
741   g_return_val_if_fail (G_IS_VALUE_STRING (value), NULL);
742   
743   return value->data[0].v_pointer;
744 }
745
746 gchar*
747 g_value_dup_string (const GValue *value)
748 {
749   g_return_val_if_fail (G_IS_VALUE_STRING (value), NULL);
750   
751   return g_strdup (value->data[0].v_pointer);
752 }
753
754 void
755 g_value_set_pointer (GValue  *value,
756                      gpointer v_pointer)
757 {
758   g_return_if_fail (G_IS_VALUE_POINTER (value));
759
760   value->data[0].v_pointer = v_pointer;
761 }
762
763 gpointer
764 g_value_get_pointer (const GValue *value)
765 {
766   g_return_val_if_fail (G_IS_VALUE_POINTER (value), NULL);
767
768   return value->data[0].v_pointer;
769 }
770
771 void
772 g_value_set_ccallback (GValue  *value,
773                        gpointer callback_func,
774                        gpointer callback_data)
775 {
776   g_return_if_fail (G_IS_VALUE_CCALLBACK (value));
777   
778   value->data[0].v_pointer = callback_func;
779   value->data[1].v_pointer = callback_data;
780 }
781
782 void
783 g_value_get_ccallback (const GValue *value,
784                        gpointer     *callback_func,
785                        gpointer     *callback_data)
786 {
787   g_return_if_fail (G_IS_VALUE_CCALLBACK (value));
788
789   if (callback_func)
790     *callback_func = value->data[0].v_pointer;
791   if (callback_data)
792     *callback_data = value->data[1].v_pointer;
793 }