1
/* musicbaidu-daemon.c generated by valac 0.18.1, the Vala compiler
2
* generated from musicbaidu-daemon.vala, do not modify */
5
* Copyright (C) 2013 Kylin Ltd
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.
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.
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/>.
19
* Authored by Weihua Zhang <fly2high@126.com>
20
* Authored by liuxing <liuxingcs@yeah.net>
21
* Modified Information:
22
* Rewrite perform_search to search China music from music.baidu.com
25
* Copyright (C) 2011 Canonical Ltd
27
* This program is free software: you can redistribute it and/or modify
28
* it under the terms of the GNU General Public License version 3 as
29
* published by the Free Software Foundation.
31
* This program is distributed in the hope that it will be useful,
32
* but WITHOUT ANY WARRANTY; without even the implied warranty of
33
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34
* GNU General Public License for more details.
36
* You should have received a copy of the GNU General Public License
37
* along with this program. If not, see <http://www.gnu.org/licenses/>.
39
* Authored by Alex Launi <alex.launi@canonical.com>
44
#include <glib-object.h>
50
#include <glib/gi18n-lib.h>
55
#define UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE (unity_music_lens_simple_scope_get_type ())
56
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope))
57
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
58
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
59
#define UNITY_MUSIC_LENS_IS_SIMPLE_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE))
60
#define UNITY_MUSIC_LENS_SIMPLE_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScopeClass))
62
typedef struct _UnityMusicLensSimpleScope UnityMusicLensSimpleScope;
63
typedef struct _UnityMusicLensSimpleScopeClass UnityMusicLensSimpleScopeClass;
65
#define UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY (unity_music_lens_music_baidu_scope_proxy_get_type ())
66
#define UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY, UnityMusicLensMusicBaiduScopeProxy))
67
#define UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY, UnityMusicLensMusicBaiduScopeProxyClass))
68
#define UNITY_MUSIC_LENS_IS_MUSIC_BAIDU_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY))
69
#define UNITY_MUSIC_LENS_IS_MUSIC_BAIDU_SCOPE_PROXY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY))
70
#define UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY, UnityMusicLensMusicBaiduScopeProxyClass))
72
typedef struct _UnityMusicLensMusicBaiduScopeProxy UnityMusicLensMusicBaiduScopeProxy;
73
typedef struct _UnityMusicLensMusicBaiduScopeProxyClass UnityMusicLensMusicBaiduScopeProxyClass;
74
typedef struct _UnityMusicLensSimpleScopePrivate UnityMusicLensSimpleScopePrivate;
76
#define UNITY_MUSIC_LENS_TYPE_FILTER_PARSER (unity_music_lens_filter_parser_get_type ())
77
#define UNITY_MUSIC_LENS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParser))
78
#define UNITY_MUSIC_LENS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
79
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
80
#define UNITY_MUSIC_LENS_IS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
81
#define UNITY_MUSIC_LENS_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
83
typedef struct _UnityMusicLensFilterParser UnityMusicLensFilterParser;
84
typedef struct _UnityMusicLensFilterParserClass UnityMusicLensFilterParserClass;
85
typedef struct _UnityMusicLensMusicBaiduScopeProxyPrivate UnityMusicLensMusicBaiduScopeProxyPrivate;
87
#define UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_COLLECTION (unity_music_lens_music_baidu_collection_get_type ())
88
#define UNITY_MUSIC_LENS_MUSIC_BAIDU_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_COLLECTION, UnityMusicLensMusicBaiduCollection))
89
#define UNITY_MUSIC_LENS_MUSIC_BAIDU_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_COLLECTION, UnityMusicLensMusicBaiduCollectionClass))
90
#define UNITY_MUSIC_LENS_IS_MUSIC_BAIDU_COLLECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_COLLECTION))
91
#define UNITY_MUSIC_LENS_IS_MUSIC_BAIDU_COLLECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_COLLECTION))
92
#define UNITY_MUSIC_LENS_MUSIC_BAIDU_COLLECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_COLLECTION, UnityMusicLensMusicBaiduCollectionClass))
94
typedef struct _UnityMusicLensMusicBaiduCollection UnityMusicLensMusicBaiduCollection;
95
typedef struct _UnityMusicLensMusicBaiduCollectionClass UnityMusicLensMusicBaiduCollectionClass;
96
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
97
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
98
#define _g_free0(var) (var = (g_free (var), NULL))
100
#define UNITY_MUSIC_LENS_TYPE_ALBUM (unity_music_lens_album_get_type ())
101
#define UNITY_MUSIC_LENS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbum))
102
#define UNITY_MUSIC_LENS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
103
#define UNITY_MUSIC_LENS_IS_ALBUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM))
104
#define UNITY_MUSIC_LENS_IS_ALBUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_ALBUM))
105
#define UNITY_MUSIC_LENS_ALBUM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_ALBUM, UnityMusicLensAlbumClass))
107
typedef struct _UnityMusicLensAlbum UnityMusicLensAlbum;
108
typedef struct _UnityMusicLensAlbumClass UnityMusicLensAlbumClass;
110
#define UNITY_MUSIC_LENS_TYPE_TRACK (unity_music_lens_track_get_type ())
111
#define UNITY_MUSIC_LENS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrack))
112
#define UNITY_MUSIC_LENS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
113
#define UNITY_MUSIC_LENS_IS_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_TRACK))
114
#define UNITY_MUSIC_LENS_IS_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_TRACK))
115
#define UNITY_MUSIC_LENS_TRACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_TRACK, UnityMusicLensTrackClass))
117
typedef struct _UnityMusicLensTrack UnityMusicLensTrack;
118
typedef struct _UnityMusicLensTrackClass UnityMusicLensTrackClass;
119
#define __g_slist_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_object_unref0_ (var), NULL)))
120
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
121
typedef struct _UnityMusicLensMusicBaiduScopeProxyPerformSearchData UnityMusicLensMusicBaiduScopeProxyPerformSearchData;
122
#define _g_variant_type_free0(var) ((var == NULL) ? NULL : (var = (g_variant_type_free (var), NULL)))
123
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
125
struct _UnityMusicLensSimpleScope {
126
GObject parent_instance;
127
UnityMusicLensSimpleScopePrivate * priv;
130
struct _UnityMusicLensSimpleScopeClass {
131
GObjectClass parent_class;
132
void (*perform_search) (UnityMusicLensSimpleScope* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
133
void (*perform_search_finish) (UnityMusicLensSimpleScope* self, GAsyncResult* _res_);
134
gint (*get_num_results_without_search) (UnityMusicLensSimpleScope* self);
135
gint (*get_num_results_global_search) (UnityMusicLensSimpleScope* self);
136
gint (*get_num_results_lens_search) (UnityMusicLensSimpleScope* self);
139
struct _UnityMusicLensMusicBaiduScopeProxy {
140
UnityMusicLensSimpleScope parent_instance;
141
UnityMusicLensMusicBaiduScopeProxyPrivate * priv;
144
struct _UnityMusicLensMusicBaiduScopeProxyClass {
145
UnityMusicLensSimpleScopeClass parent_class;
148
struct _UnityMusicLensMusicBaiduScopeProxyPrivate {
149
UnityMusicLensMusicBaiduCollection* collection;
150
UnityMusicPreview* music_preview;
153
struct _UnityMusicLensMusicBaiduScopeProxyPerformSearchData {
155
GObject* _source_object_;
157
GSimpleAsyncResult* _async_result;
158
UnityMusicLensMusicBaiduScopeProxy* self;
159
UnityLensSearch* search;
160
UnitySearchType search_type;
163
GCancellable* cancellable;
164
UnityLensSearch* _tmp0_;
166
UnityLensSearch* _tmp2_;
167
DeeSerializableModel* _tmp3_;
168
DeeSerializableModel* _tmp4_;
170
UnityMusicLensMusicBaiduCollection* _tmp6_;
171
UnityLensSearch* _tmp7_;
172
UnitySearchType _tmp8_;
175
GCancellable* _tmp11_;
176
UnityLensSearch* _tmp12_;
177
DeeSerializableModel* _tmp13_;
178
DeeSerializableModel* _tmp14_;
181
UnityLensSearch* _tmp16_;
182
const gchar* _tmp17_;
183
const gchar* _tmp18_;
185
const gchar* _tmp20_;
186
GError * _inner_error_;
190
extern GApplication* unity_music_lens_app;
191
GApplication* unity_music_lens_app = NULL;
192
extern UnityMusicLensMusicBaiduScopeProxy* unity_music_lens_daemon;
193
UnityMusicLensMusicBaiduScopeProxy* unity_music_lens_daemon = NULL;
194
static gpointer unity_music_lens_music_baidu_scope_proxy_parent_class = NULL;
196
GType unity_music_lens_simple_scope_get_type (void) G_GNUC_CONST;
197
GType unity_music_lens_music_baidu_scope_proxy_get_type (void) G_GNUC_CONST;
198
GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
199
GType unity_music_lens_music_baidu_collection_get_type (void) G_GNUC_CONST;
200
#define UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY, UnityMusicLensMusicBaiduScopeProxyPrivate))
202
UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_DUMMY_PROPERTY,
203
UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_WITHOUT_SEARCH,
204
UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_GLOBAL_SEARCH,
205
UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_LENS_SEARCH
207
UnityMusicLensMusicBaiduScopeProxy* unity_music_lens_music_baidu_scope_proxy_new (void);
208
UnityMusicLensMusicBaiduScopeProxy* unity_music_lens_music_baidu_scope_proxy_construct (GType object_type);
209
UnityMusicLensSimpleScope* unity_music_lens_simple_scope_construct (GType object_type);
210
void unity_music_lens_simple_scope_set_scope (UnityMusicLensSimpleScope* self, UnityScope* value);
211
UnityScope* unity_music_lens_simple_scope_get_scope (UnityMusicLensSimpleScope* self);
212
UnityActivationResponse* unity_music_lens_music_baidu_scope_proxy_activate (UnityMusicLensMusicBaiduScopeProxy* self, const gchar* uri);
213
static UnityActivationResponse* _unity_music_lens_music_baidu_scope_proxy_activate_unity_scope_activate_uri (UnityScope* _sender, const gchar* uri, gpointer self);
214
UnityPreview* unity_music_lens_music_baidu_scope_proxy_preview (UnityMusicLensMusicBaiduScopeProxy* self, const gchar* uri);
215
static UnityPreview* _unity_music_lens_music_baidu_scope_proxy_preview_unity_scope_preview_uri (UnityScope* _sender, const gchar* uri, gpointer self);
216
void unity_music_lens_simple_scope_initialize (UnityMusicLensSimpleScope* self);
217
UnityMusicLensMusicBaiduCollection* unity_music_lens_music_baidu_collection_new (void);
218
UnityMusicLensMusicBaiduCollection* unity_music_lens_music_baidu_collection_construct (GType object_type);
219
UnityActivationResponse* unity_music_lens_music_baidu_scope_proxy_download_album (UnityMusicLensMusicBaiduScopeProxy* self, const gchar* uri);
220
GType unity_music_lens_album_get_type (void) G_GNUC_CONST;
221
GType unity_music_lens_track_get_type (void) G_GNUC_CONST;
222
void unity_music_lens_music_baidu_collection_get_album_details (UnityMusicLensMusicBaiduCollection* self, const gchar* uri, UnityMusicLensAlbum** album, GSList** tracks, GCancellable* cancellable);
223
static void _g_object_unref0_ (gpointer var);
224
static void _g_slist_free__g_object_unref0_ (GSList* self);
225
void unity_music_lens_music_baidu_collection_get_song_details (UnityMusicLensMusicBaiduCollection* self, const gchar* uri, UnityMusicLensAlbum** album, GSList** tracks, GCancellable* cancellable);
226
const gchar* unity_music_lens_album_get_artwork_path (UnityMusicLensAlbum* self);
227
const gchar* unity_music_lens_album_get_title (UnityMusicLensAlbum* self);
228
const gchar* unity_music_lens_album_get_artist (UnityMusicLensAlbum* self);
229
const gchar* unity_music_lens_track_get_uri (UnityMusicLensTrack* self);
230
const gchar* unity_music_lens_track_get_title (UnityMusicLensTrack* self);
231
gint unity_music_lens_track_get_duration (UnityMusicLensTrack* self);
232
#define CONFIG_DATADIR "/usr/local/share"
233
static UnityActivationResponse* _unity_music_lens_music_baidu_scope_proxy_download_album_unity_preview_action_activated (UnityPreviewAction* _sender, const gchar* uri, gpointer self);
234
static void _g_list_free__g_object_unref0_ (GList* self);
235
static void unity_music_lens_music_baidu_scope_proxy_real_perform_search_data_free (gpointer _data);
236
static void unity_music_lens_music_baidu_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
237
static gboolean unity_music_lens_music_baidu_scope_proxy_real_perform_search_co (UnityMusicLensMusicBaiduScopeProxyPerformSearchData* _data_);
238
gboolean unity_music_lens_simple_scope_is_search_empty (UnityMusicLensSimpleScope* self, UnityLensSearch* search);
239
void unity_music_lens_music_baidu_collection_search (UnityMusicLensMusicBaiduCollection* self, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
240
void unity_music_lens_music_baidu_collection_search_finish (UnityMusicLensMusicBaiduCollection* self, GAsyncResult* _res_, GError** error);
241
static void unity_music_lens_music_baidu_scope_proxy_perform_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
242
static void unity_music_lens_music_baidu_scope_proxy_finalize (GObject* obj);
243
gint unity_music_lens_simple_scope_get_num_results_without_search (UnityMusicLensSimpleScope* self);
244
gint unity_music_lens_simple_scope_get_num_results_global_search (UnityMusicLensSimpleScope* self);
245
gint unity_music_lens_simple_scope_get_num_results_lens_search (UnityMusicLensSimpleScope* self);
246
static void _vala_unity_music_lens_music_baidu_scope_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
247
gboolean unity_music_lens_dbus_name_has_owner (const gchar* name);
248
gint unity_music_lens_main (gchar** args, int args_length1);
249
#define CONFIG_PACKAGE "unity-china-music-scope"
250
#define CONFIG_LOCALEDIR "/usr/local/share/locale"
253
static UnityActivationResponse* _unity_music_lens_music_baidu_scope_proxy_activate_unity_scope_activate_uri (UnityScope* _sender, const gchar* uri, gpointer self) {
254
UnityActivationResponse* result;
255
result = unity_music_lens_music_baidu_scope_proxy_activate (self, uri);
260
static UnityPreview* _unity_music_lens_music_baidu_scope_proxy_preview_unity_scope_preview_uri (UnityScope* _sender, const gchar* uri, gpointer self) {
261
UnityPreview* result;
262
result = unity_music_lens_music_baidu_scope_proxy_preview (self, uri);
267
UnityMusicLensMusicBaiduScopeProxy* unity_music_lens_music_baidu_scope_proxy_construct (GType object_type) {
268
UnityMusicLensMusicBaiduScopeProxy * self = NULL;
277
UnityMusicLensMusicBaiduCollection* _tmp8_;
278
GError * _inner_error_ = NULL;
279
self = (UnityMusicLensMusicBaiduScopeProxy*) unity_music_lens_simple_scope_construct (object_type);
280
_tmp0_ = unity_scope_new ("/com/canonical/unity/scope/musicbaidu");
282
unity_music_lens_simple_scope_set_scope ((UnityMusicLensSimpleScope*) self, _tmp1_);
283
_g_object_unref0 (_tmp1_);
284
_tmp2_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
286
unity_scope_set_search_in_global (_tmp3_, TRUE);
287
_tmp4_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
289
g_signal_connect_object (_tmp5_, "activate-uri", (GCallback) _unity_music_lens_music_baidu_scope_proxy_activate_unity_scope_activate_uri, self, 0);
290
_tmp6_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
292
g_signal_connect_object (_tmp7_, "preview-uri", (GCallback) _unity_music_lens_music_baidu_scope_proxy_preview_unity_scope_preview_uri, self, 0);
293
unity_music_lens_simple_scope_initialize (G_TYPE_CHECK_INSTANCE_CAST (self, UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, UnityMusicLensSimpleScope));
294
_tmp8_ = unity_music_lens_music_baidu_collection_new ();
295
_g_object_unref0 (self->priv->collection);
296
self->priv->collection = _tmp8_;
300
_tmp9_ = unity_music_lens_simple_scope_get_scope ((UnityMusicLensSimpleScope*) self);
302
unity_scope_export (_tmp10_, &_inner_error_);
303
if (_inner_error_ != NULL) {
304
if (_inner_error_->domain == G_IO_ERROR) {
305
goto __catch4_g_io_error;
307
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
308
g_clear_error (&_inner_error_);
318
const gchar* _tmp13_;
320
_inner_error_ = NULL;
323
_tmp13_ = _tmp12_->message;
324
fprintf (_tmp11_, "%s", _tmp13_);
328
if (_inner_error_ != NULL) {
329
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
330
g_clear_error (&_inner_error_);
337
UnityMusicLensMusicBaiduScopeProxy* unity_music_lens_music_baidu_scope_proxy_new (void) {
338
return unity_music_lens_music_baidu_scope_proxy_construct (UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY);
342
static glong string_strnlen (gchar* str, glong maxlen) {
346
gchar* _tmp2_ = NULL;
351
_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
354
if (_tmp3_ == NULL) {
364
result = (glong) (_tmp5_ - _tmp6_);
370
static gchar* string_substring (const gchar* self, glong offset, glong len) {
371
gchar* result = NULL;
372
glong string_length = 0L;
373
gboolean _tmp0_ = FALSE;
383
gchar* _tmp23_ = NULL;
384
g_return_val_if_fail (self != NULL, NULL);
386
if (_tmp1_ >= ((glong) 0)) {
389
_tmp0_ = _tmp2_ >= ((glong) 0);
400
_tmp6_ = string_strnlen ((gchar*) self, _tmp4_ + _tmp5_);
401
string_length = _tmp6_;
405
_tmp7_ = strlen (self);
407
string_length = (glong) _tmp8_;
410
if (_tmp9_ < ((glong) 0)) {
414
_tmp10_ = string_length;
416
offset = _tmp10_ + _tmp11_;
418
g_return_val_if_fail (_tmp12_ >= ((glong) 0), NULL);
423
_tmp14_ = string_length;
424
g_return_val_if_fail (_tmp13_ <= _tmp14_, NULL);
427
if (_tmp15_ < ((glong) 0)) {
430
_tmp16_ = string_length;
432
len = _tmp16_ - _tmp17_;
436
_tmp20_ = string_length;
437
g_return_val_if_fail ((_tmp18_ + _tmp19_) <= _tmp20_, NULL);
440
_tmp23_ = g_strndup (((gchar*) self) + _tmp21_, (gsize) _tmp22_);
446
UnityActivationResponse* unity_music_lens_music_baidu_scope_proxy_activate (UnityMusicLensMusicBaiduScopeProxy* self, const gchar* uri) {
447
UnityActivationResponse* result = NULL;
448
UnityActivationResponse* _tmp13_;
449
GError * _inner_error_ = NULL;
450
g_return_val_if_fail (self != NULL, NULL);
451
g_return_val_if_fail (uri != NULL, NULL);
454
gboolean _tmp1_ = FALSE;
456
_tmp1_ = g_str_has_prefix (_tmp0_, "song://");
459
gchar* _tmp3_ = NULL;
462
_tmp3_ = string_substring (_tmp2_, (glong) 7, (glong) (-1));
464
g_app_info_launch_default_for_uri (_tmp4_, NULL, &_inner_error_);
466
if (_inner_error_ != NULL) {
467
goto __catch5_g_error;
471
gboolean _tmp6_ = FALSE;
473
_tmp6_ = g_str_has_prefix (_tmp5_, "album://");
476
gchar* _tmp8_ = NULL;
479
_tmp8_ = string_substring (_tmp7_, (glong) 8, (glong) (-1));
481
g_app_info_launch_default_for_uri (_tmp9_, NULL, &_inner_error_);
483
if (_inner_error_ != NULL) {
484
goto __catch5_g_error;
493
const gchar* _tmp10_;
495
const gchar* _tmp12_;
497
_inner_error_ = NULL;
500
_tmp12_ = _tmp11_->message;
501
g_warning ("musicbaidu-daemon.vala:107: Failed to open uri %s. %s", _tmp10_, _tmp12_);
505
if (_inner_error_ != NULL) {
506
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
507
g_clear_error (&_inner_error_);
510
_tmp13_ = unity_activation_response_new (UNITY_HANDLED_TYPE_HIDE_DASH, "");
511
g_object_ref_sink (_tmp13_);
517
UnityActivationResponse* unity_music_lens_music_baidu_scope_proxy_download_album (UnityMusicLensMusicBaiduScopeProxy* self, const gchar* uri) {
518
UnityActivationResponse* result = NULL;
520
UnityActivationResponse* _tmp1_ = NULL;
521
g_return_val_if_fail (self != NULL, NULL);
522
g_return_val_if_fail (uri != NULL, NULL);
524
_tmp1_ = unity_music_lens_music_baidu_scope_proxy_activate (self, _tmp0_);
530
static void _g_object_unref0_ (gpointer var) {
531
(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
535
static void _g_slist_free__g_object_unref0_ (GSList* self) {
536
g_slist_foreach (self, (GFunc) _g_object_unref0_, NULL);
541
static gpointer _g_object_ref0 (gpointer self) {
542
return self ? g_object_ref (self) : NULL;
546
static UnityActivationResponse* _unity_music_lens_music_baidu_scope_proxy_download_album_unity_preview_action_activated (UnityPreviewAction* _sender, const gchar* uri, gpointer self) {
547
UnityActivationResponse* result;
548
result = unity_music_lens_music_baidu_scope_proxy_download_album (self, uri);
553
UnityPreview* unity_music_lens_music_baidu_scope_proxy_preview (UnityMusicLensMusicBaiduScopeProxy* self, const gchar* uri) {
554
UnityPreview* result = NULL;
555
UnityMusicLensAlbum* album;
558
gboolean _tmp1_ = FALSE;
559
UnityMusicLensAlbum* _tmp12_;
560
UnityMusicPreview* _tmp59_;
561
UnityPreview* _tmp60_;
562
g_return_val_if_fail (self != NULL, NULL);
563
g_return_val_if_fail (uri != NULL, NULL);
564
_g_object_unref0 (self->priv->music_preview);
565
self->priv->music_preview = NULL;
569
_tmp1_ = g_str_has_prefix (_tmp0_, "album://");
571
UnityMusicLensMusicBaiduCollection* _tmp2_;
573
UnityMusicLensAlbum* _tmp4_ = NULL;
574
GSList* _tmp5_ = NULL;
575
_tmp2_ = self->priv->collection;
577
unity_music_lens_music_baidu_collection_get_album_details (_tmp2_, _tmp3_, &_tmp4_, &_tmp5_, NULL);
578
_g_object_unref0 (album);
580
__g_slist_free__g_object_unref0_0 (tracks);
584
gboolean _tmp7_ = FALSE;
586
_tmp7_ = g_str_has_prefix (_tmp6_, "song://");
588
UnityMusicLensMusicBaiduCollection* _tmp8_;
590
UnityMusicLensAlbum* _tmp10_ = NULL;
591
GSList* _tmp11_ = NULL;
592
_tmp8_ = self->priv->collection;
594
unity_music_lens_music_baidu_collection_get_song_details (_tmp8_, _tmp9_, &_tmp10_, &_tmp11_, NULL);
595
_g_object_unref0 (album);
597
__g_slist_free__g_object_unref0_0 (tracks);
602
if (_tmp12_ != NULL) {
605
UnityMusicLensAlbum* _tmp13_;
606
const gchar* _tmp14_;
607
const gchar* _tmp15_;
610
const gchar* _tmp17_;
611
GFile* _tmp18_ = NULL;
614
UnityMusicLensAlbum* _tmp21_;
615
const gchar* _tmp22_;
616
const gchar* _tmp23_;
617
UnityMusicLensAlbum* _tmp24_;
618
const gchar* _tmp25_;
619
const gchar* _tmp26_;
621
UnityMusicPreview* _tmp28_;
623
GFile* _tmp49_ = NULL;
628
const gchar* _tmp53_ = NULL;
630
UnityPreviewAction* _tmp55_;
631
UnityPreviewAction* download_action;
632
UnityPreviewAction* _tmp56_;
633
UnityMusicPreview* _tmp57_;
634
UnityPreviewAction* _tmp58_;
638
_tmp14_ = unity_music_lens_album_get_artwork_path (_tmp13_);
640
_tmp16_ = g_strdup (_tmp15_);
641
artwork_path = _tmp16_;
642
_tmp17_ = artwork_path;
643
_tmp18_ = g_file_new_for_uri (_tmp17_);
645
_tmp20_ = (GFileIcon*) g_file_icon_new (_tmp19_);
646
_g_object_unref0 (icon_file);
647
icon_file = (GIcon*) _tmp20_;
648
_g_object_unref0 (_tmp19_);
650
_tmp22_ = unity_music_lens_album_get_title (_tmp21_);
653
_tmp25_ = unity_music_lens_album_get_artist (_tmp24_);
656
_tmp28_ = unity_music_preview_new (_tmp23_, _tmp26_, _tmp27_);
657
_g_object_unref0 (self->priv->music_preview);
658
self->priv->music_preview = _tmp28_;
660
if (_tmp29_ != NULL) {
664
GSList* track_collection = NULL;
665
GSList* track_it = NULL;
666
track_collection = _tmp30_;
667
for (track_it = track_collection; track_it != NULL; track_it = track_it->next) {
668
UnityMusicLensTrack* _tmp31_;
669
UnityMusicLensTrack* track = NULL;
670
_tmp31_ = _g_object_ref0 ((UnityMusicLensTrack*) track_it->data);
673
UnityTrackMetadata* _tmp32_;
674
UnityTrackMetadata* tm;
675
UnityTrackMetadata* _tmp33_;
676
UnityMusicLensTrack* _tmp34_;
677
const gchar* _tmp35_;
678
const gchar* _tmp36_;
679
UnityTrackMetadata* _tmp37_;
681
UnityTrackMetadata* _tmp39_;
682
UnityMusicLensTrack* _tmp40_;
683
const gchar* _tmp41_;
684
const gchar* _tmp42_;
685
UnityTrackMetadata* _tmp43_;
686
UnityMusicLensTrack* _tmp44_;
689
UnityMusicPreview* _tmp47_;
690
UnityTrackMetadata* _tmp48_;
691
_tmp32_ = unity_track_metadata_new ();
695
_tmp35_ = unity_music_lens_track_get_uri (_tmp34_);
697
unity_track_metadata_set_uri (_tmp33_, _tmp36_);
701
unity_track_metadata_set_track_no (_tmp37_, _tmp38_);
704
_tmp41_ = unity_music_lens_track_get_title (_tmp40_);
706
unity_track_metadata_set_title (_tmp39_, _tmp42_);
709
_tmp45_ = unity_music_lens_track_get_duration (_tmp44_);
711
unity_track_metadata_set_length (_tmp43_, (guint) _tmp46_);
712
_tmp47_ = self->priv->music_preview;
714
unity_music_preview_add_track (_tmp47_, _tmp48_);
715
_g_object_unref0 (tm);
716
_g_object_unref0 (track);
721
_tmp49_ = g_file_new_for_path (CONFIG_DATADIR "/icons/unity-icon-theme/places/svg/service-u1.svg");
723
_tmp51_ = (GFileIcon*) g_file_icon_new (_tmp50_);
724
_tmp52_ = (GIcon*) _tmp51_;
725
_g_object_unref0 (_tmp50_);
727
_tmp53_ = _ ("Download");
729
_tmp55_ = unity_preview_action_new ("download_album", _tmp53_, _tmp54_);
730
download_action = _tmp55_;
731
_tmp56_ = download_action;
732
g_signal_connect_object (_tmp56_, "activated", (GCallback) _unity_music_lens_music_baidu_scope_proxy_download_album_unity_preview_action_activated, self, 0);
733
_tmp57_ = self->priv->music_preview;
734
_tmp58_ = download_action;
735
unity_preview_add_action ((UnityPreview*) _tmp57_, _tmp58_);
736
_g_object_unref0 (download_action);
737
_g_object_unref0 (icon);
738
_g_free0 (artwork_path);
739
_g_object_unref0 (icon_file);
741
_tmp59_ = self->priv->music_preview;
742
_tmp60_ = _g_object_ref0 ((UnityPreview*) _tmp59_);
744
__g_slist_free__g_object_unref0_0 (tracks);
745
_g_object_unref0 (album);
750
static void _g_list_free__g_object_unref0_ (GList* self) {
751
g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
756
static void unity_music_lens_music_baidu_scope_proxy_real_perform_search_data_free (gpointer _data) {
757
UnityMusicLensMusicBaiduScopeProxyPerformSearchData* _data_;
759
_g_object_unref0 (_data_->search);
760
__g_list_free__g_object_unref0_0 (_data_->filters);
761
_g_object_unref0 (_data_->cancellable);
762
_g_object_unref0 (_data_->self);
763
g_slice_free (UnityMusicLensMusicBaiduScopeProxyPerformSearchData, _data_);
767
static void unity_music_lens_music_baidu_scope_proxy_real_perform_search (UnityMusicLensSimpleScope* base, UnityLensSearch* search, UnitySearchType search_type, GList* filters, gint max_results, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
768
UnityMusicLensMusicBaiduScopeProxy * self;
769
UnityMusicLensMusicBaiduScopeProxyPerformSearchData* _data_;
770
UnityMusicLensMusicBaiduScopeProxy* _tmp0_;
771
UnityLensSearch* _tmp1_;
772
UnityLensSearch* _tmp2_;
773
UnitySearchType _tmp3_;
775
GCancellable* _tmp5_;
776
GCancellable* _tmp6_;
777
self = (UnityMusicLensMusicBaiduScopeProxy*) base;
778
_data_ = g_slice_new0 (UnityMusicLensMusicBaiduScopeProxyPerformSearchData);
779
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_music_lens_music_baidu_scope_proxy_real_perform_search);
780
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_music_lens_music_baidu_scope_proxy_real_perform_search_data_free);
781
_tmp0_ = _g_object_ref0 (self);
782
_data_->self = _tmp0_;
784
_tmp2_ = _g_object_ref0 (_tmp1_);
785
_g_object_unref0 (_data_->search);
786
_data_->search = _tmp2_;
787
_tmp3_ = search_type;
788
_data_->search_type = _tmp3_;
789
__g_list_free__g_object_unref0_0 (_data_->filters);
790
_data_->filters = filters;
791
_tmp4_ = max_results;
792
_data_->max_results = _tmp4_;
793
_tmp5_ = cancellable;
794
_tmp6_ = _g_object_ref0 (_tmp5_);
795
_g_object_unref0 (_data_->cancellable);
796
_data_->cancellable = _tmp6_;
797
unity_music_lens_music_baidu_scope_proxy_real_perform_search_co (_data_);
801
static void unity_music_lens_music_baidu_scope_proxy_real_perform_search_finish (UnityMusicLensSimpleScope* base, GAsyncResult* _res_) {
802
UnityMusicLensMusicBaiduScopeProxyPerformSearchData* _data_;
803
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
807
static void unity_music_lens_music_baidu_scope_proxy_perform_search_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
808
UnityMusicLensMusicBaiduScopeProxyPerformSearchData* _data_;
809
_data_ = _user_data_;
810
_data_->_source_object_ = source_object;
811
_data_->_res_ = _res_;
812
unity_music_lens_music_baidu_scope_proxy_real_perform_search_co (_data_);
816
static gboolean unity_music_lens_music_baidu_scope_proxy_real_perform_search_co (UnityMusicLensMusicBaiduScopeProxyPerformSearchData* _data_) {
817
switch (_data_->_state_) {
823
g_assert_not_reached ();
826
_data_->_tmp0_ = _data_->search;
827
_data_->_tmp1_ = FALSE;
828
_data_->_tmp1_ = unity_music_lens_simple_scope_is_search_empty ((UnityMusicLensSimpleScope*) _data_->self, _data_->_tmp0_);
829
if (_data_->_tmp1_) {
830
__g_list_free__g_object_unref0_0 (_data_->filters);
831
if (_data_->_state_ == 0) {
832
g_simple_async_result_complete_in_idle (_data_->_async_result);
834
g_simple_async_result_complete (_data_->_async_result);
836
g_object_unref (_data_->_async_result);
840
_data_->_tmp2_ = _data_->search;
841
_data_->_tmp3_ = unity_lens_search_get_results_model (_data_->_tmp2_);
842
_data_->_tmp4_ = _data_->_tmp3_;
844
_data_->_tmp5_ = dee_model_get_n_rows ((DeeModel*) _data_->_tmp4_);
845
g_debug ("musicbaidu-daemon.vala:177: model has %u rows before search", _data_->_tmp5_);
846
_data_->_tmp6_ = _data_->self->priv->collection;
847
_data_->_tmp7_ = _data_->search;
848
_data_->_tmp8_ = _data_->search_type;
849
_data_->_tmp9_ = _data_->filters;
850
_data_->filters = NULL;
851
_data_->_tmp10_ = _data_->max_results;
852
_data_->_tmp11_ = _data_->cancellable;
854
unity_music_lens_music_baidu_collection_search (_data_->_tmp6_, _data_->_tmp7_, _data_->_tmp8_, _data_->_tmp9_, _data_->_tmp10_, _data_->_tmp11_, unity_music_lens_music_baidu_scope_proxy_perform_search_ready, _data_);
857
unity_music_lens_music_baidu_collection_search_finish (_data_->_tmp6_, _data_->_res_, &_data_->_inner_error_);
858
if (_data_->_inner_error_ != NULL) {
859
if (_data_->_inner_error_->domain == G_IO_ERROR) {
860
goto __catch6_g_io_error;
862
__g_list_free__g_object_unref0_0 (_data_->filters);
863
g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
864
g_clear_error (&_data_->_inner_error_);
867
_data_->_tmp12_ = _data_->search;
868
_data_->_tmp13_ = unity_lens_search_get_results_model (_data_->_tmp12_);
869
_data_->_tmp14_ = _data_->_tmp13_;
870
_data_->_tmp15_ = 0U;
871
_data_->_tmp15_ = dee_model_get_n_rows ((DeeModel*) _data_->_tmp14_);
872
g_debug ("musicbaidu-daemon.vala:183: model has %u rows after search", _data_->_tmp15_);
877
_data_->e = _data_->_inner_error_;
878
_data_->_inner_error_ = NULL;
879
_data_->_tmp16_ = _data_->search;
880
_data_->_tmp17_ = unity_lens_search_get_search_string (_data_->_tmp16_);
881
_data_->_tmp18_ = _data_->_tmp17_;
882
_data_->_tmp19_ = _data_->e;
883
_data_->_tmp20_ = _data_->_tmp19_->message;
884
g_warning ("musicbaidu-daemon.vala:187: Failed to search for '%s': %s", _data_->_tmp18_, _data_->_tmp20_);
885
_g_error_free0 (_data_->e);
888
if (_data_->_inner_error_ != NULL) {
889
__g_list_free__g_object_unref0_0 (_data_->filters);
890
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
891
g_clear_error (&_data_->_inner_error_);
894
__g_list_free__g_object_unref0_0 (_data_->filters);
895
if (_data_->_state_ == 0) {
896
g_simple_async_result_complete_in_idle (_data_->_async_result);
898
g_simple_async_result_complete (_data_->_async_result);
900
g_object_unref (_data_->_async_result);
905
static gint unity_music_lens_music_baidu_scope_proxy_real_get_num_results_without_search (UnityMusicLensSimpleScope* base) {
907
UnityMusicLensMusicBaiduScopeProxy* self;
908
self = (UnityMusicLensMusicBaiduScopeProxy*) base;
914
static gint unity_music_lens_music_baidu_scope_proxy_real_get_num_results_global_search (UnityMusicLensSimpleScope* base) {
916
UnityMusicLensMusicBaiduScopeProxy* self;
917
self = (UnityMusicLensMusicBaiduScopeProxy*) base;
923
static gint unity_music_lens_music_baidu_scope_proxy_real_get_num_results_lens_search (UnityMusicLensSimpleScope* base) {
925
UnityMusicLensMusicBaiduScopeProxy* self;
926
self = (UnityMusicLensMusicBaiduScopeProxy*) base;
932
static void unity_music_lens_music_baidu_scope_proxy_class_init (UnityMusicLensMusicBaiduScopeProxyClass * klass) {
933
unity_music_lens_music_baidu_scope_proxy_parent_class = g_type_class_peek_parent (klass);
934
g_type_class_add_private (klass, sizeof (UnityMusicLensMusicBaiduScopeProxyPrivate));
935
UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search = unity_music_lens_music_baidu_scope_proxy_real_perform_search;
936
UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->perform_search_finish = unity_music_lens_music_baidu_scope_proxy_real_perform_search_finish;
937
UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_without_search = unity_music_lens_music_baidu_scope_proxy_real_get_num_results_without_search;
938
UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_global_search = unity_music_lens_music_baidu_scope_proxy_real_get_num_results_global_search;
939
UNITY_MUSIC_LENS_SIMPLE_SCOPE_CLASS (klass)->get_num_results_lens_search = unity_music_lens_music_baidu_scope_proxy_real_get_num_results_lens_search;
940
G_OBJECT_CLASS (klass)->get_property = _vala_unity_music_lens_music_baidu_scope_proxy_get_property;
941
G_OBJECT_CLASS (klass)->finalize = unity_music_lens_music_baidu_scope_proxy_finalize;
942
g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_WITHOUT_SEARCH, g_param_spec_int ("num-results-without-search", "num-results-without-search", "num-results-without-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
943
g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_GLOBAL_SEARCH, g_param_spec_int ("num-results-global-search", "num-results-global-search", "num-results-global-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
944
g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_LENS_SEARCH, g_param_spec_int ("num-results-lens-search", "num-results-lens-search", "num-results-lens-search", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
948
static void unity_music_lens_music_baidu_scope_proxy_instance_init (UnityMusicLensMusicBaiduScopeProxy * self) {
949
self->priv = UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_GET_PRIVATE (self);
953
static void unity_music_lens_music_baidu_scope_proxy_finalize (GObject* obj) {
954
UnityMusicLensMusicBaiduScopeProxy * self;
955
self = G_TYPE_CHECK_INSTANCE_CAST (obj, UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY, UnityMusicLensMusicBaiduScopeProxy);
956
_g_object_unref0 (self->priv->collection);
957
_g_object_unref0 (self->priv->music_preview);
958
G_OBJECT_CLASS (unity_music_lens_music_baidu_scope_proxy_parent_class)->finalize (obj);
962
GType unity_music_lens_music_baidu_scope_proxy_get_type (void) {
963
static volatile gsize unity_music_lens_music_baidu_scope_proxy_type_id__volatile = 0;
964
if (g_once_init_enter (&unity_music_lens_music_baidu_scope_proxy_type_id__volatile)) {
965
static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensMusicBaiduScopeProxyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_music_baidu_scope_proxy_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensMusicBaiduScopeProxy), 0, (GInstanceInitFunc) unity_music_lens_music_baidu_scope_proxy_instance_init, NULL };
966
GType unity_music_lens_music_baidu_scope_proxy_type_id;
967
unity_music_lens_music_baidu_scope_proxy_type_id = g_type_register_static (UNITY_MUSIC_LENS_TYPE_SIMPLE_SCOPE, "UnityMusicLensMusicBaiduScopeProxy", &g_define_type_info, 0);
968
g_once_init_leave (&unity_music_lens_music_baidu_scope_proxy_type_id__volatile, unity_music_lens_music_baidu_scope_proxy_type_id);
970
return unity_music_lens_music_baidu_scope_proxy_type_id__volatile;
974
static void _vala_unity_music_lens_music_baidu_scope_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
975
UnityMusicLensMusicBaiduScopeProxy * self;
976
self = G_TYPE_CHECK_INSTANCE_CAST (object, UNITY_MUSIC_LENS_TYPE_MUSIC_BAIDU_SCOPE_PROXY, UnityMusicLensMusicBaiduScopeProxy);
977
switch (property_id) {
978
case UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_WITHOUT_SEARCH:
979
g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_without_search ((UnityMusicLensSimpleScope*) self));
981
case UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_GLOBAL_SEARCH:
982
g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_global_search ((UnityMusicLensSimpleScope*) self));
984
case UNITY_MUSIC_LENS_MUSIC_BAIDU_SCOPE_PROXY_NUM_RESULTS_LENS_SEARCH:
985
g_value_set_int (value, unity_music_lens_simple_scope_get_num_results_lens_search ((UnityMusicLensSimpleScope*) self));
988
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
994
gboolean unity_music_lens_dbus_name_has_owner (const gchar* name) {
995
gboolean result = FALSE;
996
GError * _inner_error_ = NULL;
997
g_return_val_if_fail (name != NULL, FALSE);
999
gboolean has_owner = FALSE;
1000
GDBusConnection* _tmp0_ = NULL;
1001
GDBusConnection* bus;
1002
GDBusConnection* _tmp1_;
1003
const gchar* _tmp2_;
1006
GVariantType* _tmp5_;
1007
GVariantType* _tmp6_;
1008
GVariant* _tmp7_ = NULL;
1012
_tmp0_ = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &_inner_error_);
1014
if (_inner_error_ != NULL) {
1015
goto __catch7_g_error;
1019
_tmp3_ = g_variant_new ("(s)", _tmp2_, NULL);
1020
g_variant_ref_sink (_tmp3_);
1022
_tmp5_ = g_variant_type_new ("(b)");
1024
_tmp7_ = g_dbus_connection_call_sync (_tmp1_, "org.freedesktop.DBus", "/org/freedesktop/dbus", "org.freedesktop.DBus", "NameHasOwner", _tmp4_, _tmp6_, G_DBUS_CALL_FLAGS_NO_AUTO_START, -1, NULL, &_inner_error_);
1026
_g_variant_type_free0 (_tmp6_);
1027
_g_variant_unref0 (_tmp4_);
1029
if (_inner_error_ != NULL) {
1030
_g_object_unref0 (bus);
1031
goto __catch7_g_error;
1034
g_variant_get (_tmp9_, "(b)", &has_owner, NULL);
1036
_g_variant_unref0 (_result_);
1037
_g_object_unref0 (bus);
1044
const gchar* _tmp10_;
1046
const gchar* _tmp12_;
1048
_inner_error_ = NULL;
1051
_tmp12_ = _tmp11_->message;
1052
g_warning ("musicbaidu-daemon.vala:214: Unable to decide whether '%s' is running: " \
1053
"%s", _tmp10_, _tmp12_);
1057
if (_inner_error_ != NULL) {
1058
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1059
g_clear_error (&_inner_error_);
1067
gint unity_music_lens_main (gchar** args, int args_length1) {
1069
gboolean _tmp0_ = FALSE;
1070
UnityMusicLensMusicBaiduScopeProxy* _tmp1_;
1071
GApplication* _tmp2_;
1072
GApplication* _tmp6_;
1073
gboolean _tmp7_ = FALSE;
1074
GApplication* _tmp8_;
1075
GApplication* _tmp9_;
1077
GError * _inner_error_ = NULL;
1078
g_set_prgname ("unity-musicbaidu-daemon");
1079
textdomain (CONFIG_PACKAGE);
1080
bindtextdomain (CONFIG_PACKAGE, CONFIG_LOCALEDIR);
1081
bind_textdomain_codeset (CONFIG_PACKAGE, "UTF-8");
1082
setlocale (LC_ALL, "");
1083
_tmp0_ = unity_music_lens_dbus_name_has_owner ("com.canonical.Unity.Scope.MusicBaidu");
1085
g_print ("%s", "Another instance of the UbuntuOne Music Daemon " "already appears to be running.\nBailing out.\n");
1089
_tmp1_ = unity_music_lens_music_baidu_scope_proxy_new ();
1090
_g_object_unref0 (unity_music_lens_daemon);
1091
unity_music_lens_daemon = _tmp1_;
1092
_tmp2_ = g_application_new ("com.canonical.Unity.Scope.MusicBaidu", G_APPLICATION_IS_SERVICE);
1093
_g_object_unref0 (unity_music_lens_app);
1094
unity_music_lens_app = _tmp2_;
1096
GApplication* _tmp3_;
1097
_tmp3_ = unity_music_lens_app;
1098
g_application_register (_tmp3_, NULL, &_inner_error_);
1099
if (_inner_error_ != NULL) {
1100
goto __catch8_g_error;
1108
const gchar* _tmp5_;
1110
_inner_error_ = NULL;
1112
_tmp5_ = _tmp4_->message;
1113
g_print ("Failed to start music daemon: %s\n", _tmp5_);
1119
if (_inner_error_ != NULL) {
1120
g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
1121
g_clear_error (&_inner_error_);
1124
_tmp6_ = unity_music_lens_app;
1125
_tmp7_ = g_application_get_is_remote (_tmp6_);
1127
g_print ("%s", "Another instance of the Unity Music Daemon " "already appears to be running.\nBailing out.\n");
1131
_tmp8_ = unity_music_lens_app;
1132
g_application_hold (_tmp8_);
1133
_tmp9_ = unity_music_lens_app;
1134
_tmp10_ = g_application_run (_tmp9_, 0, NULL);
1140
int main (int argc, char ** argv) {
1142
return unity_music_lens_main (argv, argc);