~ubuntu-branches/ubuntu/raring/rygel/raring-proposed

« back to all changes in this revision

Viewing changes to tests/rygel-environment-test.c

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2013-02-20 15:59:08 UTC
  • mfrom: (11.1.24 experimental)
  • Revision ID: package-import@ubuntu.com-20130220155908-b5y2q60z8xh9nlnt
Tags: 0.17.8-1
* dh_makeshlibs: fix exclude path for rygel 2.0 plugin ABI.
* Update package descriptions to be more factually correct.
  Thanks to to Jens Georg for suggesting the improvements.
* Add -Wl,-z,defs -Wl,--as-needed to LDFLAGS
* Make -dev packages replace and conflict because of clashing api docs
  (Closes: #700508)
* Imported Upstream version 0.17.8
* Add patch to not hide rygel-preferences in GNOME (yet):
  debian/patches/0001-Revert-data-Hide-rygel-preferences-in-GNOME.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* rygel-environment-test.c generated by valac 0.18.1, the Vala compiler
 
2
 * generated from rygel-environment-test.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2012 Intel Corporation.
 
6
 *
 
7
 * Author: Jens Georg <jensg@openismus.com>
 
8
 *
 
9
 * This file is part of Rygel.
 
10
 *
 
11
 * Rygel is free software; you can redistribute it and/or modify
 
12
 * it under the terms of the GNU Lesser General Public License as published by
 
13
 * the Free Software Foundation; either version 2 of the License, or
 
14
 * (at your option) any later version.
 
15
 *
 
16
 * Rygel is distributed in the hope that it will be useful,
 
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
19
 * GNU Lesser General Public License for more details.
 
20
 *
 
21
 * You should have received a copy of the GNU Lesser General Public License
 
22
 * along with this program; if not, write to the Free Software Foundation,
 
23
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
24
 */
 
25
 
 
26
#include <glib.h>
 
27
#include <glib-object.h>
 
28
#include <stdlib.h>
 
29
#include <string.h>
 
30
#include <gst/gst.h>
 
31
#include <gobject/gvaluecollector.h>
 
32
 
 
33
 
 
34
#define TYPE_ENVIRONMENT_TEST (environment_test_get_type ())
 
35
#define ENVIRONMENT_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ENVIRONMENT_TEST, EnvironmentTest))
 
36
#define ENVIRONMENT_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ENVIRONMENT_TEST, EnvironmentTestClass))
 
37
#define IS_ENVIRONMENT_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ENVIRONMENT_TEST))
 
38
#define IS_ENVIRONMENT_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ENVIRONMENT_TEST))
 
39
#define ENVIRONMENT_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ENVIRONMENT_TEST, EnvironmentTestClass))
 
40
 
 
41
typedef struct _EnvironmentTest EnvironmentTest;
 
42
typedef struct _EnvironmentTestClass EnvironmentTestClass;
 
43
typedef struct _EnvironmentTestPrivate EnvironmentTestPrivate;
 
44
typedef struct _ParamSpecEnvironmentTest ParamSpecEnvironmentTest;
 
45
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 
46
 
 
47
struct _EnvironmentTest {
 
48
        GTypeInstance parent_instance;
 
49
        volatile int ref_count;
 
50
        EnvironmentTestPrivate * priv;
 
51
};
 
52
 
 
53
struct _EnvironmentTestClass {
 
54
        GTypeClass parent_class;
 
55
        void (*finalize) (EnvironmentTest *self);
 
56
};
 
57
 
 
58
struct _ParamSpecEnvironmentTest {
 
59
        GParamSpec parent_instance;
 
60
};
 
61
 
 
62
 
 
63
static gpointer environment_test_parent_class = NULL;
 
64
 
 
65
gpointer environment_test_ref (gpointer instance);
 
66
void environment_test_unref (gpointer instance);
 
67
GParamSpec* param_spec_environment_test (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
 
68
void value_set_environment_test (GValue* value, gpointer v_object);
 
69
void value_take_environment_test (GValue* value, gpointer v_object);
 
70
gpointer value_get_environment_test (const GValue* value);
 
71
GType environment_test_get_type (void) G_GNUC_CONST;
 
72
enum  {
 
73
        ENVIRONMENT_TEST_DUMMY_PROPERTY
 
74
};
 
75
gint environment_test_main (gchar** args, int args_length1);
 
76
EnvironmentTest* environment_test_new (void);
 
77
EnvironmentTest* environment_test_construct (GType object_type);
 
78
static void environment_test_finalize (EnvironmentTest* obj);
 
79
 
 
80
 
 
81
gint environment_test_main (gchar** args, int args_length1) {
 
82
        gint result = 0;
 
83
        _vala_assert ((G_TIME_SPAN_SECOND * GST_USECOND) == ((GTimeSpan) GST_SECOND), "TimeSpan.SECOND * Gst.USECOND == Gst.SECOND");
 
84
        result = 0;
 
85
        return result;
 
86
}
 
87
 
 
88
 
 
89
int main (int argc, char ** argv) {
 
90
        g_type_init ();
 
91
        return environment_test_main (argv, argc);
 
92
}
 
93
 
 
94
 
 
95
EnvironmentTest* environment_test_construct (GType object_type) {
 
96
        EnvironmentTest* self = NULL;
 
97
        self = (EnvironmentTest*) g_type_create_instance (object_type);
 
98
        return self;
 
99
}
 
100
 
 
101
 
 
102
EnvironmentTest* environment_test_new (void) {
 
103
        return environment_test_construct (TYPE_ENVIRONMENT_TEST);
 
104
}
 
105
 
 
106
 
 
107
static void value_environment_test_init (GValue* value) {
 
108
        value->data[0].v_pointer = NULL;
 
109
}
 
110
 
 
111
 
 
112
static void value_environment_test_free_value (GValue* value) {
 
113
        if (value->data[0].v_pointer) {
 
114
                environment_test_unref (value->data[0].v_pointer);
 
115
        }
 
116
}
 
117
 
 
118
 
 
119
static void value_environment_test_copy_value (const GValue* src_value, GValue* dest_value) {
 
120
        if (src_value->data[0].v_pointer) {
 
121
                dest_value->data[0].v_pointer = environment_test_ref (src_value->data[0].v_pointer);
 
122
        } else {
 
123
                dest_value->data[0].v_pointer = NULL;
 
124
        }
 
125
}
 
126
 
 
127
 
 
128
static gpointer value_environment_test_peek_pointer (const GValue* value) {
 
129
        return value->data[0].v_pointer;
 
130
}
 
131
 
 
132
 
 
133
static gchar* value_environment_test_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
 
134
        if (collect_values[0].v_pointer) {
 
135
                EnvironmentTest* object;
 
136
                object = collect_values[0].v_pointer;
 
137
                if (object->parent_instance.g_class == NULL) {
 
138
                        return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
 
139
                } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
 
140
                        return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
 
141
                }
 
142
                value->data[0].v_pointer = environment_test_ref (object);
 
143
        } else {
 
144
                value->data[0].v_pointer = NULL;
 
145
        }
 
146
        return NULL;
 
147
}
 
