~ubuntu-branches/ubuntu/quantal/indicator-sound/quantal

« back to all changes in this revision

Viewing changes to src/transport-menu-item.c

  • Committer: Sebastien Bacher
  • Date: 2012-02-14 18:41:28 UTC
  • mfrom: (28.174.7)
  • mto: This revision was merged to the branch mainline in revision 106.
  • Revision ID: seb128@ubuntu.com-20120214184128-ralrqptgrtfep0c2
* New upstream release.
  - No easy way to turn the sound menu on/off (lp: #829648)
  - Avoid spawning notification daemon at startup (lp: #912150)
  - Creation of album-art-cache folder (lp: #799383)
  - schema id & path are inconsistent with other indicators (lp: #914377)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* transport-menu-item.c generated by valac 0.14.0, the Vala compiler
 
1
/* transport-menu-item.c generated by valac 0.12.1, the Vala compiler
2
2
 * generated from transport-menu-item.vala, do not modify */
3
3
 
4
4
/*
157
157
 
158
158
TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent) {
159
159
        TransportMenuitem * self = NULL;
160
 
        PlayerController* _tmp0_;
161
160
        g_return_val_if_fail (parent != NULL, NULL);
162
 
        _tmp0_ = parent;
163
 
        self = (TransportMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TRANSPORT_MENUITEM_TYPE, "owner", _tmp0_, NULL);
 
161
        self = (TransportMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_TRANSPORT_MENUITEM_TYPE, "owner", parent, NULL);
164
162
        return self;
165
163
}
166
164
 
182
180
 
183
181
 
184
182
void transport_menuitem_handle_cached_action (TransportMenuitem* self) {
185
 
        TransportAction _tmp0_;
186
183
        g_return_if_fail (self != NULL);
187
 
        _tmp0_ = self->priv->cached_action;
188
 
        if (_tmp0_ != TRANSPORT_ACTION_NO_ACTION) {
 
184
        if (self->priv->cached_action != TRANSPORT_ACTION_NO_ACTION) {
189
185
                g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 1, _transport_menuitem_send_cached_action_gsource_func, g_object_ref (self), g_object_unref);
190
186
        }
191
187
}
193
189
 
194
190
static gboolean transport_menuitem_send_cached_action (TransportMenuitem* self) {
195
191
        gboolean result = FALSE;
196
 
        PlayerController* _tmp0_;
197
 
        PlayerController* _tmp1_;
198
 
        Mpris2Controller* _tmp2_;
199
 
        TransportAction _tmp3_;
 
192
        PlayerController* _tmp0_ = NULL;
200
193
        g_return_val_if_fail (self != NULL, FALSE);
201
194
        _tmp0_ = player_item_get_owner ((PlayerItem*) self);
202
 
        _tmp1_ = _tmp0_;
203
 
        _tmp2_ = _tmp1_->mpris_bridge;
204
 
        _tmp3_ = self->priv->cached_action;
205
 
        mpris2_controller_transport_update (_tmp2_, _tmp3_);
 
195
        mpris2_controller_transport_update (_tmp0_->mpris_bridge, self->priv->cached_action);
206
196
        self->priv->cached_action = TRANSPORT_ACTION_NO_ACTION;
207
197
        result = FALSE;
208
198
        return result;
210
200
 
211
201
 
212
202
void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update) {
213
 
        TransportState _tmp0_;
214
203
        gint temp;
215
204
        g_return_if_fail (self != NULL);
216
 
        _tmp0_ = update;
217
 
        temp = (gint) _tmp0_;
 
205
        temp = (gint) update;
218
206
        dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, temp);
219
207
}
220
208
 
227
215
static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const gchar* name, GVariant* input_value, guint timestamp) {
228
216
        TransportMenuitem * self;
229
217
        GVariant* _tmp0_;
230
 
        GVariant* _tmp1_;
231
218
        GVariant* v;
232
 
        GVariant* _tmp2_;
233
 
        const GVariantType* _tmp3_;
234
 
        gboolean _tmp4_ = FALSE;
235
 
        GVariant* _tmp7_;
236
 
        gint32 _tmp8_ = 0;
 
219
        gboolean _tmp1_;
 
220
        gint32 _tmp3_;
237
221
        gint32 input;
238
 
        gboolean _tmp9_;
239
 
        gboolean _tmp10_;
 
222
        gboolean _tmp4_;
240
223
        self = (TransportMenuitem*) base;
241
224
        g_return_if_fail (name != NULL);
242
225
        g_return_if_fail (input_value != NULL);
243
 
        _tmp0_ = input_value;
244
 
        _tmp1_ = _g_variant_ref0 (_tmp0_);
245
 
        v = _tmp1_;
246
 
        _tmp2_ = input_value;
247
 
        _tmp3_ = G_VARIANT_TYPE_VARIANT;
248
 
        _tmp4_ = g_variant_is_of_type (_tmp2_, _tmp3_);
249
 
        if (_tmp4_) {
250
 
                GVariant* _tmp5_;
251
 
                GVariant* _tmp6_ = NULL;
252
 
                _tmp5_ = input_value;
253
 
                _tmp6_ = g_variant_get_variant (_tmp5_);
 
226
        _tmp0_ = _g_variant_ref0 (input_value);
 
227
        v = _tmp0_;
 
228
        _tmp1_ = g_variant_is_of_type (input_value, G_VARIANT_TYPE_VARIANT);
 
229
        if (_tmp1_) {
 
230
                GVariant* _tmp2_ = NULL;
 
231
                _tmp2_ = g_variant_get_variant (input_value);
254
232
                _g_variant_unref0 (v);
255
 
                v = _tmp6_;
 
233
                v = _tmp2_;
256
234
        }
257
 
        _tmp7_ = v;
258
 
        _tmp8_ = g_variant_get_int32 (_tmp7_);
259
 
        input = _tmp8_;
260
 
        _tmp9_ = transport_menuitem_get_running (self);
261
 
        _tmp10_ = _tmp9_;
262
 
        if (_tmp10_ == TRUE) {
263
 
                PlayerController* _tmp11_;
264
 
                PlayerController* _tmp12_;
265
 
                Mpris2Controller* _tmp13_;
266
 
                gint32 _tmp14_;
267
 
                _tmp11_ = player_item_get_owner ((PlayerItem*) self);
268
 
                _tmp12_ = _tmp11_;
269
 
                _tmp13_ = _tmp12_->mpris_bridge;
270
 
                _tmp14_ = input;
271
 
                mpris2_controller_transport_update (_tmp13_, (TransportAction) _tmp14_);
 
235
        _tmp3_ = g_variant_get_int32 (v);
 
236
        input = _tmp3_;
 
237
        _tmp4_ = transport_menuitem_get_running (self);
 
238
        if (_tmp4_ == TRUE) {
 
239
                PlayerController* _tmp5_ = NULL;
 
240
                _tmp5_ = player_item_get_owner ((PlayerItem*) self);
 
241
                mpris2_controller_transport_update (_tmp5_->mpris_bridge, (TransportAction) input);
272
242
        } else {
273
 
                gint32 _tmp15_;
274
 
                PlayerController* _tmp16_;
275
 
                PlayerController* _tmp17_;
276
 
                _tmp15_ = input;
277
 
                self->priv->cached_action = (TransportAction) _tmp15_;
278
 
                _tmp16_ = player_item_get_owner ((PlayerItem*) self);
279
 
                _tmp17_ = _tmp16_;
280
 
                player_controller_instantiate (_tmp17_);
 
243
                PlayerController* _tmp6_ = NULL;
 
244
                self->priv->cached_action = (TransportAction) input;
 
245
                _tmp6_ = player_item_get_owner ((PlayerItem*) self);
 
246
                player_controller_instantiate (_tmp6_);
281
247
                dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, (gint) TRANSPORT_STATE_LAUNCHING);
282
248
        }
283
249
        _g_variant_unref0 (v);
286
252
 
287
253
GeeHashSet* transport_menuitem_attributes_format (void) {
288
254
        GeeHashSet* result = NULL;
289
 
        GeeHashSet* _tmp0_;
 
255
        GeeHashSet* _tmp0_ = NULL;
290
256
        GeeHashSet* attrs;
291
257
        _tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
292
258
        attrs = _tmp0_;
298
264
 
299
265
static gboolean transport_menuitem_get_running (TransportMenuitem* self) {
300
266
        gboolean result;
301
 
        PlayerController* _tmp0_;
302
 
        PlayerController* _tmp1_;
303
 
        gint _tmp2_;
 
267
        PlayerController* _tmp0_ = NULL;
304
268
        g_return_val_if_fail (self != NULL, FALSE);
305
269
        _tmp0_ = player_item_get_owner ((PlayerItem*) self);
306
 
        _tmp1_ = _tmp0_;
307
 
        _tmp2_ = _tmp1_->current_state;
308
 
        result = _tmp2_ == ((gint) PLAYER_CONTROLLER_STATE_CONNECTED);
 
270
        result = _tmp0_->current_state == PLAYER_CONTROLLER_STATE_CONNECTED;
309
271
        return result;
310
272
}
311
273