~ricmm/+junk/unity-lens_music-sc

« back to all changes in this revision

Viewing changes to tests/unit/album.c

  • Committer: Ricardo Mendoza
  • Date: 2012-09-05 14:20:15 UTC
  • Revision ID: ricardo.mendoza@canonical.com-20120905142015-prem6hiyfshwgm8q
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* album.c generated by valac 0.16.1, the Vala compiler
 
2
 * generated from album.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2011 Canonical Ltd
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License version 3 as
 
9
 * published by the Free Software Foundation.
 
10
 *
 
11
 * This program 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
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 *
 
19
 * Authored by Alex Launi <alex.launi@canonical.com>
 
20
 *
 
21
 */
 
22
 
 
23
#include <glib.h>
 
24
#include <glib-object.h>
 
25
#include <stdlib.h>
 
26
#include <string.h>
 
27
 
 
28
 
 
29
#define UNITY_MUSIC_LENS_TYPE_ALBUM (unity_music_lens_album_get_type ())
 
30
#define UNITY_MUSIC_LENS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbum))
 
31
#define UNITY_MUSIC_LENS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
 
32
#define UNITY_MUSIC_LENS_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM))
 
33
#define UNITY_MUSIC_LENS_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM))
 
34
#define UNITY_MUSIC_LENS_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
 
35
 
 
36
typedef struct _UnityMusicLensAlbum UnityMusicLensAlbum;
 
37
typedef struct _UnityMusicLensAlbumClass UnityMusicLensAlbumClass;
 
38
typedef struct _UnityMusicLensAlbumPrivate UnityMusicLensAlbumPrivate;
 
39
#define _g_free0(var) (var = (g_free (var), NULL))
 
40
 
 
41
struct _UnityMusicLensAlbum {
 
42
        GObject parent_instance;
 
43
        UnityMusicLensAlbumPrivate * priv;
 
44
};
 
45
 
 
46
struct _UnityMusicLensAlbumClass {
 
47
        GObjectClass parent_class;
 
48
};
 
49
 
 
50
struct _UnityMusicLensAlbumPrivate {
 
51
        gchar* _title;
 
52
        gchar* _artist;
 
53
        gchar* _uri;
 
54
        gchar* _artwork_path;
 
55
};
 
56
 
 
57
 
 
58
static gpointer unity_music_lens_album_parent_class = NULL;
 
59
 
 
60
GType unity_music_lens_album_get_type (void) G_GNUC_CONST;
 
61
#define UNITY_MUSIC_LENS_ALBUM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumPrivate))
 
62
enum  {
 
63
        UNITY_MUSIC_LENS_ALBUM_DUMMY_PROPERTY,
 
64
        UNITY_MUSIC_LENS_ALBUM_TITLE,
 
65
        UNITY_MUSIC_LENS_ALBUM_ARTIST,
 
66
        UNITY_MUSIC_LENS_ALBUM_URI,
 
67
        UNITY_MUSIC_LENS_ALBUM_ARTWORK_PATH
 
68
};
 
69
UnityMusicLensAlbum* unity_music_lens_album_new (void);
 
70
UnityMusicLensAlbum* unity_music_lens_album_construct (GType object_type);
 
71
const gchar* unity_music_lens_album_get_title (UnityMusicLensAlbum* self);
 
72
void unity_music_lens_album_set_title (UnityMusicLensAlbum* self, const gchar* value);
 
73
const gchar* unity_music_lens_album_get_artist (UnityMusicLensAlbum* self);
 
74
void unity_music_lens_album_set_artist (UnityMusicLensAlbum* self, const gchar* value);
 
75
const gchar* unity_music_lens_album_get_uri (UnityMusicLensAlbum* self);
 
76
void unity_music_lens_album_set_uri (UnityMusicLensAlbum* self, const gchar* value);
 
77
const gchar* unity_music_lens_album_get_artwork_path (UnityMusicLensAlbum* self);
 
78
void unity_music_lens_album_set_artwork_path (UnityMusicLensAlbum* self, const gchar* value);
 
79
static void unity_music_lens_album_finalize (GObject* obj);
 
80
static void _vala_unity_music_lens_album_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 
81
static void _vala_unity_music_lens_album_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
 
82
 
 
83
 
 
84
UnityMusicLensAlbum* unity_music_lens_album_construct (GType object_type) {
 
85
        UnityMusicLensAlbum * self = NULL;
 
86
        self = (UnityMusicLensAlbum*) g_object_new (object_type, NULL);
 
87
        return self;
 
88
}
 