148
 
 
149
 
 
150
static gchar* value_environment_test_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
 
151
        EnvironmentTest** object_p;
 
152
        object_p = collect_values[0].v_pointer;
 
153
        if (!object_p) {
 
154
                return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
 
155
        }
 
156
        if (!value->data[0].v_pointer) {
 
157
                *object_p = NULL;
 
158
        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
 
159
                *object_p = value->data[0].v_pointer;
 
160
        } else {
 
161
                *object_p = environment_test_ref (value->data[0].v_pointer);
 
162
        }
 
163
        return NULL;
 
164
}
 
165
 
 
166
 
 
167
GParamSpec* param_spec_environment_test (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
 
168
        ParamSpecEnvironmentTest* spec;
 
169
        g_return_val_if_fail (g_type_is_a (object_type, TYPE_ENVIRONMENT_TEST), NULL);
 
170
        spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
 
171
        G_PARAM_SPEC (spec)->value_type = object_type;
 
172
        return G_PARAM_SPEC (spec);
 
173
}
 
174
 
 
175
 
 
176
gpointer value_get_environment_test (const GValue* value) {
 
177
        g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST), NULL);
 
178
        return value->data[0].v_pointer;
 
179
}
 
180
 
 
181
 
 
182
void value_set_environment_test (GValue* value, gpointer v_object) {
 
183
        EnvironmentTest* old;
 
184
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST));
 
