~ricmm/+junk/unity-lens_music-sc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
/* album.c generated by valac 0.16.1, the Vala compiler
 * generated from album.vala, do not modify */

/*
 * Copyright (C) 2011 Canonical Ltd
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authored by Alex Launi <alex.launi@canonical.com>
 *
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>


#define UNITY_MUSIC_LENS_TYPE_ALBUM (unity_music_lens_album_get_type ())
#define UNITY_MUSIC_LENS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbum))
#define UNITY_MUSIC_LENS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
#define UNITY_MUSIC_LENS_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM))
#define UNITY_MUSIC_LENS_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM))
#define UNITY_MUSIC_LENS_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))

typedef struct _UnityMusicLensAlbum UnityMusicLensAlbum;
typedef struct _UnityMusicLensAlbumClass UnityMusicLensAlbumClass;
typedef struct _UnityMusicLensAlbumPrivate UnityMusicLensAlbumPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))

struct _UnityMusicLensAlbum {
	GObject parent_instance;
	UnityMusicLensAlbumPrivate * priv;
};

struct _UnityMusicLensAlbumClass {
	GObjectClass parent_class;
};

struct _UnityMusicLensAlbumPrivate {
	gchar* _title;
	gchar* _artist;
	gchar* _uri;
	gchar* _artwork_path;
};


static gpointer unity_music_lens_album_parent_class = NULL;

GType unity_music_lens_album_get_type (void) G_GNUC_CONST;
#define UNITY_MUSIC_LENS_ALBUM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumPrivate))
enum  {
	UNITY_MUSIC_LENS_ALBUM_DUMMY_PROPERTY,
	UNITY_MUSIC_LENS_ALBUM_TITLE,
	UNITY_MUSIC_LENS_ALBUM_ARTIST,
	UNITY_MUSIC_LENS_ALBUM_URI,
	UNITY_MUSIC_LENS_ALBUM_ARTWORK_PATH
};
UnityMusicLensAlbum* unity_music_lens_album_new (void);
UnityMusicLensAlbum* unity_music_lens_album_construct (GType object_type);
const gchar* unity_music_lens_album_get_title (UnityMusicLensAlbum* self);
void unity_music_lens_album_set_title (UnityMusicLensAlbum* self, const gchar* value);
const gchar* unity_music_lens_album_get_artist (UnityMusicLensAlbum* self);
void unity_music_lens_album_set_artist (UnityMusicLensAlbum* self, const gchar* value);
const gchar* unity_music_lens_album_get_uri (UnityMusicLensAlbum* self);
void unity_music_lens_album_set_uri (UnityMusicLensAlbum* self, const gchar* value);
const gchar* unity_music_lens_album_get_artwork_path (UnityMusicLensAlbum* self);
void unity_music_lens_album_set_artwork_path (UnityMusicLensAlbum* self, const gchar* value);
static void unity_music_lens_album_finalize (GObject* obj);
static void _vala_unity_music_lens_album_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_unity_music_lens_album_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


UnityMusicLensAlbum* unity_music_lens_album_construct (GType object_type) {
	UnityMusicLensAlbum * self = NULL;
	self = (UnityMusicLensAlbum*) g_object_new (object_type, NULL);
	return self;
}


UnityMusicLensAlbum* unity_music_lens_album_new (void) {
	return unity_music_lens_album_construct (UNITY_MUSIC_LENS_TYPE_ALBUM);
}


const gchar* unity_music_lens_album_get_title (UnityMusicLensAlbum* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_title;
	result = _tmp0_;
	return result;
}


void unity_music_lens_album_set_title (UnityMusicLensAlbum* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_title);
	self->priv->_title = _tmp1_;
	g_object_notify ((GObject *) self, "title");
}


const gchar* unity_music_lens_album_get_artist (UnityMusicLensAlbum* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_artist;
	result = _tmp0_;
	return result;
}


void unity_music_lens_album_set_artist (UnityMusicLensAlbum* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_artist);
	self->priv->_artist = _tmp1_;
	g_object_notify ((GObject *) self, "artist");
}


const gchar* unity_music_lens_album_get_uri (UnityMusicLensAlbum* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_uri;
	result = _tmp0_;
	return result;
}


void unity_music_lens_album_set_uri (UnityMusicLensAlbum* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_uri);
	self->priv->_uri = _tmp1_;
	g_object_notify ((GObject *) self, "uri");
}


const gchar* unity_music_lens_album_get_artwork_path (UnityMusicLensAlbum* self) {
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_artwork_path;
	result = _tmp0_;
	return result;
}


void unity_music_lens_album_set_artwork_path (UnityMusicLensAlbum* self, const gchar* value) {
	const gchar* _tmp0_;
	gchar* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = value;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 (self->priv->_artwork_path);
	self->priv->_artwork_path = _tmp1_;
	g_object_notify ((GObject *) self, "artwork-path");
}


static void unity_music_lens_album_class_init (UnityMusicLensAlbumClass * klass) {
	unity_music_lens_album_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (UnityMusicLensAlbumPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_unity_music_lens_album_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_unity_music_lens_album_set_property;
	G_OBJECT_CLASS (klass)->finalize = unity_music_lens_album_finalize;
	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));
	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));
	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));
	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));
}


static void unity_music_lens_album_instance_init (UnityMusicLensAlbum * self) {
	self->priv = UNITY_MUSIC_LENS_ALBUM_GET_PRIVATE (self);
}


static void unity_music_lens_album_finalize (GObject* obj) {
	UnityMusicLensAlbum * self;
	self = UNITY_MUSIC_LENS_ALBUM (obj);
	_g_free0 (self->priv->_title);
	_g_free0 (self->priv->_artist);
	_g_free0 (self->priv->_uri);
	_g_free0 (self->priv->_artwork_path);
	G_OBJECT_CLASS (unity_music_lens_album_parent_class)->finalize (obj);
}


GType unity_music_lens_album_get_type (void) {
	static volatile gsize unity_music_lens_album_type_id__volatile = 0;
	if (g_once_init_enter (&unity_music_lens_album_type_id__volatile)) {
		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 };
		GType unity_music_lens_album_type_id;
		unity_music_lens_album_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityMusicLensAlbum", &g_define_type_info, 0);
		g_once_init_leave (&unity_music_lens_album_type_id__volatile, unity_music_lens_album_type_id);
	}
	return unity_music_lens_album_type_id__volatile;
}


static void _vala_unity_music_lens_album_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	UnityMusicLensAlbum * self;
	self = UNITY_MUSIC_LENS_ALBUM (object);
	switch (property_id) {
		case UNITY_MUSIC_LENS_ALBUM_TITLE:
		g_value_set_string (value, unity_music_lens_album_get_title (self));
		break;
		case UNITY_MUSIC_LENS_ALBUM_ARTIST:
		g_value_set_string (value, unity_music_lens_album_get_artist (self));
		break;
		case UNITY_MUSIC_LENS_ALBUM_URI:
		g_value_set_string (value, unity_music_lens_album_get_uri (self));
		break;
		case UNITY_MUSIC_LENS_ALBUM_ARTWORK_PATH:
		g_value_set_string (value, unity_music_lens_album_get_artwork_path (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_unity_music_lens_album_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	UnityMusicLensAlbum * self;
	self = UNITY_MUSIC_LENS_ALBUM (object);
	switch (property_id) {
		case UNITY_MUSIC_LENS_ALBUM_TITLE:
		unity_music_lens_album_set_title (self, g_value_get_string (value));
		break;
		case UNITY_MUSIC_LENS_ALBUM_ARTIST:
		unity_music_lens_album_set_artist (self, g_value_get_string (value));
		break;
		case UNITY_MUSIC_LENS_ALBUM_URI:
		unity_music_lens_album_set_uri (self, g_value_get_string (value));
		break;
		case UNITY_MUSIC_LENS_ALBUM_ARTWORK_PATH:
		unity_music_lens_album_set_artwork_path (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}