1
/* remote-scope.c generated by valac 0.20.1, the Vala compiler
2
* generated from remote-scope.vala, do not modify */
5
* Copyright (C) 2013 National University of Defense Technology(NUDT) & 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 shijing <jingshi@ubuntukylin.com>
21
* Modified Information:
22
* 1. Modify build_preview function , get the description information of video from youku.
23
* 2. Modify preview_result function, get the uri of single video from youku.
27
* Copyright (C) 2012 Canonical Ltd
29
* This program is free software: you can redistribute it and/or modify
30
* it under the terms of the GNU General Public License version 3 as
31
* published by the Free Software Foundation.
33
* This program is distributed in the hope that it will be useful,
34
* but WITHOUT ANY WARRANTY; without even the implied warranty of
35
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36
* GNU General Public License for more details.
38
* You should have received a copy of the GNU General Public License
39
* along with this program. If not, see <http://www.gnu.org/licenses/>.
41
* Authored by Pawel Stolowski <pawel.stolowski@canonical.com>
42
* based on python code by David Calle <davidc@framli.eu>
47
#include <glib-object.h>
49
#include <libsoup/soup.h>
53
#include <zeitgeist.h>
55
#include <libsoup/soup-gnome.h>
56
#include <glib/gi18n-lib.h>
62
#define UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE (unity_video_lens_remote_video_scope_get_type ())
63
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE, UnityVideoLensRemoteVideoScope))
64
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE, UnityVideoLensRemoteVideoScopeClass))
65
#define UNITY_VIDEO_LENS_IS_REMOTE_VIDEO_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE))
66
#define UNITY_VIDEO_LENS_IS_REMOTE_VIDEO_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE))
67
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE, UnityVideoLensRemoteVideoScopeClass))
69
typedef struct _UnityVideoLensRemoteVideoScope UnityVideoLensRemoteVideoScope;
70
typedef struct _UnityVideoLensRemoteVideoScopeClass UnityVideoLensRemoteVideoScopeClass;
71
typedef struct _UnityVideoLensRemoteVideoScopePrivate UnityVideoLensRemoteVideoScopePrivate;
73
#define UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_FILE (unity_video_lens_remote_video_file_get_type ())
74
typedef struct _UnityVideoLensRemoteVideoFile UnityVideoLensRemoteVideoFile;
75
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
76
#define _g_free0(var) (var = (g_free (var), NULL))
77
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
78
#define __g_slist_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_slist_free__g_free0_ (var), NULL)))
79
#define _g_variant_unref0(var) ((var == NULL) ? NULL : (var = (g_variant_unref (var), NULL)))
80
typedef struct _UnityVideoLensRemoteVideoScopeActivateResultData UnityVideoLensRemoteVideoScopeActivateResultData;
82
#define UNITY_VIDEO_LENS_TYPE_REMOTE_URI (unity_video_lens_remote_uri_get_type ())
83
#define UNITY_VIDEO_LENS_REMOTE_URI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_URI, UnityVideoLensRemoteUri))
84
#define UNITY_VIDEO_LENS_REMOTE_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_VIDEO_LENS_TYPE_REMOTE_URI, UnityVideoLensRemoteUriClass))
85
#define UNITY_VIDEO_LENS_IS_REMOTE_URI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_URI))
86
#define UNITY_VIDEO_LENS_IS_REMOTE_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_VIDEO_LENS_TYPE_REMOTE_URI))
87
#define UNITY_VIDEO_LENS_REMOTE_URI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_URI, UnityVideoLensRemoteUriClass))
89
typedef struct _UnityVideoLensRemoteUri UnityVideoLensRemoteUri;
90
typedef struct _UnityVideoLensRemoteUriClass UnityVideoLensRemoteUriClass;
91
#define _unity_video_lens_remote_uri_unref0(var) ((var == NULL) ? NULL : (var = (unity_video_lens_remote_uri_unref (var), NULL)))
93
#define UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_DETAILS (unity_video_lens_remote_video_details_get_type ())
94
typedef struct _UnityVideoLensRemoteVideoDetails UnityVideoLensRemoteVideoDetails;
95
#define _unity_video_lens_remote_video_details_free0(var) ((var == NULL) ? NULL : (var = (unity_video_lens_remote_video_details_free (var), NULL)))
96
typedef struct _UnityVideoLensRemoteVideoScopePreviewResultData UnityVideoLensRemoteVideoScopePreviewResultData;
97
typedef struct _Block1Data Block1Data;
98
typedef struct _UnityVideoLensRemoteVideoScopeGetDetailsData UnityVideoLensRemoteVideoScopeGetDetailsData;
99
typedef struct _UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData;
100
typedef struct _Block2Data Block2Data;
101
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
102
typedef struct _UnityVideoLensRemoteVideoScopePerformSearchData UnityVideoLensRemoteVideoScopePerformSearchData;
103
#define _unity_video_lens_remote_video_file_free0(var) ((var == NULL) ? NULL : (var = (unity_video_lens_remote_video_file_free (var), NULL)))
104
#define _g_ptr_array_unref0(var) ((var == NULL) ? NULL : (var = (g_ptr_array_unref (var), NULL)))
106
struct _UnityVideoLensRemoteVideoScope {
107
UnityDeprecatedScope parent_instance;
108
UnityVideoLensRemoteVideoScopePrivate * priv;
111
struct _UnityVideoLensRemoteVideoScopeClass {
112
UnityDeprecatedScopeClass parent_class;
115
struct _UnityVideoLensRemoteVideoFile {
125
struct _UnityVideoLensRemoteVideoScopePrivate {
126
SoupSession* session;
127
UnityPreferencesManager* preferences;
128
GeeArrayList* recommendations;
129
gint64 recommendations_last_update;
130
ZeitgeistDataSourceRegistry* zg_sources;
131
gboolean use_zeitgeist;
134
struct _UnityVideoLensRemoteVideoScopeActivateResultData {
136
GObject* _source_object_;
138
GSimpleAsyncResult* _async_result;
139
UnityVideoLensRemoteVideoScope* self;
140
UnityScopeResult _result_;
141
UnityActivationResponse* result;
142
UnityScopeResult _tmp0_;
145
gconstpointer _tmp3_;
153
UnityScopeResult _tmp10_;
154
UnityPreview* _tmp11_;
155
UnityPreview* preview;
156
UnityPreview* _tmp12_;
157
UnityActivationResponse* _tmp13_;
158
UnityScopeResult _tmp14_;
159
const gchar* _tmp15_;
160
UnityActivationResponse* _tmp16_;
163
struct _UnityVideoLensRemoteVideoDetails {
172
gint directors_length1;
177
gchar* date_uploaded;
181
struct _UnityVideoLensRemoteVideoScopePreviewResultData {
183
GObject* _source_object_;
185
GSimpleAsyncResult* _async_result;
186
UnityVideoLensRemoteVideoScope* self;
187
UnityScopeResult _result_;
188
UnityPreview* result;
189
UnityScopeResult _tmp0_;
191
UnityVideoLensRemoteUri* _tmp2_;
192
UnityVideoLensRemoteUri* fakeuri;
193
UnityVideoLensRemoteUri* _tmp3_;
194
UnityVideoLensRemoteVideoDetails* details;
196
UnityVideoLensRemoteUri* _tmp5_;
199
UnityVideoLensRemoteUri* _tmp8_;
201
const gchar* _tmp10_;
203
UnityVideoLensRemoteUri* _tmp12_;
204
const gchar* _tmp13_;
205
const gchar* _tmp14_;
206
UnityVideoLensRemoteVideoDetails* _tmp15_;
207
UnityVideoLensRemoteVideoDetails* _tmp16_;
210
const gchar* _tmp18_;
211
UnityVideoLensRemoteUri* _tmp19_;
212
UnityVideoLensRemoteVideoDetails* _tmp20_;
213
UnityPreview* _tmp21_;
214
UnityScopeResult _tmp22_;
215
const gchar* _tmp23_;
216
GError * _inner_error_;
221
UnityVideoLensRemoteVideoScope * self;
223
gpointer _async_data_;
226
struct _UnityVideoLensRemoteVideoScopeGetDetailsData {
228
GObject* _source_object_;
230
GSimpleAsyncResult* _async_result;
231
UnityVideoLensRemoteVideoScope* self;
233
UnityVideoLensRemoteVideoDetails* result;
246
SoupMessage* _tmp11_;
250
SoupMessage* _tmp15_;
251
SoupMessageBody* _tmp16_;
253
gint _tmp17__length1;
254
UnityVideoLensRemoteVideoDetails _tmp18_;
255
UnityVideoLensRemoteVideoDetails details;
256
UnityVideoLensRemoteVideoDetails _tmp19_;
257
UnityVideoLensRemoteVideoDetails* _tmp20_;
258
UnityVideoLensRemoteVideoDetails* _tmp21_;
259
GError * _inner_error_;
262
struct _UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData {
264
GObject* _source_object_;
266
GSimpleAsyncResult* _async_result;
267
UnityVideoLensRemoteVideoScope* self;
268
UnityDeprecatedScopeSearch* search;
269
UnitySearchType search_type;
270
GCancellable* cancellable;
271
GCancellable* _tmp0_;
273
UnityDeprecatedScopeSearch* _tmp2_;
277
gchar* search_string;
279
UnityDeprecatedScopeSearch* _tmp7_;
280
DeeSerializableModel* _tmp8_;
281
DeeSerializableModel* _tmp9_;
282
DeeSerializableModel* _tmp10_;
283
DeeSerializableModel* model;
284
DeeSerializableModel* _tmp11_;
285
UnityPreferencesManager* _tmp12_;
286
UnityPreferencesManagerRemoteContent _tmp13_;
287
UnityPreferencesManagerRemoteContent _tmp14_;
288
UnityDeprecatedScopeSearch* _tmp15_;
289
GeeArrayList* _tmp16_;
290
GeeArrayList* active_sources;
291
UnityOptionsFilter* _tmp17_;
292
UnityOptionsFilter* _tmp18_;
294
GList* opt_collection;
296
UnityFilterOption* _tmp20_;
297
UnityFilterOption* opt;
298
UnityFilterOption* _tmp21_;
299
const gchar* _tmp22_;
300
const gchar* _tmp23_;
302
GeeArrayList* _tmp25_;
303
UnityFilterOption* _tmp26_;
304
const gchar* _tmp27_;
305
const gchar* _tmp28_;
306
GeeArrayList* _tmp29_;
309
UnityOptionsFilter* _tmp32_;
310
UnityOptionsFilter* _tmp33_;
313
GeeArrayList* _tmp36_;
314
UnitySearchType _tmp37_;
315
GeeArrayList* _tmp38_;
317
const gchar* _tmp40_;
318
UnityDeprecatedScopeSearch* _tmp41_;
319
GeeArrayList* _tmp42_;
320
GCancellable* _tmp43_;
323
const gchar* _tmp45_;
324
UnityDeprecatedScopeSearch* _tmp46_;
327
const gchar* _tmp48_;
328
GError * _inner_error_;
333
UnityVideoLensRemoteVideoScope * self;
336
gpointer _async_data_;
339
struct _UnityVideoLensRemoteVideoScopePerformSearchData {
341
GObject* _source_object_;
343
GSimpleAsyncResult* _async_result;
344
UnityVideoLensRemoteVideoScope* self;
345
gchar* search_string;
346
UnityDeprecatedScopeSearch* search;
347
GeeArrayList* active_sources;
348
GCancellable* cancellable;
350
UnityDeprecatedScopeSearch* _tmp0_;
351
DeeSerializableModel* _tmp1_;
352
DeeSerializableModel* _tmp2_;
359
GeeArrayList* _tmp9_;
363
GeeArrayList* _tmp13_;
373
UnityDeprecatedScopeSearch* _tmp22_;
374
DeeSerializableModel* _tmp23_;
375
DeeSerializableModel* _tmp24_;
376
GeeArrayList* _tmp25_;
377
const gchar* _tmp26_;
378
GeeArrayList* _tmp27_;
381
const gchar* _tmp29_;
384
const gchar* _tmp32_;
385
const gchar* _tmp33_;
387
GeeArrayList* _tmp35_;
391
gboolean is_treat_yourself;
392
const gchar* _tmp39_;
393
SoupMessage* _tmp40_;
394
SoupSession* _tmp41_;
395
SoupMessage* _tmp42_;
396
SoupMessage* _tmp43_;
398
GCancellable* _tmp44_;
399
GCancellable* _tmp45_;
402
GCancellable* _tmp48_;
405
GCancellable* _tmp51_;
406
GCancellable* _tmp52_;
408
SoupMessage* _tmp54_;
410
GeeArrayList* _tmp56_;
411
GeeArrayList* results;
412
GeeArrayList* _tmp57_;
414
const gchar* _tmp59_;
416
const gchar* _tmp61_;
420
GeeArrayList* _tmp65_;
426
GDateTime* _vala1_time;
427
GeeArrayList* _tmp71_;
428
GeeArrayList* _tmp72_;
431
UnityDeprecatedScopeSearch* _tmp75_;
432
DeeSerializableModel* _tmp76_;
433
DeeSerializableModel* _tmp77_;
434
GeeArrayList* _tmp78_;
435
GError * _inner_error_;
439
static gpointer unity_video_lens_remote_video_scope_parent_class = NULL;
440
static gint unity_video_lens_remote_video_scope_REFRESH_INTERVAL;
441
static gint unity_video_lens_remote_video_scope_REFRESH_INTERVAL = 3600;
442
static gint unity_video_lens_remote_video_scope_RETRY_INTERVAL;
443
static gint unity_video_lens_remote_video_scope_RETRY_INTERVAL = 60;
444
static gchar* unity_video_lens_remote_video_scope_IS_IN_CHINA;
445
static gchar* unity_video_lens_remote_video_scope_IS_IN_CHINA = NULL;
446
static gchar* unity_video_lens_remote_video_scope_PREVIEW_ON_LMB;
447
static gchar* unity_video_lens_remote_video_scope_PREVIEW_ON_LMB = NULL;
448
extern gint unity_video_lens_CAT_INDEX_MORE;
450
GType unity_video_lens_remote_video_scope_get_type (void) G_GNUC_CONST;
451
GType unity_video_lens_remote_video_file_get_type (void) G_GNUC_CONST;
452
UnityVideoLensRemoteVideoFile* unity_video_lens_remote_video_file_dup (const UnityVideoLensRemoteVideoFile* self);
453
void unity_video_lens_remote_video_file_free (UnityVideoLensRemoteVideoFile* self);
454
void unity_video_lens_remote_video_file_copy (const UnityVideoLensRemoteVideoFile* self, UnityVideoLensRemoteVideoFile* dest);
455
void unity_video_lens_remote_video_file_destroy (UnityVideoLensRemoteVideoFile* self);
456
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE, UnityVideoLensRemoteVideoScopePrivate))
458
UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_DUMMY_PROPERTY
460
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_ASK_IP_SERVER_URI_ONE "http://ip.chinaz.com/"
461
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_ASK_IP_SERVER_URI_TWO "http://www.123myip.co.uk/"
462
static gboolean unity_video_lens_remote_video_scope_is_in_China (UnityVideoLensRemoteVideoScope* self, GCancellable* cancellable);
463
UnityVideoLensRemoteVideoScope* unity_video_lens_remote_video_scope_new (void);
464
UnityVideoLensRemoteVideoScope* unity_video_lens_remote_video_scope_construct (GType object_type);
465
static void unity_video_lens_remote_video_scope_real_constructed (GObject* base);
466
static void unity_video_lens_remote_video_scope_zeitgeist_init (UnityVideoLensRemoteVideoScope* self, GError** error);
467
#define CONFIG_VERSION "1.0"
468
static void __lambda3_ (UnityVideoLensRemoteVideoScope* self, UnityDeprecatedScopeSearch* search, UnitySearchType search_type, GCancellable* cancellable);
469
static void unity_video_lens_remote_video_scope_update_search_async (UnityVideoLensRemoteVideoScope* self, UnityDeprecatedScopeSearch* search, UnitySearchType search_type, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
470
static void unity_video_lens_remote_video_scope_update_search_finish (UnityVideoLensRemoteVideoScope* self, GAsyncResult* _res_);
471
static void ___lambda3__unity_deprecated_scope_search_changed (UnityDeprecatedScope* _sender, UnityDeprecatedScopeSearch* search, UnitySearchType search_type, GCancellable* cancellable, gpointer self);
472
static gchar* __lambda6_ (UnityVideoLensRemoteVideoScope* self, UnityDeprecatedScope* scope, UnityDeprecatedScopeSearch* search);
473
static gchar* ___lambda6__unity_deprecated_scope_generate_search_key (UnityDeprecatedScope* _sender, UnityDeprecatedScopeSearch* search, gpointer self);
474
static void __lambda7_ (UnityVideoLensRemoteVideoScope* self, GObject* obj, GParamSpec* pspec);
475
static void ___lambda7__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
476
static void unity_video_lens_remote_video_scope_populate_categories (UnityVideoLensRemoteVideoScope* self);
477
static void unity_video_lens_remote_video_scope_query_list_of_sources (UnityVideoLensRemoteVideoScope* self);
478
static gboolean __lambda10_ (UnityVideoLensRemoteVideoScope* self);
479
static gboolean ___lambda10__gsource_func (gpointer self);
480
#define CONFIG_ICON_PATH "/usr/share/icons/unity-icon-theme/places/svg"
481
gchar* unity_video_lens_ubuntu_video_search_sources_uri (void);
482
static void unity_video_lens_remote_video_scope_sources_cb (UnityVideoLensRemoteVideoScope* self, SoupSession* session, SoupMessage* msg);
483
static void _unity_video_lens_remote_video_scope_sources_cb_soup_session_callback (SoupSession* session, SoupMessage* msg, gpointer self);
484
static GeeArrayList* unity_video_lens_remote_video_scope_handle_search_response (UnityVideoLensRemoteVideoScope* self, SoupMessage* msg, gboolean is_treat_yourself);
485
GeeArrayList* unity_video_lens_ubuntu_video_search_process_search_results (const gchar* json_data, gboolean is_treat_yourself, GError** error);
486
GeeArrayList* unity_video_lens_ubuntu_video_search_process_sources_results (const gchar* json_data, GError** error);
487
static void _g_free0_ (gpointer var);
488
static void _g_slist_free__g_free0_ (GSList* self);
489
static gboolean __lambda9_ (UnityVideoLensRemoteVideoScope* self);
490
static gboolean ___lambda9__gsource_func (gpointer self);
491
static void unity_video_lens_remote_video_scope_real_activate_result_data_free (gpointer _data);
492
static void unity_video_lens_remote_video_scope_real_activate_result (UnityDeprecatedScope* base, UnityScopeResult* _result_, GAsyncReadyCallback _callback_, gpointer _user_data_);
493
static gboolean unity_video_lens_remote_video_scope_real_activate_result_co (UnityVideoLensRemoteVideoScopeActivateResultData* _data_);
494
static void unity_video_lens_remote_video_scope_activate_result_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
495
static UnityActivationResponse* unity_video_lens_remote_video_scope_on_activate_uri (UnityVideoLensRemoteVideoScope* self, const gchar* rawuri);
496
gpointer unity_video_lens_remote_uri_ref (gpointer instance);
497
void unity_video_lens_remote_uri_unref (gpointer instance);
498
GParamSpec* unity_video_lens_param_spec_remote_uri (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
499
void unity_video_lens_value_set_remote_uri (GValue* value, gpointer v_object);
500
void unity_video_lens_value_take_remote_uri (GValue* value, gpointer v_object);
501
gpointer unity_video_lens_value_get_remote_uri (const GValue* value);
502
GType unity_video_lens_remote_uri_get_type (void) G_GNUC_CONST;
503
UnityVideoLensRemoteUri* unity_video_lens_remote_uri_from_rawuri (const gchar* raw_uri);
504
static void unity_video_lens_remote_video_scope_zeitgeist_insert_event (UnityVideoLensRemoteVideoScope* self, const gchar* uri, const gchar* title, const gchar* icon);
505
const gchar* unity_video_lens_remote_uri_get_uri (UnityVideoLensRemoteUri* self);
506
const gchar* unity_video_lens_remote_uri_get_title (UnityVideoLensRemoteUri* self);
507
const gchar* unity_video_lens_remote_uri_get_icon (UnityVideoLensRemoteUri* self);
508
static UnityActivationResponse* unity_video_lens_remote_video_scope_on_play_video (UnityVideoLensRemoteVideoScope* self, const gchar* rawuri);
509
GType unity_video_lens_remote_video_details_get_type (void) G_GNUC_CONST;
510
UnityVideoLensRemoteVideoDetails* unity_video_lens_remote_video_details_dup (const UnityVideoLensRemoteVideoDetails* self);
511
void unity_video_lens_remote_video_details_free (UnityVideoLensRemoteVideoDetails* self);
512
void unity_video_lens_remote_video_details_copy (const UnityVideoLensRemoteVideoDetails* self, UnityVideoLensRemoteVideoDetails* dest);
513
void unity_video_lens_remote_video_details_destroy (UnityVideoLensRemoteVideoDetails* self);
514
static UnityPreview* unity_video_lens_remote_video_scope_build_preview (UnityVideoLensRemoteVideoScope* self, UnityVideoLensRemoteUri* uri, UnityVideoLensRemoteVideoDetails* details);
515
static UnityActivationResponse* _unity_video_lens_remote_video_scope_on_play_video_unity_preview_action_activated (UnityPreviewAction* _sender, const gchar* uri, gpointer self);
516
static void unity_video_lens_remote_video_scope_real_preview_result_data_free (gpointer _data);
517
static void unity_video_lens_remote_video_scope_real_preview_result (UnityDeprecatedScope* base, UnityScopeResult* _result_, GAsyncReadyCallback _callback_, gpointer _user_data_);
518
static gboolean unity_video_lens_remote_video_scope_real_preview_result_co (UnityVideoLensRemoteVideoScopePreviewResultData* _data_);
519
const gchar* unity_video_lens_remote_uri_get_details_uri (UnityVideoLensRemoteUri* self);
520
static void unity_video_lens_remote_video_scope_get_details (UnityVideoLensRemoteVideoScope* self, const gchar* url, GAsyncReadyCallback _callback_, gpointer _user_data_);
521
static UnityVideoLensRemoteVideoDetails* unity_video_lens_remote_video_scope_get_details_finish (UnityVideoLensRemoteVideoScope* self, GAsyncResult* _res_, GError** error);
522
static void unity_video_lens_remote_video_scope_preview_result_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
523
static void unity_video_lens_remote_video_scope_get_details_data_free (gpointer _data);
524
static gboolean unity_video_lens_remote_video_scope_get_details_co (UnityVideoLensRemoteVideoScopeGetDetailsData* _data_);
525
static Block1Data* block1_data_ref (Block1Data* _data1_);
526
static void block1_data_unref (void * _userdata_);
527
static void __lambda11_ (Block1Data* _data1_, SoupSession* session_, SoupMessage* msg_);
528
static void ___lambda11__soup_session_callback (SoupSession* session, SoupMessage* msg, gpointer self);
529
void unity_video_lens_ubuntu_video_search_process_details_results (const gchar* json_data, UnityVideoLensRemoteVideoDetails* result, GError** error);
530
static void unity_video_lens_remote_video_scope_update_search_async_data_free (gpointer _data);
531
static gboolean unity_video_lens_remote_video_scope_update_search_async_co (UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData* _data_);
532
static gboolean unity_video_lens_remote_video_scope_source_activated (UnityVideoLensRemoteVideoScope* self, const gchar* id);
533
static gboolean unity_video_lens_remote_video_scope_at_least_one_source_is_on (UnityVideoLensRemoteVideoScope* self, GeeArrayList* active_sources);
534
static void unity_video_lens_remote_video_scope_perform_search (UnityVideoLensRemoteVideoScope* self, const gchar* search_string, UnityDeprecatedScopeSearch* search, GeeArrayList* active_sources, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
535
static void unity_video_lens_remote_video_scope_perform_search_finish (UnityVideoLensRemoteVideoScope* self, GAsyncResult* _res_, GError** error);
536
static void unity_video_lens_remote_video_scope_update_search_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
537
static void unity_video_lens_remote_video_scope_perform_search_data_free (gpointer _data);
538
static gboolean unity_video_lens_remote_video_scope_perform_search_co (UnityVideoLensRemoteVideoScopePerformSearchData* _data_);
539
static Block2Data* block2_data_ref (Block2Data* _data2_);
540
static void block2_data_unref (void * _userdata_);
541
static void unity_video_lens_remote_video_scope_update_results_model (UnityVideoLensRemoteVideoScope* self, DeeModel* model, GeeArrayList* results);
542
gchar* unity_video_lens_ubuntu_video_search_build_search_uri (const gchar* query, GeeArrayList* sources);
543
static void __lambda4_ (Block2Data* _data2_, SoupSession* session_, SoupMessage* msg_);
544
static void ___lambda4__soup_session_callback (SoupSession* session, SoupMessage* msg, gpointer self);
545
static void ___lambda5_ (Block2Data* _data2_);
546
static void ____lambda5__gfunc (gconstpointer data, gpointer self);
547
static gboolean _unity_video_lens_remote_video_scope_perform_search_co_gsource_func (gpointer self);
548
UnityVideoLensRemoteUri* unity_video_lens_remote_uri_new (const gchar* uri, const gchar* title, const gchar* icon, const gchar* details_uri);
549
UnityVideoLensRemoteUri* unity_video_lens_remote_uri_construct (GType object_type, const gchar* uri, const gchar* title, const gchar* icon, const gchar* details_uri);
550
static GVariant* _variant_new1 (const gchar* value);
551
static GVariant* _variant_new2 (gboolean value);
552
gchar* unity_video_lens_remote_uri_to_rawuri (UnityVideoLensRemoteUri* self);
553
static void unity_video_lens_remote_video_scope_finalize (GObject* obj);
554
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
555
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
558
static gint string_index_of (const gchar* self, const gchar* needle, gint start_index) {
562
gchar* _tmp2_ = NULL;
565
g_return_val_if_fail (self != NULL, 0);
566
g_return_val_if_fail (needle != NULL, 0);
567
_tmp0_ = start_index;
569
_tmp2_ = strstr (((gchar*) self) + _tmp0_, (gchar*) _tmp1_);
572
if (_tmp3_ != NULL) {
575
result = (gint) (_tmp4_ - ((gchar*) self));
584
static gboolean unity_video_lens_remote_video_scope_is_in_China (UnityVideoLensRemoteVideoScope* self, GCancellable* cancellable) {
585
gboolean result = FALSE;
587
GError * _inner_error_ = NULL;
588
g_return_val_if_fail (self != NULL, FALSE);
589
_tmp0_ = unity_video_lens_remote_video_scope_IS_IN_CHINA;
590
if (g_strcmp0 (_tmp0_, "Unknown") == 0) {
591
GFile* _tmp1_ = NULL;
594
gint data_length1 = 0;
595
gint _data_size_ = 0;
596
gchar* content = NULL;
597
gchar* etag_out = NULL;
599
GCancellable* _tmp3_;
600
guint8* _tmp4_ = NULL;
602
gchar* _tmp6_ = NULL;
603
gboolean _tmp7_ = FALSE;
605
_tmp1_ = g_file_new_for_uri (UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_ASK_IP_SERVER_URI_ONE);
608
_tmp3_ = cancellable;
609
_tmp7_ = g_file_load_contents (_tmp2_, _tmp3_, &_tmp4_, &_tmp5_, &_tmp6_, &_inner_error_);
610
data = (g_free (data), NULL);
612
data_length1 = _tmp5_;
613
_data_size_ = data_length1;
617
if (_inner_error_ != NULL) {
620
data = (g_free (data), NULL);
621
_g_object_unref0 (file);
622
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);
623
g_clear_error (&_inner_error_);
630
const gchar* _tmp11_;
632
const gchar* _tmp13_;
634
const gchar* _tmp15_;
636
const gchar* _tmp17_;
638
const gchar* _tmp19_;
640
const gchar* _tmp21_;
642
const gchar* _tmp23_;
644
const gchar* _tmp25_;
646
const gchar* _tmp27_;
648
const gchar* _tmp29_;
650
const gchar* _tmp31_;
652
const gchar* _tmp33_;
654
const gchar* _tmp35_;
656
const gchar* _tmp37_;
658
const gchar* _tmp39_;
660
const gchar* _tmp41_;
662
const gchar* _tmp43_;
664
const gchar* _tmp45_;
666
const gchar* _tmp47_;
668
const gchar* _tmp49_;
670
const gchar* _tmp51_;
672
const gchar* _tmp53_;
674
const gchar* _tmp55_;
676
const gchar* _tmp57_;
678
const gchar* _tmp59_;
680
const gchar* _tmp61_;
682
const gchar* _tmp63_;
684
const gchar* _tmp65_;
686
const gchar* _tmp67_;
688
const gchar* _tmp69_;
690
const gchar* _tmp71_;
692
const gchar* _tmp73_;
697
_tmp9__length1 = data_length1;
698
_tmp10_ = g_strdup ((const gchar*) _tmp9_);
702
_tmp12_ = string_index_of (_tmp11_, "åäŗ¬", 0);
704
_tmp14_ = string_index_of (_tmp13_, "äøęµ·", 0);
706
_tmp16_ = string_index_of (_tmp15_, "å¤©ę“„", 0);
708
_tmp18_ = string_index_of (_tmp17_, "éåŗ", 0);
710
_tmp20_ = string_index_of (_tmp19_, "é»é¾ę±", 0);
712
_tmp22_ = string_index_of (_tmp21_, "åę", 0);
714
_tmp24_ = string_index_of (_tmp23_, "č¾½å®", 0);
716
_tmp26_ = string_index_of (_tmp25_, "ę±č", 0);
718
_tmp28_ = string_index_of (_tmp27_, "å±±äø", 0);
720
_tmp30_ = string_index_of (_tmp29_, "å®å¾½", 0);
722
_tmp32_ = string_index_of (_tmp31_, "ę²³å", 0);
724
_tmp34_ = string_index_of (_tmp33_, "ę²³å", 0);
726
_tmp36_ = string_index_of (_tmp35_, "ę¹å", 0);
728
_tmp38_ = string_index_of (_tmp37_, "ę¹å", 0);
730
_tmp40_ = string_index_of (_tmp39_, "ę±č„æ", 0);
732
_tmp42_ = string_index_of (_tmp41_, "éč„æ", 0);
734
_tmp44_ = string_index_of (_tmp43_, "å±±č„æ", 0);
736
_tmp46_ = string_index_of (_tmp45_, "åå·", 0);
738
_tmp48_ = string_index_of (_tmp47_, "éęµ·", 0);
740
_tmp50_ = string_index_of (_tmp49_, "ęµ·å", 0);
742
_tmp52_ = string_index_of (_tmp51_, "å¹æäø", 0);
744
_tmp54_ = string_index_of (_tmp53_, "蓵å·", 0);
746
_tmp56_ = string_index_of (_tmp55_, "ęµę±", 0);
748
_tmp58_ = string_index_of (_tmp57_, "ē¦å»ŗ", 0);
750
_tmp60_ = string_index_of (_tmp59_, "å°ę¹¾", 0);
752
_tmp62_ = string_index_of (_tmp61_, "ēč", 0);
754
_tmp64_ = string_index_of (_tmp63_, "äŗå", 0);
756
_tmp66_ = string_index_of (_tmp65_, "å
čå¤", 0);
758
_tmp68_ = string_index_of (_tmp67_, "å®å¤", 0);
760
_tmp70_ = string_index_of (_tmp69_, "ę°ē", 0);
762
_tmp72_ = string_index_of (_tmp71_, "č„æč", 0);
764
_tmp74_ = string_index_of (_tmp73_, "å¹æč„æ", 0);
765
location = ((((((((((((((((((((((((((((((_tmp12_ + _tmp14_) + _tmp16_) + _tmp18_) + _tmp20_) + _tmp22_) + _tmp24_) + _tmp26_) + _tmp28_) + _tmp30_) + _tmp32_) + _tmp34_) + _tmp36_) + _tmp38_) + _tmp40_) + _tmp42_) + _tmp44_) + _tmp46_) + _tmp48_) + _tmp50_) + _tmp52_) + _tmp54_) + _tmp56_) + _tmp58_) + _tmp60_) + _tmp62_) + _tmp64_) + _tmp66_) + _tmp68_) + _tmp70_) + _tmp72_) + _tmp74_;
768
GFile* _tmp76_ = NULL;
769
_tmp76_ = g_file_new_for_uri (UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_ASK_IP_SERVER_URI_TWO);
770
_g_object_unref0 (file);
774
GCancellable* _tmp78_;
775
guint8* _tmp79_ = NULL;
777
gchar* _tmp81_ = NULL;
778
gboolean _tmp82_ = FALSE;
781
_tmp78_ = cancellable;
782
_tmp82_ = g_file_load_contents (_tmp77_, _tmp78_, &_tmp79_, &_tmp80_, &_tmp81_, &_inner_error_);
783
data = (g_free (data), NULL);
785
data_length1 = _tmp80_;
786
_data_size_ = data_length1;
790
if (_inner_error_ != NULL) {
791
goto __catch1_g_error;
795
gint _tmp84__length1;
797
const gchar* _tmp86_;
801
_tmp84__length1 = data_length1;
802
_tmp85_ = g_strdup ((const gchar*) _tmp84_);
806
_tmp87_ = string_index_of (_tmp86_, "China", 0);
811
_tmp89_ = g_strdup ("Yes");
812
_g_free0 (unity_video_lens_remote_video_scope_IS_IN_CHINA);
813
unity_video_lens_remote_video_scope_IS_IN_CHINA = _tmp89_;
817
data = (g_free (data), NULL);
818
_g_object_unref0 (file);
828
gchar* _tmp91_ = NULL;
831
const gchar* _tmp94_;
833
_inner_error_ = NULL;
835
_tmp91_ = g_file_get_uri (_tmp90_);
838
_tmp94_ = _tmp93_->message;
839
g_warning ("remote-scope.vala:120: Error reading URL '%s': %s", _tmp92_, _tmp94_);
844
if (_inner_error_ != NULL) {
847
data = (g_free (data), NULL);
848
_g_object_unref0 (file);
849
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);
850
g_clear_error (&_inner_error_);
855
_tmp95_ = g_strdup ("Yes");
856
_g_free0 (unity_video_lens_remote_video_scope_IS_IN_CHINA);
857
unity_video_lens_remote_video_scope_IS_IN_CHINA = _tmp95_;
861
data = (g_free (data), NULL);
862
_g_object_unref0 (file);
868
data = (g_free (data), NULL);
869
_g_object_unref0 (file);
879
UnityVideoLensRemoteVideoScope* unity_video_lens_remote_video_scope_construct (GType object_type) {
880
UnityVideoLensRemoteVideoScope * self = NULL;
881
self = (UnityVideoLensRemoteVideoScope*) g_object_new (object_type, "dbus-path", "/net/launchpad/scope/youkuvideos", "id", "videoyouku.scope", NULL);
886
UnityVideoLensRemoteVideoScope* unity_video_lens_remote_video_scope_new (void) {
887
return unity_video_lens_remote_video_scope_construct (UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE);
891
static void __lambda3_ (UnityVideoLensRemoteVideoScope* self, UnityDeprecatedScopeSearch* search, UnitySearchType search_type, GCancellable* cancellable) {
892
UnityDeprecatedScopeSearch* _tmp0_;
893
UnitySearchType _tmp1_;
894
GCancellable* _tmp2_;
895
g_return_if_fail (search != NULL);
896
g_return_if_fail (cancellable != NULL);
898
_tmp1_ = search_type;
899
_tmp2_ = cancellable;
900
unity_video_lens_remote_video_scope_update_search_async (self, _tmp0_, _tmp1_, _tmp2_, NULL, NULL);
904
static void ___lambda3__unity_deprecated_scope_search_changed (UnityDeprecatedScope* _sender, UnityDeprecatedScopeSearch* search, UnitySearchType search_type, GCancellable* cancellable, gpointer self) {
905
__lambda3_ (self, search, search_type, cancellable);
909
static gchar* string_strip (const gchar* self) {
910
gchar* result = NULL;
911
gchar* _tmp0_ = NULL;
914
g_return_val_if_fail (self != NULL, NULL);
915
_tmp0_ = g_strdup (self);
924
static gchar* __lambda6_ (UnityVideoLensRemoteVideoScope* self, UnityDeprecatedScope* scope, UnityDeprecatedScopeSearch* search) {
925
gchar* result = NULL;
926
UnityDeprecatedScopeSearch* _tmp0_;
929
gchar* _tmp3_ = NULL;
930
g_return_val_if_fail (scope != NULL, NULL);
931
g_return_val_if_fail (search != NULL, NULL);
933
_tmp1_ = unity_deprecated_scope_search_get_search_string (_tmp0_);
935
_tmp3_ = string_strip (_tmp2_);
941
static gchar* ___lambda6__unity_deprecated_scope_generate_search_key (UnityDeprecatedScope* _sender, UnityDeprecatedScopeSearch* search, gpointer self) {
943
result = __lambda6_ (self, _sender, search);
948
static void __lambda7_ (UnityVideoLensRemoteVideoScope* self, GObject* obj, GParamSpec* pspec) {
949
g_return_if_fail (obj != NULL);
950
g_return_if_fail (pspec != NULL);
951
unity_deprecated_scope_queue_search_changed ((UnityDeprecatedScope*) self, UNITY_SEARCH_TYPE_DEFAULT);
955
static void ___lambda7__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
956
__lambda7_ (self, _sender, pspec);
960
static gboolean __lambda10_ (UnityVideoLensRemoteVideoScope* self) {
961
gboolean result = FALSE;
962
unity_deprecated_scope_queue_search_changed ((UnityDeprecatedScope*) self, UNITY_SEARCH_TYPE_DEFAULT);
968
static gboolean ___lambda10__gsource_func (gpointer self) {
970
result = __lambda10_ (self);
975
static void unity_video_lens_remote_video_scope_real_constructed (GObject* base) {
976
UnityVideoLensRemoteVideoScope * self;
980
GeeArrayList* _tmp3_;
981
SoupSessionAsync* _tmp4_;
986
UnityPreferencesManager* _tmp9_;
988
GError * _inner_error_ = NULL;
989
self = (UnityVideoLensRemoteVideoScope*) base;
990
G_OBJECT_CLASS (unity_video_lens_remote_video_scope_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, UNITY_TYPE_DEPRECATED_SCOPE, UnityDeprecatedScope));
991
_tmp0_ = unity_deprecated_scope_base_get_schema ((UnityDeprecatedScopeBase*) self);
993
_tmp2_ = unity_video_lens_remote_video_scope_PREVIEW_ON_LMB;
994
unity_schema_add_field (_tmp1_, _tmp2_, "b", UNITY_SCHEMA_FIELD_TYPE_OPTIONAL);
995
_tmp3_ = gee_array_list_new (UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_FILE, (GBoxedCopyFunc) unity_video_lens_remote_video_file_dup, unity_video_lens_remote_video_file_free, NULL);
996
_g_object_unref0 (self->priv->recommendations);
997
self->priv->recommendations = _tmp3_;
998
self->priv->use_zeitgeist = FALSE;
1000
unity_video_lens_remote_video_scope_zeitgeist_init (self, &_inner_error_);
1001
if (_inner_error_ != NULL) {
1002
goto __catch2_g_error;
1004
self->priv->use_zeitgeist = TRUE;
1011
_inner_error_ = NULL;
1012
g_warning ("remote-scope.vala:163: Failed to initialize Zeitgeist, won't store eve" \
1017
if (_inner_error_ != NULL) {
1018
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);
1019
g_clear_error (&_inner_error_);
1022
_tmp4_ = (SoupSessionAsync*) soup_session_async_new ();
1023
_g_object_unref0 (self->priv->session);
1024
self->priv->session = (SoupSession*) _tmp4_;
1025
_tmp5_ = self->priv->session;
1026
g_object_set (_tmp5_, "ssl-use-system-ca-file", TRUE, NULL);
1027
_tmp6_ = self->priv->session;
1028
g_object_set (_tmp6_, "ssl-strict", TRUE, NULL);
1029
_tmp7_ = self->priv->session;
1030
g_object_set (_tmp7_, "user-agent", "Unity Video Lens Remote Scope v" CONFIG_VERSION, NULL);
1031
_tmp8_ = self->priv->session;
1032
soup_session_add_feature_by_type (_tmp8_, soup_proxy_resolver_gnome_get_type ());
1033
unity_deprecated_scope_base_set_search_in_global ((UnityDeprecatedScopeBase*) self, FALSE);
1034
g_signal_connect_object ((UnityDeprecatedScope*) self, "search-changed", (GCallback) ___lambda3__unity_deprecated_scope_search_changed, self, 0);
1035
g_signal_connect_object ((UnityDeprecatedScope*) self, "generate-search-key", (GCallback) ___lambda6__unity_deprecated_scope_generate_search_key, self, 0);
1036
_tmp9_ = self->priv->preferences;
1037
g_signal_connect_object ((GObject*) _tmp9_, "notify::remote-content-search", (GCallback) ___lambda7__g_object_notify, self, 0);
1038
unity_video_lens_remote_video_scope_populate_categories (self);
1039
unity_video_lens_remote_video_scope_query_list_of_sources (self);
1040
_tmp10_ = unity_video_lens_remote_video_scope_REFRESH_INTERVAL;
1041
g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) (_tmp10_ / 2), ___lambda10__gsource_func, g_object_ref (self), g_object_unref);
1043
unity_deprecated_scope_base_export ((UnityDeprecatedScopeBase*) self, &_inner_error_);
1044
if (_inner_error_ != NULL) {
1045
goto __catch3_g_error;
1052
const gchar* _tmp11_;
1054
_inner_error_ = NULL;
1055
_tmp11_ = e->message;
1056
g_error ("remote-scope.vala:206: Failed to export scope: %s", _tmp11_);
1060
if (_inner_error_ != NULL) {
1061
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);
1062
g_clear_error (&_inner_error_);
1068
static void unity_video_lens_remote_video_scope_populate_categories (UnityVideoLensRemoteVideoScope* self) {
1069
UnityCategorySet* _tmp0_;
1070
UnityCategorySet* categories;
1071
GFile* _tmp1_ = NULL;
1073
const gchar* _tmp2_ = NULL;
1074
GFile* _tmp3_ = NULL;
1078
UnityCategory* _tmp7_;
1079
UnityCategory* _tmp8_;
1080
const gchar* _tmp9_ = NULL;
1081
GFile* _tmp10_ = NULL;
1085
UnityCategory* _tmp14_;
1086
UnityCategory* _tmp15_;
1087
g_return_if_fail (self != NULL);
1088
_tmp0_ = unity_category_set_new ();
1089
categories = _tmp0_;
1090
_tmp1_ = g_file_new_for_path (CONFIG_ICON_PATH);
1092
_tmp2_ = _ ("Online");
1093
_tmp3_ = g_file_get_child (icon_dir, "group-internet.svg");
1095
_tmp5_ = (GFileIcon*) g_file_icon_new (_tmp4_);
1097
_tmp7_ = unity_category_new ("online", _tmp2_, (GIcon*) _tmp6_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
1099
unity_category_set_add (categories, _tmp8_);
1100
_g_object_unref0 (_tmp8_);
1101
_g_object_unref0 (_tmp6_);
1102
_g_object_unref0 (_tmp4_);
1103
_tmp9_ = _ ("More suggestions");
1104
_tmp10_ = g_file_get_child (icon_dir, "group-treat-yourself.svg");
1106
_tmp12_ = (GFileIcon*) g_file_icon_new (_tmp11_);
1108
_tmp14_ = unity_category_new ("more", _tmp9_, (GIcon*) _tmp13_, UNITY_CATEGORY_RENDERER_VERTICAL_TILE);
1110
unity_category_set_add (categories, _tmp15_);
1111
_g_object_unref0 (_tmp15_);
1112
_g_object_unref0 (_tmp13_);
1113
_g_object_unref0 (_tmp11_);
1114
unity_deprecated_scope_base_set_categories ((UnityDeprecatedScopeBase*) self, categories);
1115
_g_object_unref0 (icon_dir);
1116
_g_object_unref0 (categories);
1120
static gpointer _g_object_ref0 (gpointer self) {
1121
return self ? g_object_ref (self) : NULL;
1125
static void _unity_video_lens_remote_video_scope_sources_cb_soup_session_callback (SoupSession* session, SoupMessage* msg, gpointer self) {
1126
unity_video_lens_remote_video_scope_sources_cb (self, session, msg);
1130
static void unity_video_lens_remote_video_scope_query_list_of_sources (UnityVideoLensRemoteVideoScope* self) {
1131
gchar* _tmp0_ = NULL;
1133
SoupMessage* _tmp2_;
1134
SoupMessage* _tmp3_;
1136
SoupSession* _tmp4_;
1137
SoupMessage* _tmp5_;
1138
g_return_if_fail (self != NULL);
1139
_tmp0_ = unity_video_lens_ubuntu_video_search_sources_uri ();
1141
_tmp2_ = soup_message_new ("GET", _tmp1_);
1145
_tmp4_ = self->priv->session;
1146
_tmp5_ = _g_object_ref0 (msg);
1147
soup_session_queue_message (_tmp4_, _tmp5_, _unity_video_lens_remote_video_scope_sources_cb_soup_session_callback, self);
1148
_g_object_unref0 (msg);
1152
static GeeArrayList* unity_video_lens_remote_video_scope_handle_search_response (UnityVideoLensRemoteVideoScope* self, SoupMessage* msg, gboolean is_treat_yourself) {
1153
GeeArrayList* result = NULL;
1154
SoupMessage* _tmp0_;
1157
GError * _inner_error_ = NULL;
1158
g_return_val_if_fail (self != NULL, NULL);
1159
g_return_val_if_fail (msg != NULL, NULL);
1161
g_object_get (_tmp0_, "status-code", &_tmp1_, NULL);
1163
if (_tmp2_ != ((guint) 200)) {
1164
SoupMessage* _tmp3_;
1167
SoupMessage* _tmp6_;
1168
gchar* _tmp7_ = NULL;
1172
g_object_get (_tmp3_, "status-code", &_tmp4_, NULL);
1175
g_object_get (_tmp6_, "reason-phrase", &_tmp7_, NULL);
1178
g_warning ("remote-scope.vala:234: Unable to get results from the server: %u, %s", _tmp5_, _tmp9_);
1182
SoupMessage* _tmp10_;
1183
SoupMessageBody* _tmp11_;
1185
gint _tmp12__length1;
1187
GeeArrayList* _tmp14_ = NULL;
1188
GeeArrayList* _tmp15_;
1190
_tmp11_ = _tmp10_->response_body;
1191
_tmp12_ = _tmp11_->data;
1192
_tmp12__length1 = (gint) _tmp11_->length;
1193
_tmp13_ = is_treat_yourself;
1194
_tmp14_ = unity_video_lens_ubuntu_video_search_process_search_results ((const gchar*) _tmp12_, _tmp13_, &_inner_error_);
1196
if (_inner_error_ != NULL) {
1197
goto __catch4_g_error;
1207
const gchar* _tmp17_;
1209
_inner_error_ = NULL;
1211
_tmp17_ = _tmp16_->message;
1212
g_warning ("remote-scope.vala:245: Error processing search results: %s", _tmp17_);
1216
if (_inner_error_ != NULL) {
1217
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);
1218
g_clear_error (&_inner_error_);
1227
static void _g_free0_ (gpointer var) {
1228
var = (g_free (var), NULL);
1232
static void _g_slist_free__g_free0_ (GSList* self) {
1233
g_slist_foreach (self, (GFunc) _g_free0_, NULL);
1234
g_slist_free (self);
1238
static gboolean __lambda9_ (UnityVideoLensRemoteVideoScope* self) {
1239
gboolean result = FALSE;
1240
unity_video_lens_remote_video_scope_query_list_of_sources (self);
1246
static gboolean ___lambda9__gsource_func (gpointer self) {
1248
result = __lambda9_ (self);
1253
static void unity_video_lens_remote_video_scope_sources_cb (UnityVideoLensRemoteVideoScope* self, SoupSession* session, SoupMessage* msg) {
1256
SoupMessage* _tmp1_;
1260
GError * _inner_error_ = NULL;
1261
g_return_if_fail (self != NULL);
1262
g_return_if_fail (session != NULL);
1263
g_return_if_fail (msg != NULL);
1264
_tmp0_ = unity_video_lens_remote_video_scope_RETRY_INTERVAL;
1265
interval = (guint) _tmp0_;
1267
g_object_get (_tmp1_, "status-code", &_tmp2_, NULL);
1269
if (_tmp3_ != ((guint) 200)) {
1270
SoupMessage* _tmp4_;
1273
SoupMessage* _tmp7_;
1274
gchar* _tmp8_ = NULL;
1278
g_object_get (_tmp4_, "status-code", &_tmp5_, NULL);
1281
g_object_get (_tmp7_, "reason-phrase", &_tmp8_, NULL);
1284
g_warning ("remote-scope.vala:257: Unable to query the server for a list of source" \
1285
"s, %u: %s", _tmp6_, _tmp10_);
1289
SoupMessage* _tmp11_;
1290
SoupMessageBody* _tmp12_;
1292
gint _tmp13__length1;
1293
GeeArrayList* _tmp14_ = NULL;
1294
GeeArrayList* sources_array;
1296
UnityOptionsFilter* _tmp15_;
1297
UnityOptionsFilter* _tmp16_;
1302
_tmp12_ = _tmp11_->response_body;
1303
_tmp13_ = _tmp12_->data;
1304
_tmp13__length1 = (gint) _tmp12_->length;
1305
_tmp14_ = unity_video_lens_ubuntu_video_search_process_sources_results ((const gchar*) _tmp13_, &_inner_error_);
1306
sources_array = _tmp14_;
1307
if (_inner_error_ != NULL) {
1308
goto __catch5_g_error;
1311
_tmp15_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) self);
1313
_tmp17_ = _tmp16_->options;
1315
GList* opt_collection = NULL;
1316
GList* opt_it = NULL;
1317
opt_collection = _tmp17_;
1318
for (opt_it = opt_collection; opt_it != NULL; opt_it = opt_it->next) {
1319
UnityFilterOption* _tmp18_;
1320
UnityFilterOption* opt = NULL;
1321
_tmp18_ = _g_object_ref0 ((UnityFilterOption*) opt_it->data);
1324
UnityFilterOption* _tmp19_;
1325
const gchar* _tmp20_;
1326
const gchar* _tmp21_;
1329
_tmp20_ = unity_filter_option_get_id (_tmp19_);
1331
_tmp22_ = g_strdup (_tmp21_);
1332
to_remove = g_slist_append (to_remove, _tmp22_);
1333
_g_object_unref0 (opt);
1337
_tmp23_ = to_remove;
1339
GSList* id_collection = NULL;
1340
GSList* id_it = NULL;
1341
id_collection = _tmp23_;
1342
for (id_it = id_collection; id_it != NULL; id_it = id_it->next) {
1345
_tmp24_ = g_strdup ((const gchar*) id_it->data);
1348
UnityOptionsFilter* _tmp25_;
1349
UnityOptionsFilter* _tmp26_;
1350
const gchar* _tmp27_;
1351
_tmp25_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) self);
1354
unity_options_filter_remove_option (_tmp26_, _tmp27_);
1360
GeeArrayList* _tmp28_;
1361
GeeArrayList* _tmp29_;
1362
GeeArrayList* _src_list;
1363
GeeArrayList* _tmp30_;
1368
_tmp28_ = sources_array;
1369
_tmp29_ = _g_object_ref0 (_tmp28_);
1370
_src_list = _tmp29_;
1371
_tmp30_ = _src_list;
1372
_tmp31_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp30_);
1374
_src_size = _tmp32_;
1380
GeeArrayList* _tmp36_;
1382
gpointer _tmp38_ = NULL;
1384
UnityOptionsFilter* _tmp39_;
1385
UnityOptionsFilter* _tmp40_;
1386
const gchar* _tmp41_;
1387
const gchar* _tmp42_;
1388
UnityFilterOption* _tmp43_ = NULL;
1389
UnityFilterOption* _tmp44_;
1390
_tmp33_ = _src_index;
1391
_src_index = _tmp33_ + 1;
1392
_tmp34_ = _src_index;
1393
_tmp35_ = _src_size;
1394
if (!(_tmp34_ < _tmp35_)) {
1397
_tmp36_ = _src_list;
1398
_tmp37_ = _src_index;
1399
_tmp38_ = gee_abstract_list_get ((GeeAbstractList*) _tmp36_, _tmp37_);
1400
src = (gchar*) _tmp38_;
1401
_tmp39_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) self);
1405
_tmp43_ = unity_options_filter_add_option (_tmp40_, _tmp41_, _tmp42_, NULL);
1407
_g_object_unref0 (_tmp44_);
1410
_g_object_unref0 (_src_list);
1412
_tmp45_ = unity_video_lens_remote_video_scope_REFRESH_INTERVAL;
1413
interval = (guint) _tmp45_;
1414
__g_slist_free__g_free0_0 (to_remove);
1415
_g_object_unref0 (sources_array);
1422
_inner_error_ = NULL;
1423
g_warning ("remote-scope.vala:281: Got invalid json from the server");
1427
if (_inner_error_ != NULL) {
1428
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);
1429
g_clear_error (&_inner_error_);
1434
g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, _tmp46_, ___lambda9__gsource_func, g_object_ref (self), g_object_unref);
1438
static void unity_video_lens_remote_video_scope_real_activate_result_data_free (gpointer _data) {
1439
UnityVideoLensRemoteVideoScopeActivateResultData* _data_;
1441
unity_scope_result_destroy (&_data_->_result_);
1442
_g_object_unref0 (_data_->result);
1443
_g_object_unref0 (_data_->self);
1444
g_slice_free (UnityVideoLensRemoteVideoScopeActivateResultData, _data_);
1448
static void unity_video_lens_remote_video_scope_real_activate_result (UnityDeprecatedScope* base, UnityScopeResult* _result_, GAsyncReadyCallback _callback_, gpointer _user_data_) {
1449
UnityVideoLensRemoteVideoScope * self;
1450
UnityVideoLensRemoteVideoScopeActivateResultData* _data_;
1451
UnityVideoLensRemoteVideoScope* _tmp0_;
1452
UnityScopeResult _tmp1_;
1453
UnityScopeResult _tmp2_ = {0};
1454
self = (UnityVideoLensRemoteVideoScope*) base;
1455
_data_ = g_slice_new0 (UnityVideoLensRemoteVideoScopeActivateResultData);
1456
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_video_lens_remote_video_scope_real_activate_result);
1457
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_video_lens_remote_video_scope_real_activate_result_data_free);
1458
_tmp0_ = _g_object_ref0 (self);
1459
_data_->self = _tmp0_;
1461
unity_scope_result_copy (&_tmp1_, &_tmp2_);
1462
unity_scope_result_destroy (&_data_->_result_);
1463
_data_->_result_ = _tmp2_;
1464
unity_video_lens_remote_video_scope_real_activate_result_co (_data_);
1468
static UnityActivationResponse* unity_video_lens_remote_video_scope_real_activate_result_finish (UnityDeprecatedScope* base, GAsyncResult* _res_) {
1469
UnityActivationResponse* result;
1470
UnityVideoLensRemoteVideoScopeActivateResultData* _data_;
1471
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
1472
result = _data_->result;
1473
_data_->result = NULL;
1478
static gpointer _g_variant_ref0 (gpointer self) {
1479
return self ? g_variant_ref (self) : NULL;
1483
static void unity_video_lens_remote_video_scope_activate_result_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
1484
UnityVideoLensRemoteVideoScopeActivateResultData* _data_;
1485
_data_ = _user_data_;
1486
_data_->_source_object_ = source_object;
1487
_data_->_res_ = _res_;
1488
unity_video_lens_remote_video_scope_real_activate_result_co (_data_);
1492
static gboolean unity_video_lens_remote_video_scope_real_activate_result_co (UnityVideoLensRemoteVideoScopeActivateResultData* _data_) {
1493
switch (_data_->_state_) {
1499
g_assert_not_reached ();
1502
_data_->_tmp0_ = _data_->_result_;
1503
_data_->_tmp1_ = _data_->_tmp0_.metadata;
1504
_data_->_tmp2_ = unity_video_lens_remote_video_scope_PREVIEW_ON_LMB;
1505
_data_->_tmp3_ = NULL;
1506
_data_->_tmp3_ = g_hash_table_lookup (_data_->_tmp1_, _data_->_tmp2_);
1507
_data_->_tmp4_ = _g_variant_ref0 ((GVariant*) _data_->_tmp3_);
1508
_data_->realcat = _data_->_tmp4_;
1509
_data_->_tmp6_ = _data_->realcat;
1510
if (_data_->_tmp6_ != NULL) {
1511
_data_->_tmp7_ = _data_->realcat;
1512
_data_->_tmp8_ = FALSE;
1513
_data_->_tmp8_ = g_variant_get_boolean (_data_->_tmp7_);
1514
_data_->_tmp5_ = _data_->_tmp8_;
1516
_data_->_tmp5_ = FALSE;
1518
_data_->_tmp9_ = _data_->_tmp5_;
1519
if (_data_->_tmp9_) {
1520
_data_->_tmp10_ = _data_->_result_;
1521
_data_->_state_ = 1;
1522
unity_deprecated_scope_preview_result ((UnityDeprecatedScope*) _data_->self, &_data_->_tmp10_, unity_video_lens_remote_video_scope_activate_result_ready, _data_);
1525
_data_->_tmp11_ = NULL;
1526
_data_->_tmp11_ = unity_deprecated_scope_preview_result_finish ((UnityDeprecatedScope*) _data_->self, _data_->_res_);
1527
_data_->preview = _data_->_tmp11_;
1528
_data_->_tmp12_ = _data_->preview;
1529
_data_->_tmp13_ = unity_activation_response_new_with_preview (_data_->_tmp12_);
1530
_data_->result = _data_->_tmp13_;
1531
_g_object_unref0 (_data_->preview);
1532
_g_variant_unref0 (_data_->realcat);
1533
if (_data_->_state_ == 0) {
1534
g_simple_async_result_complete_in_idle (_data_->_async_result);
1536
g_simple_async_result_complete (_data_->_async_result);
1538
g_object_unref (_data_->_async_result);
1541
_data_->_tmp14_ = _data_->_result_;
1542
_data_->_tmp15_ = _data_->_tmp14_.uri;
1543
_data_->_tmp16_ = NULL;
1544
_data_->_tmp16_ = unity_video_lens_remote_video_scope_on_activate_uri (_data_->self, _data_->_tmp15_);
1545
_data_->result = _data_->_tmp16_;
1546
_g_variant_unref0 (_data_->realcat);
1547
if (_data_->_state_ == 0) {
1548
g_simple_async_result_complete_in_idle (_data_->_async_result);
1550
g_simple_async_result_complete (_data_->_async_result);
1552
g_object_unref (_data_->_async_result);
1554
_g_variant_unref0 (_data_->realcat);
1555
if (_data_->_state_ == 0) {
1556
g_simple_async_result_complete_in_idle (_data_->_async_result);
1558
g_simple_async_result_complete (_data_->_async_result);
1560
g_object_unref (_data_->_async_result);
1565
static UnityActivationResponse* unity_video_lens_remote_video_scope_on_activate_uri (UnityVideoLensRemoteVideoScope* self, const gchar* rawuri) {
1566
UnityActivationResponse* result = NULL;
1567
const gchar* _tmp0_;
1568
UnityVideoLensRemoteUri* _tmp1_ = NULL;
1569
UnityVideoLensRemoteUri* fakeuri;
1570
UnityVideoLensRemoteUri* _tmp2_;
1571
UnityActivationResponse* _tmp23_;
1572
GError * _inner_error_ = NULL;
1573
g_return_val_if_fail (self != NULL, NULL);
1574
g_return_val_if_fail (rawuri != NULL, NULL);
1576
_tmp1_ = unity_video_lens_remote_uri_from_rawuri (_tmp0_);
1579
if (_tmp2_ != NULL) {
1581
_tmp3_ = self->priv->use_zeitgeist;
1583
UnityVideoLensRemoteUri* _tmp4_;
1584
const gchar* _tmp5_;
1585
const gchar* _tmp6_;
1586
UnityVideoLensRemoteUri* _tmp7_;
1587
const gchar* _tmp8_;
1588
const gchar* _tmp9_;
1589
UnityVideoLensRemoteUri* _tmp10_;
1590
const gchar* _tmp11_;
1591
const gchar* _tmp12_;
1593
_tmp5_ = unity_video_lens_remote_uri_get_uri (_tmp4_);
1596
_tmp8_ = unity_video_lens_remote_uri_get_title (_tmp7_);
1599
_tmp11_ = unity_video_lens_remote_uri_get_icon (_tmp10_);
1601
unity_video_lens_remote_video_scope_zeitgeist_insert_event (self, _tmp6_, _tmp9_, _tmp12_);
1604
UnityVideoLensRemoteUri* _tmp13_;
1605
const gchar* _tmp14_;
1606
const gchar* _tmp15_;
1607
UnityActivationResponse* _tmp16_;
1609
_tmp14_ = unity_video_lens_remote_uri_get_uri (_tmp13_);
1611
g_app_info_launch_default_for_uri (_tmp15_, NULL, &_inner_error_);
1612
if (_inner_error_ != NULL) {
1613
goto __catch6_g_error;
1615
_tmp16_ = unity_activation_response_new (UNITY_HANDLED_TYPE_HIDE_DASH, "");
1617
_unity_video_lens_remote_uri_unref0 (fakeuri);
1624
UnityVideoLensRemoteUri* _tmp17_;
1625
const gchar* _tmp18_;
1626
const gchar* _tmp19_;
1628
const gchar* _tmp21_;
1630
_inner_error_ = NULL;
1632
_tmp18_ = unity_video_lens_remote_uri_get_uri (_tmp17_);
1635
_tmp21_ = _tmp20_->message;
1636
g_warning ("remote-scope.vala:317: Failed to launch default application for '%s': " \
1637
"%s", _tmp19_, _tmp21_);
1641
if (_inner_error_ != NULL) {
1642
_unity_video_lens_remote_uri_unref0 (fakeuri);
1643
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);
1644
g_clear_error (&_inner_error_);
1648
const gchar* _tmp22_;
1650
g_warning ("remote-scope.vala:322: Invalid raw uri: '%s'", _tmp22_);
1652
_tmp23_ = unity_activation_response_new (UNITY_HANDLED_TYPE_NOT_HANDLED, "");
1654
_unity_video_lens_remote_uri_unref0 (fakeuri);
1659
static UnityActivationResponse* unity_video_lens_remote_video_scope_on_play_video (UnityVideoLensRemoteVideoScope* self, const gchar* rawuri) {
1660
UnityActivationResponse* result = NULL;
1661
const gchar* _tmp0_;
1662
UnityActivationResponse* _tmp1_ = NULL;
1663
g_return_val_if_fail (self != NULL, NULL);
1664
g_return_val_if_fail (rawuri != NULL, NULL);
1666
_tmp1_ = unity_video_lens_remote_video_scope_on_activate_uri (self, _tmp0_);
1672
static glong string_strnlen (gchar* str, glong maxlen) {
1676
gchar* _tmp2_ = NULL;
1681
_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
1684
if (_tmp3_ == NULL) {
1694
result = (glong) (_tmp5_ - _tmp6_);
1700
static gchar* string_substring (const gchar* self, glong offset, glong len) {
1701
gchar* result = NULL;
1702
glong string_length = 0L;
1703
gboolean _tmp0_ = FALSE;
1713
gchar* _tmp23_ = NULL;
1714
g_return_val_if_fail (self != NULL, NULL);
1716
if (_tmp1_ >= ((glong) 0)) {
1719
_tmp0_ = _tmp2_ >= ((glong) 0);
1730
_tmp6_ = string_strnlen ((gchar*) self, _tmp4_ + _tmp5_);
1731
string_length = _tmp6_;
1735
_tmp7_ = strlen (self);
1737
string_length = (glong) _tmp8_;
1740
if (_tmp9_ < ((glong) 0)) {
1744
_tmp10_ = string_length;
1746
offset = _tmp10_ + _tmp11_;
1748
g_return_val_if_fail (_tmp12_ >= ((glong) 0), NULL);
1753
_tmp14_ = string_length;
1754
g_return_val_if_fail (_tmp13_ <= _tmp14_, NULL);
1757
if (_tmp15_ < ((glong) 0)) {
1760
_tmp16_ = string_length;
1762
len = _tmp16_ - _tmp17_;
1766
_tmp20_ = string_length;
1767
g_return_val_if_fail ((_tmp18_ + _tmp19_) <= _tmp20_, NULL);
1770
_tmp23_ = g_strndup (((gchar*) self) + _tmp21_, (gsize) _tmp22_);
1776
static UnityActivationResponse* _unity_video_lens_remote_video_scope_on_play_video_unity_preview_action_activated (UnityPreviewAction* _sender, const gchar* uri, gpointer self) {
1777
UnityActivationResponse* result;
1778
result = unity_video_lens_remote_video_scope_on_play_video (self, uri);
1783
static UnityPreview* unity_video_lens_remote_video_scope_build_preview (UnityVideoLensRemoteVideoScope* self, UnityVideoLensRemoteUri* uri, UnityVideoLensRemoteVideoDetails* details) {
1784
UnityPreview* result = NULL;
1785
UnityVideoLensRemoteUri* _tmp0_;
1786
const gchar* _tmp1_;
1787
const gchar* _tmp2_;
1794
GFile* song_file = NULL;
1795
guint8* song_data = NULL;
1796
gint song_data_length1 = 0;
1797
gint _song_data_size_ = 0;
1798
gchar* etag_out = NULL;
1801
UnityVideoLensRemoteUri* _tmp7_;
1802
const gchar* _tmp8_;
1803
const gchar* _tmp9_;
1804
GFile* _tmp10_ = NULL;
1805
guint8* _tmp11_ = NULL;
1807
gchar* _tmp13_ = NULL;
1808
gboolean _tmp14_ = FALSE;
1810
const gchar* _tmp17_;
1813
const gchar* _tmp19_;
1815
gchar* _tmp21_ = NULL;
1820
const gchar* _tmp25_;
1823
gchar* _tmp28_ = NULL;
1824
const gchar* _tmp29_;
1826
UnityVideoLensRemoteVideoDetails* _tmp31_;
1827
const gchar* _tmp63_ = NULL;
1828
UnityVideoLensRemoteVideoDetails* _tmp64_;
1829
const gchar* _tmp70_;
1830
GFile* _tmp71_ = NULL;
1835
const gchar* _tmp75_;
1836
const gchar* _tmp76_;
1837
const gchar* _tmp77_;
1839
UnityMoviePreview* _tmp79_;
1840
UnityMoviePreview* real_preview;
1841
const gchar* _tmp80_ = NULL;
1842
UnityPreviewAction* _tmp81_;
1843
UnityPreviewAction* play_video;
1844
UnityPreviewAction* _tmp82_;
1845
UnityMoviePreview* _tmp83_;
1846
UnityPreviewAction* _tmp84_;
1847
UnityMoviePreview* _tmp85_;
1848
UnityVideoLensRemoteVideoDetails* _tmp86_;
1849
GError * _inner_error_ = NULL;
1850
g_return_val_if_fail (self != NULL, NULL);
1851
g_return_val_if_fail (uri != NULL, NULL);
1853
_tmp1_ = unity_video_lens_remote_uri_get_title (_tmp0_);
1855
_tmp3_ = g_strdup (_tmp2_);
1857
_tmp4_ = g_strdup ("");
1859
_tmp5_ = g_strdup ("");
1860
description = _tmp5_;
1861
_tmp6_ = g_strdup ("");
1864
_tmp8_ = unity_video_lens_remote_uri_get_uri (_tmp7_);
1866
_tmp10_ = g_file_new_for_uri (_tmp9_);
1867
_g_object_unref0 (song_file);
1868
song_file = _tmp10_;
1869
_tmp14_ = g_file_load_contents (song_file, NULL, &_tmp11_, &_tmp12_, &_tmp13_, &_inner_error_);
1870
song_data = (g_free (song_data), NULL);
1871
song_data = _tmp11_;
1872
song_data_length1 = _tmp12_;
1873
_song_data_size_ = song_data_length1;
1874
_g_free0 (etag_out);
1877
if (_inner_error_ != NULL) {
1879
_g_free0 (etag_out);
1880
song_data = (g_free (song_data), NULL);
1881
_g_object_unref0 (song_file);
1882
_g_free0 (description);
1883
_g_free0 (subtitle);
1885
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);
1886
g_clear_error (&_inner_error_);
1891
_tmp16_ = g_strdup ((const gchar*) song_data);
1896
_tmp18_ = string_index_of (_tmp17_, "<meta name=\"description\"", 0);
1900
_tmp21_ = string_substring (_tmp19_, (glong) _tmp20_, (glong) (-1));
1902
_tmp23_ = string_index_of (_tmp22_, ">", 0);
1909
_tmp28_ = string_substring (_tmp25_, (glong) (_tmp26_ + 34), (glong) (_tmp27_ - 37));
1913
_tmp30_ = g_strdup (_tmp29_);
1914
_g_free0 (description);
1915
description = _tmp30_;
1917
if (_tmp31_ != NULL) {
1918
UnityVideoLensRemoteVideoDetails* _tmp32_;
1919
const gchar* _tmp33_;
1921
UnityVideoLensRemoteVideoDetails* _tmp35_;
1922
const gchar* _tmp36_;
1924
gboolean _tmp38_ = FALSE;
1925
UnityVideoLensRemoteVideoDetails* _tmp39_;
1926
const gchar* _tmp40_;
1928
UnityVideoLensRemoteVideoDetails* _tmp47_;
1931
_tmp33_ = (*_tmp32_).title;
1932
_tmp34_ = g_strdup (_tmp33_);
1936
_tmp36_ = (*_tmp35_).description;
1937
_tmp37_ = g_strdup (_tmp36_);
1938
_g_free0 (description);
1939
description = _tmp37_;
1941
_tmp40_ = (*_tmp39_).release_date;
1942
if (_tmp40_ != NULL) {
1943
UnityVideoLensRemoteVideoDetails* _tmp41_;
1944
const gchar* _tmp42_;
1946
_tmp42_ = (*_tmp41_).release_date;
1947
_tmp38_ = g_strcmp0 (_tmp42_, "") != 0;
1953
UnityVideoLensRemoteVideoDetails* _tmp44_;
1954
const gchar* _tmp45_;
1957
_tmp45_ = (*_tmp44_).release_date;
1958
_tmp46_ = g_strdup (_tmp45_);
1959
_g_free0 (subtitle);
1963
_tmp48_ = (*_tmp47_).duration;
1965
UnityVideoLensRemoteVideoDetails* _tmp49_;
1967
const gchar* _tmp51_ = NULL;
1968
UnityVideoLensRemoteVideoDetails* _tmp52_;
1970
gchar* _tmp54_ = NULL;
1972
const gchar* _tmp55_;
1974
_tmp50_ = (*_tmp49_).duration;
1975
_tmp51_ = ngettext ("%d min", "%d mins", (gulong) _tmp50_);
1977
_tmp53_ = (*_tmp52_).duration;
1978
_tmp54_ = g_strdup_printf (_tmp51_, _tmp53_);
1981
if (g_strcmp0 (_tmp55_, "") != 0) {
1982
const gchar* _tmp56_;
1983
const gchar* _tmp57_;
1989
_tmp58_ = g_strconcat (", ", _tmp57_, NULL);
1991
_tmp60_ = g_strconcat (_tmp56_, _tmp59_, NULL);
1992
_g_free0 (subtitle);
1996
const gchar* _tmp61_;
1999
_tmp62_ = g_strdup (_tmp61_);
2000
_g_free0 (subtitle);
2003
_g_free0 (duration);
2007
if (_tmp64_ != NULL) {
2008
UnityVideoLensRemoteVideoDetails* _tmp65_;
2009
const gchar* _tmp66_;
2011
_tmp66_ = (*_tmp65_).image;
2014
UnityVideoLensRemoteUri* _tmp67_;
2015
const gchar* _tmp68_;
2016
const gchar* _tmp69_;
2018
_tmp68_ = unity_video_lens_remote_uri_get_icon (_tmp67_);
2023
_tmp71_ = g_file_new_for_uri (_tmp70_);
2025
_tmp73_ = (GFileIcon*) g_file_icon_new (_tmp72_);
2026
_tmp74_ = (GIcon*) _tmp73_;
2027
_g_object_unref0 (_tmp72_);
2028
thumbnail = _tmp74_;
2031
_tmp77_ = description;
2032
_tmp78_ = thumbnail;
2033
_tmp79_ = unity_movie_preview_new (_tmp75_, _tmp76_, _tmp77_, _tmp78_);
2034
real_preview = _tmp79_;
2035
_tmp80_ = _ ("Play");
2036
_tmp81_ = unity_preview_action_new ("play", _tmp80_, NULL);
2037
play_video = _tmp81_;
2038
_tmp82_ = play_video;
2039
g_signal_connect_object (_tmp82_, "activated", (GCallback) _unity_video_lens_remote_video_scope_on_play_video_unity_preview_action_activated, self, 0);
2040
_tmp83_ = real_preview;
2041
_tmp84_ = play_video;
2042
unity_preview_add_action ((UnityPreview*) _tmp83_, _tmp84_);
2043
_tmp85_ = real_preview;
2044
unity_movie_preview_set_rating (_tmp85_, (gfloat) (-1), (guint) 0);
2046
if (_tmp86_ != NULL) {
2047
UnityVideoLensRemoteVideoDetails* _tmp87_;
2049
gint _tmp88__length1;
2050
gboolean _tmp99_ = FALSE;
2051
UnityVideoLensRemoteVideoDetails* _tmp100_;
2052
const gchar* _tmp101_;
2054
gboolean _tmp111_ = FALSE;
2055
UnityVideoLensRemoteVideoDetails* _tmp112_;
2057
gint _tmp113__length1;
2059
gboolean _tmp127_ = FALSE;
2060
UnityVideoLensRemoteVideoDetails* _tmp128_;
2061
const gchar* _tmp129_;
2063
gboolean _tmp139_ = FALSE;
2064
UnityVideoLensRemoteVideoDetails* _tmp140_;
2065
const gchar* _tmp141_;
2068
_tmp88_ = (*_tmp87_).directors;
2069
_tmp88__length1 = (*_tmp87_).directors_length1;
2070
if (_tmp88__length1 > 0) {
2071
UnityMoviePreview* _tmp89_;
2072
UnityVideoLensRemoteVideoDetails* _tmp90_;
2074
gint _tmp91__length1;
2075
const gchar* _tmp92_ = NULL;
2076
UnityVideoLensRemoteVideoDetails* _tmp93_;
2078
gint _tmp94__length1;
2079
gchar* _tmp95_ = NULL;
2081
UnityInfoHint* _tmp97_;
2082
UnityInfoHint* _tmp98_;
2083
_tmp89_ = real_preview;
2085
_tmp91_ = (*_tmp90_).directors;
2086
_tmp91__length1 = (*_tmp90_).directors_length1;
2087
_tmp92_ = ngettext ("Director", "Directors", (gulong) _tmp91__length1);
2089
_tmp94_ = (*_tmp93_).directors;
2090
_tmp94__length1 = (*_tmp93_).directors_length1;
2091
_tmp95_ = g_strjoinv (", ", _tmp94_);
2093
_tmp97_ = unity_info_hint_new ("directors", _tmp92_, NULL, _tmp96_);
2094
g_object_ref_sink (_tmp97_);
2096
unity_preview_add_info ((UnityPreview*) _tmp89_, _tmp98_);
2097
_g_object_unref0 (_tmp98_);
2101
_tmp101_ = (*_tmp100_).starring;
2102
if (_tmp101_ != NULL) {
2103
UnityVideoLensRemoteVideoDetails* _tmp102_;
2104
const gchar* _tmp103_;
2106
_tmp103_ = (*_tmp102_).starring;
2107
_tmp99_ = g_strcmp0 (_tmp103_, "") != 0;
2113
UnityMoviePreview* _tmp105_;
2114
const gchar* _tmp106_ = NULL;
2115
UnityVideoLensRemoteVideoDetails* _tmp107_;
2116
const gchar* _tmp108_;
2117
UnityInfoHint* _tmp109_;
2118
UnityInfoHint* _tmp110_;
2119
_tmp105_ = real_preview;
2120
_tmp106_ = _ ("Cast");
2122
_tmp108_ = (*_tmp107_).starring;
2123
_tmp109_ = unity_info_hint_new ("cast", _tmp106_, NULL, _tmp108_);
2124
g_object_ref_sink (_tmp109_);
2125
_tmp110_ = _tmp109_;
2126
unity_preview_add_info ((UnityPreview*) _tmp105_, _tmp110_);
2127
_g_object_unref0 (_tmp110_);
2130
_tmp113_ = (*_tmp112_).genres;
2131
_tmp113__length1 = (*_tmp112_).genres_length1;
2132
if (_tmp113_ != NULL) {
2133
UnityVideoLensRemoteVideoDetails* _tmp114_;
2135
gint _tmp115__length1;
2137
_tmp115_ = (*_tmp114_).genres;
2138
_tmp115__length1 = (*_tmp114_).genres_length1;
2139
_tmp111_ = _tmp115__length1 > 0;
2143
_tmp116_ = _tmp111_;
2145
UnityMoviePreview* _tmp117_;
2146
UnityVideoLensRemoteVideoDetails* _tmp118_;
2148
gint _tmp119__length1;
2149
const gchar* _tmp120_ = NULL;
2150
UnityVideoLensRemoteVideoDetails* _tmp121_;
2152
gint _tmp122__length1;
2153
gchar* _tmp123_ = NULL;
2155
UnityInfoHint* _tmp125_;
2156
UnityInfoHint* _tmp126_;
2157
_tmp117_ = real_preview;
2159
_tmp119_ = (*_tmp118_).genres;
2160
_tmp119__length1 = (*_tmp118_).genres_length1;
2161
_tmp120_ = ngettext ("Genre", "Genres", (gulong) _tmp119__length1);
2163
_tmp122_ = (*_tmp121_).genres;
2164
_tmp122__length1 = (*_tmp121_).genres_length1;
2165
_tmp123_ = g_strjoinv (", ", _tmp122_);
2166
_tmp124_ = _tmp123_;
2167
_tmp125_ = unity_info_hint_new ("genres", _tmp120_, NULL, _tmp124_);
2168
g_object_ref_sink (_tmp125_);
2169
_tmp126_ = _tmp125_;
2170
unity_preview_add_info ((UnityPreview*) _tmp117_, _tmp126_);
2171
_g_object_unref0 (_tmp126_);
2172
_g_free0 (_tmp124_);
2175
_tmp129_ = (*_tmp128_).uploaded_by;
2176
if (_tmp129_ != NULL) {
2177
UnityVideoLensRemoteVideoDetails* _tmp130_;
2178
const gchar* _tmp131_;
2180
_tmp131_ = (*_tmp130_).uploaded_by;
2181
_tmp127_ = g_strcmp0 (_tmp131_, "") != 0;
2185
_tmp132_ = _tmp127_;
2187
UnityMoviePreview* _tmp133_;
2188
const gchar* _tmp134_ = NULL;
2189
UnityVideoLensRemoteVideoDetails* _tmp135_;
2190
const gchar* _tmp136_;
2191
UnityInfoHint* _tmp137_;
2192
UnityInfoHint* _tmp138_;
2193
_tmp133_ = real_preview;
2194
_tmp134_ = _ ("Uploaded by");
2196
_tmp136_ = (*_tmp135_).uploaded_by;
2197
_tmp137_ = unity_info_hint_new ("uploaded-by", _tmp134_, NULL, _tmp136_);
2198
g_object_ref_sink (_tmp137_);
2199
_tmp138_ = _tmp137_;
2200
unity_preview_add_info ((UnityPreview*) _tmp133_, _tmp138_);
2201
_g_object_unref0 (_tmp138_);
2204
_tmp141_ = (*_tmp140_).date_uploaded;
2205
if (_tmp141_ != NULL) {
2206
UnityVideoLensRemoteVideoDetails* _tmp142_;
2207
const gchar* _tmp143_;
2209
_tmp143_ = (*_tmp142_).date_uploaded;
2210
_tmp139_ = g_strcmp0 (_tmp143_, "") != 0;
2214
_tmp144_ = _tmp139_;
2216
UnityMoviePreview* _tmp145_;
2217
const gchar* _tmp146_ = NULL;
2218
UnityVideoLensRemoteVideoDetails* _tmp147_;
2219
const gchar* _tmp148_;
2220
UnityInfoHint* _tmp149_;
2221
UnityInfoHint* _tmp150_;
2222
_tmp145_ = real_preview;
2223
_tmp146_ = _ ("Uploaded on");
2225
_tmp148_ = (*_tmp147_).date_uploaded;
2226
_tmp149_ = unity_info_hint_new ("uploaded-on", _tmp146_, NULL, _tmp148_);
2227
g_object_ref_sink (_tmp149_);
2228
_tmp150_ = _tmp149_;
2229
unity_preview_add_info ((UnityPreview*) _tmp145_, _tmp150_);
2230
_g_object_unref0 (_tmp150_);
2233
result = (UnityPreview*) real_preview;
2234
_g_object_unref0 (play_video);
2235
_g_object_unref0 (thumbnail);
2237
_g_free0 (etag_out);
2238
song_data = (g_free (song_data), NULL);
2239
_g_object_unref0 (song_file);
2240
_g_free0 (description);
2241
_g_free0 (subtitle);
2247
static void unity_video_lens_remote_video_scope_real_preview_result_data_free (gpointer _data) {
2248
UnityVideoLensRemoteVideoScopePreviewResultData* _data_;
2250
unity_scope_result_destroy (&_data_->_result_);
2251
_g_object_unref0 (_data_->result);
2252
_g_object_unref0 (_data_->self);
2253
g_slice_free (UnityVideoLensRemoteVideoScopePreviewResultData, _data_);
2257
static void unity_video_lens_remote_video_scope_real_preview_result (UnityDeprecatedScope* base, UnityScopeResult* _result_, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2258
UnityVideoLensRemoteVideoScope * self;
2259
UnityVideoLensRemoteVideoScopePreviewResultData* _data_;
2260
UnityVideoLensRemoteVideoScope* _tmp0_;
2261
UnityScopeResult _tmp1_;
2262
UnityScopeResult _tmp2_ = {0};
2263
self = (UnityVideoLensRemoteVideoScope*) base;
2264
_data_ = g_slice_new0 (UnityVideoLensRemoteVideoScopePreviewResultData);
2265
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_video_lens_remote_video_scope_real_preview_result);
2266
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_video_lens_remote_video_scope_real_preview_result_data_free);
2267
_tmp0_ = _g_object_ref0 (self);
2268
_data_->self = _tmp0_;
2270
unity_scope_result_copy (&_tmp1_, &_tmp2_);
2271
unity_scope_result_destroy (&_data_->_result_);
2272
_data_->_result_ = _tmp2_;
2273
unity_video_lens_remote_video_scope_real_preview_result_co (_data_);
2277
static UnityPreview* unity_video_lens_remote_video_scope_real_preview_result_finish (UnityDeprecatedScope* base, GAsyncResult* _res_) {
2278
UnityPreview* result;
2279
UnityVideoLensRemoteVideoScopePreviewResultData* _data_;
2280
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
2281
result = _data_->result;
2282
_data_->result = NULL;
2287
static void unity_video_lens_remote_video_scope_preview_result_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
2288
UnityVideoLensRemoteVideoScopePreviewResultData* _data_;
2289
_data_ = _user_data_;
2290
_data_->_source_object_ = source_object;
2291
_data_->_res_ = _res_;
2292
unity_video_lens_remote_video_scope_real_preview_result_co (_data_);
2296
static gboolean unity_video_lens_remote_video_scope_real_preview_result_co (UnityVideoLensRemoteVideoScopePreviewResultData* _data_) {
2297
switch (_data_->_state_) {
2303
g_assert_not_reached ();
2306
_data_->_tmp0_ = _data_->_result_;
2307
_data_->_tmp1_ = _data_->_tmp0_.uri;
2308
_data_->_tmp2_ = NULL;
2309
_data_->_tmp2_ = unity_video_lens_remote_uri_from_rawuri (_data_->_tmp1_);
2310
_data_->fakeuri = _data_->_tmp2_;
2311
_data_->_tmp3_ = _data_->fakeuri;
2312
if (_data_->_tmp3_ != NULL) {
2313
_data_->details = NULL;
2314
_data_->_tmp5_ = _data_->fakeuri;
2315
_data_->_tmp6_ = unity_video_lens_remote_uri_get_details_uri (_data_->_tmp5_);
2316
_data_->_tmp7_ = _data_->_tmp6_;
2317
if (_data_->_tmp7_ != NULL) {
2318
_data_->_tmp8_ = _data_->fakeuri;
2319
_data_->_tmp9_ = unity_video_lens_remote_uri_get_details_uri (_data_->_tmp8_);
2320
_data_->_tmp10_ = _data_->_tmp9_;
2321
_data_->_tmp4_ = g_strcmp0 (_data_->_tmp10_, "") != 0;
2323
_data_->_tmp4_ = FALSE;
2325
_data_->_tmp11_ = _data_->_tmp4_;
2326
if (_data_->_tmp11_) {
2328
_data_->_tmp12_ = _data_->fakeuri;
2329
_data_->_tmp13_ = unity_video_lens_remote_uri_get_uri (_data_->_tmp12_);
2330
_data_->_tmp14_ = _data_->_tmp13_;
2331
_data_->_state_ = 1;
2332
unity_video_lens_remote_video_scope_get_details (_data_->self, _data_->_tmp14_, unity_video_lens_remote_video_scope_preview_result_ready, _data_);
2335
_data_->_tmp15_ = NULL;
2336
_data_->_tmp15_ = unity_video_lens_remote_video_scope_get_details_finish (_data_->self, _data_->_res_, &_data_->_inner_error_);
2337
_data_->_tmp16_ = _data_->_tmp15_;
2338
if (_data_->_inner_error_ != NULL) {
2339
goto __catch7_g_error;
2341
_unity_video_lens_remote_video_details_free0 (_data_->details);
2342
_data_->details = _data_->_tmp16_;
2347
_data_->e = _data_->_inner_error_;
2348
_data_->_inner_error_ = NULL;
2349
_data_->_tmp17_ = _data_->e;
2350
_data_->_tmp18_ = _data_->_tmp17_->message;
2351
g_warning ("remote-scope.vala:420: Failed to fetch video details: %s", _data_->_tmp18_);
2352
_g_error_free0 (_data_->e);
2355
if (_data_->_inner_error_ != NULL) {
2356
_unity_video_lens_remote_video_details_free0 (_data_->details);
2357
_unity_video_lens_remote_uri_unref0 (_data_->fakeuri);
2358
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);
2359
g_clear_error (&_data_->_inner_error_);
2363
_data_->_tmp19_ = _data_->fakeuri;
2364
_data_->_tmp20_ = _data_->details;
2365
_data_->_tmp21_ = NULL;
2366
_data_->_tmp21_ = unity_video_lens_remote_video_scope_build_preview (_data_->self, _data_->_tmp19_, _data_->_tmp20_);
2367
_data_->result = _data_->_tmp21_;
2368
_unity_video_lens_remote_video_details_free0 (_data_->details);
2369
_unity_video_lens_remote_uri_unref0 (_data_->fakeuri);
2370
if (_data_->_state_ == 0) {
2371
g_simple_async_result_complete_in_idle (_data_->_async_result);
2373
g_simple_async_result_complete (_data_->_async_result);
2375
g_object_unref (_data_->_async_result);
2378
_data_->_tmp22_ = _data_->_result_;
2379
_data_->_tmp23_ = _data_->_tmp22_.uri;
2380
g_warning ("remote-scope.vala:428: Invalid raw uri: '%s'", _data_->_tmp23_);
2382
_data_->result = NULL;
2383
_unity_video_lens_remote_uri_unref0 (_data_->fakeuri);
2384
if (_data_->_state_ == 0) {
2385
g_simple_async_result_complete_in_idle (_data_->_async_result);
2387
g_simple_async_result_complete (_data_->_async_result);
2389
g_object_unref (_data_->_async_result);
2391
_unity_video_lens_remote_uri_unref0 (_data_->fakeuri);
2392
if (_data_->_state_ == 0) {
2393
g_simple_async_result_complete_in_idle (_data_->_async_result);
2395
g_simple_async_result_complete (_data_->_async_result);
2397
g_object_unref (_data_->_async_result);
2402
static void unity_video_lens_remote_video_scope_get_details_data_free (gpointer _data) {
2403
UnityVideoLensRemoteVideoScopeGetDetailsData* _data_;
2405
_g_free0 (_data_->url);
2406
_unity_video_lens_remote_video_details_free0 (_data_->result);
2407
_g_object_unref0 (_data_->self);
2408
g_slice_free (UnityVideoLensRemoteVideoScopeGetDetailsData, _data_);
2412
static void unity_video_lens_remote_video_scope_get_details (UnityVideoLensRemoteVideoScope* self, const gchar* url, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2413
UnityVideoLensRemoteVideoScopeGetDetailsData* _data_;
2414
UnityVideoLensRemoteVideoScope* _tmp0_;
2415
const gchar* _tmp1_;
2417
_data_ = g_slice_new0 (UnityVideoLensRemoteVideoScopeGetDetailsData);
2418
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_video_lens_remote_video_scope_get_details);
2419
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_video_lens_remote_video_scope_get_details_data_free);
2420
_tmp0_ = _g_object_ref0 (self);
2421
_data_->self = _tmp0_;
2423
_tmp2_ = g_strdup (_tmp1_);
2424
_g_free0 (_data_->url);
2425
_data_->url = _tmp2_;
2426
unity_video_lens_remote_video_scope_get_details_co (_data_);
2430
static UnityVideoLensRemoteVideoDetails* unity_video_lens_remote_video_scope_get_details_finish (UnityVideoLensRemoteVideoScope* self, GAsyncResult* _res_, GError** error) {
2431
UnityVideoLensRemoteVideoDetails* result;
2432
UnityVideoLensRemoteVideoScopeGetDetailsData* _data_;
2433
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
2436
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
2437
result = _data_->result;
2438
_data_->result = NULL;
2443
static Block1Data* block1_data_ref (Block1Data* _data1_) {
2444
g_atomic_int_inc (&_data1_->_ref_count_);
2449
static void block1_data_unref (void * _userdata_) {
2450
Block1Data* _data1_;
2451
_data1_ = (Block1Data*) _userdata_;
2452
if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
2453
UnityVideoLensRemoteVideoScope * self;
2454
self = _data1_->self;
2455
_g_object_unref0 (_data1_->msg);
2456
_g_object_unref0 (self);
2457
g_slice_free (Block1Data, _data1_);
2462
static void __lambda11_ (Block1Data* _data1_, SoupSession* session_, SoupMessage* msg_) {
2463
UnityVideoLensRemoteVideoScope * self;
2464
SoupMessage* _tmp0_;
2465
SoupMessage* _tmp1_;
2466
self = _data1_->self;
2467
g_return_if_fail (session_ != NULL);
2468
g_return_if_fail (msg_ != NULL);
2470
_tmp1_ = _g_object_ref0 (_tmp0_);
2471
_g_object_unref0 (_data1_->msg);
2472
_data1_->msg = _tmp1_;
2473
unity_video_lens_remote_video_scope_get_details_co (_data1_->_async_data_);
2477
static void ___lambda11__soup_session_callback (SoupSession* session, SoupMessage* msg, gpointer self) {
2478
__lambda11_ (self, session, msg);
2482
static gpointer _unity_video_lens_remote_video_details_dup0 (gpointer self) {
2483
return self ? unity_video_lens_remote_video_details_dup (self) : NULL;
2487
static gboolean unity_video_lens_remote_video_scope_get_details_co (UnityVideoLensRemoteVideoScopeGetDetailsData* _data_) {
2488
switch (_data_->_state_) {
2494
g_assert_not_reached ();
2497
_data_->_data1_ = g_slice_new0 (Block1Data);
2498
_data_->_data1_->_ref_count_ = 1;
2499
_data_->_data1_->self = g_object_ref (_data_->self);
2500
_data_->_data1_->_async_data_ = _data_;
2501
_data_->_tmp0_ = _data_->url;
2502
_data_->_tmp1_ = soup_message_new ("GET", _data_->_tmp0_);
2503
_data_->_data1_->msg = _data_->_tmp1_;
2504
_data_->_tmp2_ = _data_->self->priv->session;
2505
_data_->_tmp3_ = _data_->_data1_->msg;
2506
_data_->_tmp4_ = _g_object_ref0 (_data_->_tmp3_);
2507
soup_session_queue_message (_data_->_tmp2_, _data_->_tmp4_, ___lambda11__soup_session_callback, _data_->_data1_);
2508
_data_->_state_ = 1;
2512
_data_->_tmp5_ = _data_->_data1_->msg;
2513
_data_->_tmp6_ = 0U;
2514
g_object_get (_data_->_tmp5_, "status-code", &_data_->_tmp6_, NULL);
2515
_data_->_tmp7_ = _data_->_tmp6_;
2516
if (_data_->_tmp7_ != ((guint) 200)) {
2517
_data_->_tmp8_ = _data_->_data1_->msg;
2518
_data_->_tmp9_ = 0U;
2519
g_object_get (_data_->_tmp8_, "status-code", &_data_->_tmp9_, NULL);
2520
_data_->_tmp10_ = _data_->_tmp9_;
2521
_data_->_tmp11_ = _data_->_data1_->msg;
2522
_data_->_tmp12_ = NULL;
2523
g_object_get (_data_->_tmp11_, "reason-phrase", &_data_->_tmp12_, NULL);
2524
_data_->_tmp13_ = _data_->_tmp12_;
2525
_data_->_tmp14_ = _data_->_tmp13_;
2526
g_warning ("remote-scope.vala:446: Unable to get details from the server: %u, %s", _data_->_tmp10_, _data_->_tmp14_);
2527
_g_free0 (_data_->_tmp14_);
2528
_data_->result = NULL;
2529
block1_data_unref (_data_->_data1_);
2530
_data_->_data1_ = NULL;
2531
if (_data_->_state_ == 0) {
2532
g_simple_async_result_complete_in_idle (_data_->_async_result);
2534
g_simple_async_result_complete (_data_->_async_result);
2536
g_object_unref (_data_->_async_result);
2539
_data_->_tmp15_ = _data_->_data1_->msg;
2540
_data_->_tmp16_ = _data_->_tmp15_->response_body;
2541
_data_->_tmp17_ = _data_->_tmp16_->data;
2542
_data_->_tmp17__length1 = (gint) _data_->_tmp16_->length;
2543
memset (&_data_->_tmp18_, 0, sizeof (UnityVideoLensRemoteVideoDetails));
2544
unity_video_lens_ubuntu_video_search_process_details_results ((const gchar*) _data_->_tmp17_, &_data_->_tmp18_, &_data_->_inner_error_);
2545
_data_->details = _data_->_tmp18_;
2546
if (_data_->_inner_error_ != NULL) {
2547
g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
2548
g_error_free (_data_->_inner_error_);
2549
block1_data_unref (_data_->_data1_);
2550
_data_->_data1_ = NULL;
2551
if (_data_->_state_ == 0) {
2552
g_simple_async_result_complete_in_idle (_data_->_async_result);
2554
g_simple_async_result_complete (_data_->_async_result);
2556
g_object_unref (_data_->_async_result);
2559
_data_->_tmp19_ = _data_->details;
2560
_data_->_tmp20_ = _unity_video_lens_remote_video_details_dup0 (&_data_->_tmp19_);
2561
_data_->_tmp21_ = _data_->_tmp20_;
2562
unity_video_lens_remote_video_details_destroy (&_data_->_tmp19_);
2563
_data_->result = _data_->_tmp21_;
2564
block1_data_unref (_data_->_data1_);
2565
_data_->_data1_ = NULL;
2566
if (_data_->_state_ == 0) {
2567
g_simple_async_result_complete_in_idle (_data_->_async_result);
2569
g_simple_async_result_complete (_data_->_async_result);
2571
g_object_unref (_data_->_async_result);
2574
block1_data_unref (_data_->_data1_);
2575
_data_->_data1_ = NULL;
2576
if (_data_->_state_ == 0) {
2577
g_simple_async_result_complete_in_idle (_data_->_async_result);
2579
g_simple_async_result_complete (_data_->_async_result);
2581
g_object_unref (_data_->_async_result);
2586
static void unity_video_lens_remote_video_scope_update_search_async_data_free (gpointer _data) {
2587
UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData* _data_;
2589
_g_object_unref0 (_data_->search);
2590
_g_object_unref0 (_data_->cancellable);
2591
_g_object_unref0 (_data_->self);
2592
g_slice_free (UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData, _data_);
2596
static void unity_video_lens_remote_video_scope_update_search_async (UnityVideoLensRemoteVideoScope* self, UnityDeprecatedScopeSearch* search, UnitySearchType search_type, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2597
UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData* _data_;
2598
UnityVideoLensRemoteVideoScope* _tmp0_;
2599
UnityDeprecatedScopeSearch* _tmp1_;
2600
UnityDeprecatedScopeSearch* _tmp2_;
2601
UnitySearchType _tmp3_;
2602
GCancellable* _tmp4_;
2603
GCancellable* _tmp5_;
2604
_data_ = g_slice_new0 (UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData);
2605
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_video_lens_remote_video_scope_update_search_async);
2606
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_video_lens_remote_video_scope_update_search_async_data_free);
2607
_tmp0_ = _g_object_ref0 (self);
2608
_data_->self = _tmp0_;
2610
_tmp2_ = _g_object_ref0 (_tmp1_);
2611
_g_object_unref0 (_data_->search);
2612
_data_->search = _tmp2_;
2613
_tmp3_ = search_type;
2614
_data_->search_type = _tmp3_;
2615
_tmp4_ = cancellable;
2616
_tmp5_ = _g_object_ref0 (_tmp4_);
2617
_g_object_unref0 (_data_->cancellable);
2618
_data_->cancellable = _tmp5_;
2619
unity_video_lens_remote_video_scope_update_search_async_co (_data_);
2623
static void unity_video_lens_remote_video_scope_update_search_finish (UnityVideoLensRemoteVideoScope* self, GAsyncResult* _res_) {
2624
UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData* _data_;
2625
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
2629
static void unity_video_lens_remote_video_scope_update_search_async_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
2630
UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData* _data_;
2631
_data_ = _user_data_;
2632
_data_->_source_object_ = source_object;
2633
_data_->_res_ = _res_;
2634
unity_video_lens_remote_video_scope_update_search_async_co (_data_);
2638
static gboolean unity_video_lens_remote_video_scope_update_search_async_co (UnityVideoLensRemoteVideoScopeUpdateSearchAsyncData* _data_) {
2639
switch (_data_->_state_) {
2645
g_assert_not_reached ();
2648
_data_->_tmp0_ = _data_->cancellable;
2649
_data_->_tmp1_ = FALSE;
2650
_data_->_tmp1_ = unity_video_lens_remote_video_scope_is_in_China (_data_->self, _data_->_tmp0_);
2651
if (!_data_->_tmp1_) {
2652
g_warning ("remote-scope.vala:461: Error can not search video from Youku !");
2653
if (_data_->_state_ == 0) {
2654
g_simple_async_result_complete_in_idle (_data_->_async_result);
2656
g_simple_async_result_complete (_data_->_async_result);
2658
g_object_unref (_data_->_async_result);
2662
_data_->_tmp2_ = _data_->search;
2663
_data_->_tmp3_ = unity_deprecated_scope_search_get_search_string (_data_->_tmp2_);
2664
_data_->_tmp4_ = _data_->_tmp3_;
2665
_data_->_tmp5_ = NULL;
2666
_data_->_tmp5_ = string_strip (_data_->_tmp4_);
2667
_data_->search_string = _data_->_tmp5_;
2668
_data_->_tmp6_ = _data_->search_string;
2669
g_debug ("remote-scope.vala:467: Remote search string changed to: %s", _data_->_tmp6_);
2670
_data_->_tmp7_ = _data_->search;
2671
_data_->_tmp8_ = unity_deprecated_scope_search_get_results_model (_data_->_tmp7_);
2672
_data_->_tmp9_ = _data_->_tmp8_;
2673
_data_->_tmp10_ = _g_object_ref0 (_data_->_tmp9_);
2674
_data_->model = _data_->_tmp10_;
2675
_data_->_tmp11_ = _data_->model;
2676
dee_model_clear ((DeeModel*) _data_->_tmp11_);
2677
_data_->_tmp12_ = _data_->self->priv->preferences;
2678
_data_->_tmp13_ = unity_preferences_manager_get_remote_content_search (_data_->_tmp12_);
2679
_data_->_tmp14_ = _data_->_tmp13_;
2680
if (_data_->_tmp14_ != UNITY_PREFERENCES_MANAGER_REMOTE_CONTENT_ALL) {
2681
_data_->_tmp15_ = _data_->search;
2682
g_signal_emit_by_name (_data_->_tmp15_, "finished");
2683
_g_object_unref0 (_data_->model);
2684
_g_free0 (_data_->search_string);
2685
if (_data_->_state_ == 0) {
2686
g_simple_async_result_complete_in_idle (_data_->_async_result);
2688
g_simple_async_result_complete (_data_->_async_result);
2690
g_object_unref (_data_->_async_result);
2693
_data_->_tmp16_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL);
2694
_data_->active_sources = _data_->_tmp16_;
2695
_data_->_tmp17_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) _data_->self);
2696
_data_->_tmp18_ = _data_->_tmp17_;
2697
_data_->_tmp19_ = _data_->_tmp18_->options;
2699
_data_->opt_collection = _data_->_tmp19_;
2700
for (_data_->opt_it = _data_->opt_collection; _data_->opt_it != NULL; _data_->opt_it = _data_->opt_it->next) {
2701
_data_->_tmp20_ = _g_object_ref0 ((UnityFilterOption*) _data_->opt_it->data);
2702
_data_->opt = _data_->_tmp20_;
2704
_data_->_tmp21_ = _data_->opt;
2705
_data_->_tmp22_ = unity_filter_option_get_id (_data_->_tmp21_);
2706
_data_->_tmp23_ = _data_->_tmp22_;
2707
_data_->_tmp24_ = FALSE;
2708
_data_->_tmp24_ = unity_video_lens_remote_video_scope_source_activated (_data_->self, _data_->_tmp23_);
2709
if (_data_->_tmp24_) {
2710
_data_->_tmp25_ = _data_->active_sources;
2711
_data_->_tmp26_ = _data_->opt;
2712
_data_->_tmp27_ = unity_filter_option_get_id (_data_->_tmp26_);
2713
_data_->_tmp28_ = _data_->_tmp27_;
2714
gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp25_, _data_->_tmp28_);
2716
_g_object_unref0 (_data_->opt);
2720
_data_->_tmp29_ = _data_->active_sources;
2721
_data_->_tmp30_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp29_);
2722
_data_->_tmp31_ = _data_->_tmp30_;
2723
_data_->_tmp32_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) _data_->self);
2724
_data_->_tmp33_ = _data_->_tmp32_;
2725
_data_->_tmp34_ = _data_->_tmp33_->options;
2726
_data_->_tmp35_ = 0U;
2727
_data_->_tmp35_ = g_list_length (_data_->_tmp34_);
2728
if (((guint) _data_->_tmp31_) == _data_->_tmp35_) {
2729
_data_->_tmp36_ = _data_->active_sources;
2730
gee_abstract_collection_clear ((GeeAbstractCollection*) _data_->_tmp36_);
2732
_data_->_tmp37_ = _data_->search_type;
2733
if (_data_->_tmp37_ == UNITY_SEARCH_TYPE_DEFAULT) {
2734
_data_->_tmp38_ = _data_->active_sources;
2735
_data_->_tmp39_ = FALSE;
2736
_data_->_tmp39_ = unity_video_lens_remote_video_scope_at_least_one_source_is_on (_data_->self, _data_->_tmp38_);
2737
if (_data_->_tmp39_) {
2739
_data_->_tmp40_ = _data_->search_string;
2740
_data_->_tmp41_ = _data_->search;
2741
_data_->_tmp42_ = _data_->active_sources;
2742
_data_->_tmp43_ = _data_->cancellable;
2743
_data_->_state_ = 1;
2744
unity_video_lens_remote_video_scope_perform_search (_data_->self, _data_->_tmp40_, _data_->_tmp41_, _data_->_tmp42_, _data_->_tmp43_, unity_video_lens_remote_video_scope_update_search_async_ready, _data_);
2747
unity_video_lens_remote_video_scope_perform_search_finish (_data_->self, _data_->_res_, &_data_->_inner_error_);
2748
if (_data_->_inner_error_ != NULL) {
2749
goto __catch9_g_error;
2755
_data_->e = _data_->_inner_error_;
2756
_data_->_inner_error_ = NULL;
2757
_data_->_tmp44_ = _data_->e;
2758
_data_->_tmp45_ = _data_->_tmp44_->message;
2759
g_warning ("remote-scope.vala:505: Search interrupted: %s", _data_->_tmp45_);
2760
_g_error_free0 (_data_->e);
2763
if (_data_->_inner_error_ != NULL) {
2764
_g_object_unref0 (_data_->active_sources);
2765
_g_object_unref0 (_data_->model);
2766
_g_free0 (_data_->search_string);
2767
goto __catch8_g_error;
2771
_data_->_tmp46_ = _data_->search;
2772
g_signal_emit_by_name (_data_->_tmp46_, "finished");
2773
_g_object_unref0 (_data_->active_sources);
2774
_g_object_unref0 (_data_->model);
2775
_g_free0 (_data_->search_string);
2780
_data_->_vala1_e = _data_->_inner_error_;
2781
_data_->_inner_error_ = NULL;
2782
_data_->_tmp47_ = _data_->_vala1_e;
2783
_data_->_tmp48_ = _data_->_tmp47_->message;
2784
g_warning ("remote-scope.vala:515: Error getting result from youku: %s(Failed to S" \
2785
"earch video from Youku)!", _data_->_tmp48_);
2786
_g_error_free0 (_data_->_vala1_e);
2789
if (_data_->_inner_error_ != NULL) {
2790
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);
2791
g_clear_error (&_data_->_inner_error_);
2794
if (_data_->_state_ == 0) {
2795
g_simple_async_result_complete_in_idle (_data_->_async_result);
2797
g_simple_async_result_complete (_data_->_async_result);
2799
g_object_unref (_data_->_async_result);
2804
static gboolean unity_video_lens_remote_video_scope_source_activated (UnityVideoLensRemoteVideoScope* self, const gchar* id) {
2805
gboolean result = FALSE;
2806
UnityOptionsFilter* _tmp0_;
2807
UnityOptionsFilter* _tmp1_;
2808
const gchar* _tmp2_;
2809
UnityFilterOption* _tmp3_ = NULL;
2810
UnityFilterOption* _tmp4_;
2815
UnityOptionsFilter* _tmp8_;
2816
UnityOptionsFilter* _tmp9_;
2820
gboolean _tmp12_ = FALSE;
2821
gboolean _tmp13_ = FALSE;
2825
g_return_val_if_fail (self != NULL, FALSE);
2826
g_return_val_if_fail (id != NULL, FALSE);
2827
_tmp0_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) self);
2830
_tmp3_ = unity_options_filter_get_option (_tmp1_, _tmp2_);
2832
_tmp5_ = unity_filter_option_get_active (_tmp4_);
2835
_g_object_unref0 (_tmp4_);
2837
_tmp8_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) self);
2839
_tmp10_ = unity_filter_get_filtering ((UnityFilter*) _tmp9_);
2841
filtering = _tmp11_;
2845
_tmp15_ = filtering;
2854
gboolean _tmp17_ = FALSE;
2860
_tmp19_ = filtering;
2878
static gboolean unity_video_lens_remote_video_scope_at_least_one_source_is_on (UnityVideoLensRemoteVideoScope* self, GeeArrayList* active_sources) {
2879
gboolean result = FALSE;
2880
gboolean _tmp0_ = FALSE;
2881
gboolean _tmp1_ = FALSE;
2882
UnityOptionsFilter* _tmp2_;
2883
UnityOptionsFilter* _tmp3_;
2888
g_return_val_if_fail (self != NULL, FALSE);
2889
g_return_val_if_fail (active_sources != NULL, FALSE);
2890
_tmp2_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) self);
2892
_tmp4_ = unity_filter_get_filtering ((UnityFilter*) _tmp3_);
2895
GeeArrayList* _tmp6_;
2898
_tmp6_ = active_sources;
2899
_tmp7_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp6_);
2901
_tmp1_ = _tmp8_ > 0;
2909
UnityOptionsFilter* _tmp10_;
2910
UnityOptionsFilter* _tmp11_;
2913
_tmp10_ = unity_deprecated_scope_base_get_sources ((UnityDeprecatedScopeBase*) self);
2915
_tmp12_ = unity_filter_get_filtering ((UnityFilter*) _tmp11_);
2925
static void unity_video_lens_remote_video_scope_perform_search_data_free (gpointer _data) {
2926
UnityVideoLensRemoteVideoScopePerformSearchData* _data_;
2928
_g_free0 (_data_->search_string);
2929
_g_object_unref0 (_data_->search);
2930
_g_object_unref0 (_data_->active_sources);
2931
_g_object_unref0 (_data_->cancellable);
2932
_g_object_unref0 (_data_->self);
2933
g_slice_free (UnityVideoLensRemoteVideoScopePerformSearchData, _data_);
2937
static void unity_video_lens_remote_video_scope_perform_search (UnityVideoLensRemoteVideoScope* self, const gchar* search_string, UnityDeprecatedScopeSearch* search, GeeArrayList* active_sources, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
2938
UnityVideoLensRemoteVideoScopePerformSearchData* _data_;
2939
UnityVideoLensRemoteVideoScope* _tmp0_;
2940
const gchar* _tmp1_;
2942
UnityDeprecatedScopeSearch* _tmp3_;
2943
UnityDeprecatedScopeSearch* _tmp4_;
2944
GeeArrayList* _tmp5_;
2945
GeeArrayList* _tmp6_;
2946
GCancellable* _tmp7_;
2947
GCancellable* _tmp8_;
2948
_data_ = g_slice_new0 (UnityVideoLensRemoteVideoScopePerformSearchData);
2949
_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_video_lens_remote_video_scope_perform_search);
2950
g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_video_lens_remote_video_scope_perform_search_data_free);
2951
_tmp0_ = _g_object_ref0 (self);
2952
_data_->self = _tmp0_;
2953
_tmp1_ = search_string;
2954
_tmp2_ = g_strdup (_tmp1_);
2955
_g_free0 (_data_->search_string);
2956
_data_->search_string = _tmp2_;
2958
_tmp4_ = _g_object_ref0 (_tmp3_);
2959
_g_object_unref0 (_data_->search);
2960
_data_->search = _tmp4_;
2961
_tmp5_ = active_sources;
2962
_tmp6_ = _g_object_ref0 (_tmp5_);
2963
_g_object_unref0 (_data_->active_sources);
2964
_data_->active_sources = _tmp6_;
2965
_tmp7_ = cancellable;
2966
_tmp8_ = _g_object_ref0 (_tmp7_);
2967
_g_object_unref0 (_data_->cancellable);
2968
_data_->cancellable = _tmp8_;
2969
unity_video_lens_remote_video_scope_perform_search_co (_data_);
2973
static void unity_video_lens_remote_video_scope_perform_search_finish (UnityVideoLensRemoteVideoScope* self, GAsyncResult* _res_, GError** error) {
2974
UnityVideoLensRemoteVideoScopePerformSearchData* _data_;
2975
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
2978
_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
2982
static Block2Data* block2_data_ref (Block2Data* _data2_) {
2983
g_atomic_int_inc (&_data2_->_ref_count_);
2988
static void block2_data_unref (void * _userdata_) {
2989
Block2Data* _data2_;
2990
_data2_ = (Block2Data*) _userdata_;
2991
if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
2992
UnityVideoLensRemoteVideoScope * self;
2993
self = _data2_->self;
2994
_g_object_unref0 (_data2_->msg);
2995
_g_object_unref0 (self);
2996
g_slice_free (Block2Data, _data2_);
3001
static void __lambda4_ (Block2Data* _data2_, SoupSession* session_, SoupMessage* msg_) {
3002
UnityVideoLensRemoteVideoScope * self;
3003
SoupMessage* _tmp0_;
3004
SoupMessage* _tmp1_;
3005
self = _data2_->self;
3006
g_return_if_fail (session_ != NULL);
3007
g_return_if_fail (msg_ != NULL);
3009
_tmp1_ = _g_object_ref0 (_tmp0_);
3010
_g_object_unref0 (_data2_->msg);
3011
_data2_->msg = _tmp1_;
3012
unity_video_lens_remote_video_scope_perform_search_co (_data2_->_async_data_);
3016
static void ___lambda4__soup_session_callback (SoupSession* session, SoupMessage* msg, gpointer self) {
3017
__lambda4_ (self, session, msg);
3021
static void ___lambda5_ (Block2Data* _data2_) {
3022
UnityVideoLensRemoteVideoScope * self;
3023
SoupSession* _tmp0_;
3024
SoupMessage* _tmp1_;
3025
self = _data2_->self;
3026
_data2_->cancelled = TRUE;
3027
_tmp0_ = self->priv->session;
3028
_tmp1_ = _data2_->msg;
3029
soup_session_cancel_message (_tmp0_, _tmp1_, (guint) SOUP_STATUS_CANCELLED);
3033
static void ____lambda5__gfunc (gconstpointer data, gpointer self) {
3038
static gboolean _unity_video_lens_remote_video_scope_perform_search_co_gsource_func (gpointer self) {
3040
result = unity_video_lens_remote_video_scope_perform_search_co (self);
3045
static gboolean unity_video_lens_remote_video_scope_perform_search_co (UnityVideoLensRemoteVideoScopePerformSearchData* _data_) {
3046
switch (_data_->_state_) {
3054
g_assert_not_reached ();
3057
_data_->_data2_ = g_slice_new0 (Block2Data);
3058
_data_->_data2_->_ref_count_ = 1;
3059
_data_->_data2_->self = g_object_ref (_data_->self);
3060
_data_->_data2_->_async_data_ = _data_;
3061
_data_->_tmp0_ = _data_->search;
3062
_data_->_tmp1_ = unity_deprecated_scope_search_get_results_model (_data_->_tmp0_);
3063
_data_->_tmp2_ = _data_->_tmp1_;
3064
dee_model_clear ((DeeModel*) _data_->_tmp2_);
3065
_data_->_tmp6_ = _data_->search_string;
3066
if (_data_->_tmp6_ == NULL) {
3067
_data_->_tmp5_ = TRUE;
3069
_data_->_tmp7_ = _data_->search_string;
3070
_data_->_tmp5_ = g_strcmp0 (_data_->_tmp7_, "") == 0;
3072
_data_->_tmp8_ = _data_->_tmp5_;
3073
if (_data_->_tmp8_) {
3074
_data_->_tmp9_ = _data_->active_sources;
3075
_data_->_tmp10_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp9_);
3076
_data_->_tmp11_ = _data_->_tmp10_;
3077
_data_->_tmp4_ = _data_->_tmp11_ == 0;
3079
_data_->_tmp4_ = FALSE;
3081
_data_->_tmp12_ = _data_->_tmp4_;
3082
if (_data_->_tmp12_) {
3083
_data_->_tmp13_ = _data_->self->priv->recommendations;
3084
_data_->_tmp14_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp13_);
3085
_data_->_tmp15_ = _data_->_tmp14_;
3086
_data_->_tmp3_ = _data_->_tmp15_ > 0;
3088
_data_->_tmp3_ = FALSE;
3090
_data_->_tmp16_ = _data_->_tmp3_;
3091
if (_data_->_tmp16_) {
3092
_data_->_tmp17_ = g_date_time_new_now_utc ();
3093
_data_->time = _data_->_tmp17_;
3094
_data_->_tmp18_ = _data_->time;
3095
_data_->_tmp19_ = 0LL;
3096
_data_->_tmp19_ = g_date_time_to_unix (_data_->_tmp18_);
3097
_data_->_tmp20_ = _data_->self->priv->recommendations_last_update;
3098
_data_->_tmp21_ = unity_video_lens_remote_video_scope_REFRESH_INTERVAL;
3099
if ((_data_->_tmp19_ - _data_->_tmp20_) < ((gint64) _data_->_tmp21_)) {
3100
g_debug ("remote-scope.vala:550: Updating search results with recommendations");
3101
_data_->_tmp22_ = _data_->search;
3102
_data_->_tmp23_ = unity_deprecated_scope_search_get_results_model (_data_->_tmp22_);
3103
_data_->_tmp24_ = _data_->_tmp23_;
3104
_data_->_tmp25_ = _data_->self->priv->recommendations;
3105
unity_video_lens_remote_video_scope_update_results_model (_data_->self, (DeeModel*) _data_->_tmp24_, _data_->_tmp25_);
3106
_g_date_time_unref0 (_data_->time);
3107
block2_data_unref (_data_->_data2_);
3108
_data_->_data2_ = NULL;
3109
if (_data_->_state_ == 0) {
3110
g_simple_async_result_complete_in_idle (_data_->_async_result);
3112
g_simple_async_result_complete (_data_->_async_result);
3114
g_object_unref (_data_->_async_result);
3117
_g_date_time_unref0 (_data_->time);
3119
_data_->_tmp26_ = _data_->search_string;
3120
_data_->_tmp27_ = _data_->active_sources;
3121
_data_->_tmp28_ = NULL;
3122
_data_->_tmp28_ = unity_video_lens_ubuntu_video_search_build_search_uri (_data_->_tmp26_, _data_->_tmp27_);
3123
_data_->url = _data_->_tmp28_;
3124
_data_->_tmp29_ = _data_->url;
3125
g_debug ("remote-scope.vala:557: Querying the server: %s", _data_->_tmp29_);
3126
_data_->_tmp32_ = _data_->search_string;
3127
if (_data_->_tmp32_ == NULL) {
3128
_data_->_tmp31_ = TRUE;
3130
_data_->_tmp33_ = _data_->search_string;
3131
_data_->_tmp31_ = g_strcmp0 (_data_->_tmp33_, "") == 0;
3133
_data_->_tmp34_ = _data_->_tmp31_;
3134
if (_data_->_tmp34_) {
3135
_data_->_tmp30_ = TRUE;
3137
_data_->_tmp35_ = _data_->active_sources;
3138
_data_->_tmp36_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp35_);
3139
_data_->_tmp37_ = _data_->_tmp36_;
3140
_data_->_tmp30_ = _data_->_tmp37_ == 0;
3142
_data_->_tmp38_ = _data_->_tmp30_;
3143
_data_->is_treat_yourself = _data_->_tmp38_;
3144
_data_->_tmp39_ = _data_->url;
3145
_data_->_tmp40_ = soup_message_new ("GET", _data_->_tmp39_);
3146
_data_->_data2_->msg = _data_->_tmp40_;
3147
_data_->_tmp41_ = _data_->self->priv->session;
3148
_data_->_tmp42_ = _data_->_data2_->msg;
3149
_data_->_tmp43_ = _g_object_ref0 (_data_->_tmp42_);
3150
soup_session_queue_message (_data_->_tmp41_, _data_->_tmp43_, ___lambda4__soup_session_callback, _data_->_data2_);
3151
_data_->_data2_->cancelled = FALSE;
3152
_data_->cancel_id = (gulong) 0;
3153
_data_->_tmp44_ = _data_->cancellable;
3154
if (_data_->_tmp44_ != NULL) {
3155
_data_->_tmp45_ = _data_->cancellable;
3156
_data_->_tmp46_ = 0UL;
3157
_data_->_tmp46_ = g_cancellable_connect (_data_->_tmp45_, (GCallback) ____lambda5__gfunc, block2_data_ref (_data_->_data2_), block2_data_unref);
3158
_data_->cancel_id = _data_->_tmp46_;
3160
_data_->_state_ = 1;
3164
_data_->_tmp47_ = _data_->_data2_->cancelled;
3165
if (_data_->_tmp47_) {
3166
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _unity_video_lens_remote_video_scope_perform_search_co_gsource_func, _data_, NULL);
3167
_data_->_state_ = 2;
3171
_data_->_tmp48_ = _data_->cancellable;
3172
_data_->_tmp49_ = _data_->cancel_id;
3173
g_cancellable_disconnect (_data_->_tmp48_, _data_->_tmp49_);
3174
_data_->_tmp50_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED, "Cancelled");
3175
_data_->_inner_error_ = _data_->_tmp50_;
3176
g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
3177
g_error_free (_data_->_inner_error_);
3178
_g_free0 (_data_->url);
3179
block2_data_unref (_data_->_data2_);
3180
_data_->_data2_ = NULL;
3181
if (_data_->_state_ == 0) {
3182
g_simple_async_result_complete_in_idle (_data_->_async_result);
3184
g_simple_async_result_complete (_data_->_async_result);
3186
g_object_unref (_data_->_async_result);
3189
_data_->_tmp51_ = _data_->cancellable;
3190
if (_data_->_tmp51_ != NULL) {
3191
_data_->_tmp52_ = _data_->cancellable;
3192
_data_->_tmp53_ = _data_->cancel_id;
3193
g_cancellable_disconnect (_data_->_tmp52_, _data_->_tmp53_);
3195
_data_->_tmp54_ = _data_->_data2_->msg;
3196
_data_->_tmp55_ = _data_->is_treat_yourself;
3197
_data_->_tmp56_ = NULL;
3198
_data_->_tmp56_ = unity_video_lens_remote_video_scope_handle_search_response (_data_->self, _data_->_tmp54_, _data_->_tmp55_);
3199
_data_->results = _data_->_tmp56_;
3200
_data_->_tmp57_ = _data_->results;
3201
if (_data_->_tmp57_ != NULL) {
3202
_data_->_tmp59_ = _data_->search_string;
3203
if (_data_->_tmp59_ == NULL) {
3204
_data_->_tmp58_ = TRUE;
3206
_data_->_tmp61_ = _data_->search_string;
3207
_data_->_tmp62_ = NULL;
3208
_data_->_tmp62_ = string_strip (_data_->_tmp61_);
3209
_data_->_tmp63_ = _data_->_tmp62_;
3210
_data_->_tmp64_ = g_strcmp0 (_data_->_tmp63_, "") == 0;
3211
_g_free0 (_data_->_tmp63_);
3212
if (_data_->_tmp64_) {
3213
_data_->_tmp65_ = _data_->active_sources;
3214
_data_->_tmp66_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp65_);
3215
_data_->_tmp67_ = _data_->_tmp66_;
3216
_data_->_tmp60_ = _data_->_tmp67_ == 0;
3218
_data_->_tmp60_ = FALSE;
3220
_data_->_tmp68_ = _data_->_tmp60_;
3221
_data_->_tmp58_ = _data_->_tmp68_;
3223
_data_->_tmp69_ = _data_->_tmp58_;
3224
if (_data_->_tmp69_) {
3225
g_debug ("remote-scope.vala:603: Empty search, updating recommendations");
3226
_data_->_tmp70_ = g_date_time_new_now_utc ();
3227
_data_->_vala1_time = _data_->_tmp70_;
3228
_data_->_tmp71_ = _data_->results;
3229
_data_->_tmp72_ = _g_object_ref0 (_data_->_tmp71_);
3230
_g_object_unref0 (_data_->self->priv->recommendations);
3231
_data_->self->priv->recommendations = _data_->_tmp72_;
3232
_data_->_tmp73_ = _data_->_vala1_time;
3233
_data_->_tmp74_ = 0LL;
3234
_data_->_tmp74_ = g_date_time_to_unix (_data_->_tmp73_);
3235
_data_->self->priv->recommendations_last_update = _data_->_tmp74_;
3236
_g_date_time_unref0 (_data_->_vala1_time);
3238
_data_->_tmp75_ = _data_->search;
3239
_data_->_tmp76_ = unity_deprecated_scope_search_get_results_model (_data_->_tmp75_);
3240
_data_->_tmp77_ = _data_->_tmp76_;
3241
_data_->_tmp78_ = _data_->results;
3242
unity_video_lens_remote_video_scope_update_results_model (_data_->self, (DeeModel*) _data_->_tmp77_, _data_->_tmp78_);
3244
_g_object_unref0 (_data_->results);
3245
_g_free0 (_data_->url);
3246
block2_data_unref (_data_->_data2_);
3247
_data_->_data2_ = NULL;
3248
if (_data_->_state_ == 0) {
3249
g_simple_async_result_complete_in_idle (_data_->_async_result);
3251
g_simple_async_result_complete (_data_->_async_result);
3253
g_object_unref (_data_->_async_result);
3258
static GVariant* _variant_new1 (const gchar* value) {
3259
return g_variant_ref_sink (g_variant_new_string (value));
3263
static GVariant* _variant_new2 (gboolean value) {
3264
return g_variant_ref_sink (g_variant_new_boolean (value));
3268
static void unity_video_lens_remote_video_scope_update_results_model (UnityVideoLensRemoteVideoScope* self, DeeModel* model, GeeArrayList* results) {
3269
g_return_if_fail (self != NULL);
3270
g_return_if_fail (model != NULL);
3271
g_return_if_fail (results != NULL);
3273
GeeArrayList* _tmp0_;
3274
GeeArrayList* _tmp1_;
3275
GeeArrayList* _video_list;
3276
GeeArrayList* _tmp2_;
3282
_tmp1_ = _g_object_ref0 (_tmp0_);
3283
_video_list = _tmp1_;
3284
_tmp2_ = _video_list;
3285
_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
3287
_video_size = _tmp4_;
3293
GeeArrayList* _tmp8_;
3295
gpointer _tmp10_ = NULL;
3296
UnityVideoLensRemoteVideoFile* video;
3297
UnityVideoLensRemoteVideoFile* _tmp11_;
3298
const gchar* _tmp12_;
3299
gboolean _tmp13_ = FALSE;
3300
_tmp5_ = _video_index;
3301
_video_index = _tmp5_ + 1;
3302
_tmp6_ = _video_index;
3303
_tmp7_ = _video_size;
3304
if (!(_tmp6_ < _tmp7_)) {
3307
_tmp8_ = _video_list;
3308
_tmp9_ = _video_index;
3309
_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
3310
video = (UnityVideoLensRemoteVideoFile*) _tmp10_;
3312
_tmp12_ = (*_tmp11_).uri;
3313
_tmp13_ = g_str_has_prefix (_tmp12_, "http");
3315
UnityVideoLensRemoteVideoFile* _tmp14_;
3316
const gchar* _tmp15_;
3317
UnityVideoLensRemoteVideoFile* _tmp16_;
3318
const gchar* _tmp17_;
3319
UnityVideoLensRemoteVideoFile* _tmp18_;
3320
const gchar* _tmp19_;
3321
UnityVideoLensRemoteUri* _tmp20_;
3322
UnityVideoLensRemoteUri* fake_uri;
3323
UnityVideoLensRemoteUri* _tmp21_;
3324
UnityVideoLensRemoteVideoFile* _tmp22_;
3325
const gchar* _tmp23_;
3328
gboolean _tmp25_ = FALSE;
3329
gboolean _tmp26_ = FALSE;
3330
UnityVideoLensRemoteVideoFile* _tmp27_;
3335
const gchar* _tmp49_;
3337
UnityVideoLensRemoteVideoFile* _tmp51_;
3346
const GVariantType* _tmp59_;
3347
const GVariantType* _tmp60_ = NULL;
3350
GVariant** _tmp63_ = NULL;
3352
gint _tmp64__length1;
3357
UnityVideoLensRemoteUri* _tmp68_;
3358
gchar* _tmp69_ = NULL;
3360
const gchar* _tmp71_;
3361
UnityVideoLensRemoteVideoFile* _tmp72_;
3363
UnityVideoLensRemoteVideoFile* _tmp74_;
3364
const gchar* _tmp75_;
3365
UnityVideoLensRemoteVideoFile* _tmp76_;
3366
const gchar* _tmp77_;
3367
UnityVideoLensRemoteVideoFile* _tmp78_;
3368
const gchar* _tmp79_;
3371
_tmp15_ = (*_tmp14_).uri;
3373
_tmp17_ = (*_tmp16_).title;
3375
_tmp19_ = (*_tmp18_).icon;
3376
_tmp20_ = unity_video_lens_remote_uri_new (_tmp15_, _tmp17_, _tmp19_, "video.details_uri");
3379
if (_tmp21_ == NULL) {
3380
g_warning ("remote-scope.vala:623: fake_uri is null");
3383
_tmp23_ = (*_tmp22_).icon;
3384
_tmp24_ = g_strdup (_tmp23_);
3385
result_icon = _tmp24_;
3387
_tmp28_ = (*_tmp27_).category;
3388
_tmp29_ = unity_video_lens_CAT_INDEX_MORE;
3389
if (_tmp28_ == _tmp29_) {
3390
UnityVideoLensRemoteVideoFile* _tmp30_;
3391
const gchar* _tmp31_;
3393
_tmp31_ = (*_tmp30_).price;
3394
_tmp26_ = _tmp31_ != NULL;
3400
UnityVideoLensRemoteVideoFile* _tmp33_;
3401
const gchar* _tmp34_;
3403
_tmp34_ = (*_tmp33_).price;
3404
_tmp25_ = g_strcmp0 (_tmp34_, "") != 0;
3410
const gchar* _tmp36_;
3411
GFile* _tmp37_ = NULL;
3415
UnityAnnotatedIcon* _tmp41_;
3416
UnityAnnotatedIcon* _tmp42_;
3417
UnityAnnotatedIcon* anno_icon;
3418
UnityAnnotatedIcon* _tmp43_;
3419
UnityAnnotatedIcon* _tmp44_;
3420
UnityVideoLensRemoteVideoFile* _tmp45_;
3421
const gchar* _tmp46_;
3422
UnityAnnotatedIcon* _tmp47_;
3423
gchar* _tmp48_ = NULL;
3424
_tmp36_ = result_icon;
3425
_tmp37_ = g_file_new_for_uri (_tmp36_);
3427
_tmp39_ = (GFileIcon*) g_file_icon_new (_tmp38_);
3429
_tmp41_ = unity_annotated_icon_new ((GIcon*) _tmp40_);
3431
_g_object_unref0 (_tmp40_);
3432
_g_object_unref0 (_tmp38_);
3433
anno_icon = _tmp42_;
3434
_tmp43_ = anno_icon;
3435
unity_annotated_icon_set_category (_tmp43_, UNITY_CATEGORY_TYPE_MOVIE);
3436
_tmp44_ = anno_icon;
3438
_tmp46_ = (*_tmp45_).price;
3439
unity_annotated_icon_set_ribbon (_tmp44_, _tmp46_);
3440
_tmp47_ = anno_icon;
3441
_tmp48_ = unity_annotated_icon_to_string (_tmp47_);
3442
_g_free0 (result_icon);
3443
result_icon = _tmp48_;
3444
_g_object_unref0 (anno_icon);
3446
_tmp49_ = unity_video_lens_remote_video_scope_PREVIEW_ON_LMB;
3447
_tmp50_ = _variant_new1 (_tmp49_);
3449
_tmp52_ = (*_tmp51_).category;
3450
_tmp53_ = unity_video_lens_CAT_INDEX_MORE;
3451
_tmp54_ = _variant_new2 (_tmp52_ == _tmp53_);
3452
_tmp55_ = g_variant_new_variant (_tmp54_);
3453
g_variant_ref_sink (_tmp55_);
3455
_tmp57_ = g_variant_new_dict_entry (_tmp50_, _tmp56_);
3456
g_variant_ref_sink (_tmp57_);
3458
_g_variant_unref0 (_tmp56_);
3460
_tmp59_ = G_VARIANT_TYPE_VARDICT;
3461
_tmp60_ = g_variant_type_element (_tmp59_);
3463
_tmp62_ = _g_variant_ref0 (_tmp61_);
3464
_tmp63_ = g_new0 (GVariant*, 1 + 1);
3465
_tmp63_[0] = _tmp62_;
3467
_tmp64__length1 = 1;
3468
_tmp65_ = g_variant_new_array (_tmp60_, _tmp64_, 1);
3469
g_variant_ref_sink (_tmp65_);
3471
_tmp64_ = (_vala_array_free (_tmp64_, _tmp64__length1, (GDestroyNotify) g_variant_unref), NULL);
3475
_tmp69_ = unity_video_lens_remote_uri_to_rawuri (_tmp68_);
3477
_tmp71_ = result_icon;
3479
_tmp73_ = (*_tmp72_).category;
3481
_tmp75_ = (*_tmp74_).title;
3483
_tmp77_ = (*_tmp76_).comment;
3485
_tmp79_ = (*_tmp78_).uri;
3487
dee_model_append (_tmp67_, _tmp70_, _tmp71_, _tmp73_, UNITY_RESULT_TYPE_DEFAULT, "text/html", _tmp75_, _tmp77_, _tmp79_, _tmp80_, NULL);
3489
_g_variant_unref0 (metadata);
3490
_g_variant_unref0 (realcat);
3491
_g_free0 (result_icon);
3492
_unity_video_lens_remote_uri_unref0 (fake_uri);
3494
_unity_video_lens_remote_video_file_free0 (video);
3496
_g_object_unref0 (_video_list);
3501
static gpointer _g_ptr_array_ref0 (gpointer self) {
3502
return self ? g_ptr_array_ref (self) : NULL;
3506
static void unity_video_lens_remote_video_scope_zeitgeist_init (UnityVideoLensRemoteVideoScope* self, GError** error) {
3507
ZeitgeistDataSourceRegistry* _tmp0_;
3509
GPtrArray* templates;
3510
ZeitgeistEvent* _tmp2_;
3512
GObject* _tmp3_ = NULL;
3514
ZeitgeistDataSource* _tmp5_;
3515
ZeitgeistDataSource* data_source;
3516
ZeitgeistDataSourceRegistry* _tmp6_;
3517
ZeitgeistDataSource* _tmp7_;
3518
g_return_if_fail (self != NULL);
3519
_tmp0_ = zeitgeist_data_source_registry_new ();
3520
_g_object_unref0 (self->priv->zg_sources);
3521
self->priv->zg_sources = _tmp0_;
3522
_tmp1_ = g_ptr_array_sized_new ((guint) 1);
3524
_tmp2_ = zeitgeist_event_new_full (ZEITGEIST_ZG_ACCESS_EVENT, ZEITGEIST_ZG_USER_ACTIVITY, "lens://unity-lens-video", NULL);
3525
g_object_ref_sink (_tmp2_);
3527
_tmp3_ = g_object_ref (G_TYPE_CHECK_INSTANCE_TYPE (ev, G_TYPE_OBJECT) ? ((GObject*) ev) : NULL);
3528
g_ptr_array_add (templates, _tmp3_);
3529
_tmp4_ = _g_ptr_array_ref0 (templates);
3530
_tmp5_ = zeitgeist_data_source_new_full ("98898", "Unity Video Lens", "", _tmp4_);
3531
g_object_ref_sink (_tmp5_);
3532
data_source = _tmp5_;
3533
_tmp6_ = self->priv->zg_sources;
3534
_tmp7_ = _g_object_ref0 (data_source);
3535
zeitgeist_data_source_registry_register_data_source (_tmp6_, _tmp7_, NULL, NULL, NULL);
3536
_g_object_unref0 (data_source);
3537
_g_object_unref0 (ev);
3538
_g_ptr_array_unref0 (templates);
3542
static void unity_video_lens_remote_video_scope_zeitgeist_insert_event (UnityVideoLensRemoteVideoScope* self, const gchar* uri, const gchar* title, const gchar* icon) {
3543
const gchar* _tmp0_;
3544
const gchar* _tmp1_;
3545
const gchar* _tmp2_;
3546
const gchar* _tmp3_;
3547
ZeitgeistSubject* _tmp4_;
3548
ZeitgeistSubject* subject;
3549
ZeitgeistEvent* _tmp5_;
3550
ZeitgeistEvent* event;
3552
GPtrArray* ev_array;
3553
GObject* _tmp7_ = NULL;
3554
ZeitgeistLog* _tmp8_ = NULL;
3556
g_return_if_fail (self != NULL);
3557
g_return_if_fail (uri != NULL);
3558
g_return_if_fail (title != NULL);
3559
g_return_if_fail (icon != NULL);
3564
_tmp4_ = zeitgeist_subject_new_full (_tmp0_, ZEITGEIST_NFO_VIDEO, ZEITGEIST_NFO_REMOTE_DATA_OBJECT, "", _tmp1_, _tmp2_, _tmp3_);
3565
g_object_ref_sink (_tmp4_);
3567
_tmp5_ = zeitgeist_event_new_full (ZEITGEIST_ZG_ACCESS_EVENT, ZEITGEIST_ZG_USER_ACTIVITY, "lens://unity-lens-video", NULL);
3568
g_object_ref_sink (_tmp5_);
3570
zeitgeist_event_add_subject (event, subject);
3571
_tmp6_ = g_ptr_array_sized_new ((guint) 1);
3573
_tmp7_ = g_object_ref (G_TYPE_CHECK_INSTANCE_TYPE (event, G_TYPE_OBJECT) ? ((GObject*) event) : NULL);
3574
g_ptr_array_add (ev_array, _tmp7_);
3575
_tmp8_ = zeitgeist_log_get_default ();
3576
_tmp9_ = _g_ptr_array_ref0 (ev_array);
3577
zeitgeist_log_insert_events_from_ptrarray (_tmp8_, _tmp9_, NULL, NULL, NULL);
3578
_g_ptr_array_unref0 (ev_array);
3579
_g_object_unref0 (event);
3580
_g_object_unref0 (subject);
3584
static void unity_video_lens_remote_video_scope_class_init (UnityVideoLensRemoteVideoScopeClass * klass) {
3587
unity_video_lens_remote_video_scope_parent_class = g_type_class_peek_parent (klass);
3588
g_type_class_add_private (klass, sizeof (UnityVideoLensRemoteVideoScopePrivate));
3589
G_OBJECT_CLASS (klass)->constructed = unity_video_lens_remote_video_scope_real_constructed;
3590
UNITY_DEPRECATED_SCOPE_CLASS (klass)->activate_result = unity_video_lens_remote_video_scope_real_activate_result;
3591
UNITY_DEPRECATED_SCOPE_CLASS (klass)->activate_result_finish = unity_video_lens_remote_video_scope_real_activate_result_finish;
3592
UNITY_DEPRECATED_SCOPE_CLASS (klass)->preview_result = unity_video_lens_remote_video_scope_real_preview_result;
3593
UNITY_DEPRECATED_SCOPE_CLASS (klass)->preview_result_finish = unity_video_lens_remote_video_scope_real_preview_result_finish;
3594
G_OBJECT_CLASS (klass)->finalize = unity_video_lens_remote_video_scope_finalize;
3595
_tmp0_ = g_strdup ("Unknown");
3596
unity_video_lens_remote_video_scope_IS_IN_CHINA = _tmp0_;
3597
_tmp1_ = g_strdup ("lmb-preview");
3598
unity_video_lens_remote_video_scope_PREVIEW_ON_LMB = _tmp1_;
3602
static void unity_video_lens_remote_video_scope_instance_init (UnityVideoLensRemoteVideoScope * self) {
3603
UnityPreferencesManager* _tmp0_ = NULL;
3604
self->priv = UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_GET_PRIVATE (self);
3605
_tmp0_ = unity_preferences_manager_get_default ();
3606
self->priv->preferences = _tmp0_;
3607
self->priv->recommendations_last_update = (gint64) 0;
3611
static void unity_video_lens_remote_video_scope_finalize (GObject* obj) {
3612
UnityVideoLensRemoteVideoScope * self;
3613
self = G_TYPE_CHECK_INSTANCE_CAST (obj, UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE, UnityVideoLensRemoteVideoScope);
3614
_g_object_unref0 (self->priv->session);
3615
_g_object_unref0 (self->priv->preferences);
3616
_g_object_unref0 (self->priv->recommendations);
3617
_g_object_unref0 (self->priv->zg_sources);
3618
G_OBJECT_CLASS (unity_video_lens_remote_video_scope_parent_class)->finalize (obj);
3622
GType unity_video_lens_remote_video_scope_get_type (void) {
3623
static volatile gsize unity_video_lens_remote_video_scope_type_id__volatile = 0;
3624
if (g_once_init_enter (&unity_video_lens_remote_video_scope_type_id__volatile)) {
3625
static const GTypeInfo g_define_type_info = { sizeof (UnityVideoLensRemoteVideoScopeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_video_lens_remote_video_scope_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityVideoLensRemoteVideoScope), 0, (GInstanceInitFunc) unity_video_lens_remote_video_scope_instance_init, NULL };
3626
GType unity_video_lens_remote_video_scope_type_id;
3627
unity_video_lens_remote_video_scope_type_id = g_type_register_static (UNITY_TYPE_DEPRECATED_SCOPE, "UnityVideoLensRemoteVideoScope", &g_define_type_info, 0);
3628
g_once_init_leave (&unity_video_lens_remote_video_scope_type_id__volatile, unity_video_lens_remote_video_scope_type_id);
3630
return unity_video_lens_remote_video_scope_type_id__volatile;
3634
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
3635
if ((array != NULL) && (destroy_func != NULL)) {
3637
for (i = 0; i < array_length; i = i + 1) {
3638
if (((gpointer*) array)[i] != NULL) {
3639
destroy_func (((gpointer*) array)[i]);
3646
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
3647
_vala_array_destroy (array, array_length, destroy_func);