Merge branch 'master' into rewrite-sheet
[pspp-builds.git] / lib / gtksheet / gtkmarshalers.c
1 /*******************************************************************************
2 **3456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 
3 **      10        20        30        40        50        60        70        80
4 **
5 **  library for GtkXPaned-widget, a 2x2 grid-like variation of GtkPaned of gtk+
6 **  Copyright (C) 2005-2006 Mirco "MacSlow" Müller <macslow@bangang.de>
7 **
8 **  This library is free software; you can redistribute it and/or
9 **  modify it under the terms of the GNU Lesser General Public
10 **  License as published by the Free Software Foundation; either
11 **  version 2.1 of the License, or (at your option) any later version.
12 **
13 **  This library is distributed in the hope that it will be useful,
14 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
15 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 **  Lesser General Public License for more details.
17 **
18 **  You should have received a copy of the GNU Lesser General Public
19 **  License along with this library; if not, write to the Free Software
20 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 **
22 **  GtkXPaned is based on GtkPaned which was done by...
23 **
24 **  "Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald"
25 **
26 **  and later modified by...
27 **
28 **  "the GTK+ Team and others 1997-2000"
29 **
30 *******************************************************************************/
31
32 #include "gtkmarshalers.h"
33
34 /* lazy copied some marshalers copied from gtk+-2.6.10/gtk/gtkmarshalers.c */
35 void gtk_marshal_BOOLEAN__BOOLEAN (GClosure* closure,
36                                                                    GValue* return_value,
37                                                                    guint n_param_values,
38                                                                    const GValue* param_values,
39                                                                    gpointer invocation_hint,
40                                                                    gpointer marshal_data)
41 {
42         typedef gboolean (*GMarshalFunc_BOOLEAN__BOOLEAN) (gpointer data1,
43                                                                                                            gboolean arg_1,
44                                                                                                            gpointer data2);
45         register GMarshalFunc_BOOLEAN__BOOLEAN callback;
46         register GCClosure* cc = (GCClosure*) closure;
47         register gpointer data1;
48         register gpointer data2;
49         gboolean v_return;
50
51         g_return_if_fail (return_value != NULL);
52         g_return_if_fail (n_param_values == 2);
53
54         if (G_CCLOSURE_SWAP_DATA (closure))
55         {
56                 data1 = closure->data;
57                 data2 = g_value_peek_pointer (param_values + 0);
58         }
59         else
60         {
61                 data1 = g_value_peek_pointer (param_values + 0);
62                 data2 = closure->data;
63         }
64
65         callback = (GMarshalFunc_BOOLEAN__BOOLEAN) (marshal_data ? marshal_data : cc->callback);
66         v_return = callback (data1, g_marshal_value_peek_boolean (param_values + 1), data2);
67         g_value_set_boolean (return_value, v_return);
68 }
69
70 void gtk_marshal_BOOLEAN__ENUM (GClosure* closure,
71                                                                 GValue* return_value,
72                                                                 guint n_param_values,
73                                                                 const GValue* param_values,
74                                                                 gpointer invocation_hint,
75                                                                 gpointer marshal_data)
76 {
77         typedef gboolean (*GMarshalFunc_BOOLEAN__ENUM) (gpointer data1,
78                                                                                                         gint arg_1,
79                                                                                                         gpointer data2);
80         register GMarshalFunc_BOOLEAN__ENUM callback;
81         register GCClosure* cc = (GCClosure*) closure;
82         register gpointer data1;
83         register gpointer data2;
84         gboolean v_return;
85
86         g_return_if_fail (return_value != NULL);
87         g_return_if_fail (n_param_values == 2);
88
89         if (G_CCLOSURE_SWAP_DATA (closure))
90         {
91                 data1 = closure->data;
92                 data2 = g_value_peek_pointer (param_values + 0);
93         }
94         else
95         {
96                 data1 = g_value_peek_pointer (param_values + 0);
97                 data2 = closure->data;
98         }
99
100         callback = (GMarshalFunc_BOOLEAN__ENUM) (marshal_data ? marshal_data : cc->callback);
101         v_return = callback (data1, g_marshal_value_peek_enum (param_values + 1), data2);
102         g_value_set_boolean (return_value, v_return);
103 }
104
105 void gtk_marshal_BOOLEAN__VOID (GClosure* closure,
106                                                                 GValue* return_value,
107                                                                 guint n_param_values,
108                                                                 const GValue* param_values,
109                                                                 gpointer invocation_hint,
110                                                                 gpointer marshal_data)
111 {
112         typedef gboolean (*GMarshalFunc_BOOLEAN__VOID) (gpointer data1,
113                                                                                                         gpointer data2);
114         register GMarshalFunc_BOOLEAN__VOID callback;
115         register GCClosure* cc = (GCClosure*) closure;
116         register gpointer data1;
117         register gpointer data2;
118         gboolean v_return;
119
120         g_return_if_fail (return_value != NULL);
121         g_return_if_fail (n_param_values == 1);
122
123         if (G_CCLOSURE_SWAP_DATA (closure))
124         {
125                 data1 = closure->data;
126                 data2 = g_value_peek_pointer (param_values + 0);
127         }
128         else
129         {
130                 data1 = g_value_peek_pointer (param_values + 0);
131                 data2 = closure->data;
132         }
133
134         callback = (GMarshalFunc_BOOLEAN__VOID) (marshal_data ? marshal_data : cc->callback);
135         v_return = callback (data1, data2);
136         g_value_set_boolean (return_value, v_return);
137 }