185
        old = value->data[0].v_pointer;
 
186
        if (v_object) {
 
187
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENVIRONMENT_TEST));
 
188
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
 
189
                value->data[0].v_pointer = v_object;
 
190
                environment_test_ref (value->data[0].v_pointer);
 
191
        } else {
 
192
                value->data[0].v_pointer = NULL;
 
193
        }
 
194
        if (old) {
 
195
                environment_test_unref (old);
 
196
        }
 
197
}
 
198
 
 
199
 
 
200
void value_take_environment_test (GValue* value, gpointer v_object) {
 
201
        EnvironmentTest* old;
 
202
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST));
 
203
        old = value->data[0].v_pointer;
 
204
        if (v_object) {
 
205
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENVIRONMENT_TEST));
 
206
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
 
207
                value->data[0].v_pointer = v_object;
 
208
        } else {
 
209
                value->data[0].v_pointer = NULL;
 
210
        }
 
211
        if (old) {
 
212
                environment_test_unref (old);
 
213
        }
 
214
}
 
215
 
 
216
 
 
217
static void environment_test_class_init (EnvironmentTestClass * klass) {
 
218
        environment_test_parent_class = g_type_class_peek_parent (klass);
 
219
        ENVIRONMENT_TEST_CLASS (klass)->finalize = environment_test_finalize;
 
220
}
 
221
 
 
222
 
 
223
static void environment_test_instance_init (EnvironmentTest * self) {
 
224
        self->ref_count = 1;
 
225
}
 
226
 
 
227
 
 
228
static void environment_test_finalize (EnvironmentTest* obj) {
 
229
        EnvironmentTest * self;
 
230
        self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ENVIRONMENT_TEST, EnvironmentTest);
 
231
}
 
232
 
 
233
 
 
234
GType environment_test_get_type (void) {
 
235
        static volatile gsize environment_test_type_id__volatile = 0;
 
236
        if (g_once_init_enter (&environment_test_type_id__volatile)) {
 
237
                static const GTypeValueTable g_define_type_value_table = { value_environment_test_init, value_environment_test_free_value, value_environment_test_copy_value, value_environment_test_peek_pointer, "p", value_environment_test_collect_value, "p", value_environment_test_lcopy_value };
 
238
                static const GTypeInfo g_define_type_info = { sizeof (EnvironmentTestClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) environment_test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EnvironmentTest), 0, (GInstanceInitFunc) environment_test_instance_init, &g_define_type_value_table };
 
239
                static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
 
240
                GType environment_test_type_id;
 
241
                environment_test_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EnvironmentTest", &g_define_type_info, &g_define_type_fundamental_info, 0);
 
242
                g_once_init_leave (&environment_test_type_id__volatile, environment_test_type_id);
 
243
        }
 
244
        return environment_test_type_id__volatile;
 
245
}
 
246
 
 
247
 
 
248
gpointer environment_test_ref (gpointer instance) {
 
249
        EnvironmentTest* self;
 
250
        self = instance;
 
251
        g_atomic_int_inc (&self->ref_count);
 
252
        return instance;
 
253
}
 
254
 
 
255
 
 
256
void environment_test_unref (gpointer instance) {
 
257
        EnvironmentTest* self;
 
258
        self = instance;
 
259
        if (g_atomic_int_dec_and_test (&self->ref_count)) {
 
260
                ENVIRONMENT_TEST_GET_CLASS (self)->finalize (self);
 
261
                g_type_free_instance ((GTypeInstance *) self);
 
262
        }
 
263
}
 
264
 
 
265
 
 
266