~ubuntu-branches/ubuntu/wily/baobab/wily-proposed

« back to all changes in this revision

Viewing changes to src/baobab-connect-server.c

  • Committer: Package Import Robot
  • Author(s): Jackson Doak
  • Date: 2014-10-15 23:15:13 UTC
  • mfrom: (2.2.1 experimental) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20141015231513-6cpun88orgfpyzdv
Tags: 3.14.1-1ubuntu1
* Merge from Debian unstable. (LP: #1268721) Remaining changes:
* debian/patches/use_traditional_titlebars_in_unity.patch:
  - Use the traditional menubar under Unity
* debian/patches/git_fix_pie_chart.patch:
  - Fx top level pie chart. (LP: #1393333)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* baobab-connect-server.c generated by valac 0.20.1.4-f5a54, the Vala compiler
 
1
/* baobab-connect-server.c generated by valac 0.26.0.7-2832, the Vala compiler
2
2
 * generated from baobab-connect-server.vala, do not modify */
3
3
 
4
4
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
69
69
static const gchar* BAOBAB_CONNECT_SERVER_argv[3] = {"nautilus-connect-server", "--print-uri", NULL};
70
70
 
71
71
static void baobab_connect_server_on_child_watch (BaobabConnectServer* self, GPid pid, gint status) {
72
 
        GPid _tmp0_;
 
72
        GPid _tmp0_ = 0;
73
73
        g_return_if_fail (self != NULL);
74
74
        _tmp0_ = pid;
75
75
        g_spawn_close_pid (_tmp0_);
78
78
 
79
79
static gchar* string_slice (const gchar* self, glong start, glong end) {
80
80
        gchar* result = NULL;
81
 
        gint _tmp0_;
82
 
        gint _tmp1_;
83
 
        glong string_length;
84
 
        glong _tmp2_;
85
 
        glong _tmp5_;
 
81
        glong string_length = 0L;
 
82
        gint _tmp0_ = 0;
 
83
        gint _tmp1_ = 0;
 
84
        glong _tmp2_ = 0L;
 
85
        glong _tmp5_ = 0L;
86
86
        gboolean _tmp8_ = FALSE;
87
 
        glong _tmp9_;
88
 
        gboolean _tmp12_;
89
 
        gboolean _tmp13_ = FALSE;
90
 
        glong _tmp14_;
91
 
        gboolean _tmp17_;
92
 
        glong _tmp18_;
93
 
        glong _tmp19_;
94
 
        glong _tmp20_;
95
 
        glong _tmp21_;
96
 
        glong _tmp22_;
97
 
        gchar* _tmp23_ = NULL;
 
87
        glong _tmp9_ = 0L;
 
88
        gboolean _tmp12_ = FALSE;
 
89
        glong _tmp13_ = 0L;
 
90
        glong _tmp16_ = 0L;
 
91
        glong _tmp17_ = 0L;
 
92
        glong _tmp18_ = 0L;
 
93
        glong _tmp19_ = 0L;
 
94
        glong _tmp20_ = 0L;
 
95
        gchar* _tmp21_ = NULL;
98
96
        g_return_val_if_fail (self != NULL, NULL);
99
97
        _tmp0_ = strlen (self);
100
98
        _tmp1_ = _tmp0_;
101
99
        string_length = (glong) _tmp1_;
102
100
        _tmp2_ = start;
103
101
        if (_tmp2_ < ((glong) 0)) {
104
 
                glong _tmp3_;
105
 
                glong _tmp4_;
 
102
                glong _tmp3_ = 0L;
 
103
                glong _tmp4_ = 0L;
106
104
                _tmp3_ = string_length;
107
105
                _tmp4_ = start;
108
106
                start = _tmp3_ + _tmp4_;
109
107
        }
110
108
        _tmp5_ = end;
111
109
        if (_tmp5_ < ((glong) 0)) {
112
 
                glong _tmp6_;
113
 
                glong _tmp7_;
 
110
                glong _tmp6_ = 0L;
 
111
                glong _tmp7_ = 0L;
114
112
                _tmp6_ = string_length;
115
113
                _tmp7_ = end;
116
114
                end = _tmp6_ + _tmp7_;
117
115
        }
118
116
        _tmp9_ = start;
119
117
        if (_tmp9_ >= ((glong) 0)) {
120
 
                glong _tmp10_;
121
 
                glong _tmp11_;
 
118
                glong _tmp10_ = 0L;
 
119
                glong _tmp11_ = 0L;
122
120
                _tmp10_ = start;
123
121
                _tmp11_ = string_length;
124
122
                _tmp8_ = _tmp10_ <= _tmp11_;
125
123
        } else {
126
124
                _tmp8_ = FALSE;
127
125
        }
128
 
        _tmp12_ = _tmp8_;
 
126
        g_return_val_if_fail (_tmp8_, NULL);
 
127
        _tmp13_ = end;
 
128
        if (_tmp13_ >= ((glong) 0)) {
 
129
                glong _tmp14_ = 0L;
 
130
                glong _tmp15_ = 0L;
 
131
                _tmp14_ = end;
 
132
                _tmp15_ = string_length;
 
133
                _tmp12_ = _tmp14_ <= _tmp15_;
 
134
        } else {
 
135
                _tmp12_ = FALSE;
 
136
        }
129
137
        g_return_val_if_fail (_tmp12_, NULL);
130
 
        _tmp14_ = end;
131
 
        if (_tmp14_ >= ((glong) 0)) {
132
 
                glong _tmp15_;
133
 
                glong _tmp16_;
134
 
                _tmp15_ = end;
135
 
                _tmp16_ = string_length;
136
 
                _tmp13_ = _tmp15_ <= _tmp16_;
137
 
        } else {
138
 
                _tmp13_ = FALSE;
139
 
        }
140
 
        _tmp17_ = _tmp13_;
141
 
        g_return_val_if_fail (_tmp17_, NULL);
 
138
        _tmp16_ = start;
 
139
        _tmp17_ = end;
 
140
        g_return_val_if_fail (_tmp16_ <= _tmp17_, NULL);
142
141
        _tmp18_ = start;
143
142
        _tmp19_ = end;
144
 
        g_return_val_if_fail (_tmp18_ <= _tmp19_, NULL);
145
143
        _tmp20_ = start;
146
 
        _tmp21_ = end;
147
 
        _tmp22_ = start;
148
 
        _tmp23_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) (_tmp21_ - _tmp22_));
149
 
        result = _tmp23_;
 
144
        _tmp21_ = g_strndup (((gchar*) self) + _tmp18_, (gsize) (_tmp19_ - _tmp20_));
 
145
        result = _tmp21_;
150
146
        return result;
151
147
}
152
148
 
153
149
 
154
150
static gboolean baobab_connect_server_on_out_watch (BaobabConnectServer* self, GIOChannel* channel, GIOCondition cond) {
155
151
        gboolean result = FALSE;
156
 
        gchar* uri;
157
 
        GIOCondition _tmp0_;
158
 
        const gchar* _tmp9_;
 
152
        gchar* uri = NULL;
 
153
        GIOCondition _tmp0_ = 0;
 
154
        const gchar* _tmp9_ = NULL;
159
155
        GError * _inner_error_ = NULL;
160
156
        g_return_val_if_fail (self != NULL, FALSE);
161
157
        g_return_val_if_fail (channel != NULL, FALSE);
165
161
                {
166
162
                        gsize len = 0UL;
167
163
                        gsize lineend = 0UL;
168
 
                        GIOChannel* _tmp1_;
 
164
                        GIOChannel* _tmp1_ = NULL;
169
165
                        gchar* _tmp2_ = NULL;
170
166
                        gsize _tmp3_ = 0UL;
171
167
                        gsize _tmp4_ = 0UL;
172
 
                        gsize _tmp5_;
 
168
                        gsize _tmp5_ = 0UL;
173
169
                        _tmp1_ = channel;
174
170
                        g_io_channel_read_line (_tmp1_, &_tmp2_, &_tmp3_, &_tmp4_, &_inner_error_);
175
171
                        _g_free0 (uri);
176
172
                        uri = _tmp2_;
177
173
                        len = _tmp3_;
178
174
                        lineend = _tmp4_;
179
 
                        if (_inner_error_ != NULL) {
180
 
                                goto __catch2_g_error;
 
175
                        if (G_UNLIKELY (_inner_error_ != NULL)) {
 
176
                                goto __catch1_g_error;
181
177
                        }
182
178
                        _tmp5_ = len;
183
179
                        if (_tmp5_ > ((gsize) 0)) {
184
 
                                const gchar* _tmp6_;
185
 
                                gsize _tmp7_;
 
180
                                const gchar* _tmp6_ = NULL;
 
181
                                gsize _tmp7_ = 0UL;
186
182
                                gchar* _tmp8_ = NULL;
187
183
                                _tmp6_ = uri;
188
184
                                _tmp7_ = lineend;
191
187
                                uri = _tmp8_;
192
188
                        }
193
189
                }
194
 
                goto __finally2;
195
 
                __catch2_g_error:
 
190
                goto __finally1;
 
191
                __catch1_g_error:
196
192
                {
197
193
                        g_clear_error (&_inner_error_);
198
194
                        _inner_error_ = NULL;
199
195
                }
200
 
                __finally2:
201
 
                if (_inner_error_ != NULL) {
 
196
                __finally1:
 
197
                if (G_UNLIKELY (_inner_error_ != NULL)) {
202
198
                        _g_free0 (uri);
203
199
                        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);
204
200
                        g_clear_error (&_inner_error_);
215
211
 
216
212
static gboolean _baobab_connect_server_on_out_watch_gio_func (GIOChannel* source, GIOCondition condition, gpointer self) {
217
213
        gboolean result;
218
 
        result = baobab_connect_server_on_out_watch (self, source, condition);
 
214
        result = baobab_connect_server_on_out_watch ((BaobabConnectServer*) self, source, condition);
219
215
        return result;
220
216
}
221
217
 
222
218
 
223
219
static void _baobab_connect_server_on_child_watch_gchild_watch_func (GPid pid, gint status, gpointer self) {
224
 
        baobab_connect_server_on_child_watch (self, pid, status);
 
220
        baobab_connect_server_on_child_watch ((BaobabConnectServer*) self, pid, status);
225
221
}
226
222
 
227
223
 
228
224
void baobab_connect_server_show (BaobabConnectServer* self) {
229
225
        GPid pid = 0;
230
226
        gint out_fd = 0;
231
 
        GIOChannel* _tmp4_;
232
 
        GIOChannel* out_channel;
 
227
        GIOChannel* out_channel = NULL;
 
228
        GIOChannel* _tmp4_ = NULL;
233
229
        GError * _inner_error_ = NULL;
234
230
        g_return_if_fail (self != NULL);
235
231
        {
238
234
                g_spawn_async_with_pipes (NULL, BAOBAB_CONNECT_SERVER_argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, &_tmp0_, NULL, &_tmp1_, NULL, &_inner_error_);
239
235
                pid = _tmp0_;
240
236
                out_fd = _tmp1_;
241
 
                if (_inner_error_ != NULL) {
 
237
                if (G_UNLIKELY (_inner_error_ != NULL)) {
242
238
                        if (_inner_error_->domain == G_SPAWN_ERROR) {
243
 
                                goto __catch3_g_spawn_error;
 
239
                                goto __catch2_g_spawn_error;
244
240
                        }
245
241
                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
246
242
                        g_clear_error (&_inner_error_);
247
243
                        return;
248
244
                }
249
245
        }
250
 
        goto __finally3;
251
 
        __catch3_g_spawn_error:
 
246
        goto __finally2;
 
247
        __catch2_g_spawn_error:
252
248
        {
253
249
                GError* e = NULL;
254
 
                GError* _tmp2_;
255
 
                const gchar* _tmp3_;
 
250
                GError* _tmp2_ = NULL;
 
251
                const gchar* _tmp3_ = NULL;
256
252
                e = _inner_error_;
257
253
                _inner_error_ = NULL;
258
254
                _tmp2_ = e;
261
257
"%s", _tmp3_);
262
258
                _g_error_free0 (e);
263
259
        }
264
 
        __finally3:
265
 
        if (_inner_error_ != NULL) {
 
260
        __finally2:
 
261
        if (G_UNLIKELY (_inner_error_ != NULL)) {
266
262
                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);
267
263
                g_clear_error (&_inner_error_);
268
264
                return;
277
273
 
278
274
gboolean baobab_connect_server_available (void) {
279
275
        gboolean result = FALSE;
280
 
        const gchar* _tmp0_;
 
276
        const gchar* _tmp0_ = NULL;
281
277
        gchar* _tmp1_ = NULL;
282
 
        gchar* _tmp2_;
283
 
        gboolean _tmp3_;
 
278
        gchar* _tmp2_ = NULL;
 
279
        gboolean _tmp3_ = FALSE;
284
280
        _tmp0_ = BAOBAB_CONNECT_SERVER_argv[0];
285
281
        _tmp1_ = g_find_program_in_path (_tmp0_);
286
282
        _tmp2_ = _tmp1_;