~pishuilu1128/unity-china-video-scope/unity-china-video-scope

« back to all changes in this revision

Viewing changes to src/remote-video-main.c

  • Committer: Package Import Robot
  • Author(s): shijing
  • Date: 2013-07-20 17:01:30 UTC
  • Revision ID: package-import@ubuntu.com-20130720170130-ngvubtekpiuzfrls
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* remote-video-main.c generated by valac 0.20.1, the Vala compiler
 
2
 * generated from remote-video-main.vala, do not modify */
 
3
 
 
4
/*
 
5
 * Copyright (C) 2012 Canonical Ltd
 
6
 *
 
7
 * This program is free software: you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License version 3 as
 
9
 * published by the Free Software Foundation.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#include <glib.h>
 
21
#include <glib-object.h>
 
22
#include <stdlib.h>
 
23
#include <string.h>
 
24
#include <unity.h>
 
25
#include <gio/gio.h>
 
26
#include <glib/gi18n-lib.h>
 
27
#include <locale.h>
 
28
#include <unity-extras.h>
 
29
 
 
30
 
 
31
#define UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE (unity_video_lens_remote_video_scope_get_type ())
 
32
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE, UnityVideoLensRemoteVideoScope))
 
33
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE, UnityVideoLensRemoteVideoScopeClass))
 
34
#define UNITY_VIDEO_LENS_IS_REMOTE_VIDEO_SCOPE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE))
 
35
#define UNITY_VIDEO_LENS_IS_REMOTE_VIDEO_SCOPE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE))
 
36
#define UNITY_VIDEO_LENS_REMOTE_VIDEO_SCOPE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_VIDEO_LENS_TYPE_REMOTE_VIDEO_SCOPE, UnityVideoLensRemoteVideoScopeClass))
 
37
 
 
38
typedef struct _UnityVideoLensRemoteVideoScope UnityVideoLensRemoteVideoScope;
 
39
typedef struct _UnityVideoLensRemoteVideoScopeClass UnityVideoLensRemoteVideoScopeClass;
 
40
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
 
41
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
42
 
 
43
 
 
44
extern UnityDeprecatedScope* unity_video_lens_scope;
 
45
UnityDeprecatedScope* unity_video_lens_scope = NULL;
 
46
extern GApplication* unity_video_lens_app;
 
47
GApplication* unity_video_lens_app = NULL;
 
48
 
 
49
#define UNITY_VIDEO_LENS_BUS_NAME "net.launchpad.scope.YoukuVideos"
 
50
gint unity_video_lens_main (gchar** args, int args_length1);
 
51
#define CONFIG_PACKAGE "unity-china-video-scope"
 
52
#define CONFIG_LOCALEDIR "/usr/share/locale"
 
53
static void ___lambda2_ (void);
 
54
UnityVideoLensRemoteVideoScope* unity_video_lens_remote_video_scope_new (void);
 
55
UnityVideoLensRemoteVideoScope* unity_video_lens_remote_video_scope_construct (GType object_type);
 
56
GType unity_video_lens_remote_video_scope_get_type (void) G_GNUC_CONST;
 
57
static void ____lambda2__unity_extras_create_scope_callback (gpointer self);
 
58
 
 
59
 
 
60
static void ___lambda2_ (void) {
 
61
        UnityVideoLensRemoteVideoScope* _tmp0_;
 
62
        UnityDeprecatedScope* _tmp1_;
 
63
        GError * _inner_error_ = NULL;
 
64
        _tmp0_ = unity_video_lens_remote_video_scope_new ();
 
65
        _g_object_unref0 (unity_video_lens_scope);
 
66
        unity_video_lens_scope = (UnityDeprecatedScope*) _tmp0_;
 
67
        _tmp1_ = unity_video_lens_scope;
 
68
        unity_deprecated_scope_base_export ((UnityDeprecatedScopeBase*) _tmp1_, &_inner_error_);
 
69
        if (_inner_error_ != NULL) {
 
70
                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);
 
71
                g_clear_error (&_inner_error_);
 
72
                return;
 
73
        }
 
74
}
 
75
 
 
76
 
 
77
static void ____lambda2__unity_extras_create_scope_callback (gpointer self) {
 
78
        ___lambda2_ ();
 
79
}
 
80
 
 
81
 
 
82
gint unity_video_lens_main (gchar** args, int args_length1) {
 
83
        gint result = 0;
 
84
        GApplication* _tmp4_;
 
85
        GApplication* _tmp5_;
 
86
        gint _tmp6_ = 0;
 
87
        GError * _inner_error_ = NULL;
 
88
        g_set_prgname ("unity-remote-video-scope");
 
89
        textdomain (CONFIG_PACKAGE);
 
90
        bindtextdomain (CONFIG_PACKAGE, CONFIG_LOCALEDIR);
 
91
        bind_textdomain_codeset (CONFIG_PACKAGE, "UTF-8");
 
92
        setlocale (LC_ALL, "");
 
93
        {
 
94
                GApplication* _tmp0_ = NULL;
 
95
                GApplication* _tmp1_;
 
96
                _tmp0_ = unity_extras_dbus_own_name (UNITY_VIDEO_LENS_BUS_NAME, ____lambda2__unity_extras_create_scope_callback, NULL, &_inner_error_);
 
97
                _tmp1_ = _tmp0_;
 
98
                if (_inner_error_ != NULL) {
 
99
                        goto __catch0_g_error;
 
100
                }
 
101
                _g_object_unref0 (unity_video_lens_app);
 
102
                unity_video_lens_app = _tmp1_;
 
103
        }
 
104
        goto __finally0;
 
105
        __catch0_g_error:
 
106
        {
 
107
                GError* e = NULL;
 
108
                GError* _tmp2_;
 
109
                const gchar* _tmp3_;
 
110
                e = _inner_error_;
 
111
                _inner_error_ = NULL;
 
112
                _tmp2_ = e;
 
113
                _tmp3_ = _tmp2_->message;
 
114
                g_warning ("remote-video-main.vala:47: Failed to start video lens daemon: %s\n", _tmp3_);
 
115
                result = 1;
 
116
                _g_error_free0 (e);
 
117
                return result;
 
118
        }
 
119
        __finally0:
 
120
        if (_inner_error_ != NULL) {
 
121
                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);
 
122
                g_clear_error (&_inner_error_);
 
123
                return 0;
 
124
        }
 
125
        _tmp4_ = unity_video_lens_app;
 
126
        if (_tmp4_ == NULL) {
 
127
                g_warning ("remote-video-main.vala:53: %s", "Another instance of the Unity Videos Lens " "already appears to be running.\nBailing out.\n");
 
128
                result = 2;
 
129
                return result;
 
130
        }
 
131
        _tmp5_ = unity_video_lens_app;
 
132
        _tmp6_ = g_application_run (_tmp5_, 0, NULL);
 
133
        result = _tmp6_;
 
134
        return result;
 
135
}
 
136
 
 
137
 
 
138
int main (int argc, char ** argv) {
 
139
        g_type_init ();
 
140
        return unity_video_lens_main (argv, argc);
 
141
}
 
142
 
 
143
 
 
144