89
 
 
90
 
 
91
UnityMusicLensAlbum* unity_music_lens_album_new (void) {
 
92
        return unity_music_lens_album_construct (UNITY_MUSIC_LENS_TYPE_ALBUM);
 
93
}
 
94
 
 
95
 
 
96
const gchar* unity_music_lens_album_get_title (UnityMusicLensAlbum* self) {
 
97
        const gchar* result;
 
98
        const gchar* _tmp0_;
 
99
        g_return_val_if_fail (self != NULL, NULL);
 
100
        _tmp0_ = self->priv->_title;
 
101
        result = _tmp0_;
 
102
        return result;
 
103
}
 
104
 
 
105
 
 
106
void unity_music_lens_album_set_title (UnityMusicLensAlbum* self, const gchar* value) {
 
107
        const gchar* _tmp0_;
 
108
        gchar* _tmp1_;
 
109
        g_return_if_fail (self != NULL);
 
110
        _tmp0_ = value;
 
111
        _tmp1_ = g_strdup (_tmp0_);
 
112
        _g_free0 (self->priv->_title);
 
113
        self->priv->_title = _tmp1_;
 
114
        g_object_notify ((GObject *) self, "title");
 
115
}
 
116
 
 
117
 
 
118
const gchar* unity_music_lens_album_get_artist (UnityMusicLensAlbum* self) {
 
119
        const gchar* result;
 
120
        const gchar* _tmp0_;
 
121
        g_return_val_if_fail (self != NULL, NULL);
 
122
        _tmp0_ = self->priv->_artist;
 
123
        result = _tmp0_;
 
124
        return result;
 
125
}
 
126
 
 
127
 
 
128
void unity_music_lens_album_set_artist (UnityMusicLensAlbum* self, const gchar* value) {
 
129
        const gchar* _tmp0_;
 
130
        gchar* _tmp1_;
 
131
        g_return_if_fail (self != NULL);
 
132
        _tmp0_ = value;
 
133
        _tmp1_ = g_strdup (_tmp0_);
 
134
        _g_free0 (self->priv->_artist);
 
135
        self->priv->_artist = _tmp1_;
 
136
        g_object_notify ((GObject *) self, "artist");
 
137
}
 
138
 
 
139
 
 
140
const gchar* unity_music_lens_album_get_uri (UnityMusicLensAlbum* self) {
 
141
        const gchar* result;
 
142
        const gchar* _tmp0_;
 
143
        g_return_val_if_fail (self != NULL, NULL);
 
144
        _tmp0_ = self->priv->_uri;
 
145
        result = _tmp0_;
 
146
        return result;
 
147
}
 
148
 
 
149
 
 
150
void unity_music_lens_album_set_uri (UnityMusicLensAlbum* self, const gchar* value) {
 
151
        const gchar* _tmp0_;
 
152
        gchar* _tmp1_;
 
153
        g_return_if_fail (self != NULL);
 
154
        _tmp0_ = value;
 
155
        _tmp1_ = g_strdup (_tmp0_);
 
156
        _g_free0 (self->priv->_uri);
 
157
        self->priv->_uri = _tmp1_;
 
158
        g_object_notify ((GObject *) self, "uri");
 
159
}
 
160
 
 
161
 
 
162
const gchar* unity_music_lens_album_get_artwork_path (UnityMusicLensAlbum* self) {
 
163
        const gchar* result;
 
164
        const gchar* _tmp0_;
 
165
        g_return_val_if_fail (self != NULL, NULL);
 
166
        _tmp0_ = self->priv->_artwork_path;
 
167
        result = _tmp0_;
 
168
        return result;
 
169
}
 
170
 
 
171
 
 
172
void unity_music_lens_album_set_artwork_path (UnityMusicLensAlbum* self, const gchar* value) {
 
173
        const gchar* _tmp0_;
 
174
        gchar* _tmp1_;
 
175
        g_return_if_fail (self != NULL);
 
176
        _tmp0_ = value;
 
177
        _tmp1_ = g_strdup (_tmp0_);
 
178
        _g_free0 (self->priv->_artwork_path);
 
179
        self->priv->_artwork_path = _tmp1_;
 
180
        g_object_notify ((GObject *) self, "artwork-path");
 
181
}
 
182
 
 
183
 
 
184
static void unity_music_lens_album_class_init (UnityMusicLensAlbumClass * klass) {
 
185
        unity_music_lens_album_parent_class = g_type_class_peek_parent (klass);
 
186
        g_type_class_add_private (klass, sizeof (UnityMusicLensAlbumPrivate));
 
187
        G_OBJECT_CLASS (klass)->get_property = _vala_unity_music_lens_album_get_property;
 
188
        G_OBJECT_CLASS (klass)->set_property = _vala_unity_music_lens_album_set_property;
 
189
        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_album_finalize;
 
190
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_ALBUM_TITLE, g_param_spec_string ("title", "title", "title", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 
191
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_ALBUM_ARTIST, g_param_spec_string ("artist", "artist", "artist", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 
192
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_ALBUM_URI, g_param_spec_string ("uri", "uri", "uri", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 
193
        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_ALBUM_ARTWORK_PATH, g_param_spec_string ("artwork-path", "artwork-path", "artwork-path", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
 
194
}
 
195
 
 
196
 
 
197
static void unity_music_lens_album_instance_init (UnityMusicLensAlbum * self) {
 
198
        self->priv = UNITY_MUSIC_LENS_ALBUM_GET_PRIVATE (self);
 
199
}
 
200
 
 
201
 
 
202
static void unity_music_lens_album_finalize (GObject* obj) {
 
203
        UnityMusicLensAlbum * self;
 
204
        self = UNITY_MUSIC_LENS_ALBUM (obj);
 
205
        _g_free0 (self->priv->_title);
 
206
        _g_free0 (self->priv->_artist);
 
207
        _g_free0 (self->priv->_uri);
 
208
        _g_free0 (self->priv->_artwork_path);
 
209
        G_OBJECT_CLASS (unity_music_lens_album_parent_class)->finalize (obj);
 
210
}
 
211
 
 
212
 
 
213
GType unity_music_lens_album_get_type (void) {
 
214
        static volatile gsize unity_music_lens_album_type_id__volatile = 0;
 
215
        if (g_once_init_enter (&unity_music_lens_album_type_id__volatile)) {
 
216
                static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensAlbumClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_album_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensAlbum), 0, (GInstanceInitFunc) unity_music_lens_album_instance_init, NULL };
 
217
                GType unity_music_lens_album_type_id;
 
218
                unity_music_lens_album_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensAlbum", &g_define_type_info, 0);
 
219
                g_once_init_leave (&unity_music_lens_album_type_id__volatile, unity_music_lens_album_type_id);
 
220
        }
 
221
        return unity_music_lens_album_type_id__volatile;
 
222
}
 
223
 
 
224
 
 
225
static void _vala_unity_music_lens_album_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 
226
        UnityMusicLensAlbum * self;
 
227
        self = UNITY_MUSIC_LENS_ALBUM (object);
 
228
        switch (property_id) {
 
229
                case UNITY_MUSIC_LENS_ALBUM_TITLE:
 
230
                g_value_set_string (value, unity_music_lens_album_get_title (self));
 
231
                break;
 
232
                case UNITY_MUSIC_LENS_ALBUM_ARTIST:
 
233
                g_value_set_string (value, unity_music_lens_album_get_artist (self));
 
234
                break;
 
235
                case UNITY_MUSIC_LENS_ALBUM_URI:
 
236
                g_value_set_string (value, unity_music_lens_album_get_uri (self));
 
237
                break;
 
238
                case UNITY_MUSIC_LENS_ALBUM_ARTWORK_PATH:
 
239
                g_value_set_string (value, unity_music_lens_album_get_artwork_path (self));
 
240
                break;
 
241
                default:
 
242
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
243
                break;
 
244
        }
 
245
}
 
246
 
 
247
 
 
248
static void _vala_unity_music_lens_album_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
 
249
        UnityMusicLensAlbum * self;
 
250
        self = UNITY_MUSIC_LENS_ALBUM (object);
 
251
        switch (property_id) {
 
252
                case UNITY_MUSIC_LENS_ALBUM_TITLE:
 
253
                unity_music_lens_album_set_title (self, g_value_get_string (value));
 
254
                break;
 
255
                case UNITY_MUSIC_LENS_ALBUM_ARTIST:
 
256
                unity_music_lens_album_set_artist (self, g_value_get_string (value));
 
257
                break;
 
258
                case UNITY_MUSIC_LENS_ALBUM_URI:
 
259
                unity_music_lens_album_set_uri (self, g_value_get_string (value));
 
260
                break;
 
261
                case UNITY_MUSIC_LENS_ALBUM_ARTWORK_PATH:
 
262
                unity_music_lens_album_set_artwork_path (self, g_value_get_string (value));
 
263
                break;
 
264
                default:
 
265
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
266
                break;
 
267
        }
 
268
}
 
269
 
 
270
 
 
271