diff options
Diffstat (limited to 'src/player-controller.c')
-rw-r--r-- | src/player-controller.c | 644 |
1 files changed, 421 insertions, 223 deletions
diff --git a/src/player-controller.c b/src/player-controller.c index 099c264..d086e5d 100644 --- a/src/player-controller.c +++ b/src/player-controller.c @@ -1,4 +1,4 @@ -/* player-controller.c generated by valac 0.12.1, the Vala compiler +/* player-controller.c generated by valac 0.14.2, the Vala compiler * generated from player-controller.vala, do not modify */ /* @@ -298,33 +298,51 @@ static gpointer _g_object_ref0 (gpointer self) { PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state) { PlayerController * self = NULL; gboolean* _tmp0_; - DbusmenuMenuitem* _tmp1_; - GeeArrayList* _tmp2_ = NULL; - const gchar* _tmp3_ = NULL; + gboolean* _tmp1_; + DbusmenuMenuitem* _tmp2_; + DbusmenuMenuitem* _tmp3_; + GAppInfo* _tmp4_; + const gchar* _tmp5_; + const gchar* _tmp6_; + GeeArrayList* _tmp7_; + PlayerControllerstate _tmp8_; + gint _tmp9_; + GAppInfo* _tmp10_; + const gchar* _tmp11_ = NULL; + const gchar* _tmp12_; g_return_val_if_fail (root != NULL, NULL); g_return_val_if_fail (app != NULL, NULL); g_return_val_if_fail (icon_name != NULL, NULL); self = (PlayerController*) g_object_new (object_type, NULL); - _tmp0_ = __bool_dup0 (use_playlists); + _tmp0_ = use_playlists; + _tmp1_ = __bool_dup0 (_tmp0_); _g_free0 (self->use_playlists); - self->use_playlists = _tmp0_; - _tmp1_ = _g_object_ref0 (root); + self->use_playlists = _tmp1_; + _tmp2_ = root; + _tmp3_ = _g_object_ref0 (_tmp2_); _g_object_unref0 (self->root_menu); - self->root_menu = _tmp1_; - player_controller_set_app_info (self, app); - player_controller_set_dbus_name (self, dbus_name); - player_controller_set_icon_name (self, icon_name); - _tmp2_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); + self->root_menu = _tmp3_; + _tmp4_ = app; + player_controller_set_app_info (self, _tmp4_); + _tmp5_ = dbus_name; + player_controller_set_dbus_name (self, _tmp5_); + _tmp6_ = icon_name; + player_controller_set_icon_name (self, _tmp6_); + _tmp7_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL); _g_object_unref0 (self->custom_items); - self->custom_items = _tmp2_; - self->current_state = (gint) initial_state; - player_controller_set_menu_offset (self, offset); + self->custom_items = _tmp7_; + _tmp8_ = initial_state; + self->current_state = (gint) _tmp8_; + _tmp9_ = offset; + player_controller_set_menu_offset (self, _tmp9_); player_controller_construct_widgets (self); player_controller_establish_mpris_connection (self); player_controller_update_layout (self); - _tmp3_ = g_app_info_get_name (self->priv->_app_info); - g_debug ("player-controller.vala:76: New player controller for %s with icon nam" \ -"e %s", _tmp3_, self->priv->_icon_name); + _tmp10_ = self->priv->_app_info; + _tmp11_ = g_app_info_get_name (_tmp10_); + _tmp12_ = self->priv->_icon_name; + g_debug ("player-controller.vala:74: New player controller for %s with icon nam" \ +"e %s", _tmp11_, _tmp12_); return self; } @@ -335,48 +353,68 @@ PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) { - const gchar* _tmp0_ = NULL; + GAppInfo* _tmp0_; + const gchar* _tmp1_ = NULL; + PlayerControllerstate _tmp2_; + PlayerControllerstate _tmp3_; g_return_if_fail (self != NULL); - _tmp0_ = g_app_info_get_name (self->priv->_app_info); - g_debug ("player-controller.vala:81: update_state - player controller %s : new s" \ -"tate %i", _tmp0_, (gint) new_state); - self->current_state = (gint) new_state; + _tmp0_ = self->priv->_app_info; + _tmp1_ = g_app_info_get_name (_tmp0_); + _tmp2_ = new_state; + g_debug ("player-controller.vala:79: update_state - player controller %s : new s" \ +"tate %i", _tmp1_, (gint) _tmp2_); + _tmp3_ = new_state; + self->current_state = (gint) _tmp3_; player_controller_update_layout (self); } void player_controller_activate (PlayerController* self, const gchar* dbus_name) { + const gchar* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (dbus_name != NULL); - player_controller_set_dbus_name (self, dbus_name); + _tmp0_ = dbus_name; + player_controller_set_dbus_name (self, _tmp0_); player_controller_establish_mpris_connection (self); } void player_controller_instantiate (PlayerController* self) { - const gchar* _tmp0_ = NULL; + GAppInfo* _tmp0_; + const gchar* _tmp1_ = NULL; GError * _inner_error_ = NULL; g_return_if_fail (self != NULL); - _tmp0_ = g_app_info_get_name (self->priv->_app_info); - g_debug ("player-controller.vala:101: instantiate in player controller for %s", _tmp0_); - g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_); - if (_inner_error_ != NULL) { - goto __catch6_g_error; + _tmp0_ = self->priv->_app_info; + _tmp1_ = g_app_info_get_name (_tmp0_); + g_debug ("player-controller.vala:99: instantiate in player controller for %s", _tmp1_); + { + GAppInfo* _tmp2_; + _tmp2_ = self->priv->_app_info; + g_app_info_launch (_tmp2_, NULL, NULL, &_inner_error_); + if (_inner_error_ != NULL) { + goto __catch7_g_error; + } + player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING); } - player_controller_update_state (self, PLAYER_CONTROLLER_STATE_INSTANTIATING); - goto __finally6; - __catch6_g_error: + goto __finally7; + __catch7_g_error: { - GError * _error_; - const gchar* _tmp1_ = NULL; + GError* _error_ = NULL; + GAppInfo* _tmp3_; + const gchar* _tmp4_ = NULL; + GError* _tmp5_; + const gchar* _tmp6_; _error_ = _inner_error_; _inner_error_ = NULL; - _tmp1_ = g_app_info_get_name (self->priv->_app_info); - g_warning ("player-controller.vala:107: Failed to launch app %s with error message" \ -": %s", _tmp1_, _error_->message); + _tmp3_ = self->priv->_app_info; + _tmp4_ = g_app_info_get_name (_tmp3_); + _tmp5_ = _error_; + _tmp6_ = _tmp5_->message; + g_warning ("player-controller.vala:105: Failed to launch app %s with error message" \ +": %s", _tmp4_, _tmp6_); _g_error_free0 (_error_); } - __finally6: + __finally7: if (_inner_error_ != NULL) { 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); g_clear_error (&_inner_error_); @@ -386,41 +424,57 @@ void player_controller_instantiate (PlayerController* self) { void player_controller_enable_track_specific_items (PlayerController* self, const gchar* object_path) { + SpecificItemsManager* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); - if (self->priv->track_specific_mgr == NULL) { - SpecificItemsManager* _tmp0_ = NULL; - _tmp0_ = specific_items_manager_new (self, object_path, SPECIFIC_ITEMS_MANAGER_CATEGORY_TRACK); + _tmp0_ = self->priv->track_specific_mgr; + if (_tmp0_ == NULL) { + const gchar* _tmp1_; + SpecificItemsManager* _tmp2_; + _tmp1_ = object_path; + _tmp2_ = specific_items_manager_new (self, _tmp1_, SPECIFIC_ITEMS_MANAGER_CATEGORY_TRACK); _g_object_unref0 (self->priv->track_specific_mgr); - self->priv->track_specific_mgr = _tmp0_; + self->priv->track_specific_mgr = _tmp2_; } } void player_controller_enable_player_specific_items (PlayerController* self, const gchar* object_path) { + SpecificItemsManager* _tmp0_; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); - if (self->priv->player_specific_mgr == NULL) { - SpecificItemsManager* _tmp0_ = NULL; - _tmp0_ = specific_items_manager_new (self, object_path, SPECIFIC_ITEMS_MANAGER_CATEGORY_PLAYER); + _tmp0_ = self->priv->player_specific_mgr; + if (_tmp0_ == NULL) { + const gchar* _tmp1_; + SpecificItemsManager* _tmp2_; + _tmp1_ = object_path; + _tmp2_ = specific_items_manager_new (self, _tmp1_, SPECIFIC_ITEMS_MANAGER_CATEGORY_PLAYER); _g_object_unref0 (self->priv->player_specific_mgr); - self->priv->player_specific_mgr = _tmp0_; + self->priv->player_specific_mgr = _tmp2_; } } gint player_controller_track_specific_count (PlayerController* self) { gint result = 0; - GeeArrayList* _tmp0_ = NULL; - gint _tmp1_; + SpecificItemsManager* _tmp0_; + SpecificItemsManager* _tmp1_; + GeeArrayList* _tmp2_; + GeeArrayList* _tmp3_; + gint _tmp4_; + gint _tmp5_; g_return_val_if_fail (self != NULL, 0); - if (self->priv->track_specific_mgr == NULL) { + _tmp0_ = self->priv->track_specific_mgr; + if (_tmp0_ == NULL) { result = 0; return result; } - _tmp0_ = specific_items_manager_get_proxy_items (self->priv->track_specific_mgr); - _tmp1_ = gee_collection_get_size ((GeeCollection*) _tmp0_); - result = _tmp1_; + _tmp1_ = self->priv->track_specific_mgr; + _tmp2_ = specific_items_manager_get_proxy_items (_tmp1_); + _tmp3_ = _tmp2_; + _tmp4_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp3_); + _tmp5_ = _tmp4_; + result = _tmp5_; return result; } @@ -443,28 +497,36 @@ static gchar* bool_to_string (gboolean self) { static void player_controller_establish_mpris_connection (PlayerController* self) { gboolean _tmp0_ = FALSE; - gchar* _tmp1_ = NULL; - gchar* _tmp2_; - Mpris2Controller* _tmp3_ = NULL; + gint _tmp1_; + gboolean _tmp3_; + gboolean* _tmp4_; + gchar* _tmp5_ = NULL; + gchar* _tmp6_; + Mpris2Controller* _tmp7_; g_return_if_fail (self != NULL); - if (self->current_state != PLAYER_CONTROLLER_STATE_READY) { + _tmp1_ = self->current_state; + if (_tmp1_ != ((gint) PLAYER_CONTROLLER_STATE_READY)) { _tmp0_ = TRUE; } else { - _tmp0_ = self->priv->_dbus_name == NULL; + const gchar* _tmp2_; + _tmp2_ = self->priv->_dbus_name; + _tmp0_ = _tmp2_ == NULL; } - if (_tmp0_) { - g_debug ("player-controller.vala:141: establish_mpris_connection - Not ready to " \ + _tmp3_ = _tmp0_; + if (_tmp3_) { + g_debug ("player-controller.vala:139: establish_mpris_connection - Not ready to " \ "connect"); return; } - _tmp1_ = bool_to_string (*self->use_playlists); - _tmp2_ = _tmp1_; - g_debug ("player-controller.vala:144: establish mpris connection - use playlist" \ -"s value = %s ", _tmp2_); - _g_free0 (_tmp2_); - _tmp3_ = mpris2_controller_new (self); + _tmp4_ = self->use_playlists; + _tmp5_ = bool_to_string (*_tmp4_); + _tmp6_ = _tmp5_; + g_debug ("player-controller.vala:142: establish mpris connection - use playlist" \ +"s value = %s ", _tmp6_); + _g_free0 (_tmp6_); + _tmp7_ = mpris2_controller_new (self); _g_object_unref0 (self->mpris_bridge); - self->mpris_bridge = _tmp3_; + self->mpris_bridge = _tmp7_; player_controller_determine_state (self); } @@ -484,74 +546,104 @@ static gboolean _bool_equal (const gboolean* s1, const gboolean* s2) { void player_controller_remove_from_menu (PlayerController* self) { - gboolean _tmp3_; + gboolean* _tmp13_; + gboolean _tmp14_; g_return_if_fail (self != NULL); { GeeArrayList* _tmp0_; + GeeArrayList* _tmp1_; GeeArrayList* _item_list; - gint _tmp1_; + GeeArrayList* _tmp2_; + gint _tmp3_; + gint _tmp4_; gint _item_size; gint _item_index; - _tmp0_ = _g_object_ref0 (self->custom_items); - _item_list = _tmp0_; - _tmp1_ = gee_collection_get_size ((GeeCollection*) _item_list); - _item_size = _tmp1_; + _tmp0_ = self->custom_items; + _tmp1_ = _g_object_ref0 (_tmp0_); + _item_list = _tmp1_; + _tmp2_ = _item_list; + _tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_); + _tmp4_ = _tmp3_; + _item_size = _tmp4_; _item_index = -1; while (TRUE) { - gpointer _tmp2_ = NULL; + gint _tmp5_; + gint _tmp6_; + gint _tmp7_; + GeeArrayList* _tmp8_; + gint _tmp9_; + gpointer _tmp10_ = NULL; PlayerItem* item; - _item_index = _item_index + 1; - if (!(_item_index < _item_size)) { + DbusmenuMenuitem* _tmp11_; + PlayerItem* _tmp12_; + _tmp5_ = _item_index; + _item_index = _tmp5_ + 1; + _tmp6_ = _item_index; + _tmp7_ = _item_size; + if (!(_tmp6_ < _tmp7_)) { break; } - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _item_list, _item_index); - item = (PlayerItem*) _tmp2_; - dbusmenu_menuitem_child_delete (self->root_menu, (DbusmenuMenuitem*) item); + _tmp8_ = _item_list; + _tmp9_ = _item_index; + _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_); + item = (PlayerItem*) _tmp10_; + _tmp11_ = self->root_menu; + _tmp12_ = item; + dbusmenu_menuitem_child_delete (_tmp11_, (DbusmenuMenuitem*) _tmp12_); _g_object_unref0 (item); } _g_object_unref0 (_item_list); } - _tmp3_ = TRUE; - if (_bool_equal (self->use_playlists, &_tmp3_) == TRUE) { - gpointer _tmp4_ = NULL; - PlayerItem* _tmp5_; + _tmp13_ = self->use_playlists; + _tmp14_ = TRUE; + if (_bool_equal (_tmp13_, &_tmp14_) == TRUE) { + GeeArrayList* _tmp15_; + gpointer _tmp16_ = NULL; PlaylistsMenuitem* playlists_menuitem; - _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); - _tmp5_ = (PlayerItem*) _tmp4_; - playlists_menuitem = IS_PLAYLISTS_MENUITEM (_tmp5_) ? ((PlaylistsMenuitem*) _tmp5_) : NULL; - dbusmenu_menuitem_child_delete (self->root_menu, playlists_menuitem->root_item); + DbusmenuMenuitem* _tmp17_; + PlaylistsMenuitem* _tmp18_; + DbusmenuMenuitem* _tmp19_; + _tmp15_ = self->custom_items; + _tmp16_ = gee_abstract_list_get ((GeeAbstractList*) _tmp15_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); + playlists_menuitem = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp16_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp16_)) : NULL; + _tmp17_ = self->root_menu; + _tmp18_ = playlists_menuitem; + _tmp19_ = _tmp18_->root_item; + dbusmenu_menuitem_child_delete (_tmp17_, _tmp19_); _g_object_unref0 (playlists_menuitem); } } void player_controller_hibernate (PlayerController* self) { - gpointer _tmp0_ = NULL; - PlayerItem* _tmp1_; + GeeArrayList* _tmp0_; + gpointer _tmp1_ = NULL; TransportMenuitem* transport; - gpointer _tmp2_ = NULL; - PlayerItem* _tmp3_; - GeeHashSet* _tmp4_ = NULL; - GeeHashSet* _tmp5_; - gpointer _tmp6_ = NULL; - PlayerItem* _tmp7_; + GeeArrayList* _tmp2_; + gpointer _tmp3_ = NULL; + PlayerItem* _tmp4_; + GeeHashSet* _tmp5_ = NULL; + GeeHashSet* _tmp6_; + GeeArrayList* _tmp7_; + gpointer _tmp8_ = NULL; MetadataMenuitem* md; g_return_if_fail (self != NULL); player_controller_update_state (self, PLAYER_CONTROLLER_STATE_OFFLINE); - _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp1_ = (PlayerItem*) _tmp0_; - transport = IS_TRANSPORT_MENUITEM (_tmp1_) ? ((TransportMenuitem*) _tmp1_) : NULL; + _tmp0_ = self->custom_items; + _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + transport = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp1_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp1_)) : NULL; transport_menuitem_change_play_state (transport, TRANSPORT_STATE_PAUSED); - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp3_ = (PlayerItem*) _tmp2_; - _tmp4_ = metadata_menuitem_relevant_attributes_for_ui (); - _tmp5_ = _tmp4_; - player_item_reset (_tmp3_, _tmp5_); - _g_object_unref0 (_tmp5_); - _g_object_unref0 (_tmp3_); - _tmp6_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp7_ = (PlayerItem*) _tmp6_; - md = IS_METADATA_MENUITEM (_tmp7_) ? ((MetadataMenuitem*) _tmp7_) : NULL; + _tmp2_ = self->custom_items; + _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp4_ = (PlayerItem*) _tmp3_; + _tmp5_ = metadata_menuitem_relevant_attributes_for_ui (); + _tmp6_ = _tmp5_; + player_item_reset (_tmp4_, _tmp6_); + _g_object_unref0 (_tmp6_); + _g_object_unref0 (_tmp4_); + _tmp7_ = self->custom_items; + _tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp8_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp8_)) : NULL; metadata_menuitem_toggle_active_triangle (md, FALSE); _g_object_unref0 (self->mpris_bridge); self->mpris_bridge = NULL; @@ -561,132 +653,216 @@ void player_controller_hibernate (PlayerController* self) { void player_controller_update_layout (PlayerController* self) { - gpointer _tmp0_ = NULL; - PlayerItem* _tmp1_; + GeeArrayList* _tmp0_; + gpointer _tmp1_ = NULL; PlaylistsMenuitem* playlists_menuitem; - gpointer _tmp2_ = NULL; - PlayerItem* _tmp3_; + GeeArrayList* _tmp2_; + gpointer _tmp3_ = NULL; MetadataMenuitem* metadata_menuitem; - gpointer _tmp7_ = NULL; - PlayerItem* _tmp8_; - GeeHashSet* _tmp9_ = NULL; - GeeHashSet* _tmp10_; - gboolean _tmp11_; - const gchar* _tmp12_ = NULL; + gint _tmp4_; + MetadataMenuitem* _tmp13_; + GeeArrayList* _tmp14_; + gpointer _tmp15_ = NULL; + PlayerItem* _tmp16_; + GeeHashSet* _tmp17_ = NULL; + GeeHashSet* _tmp18_; + gboolean _tmp19_ = FALSE; + GAppInfo* _tmp20_; + const gchar* _tmp21_ = NULL; + PlaylistsMenuitem* _tmp28_; + DbusmenuMenuitem* _tmp29_; + gboolean* _tmp30_; g_return_if_fail (self != NULL); - _tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); - _tmp1_ = (PlayerItem*) _tmp0_; - playlists_menuitem = IS_PLAYLISTS_MENUITEM (_tmp1_) ? ((PlaylistsMenuitem*) _tmp1_) : NULL; - _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp3_ = (PlayerItem*) _tmp2_; - metadata_menuitem = IS_METADATA_MENUITEM (_tmp3_) ? ((MetadataMenuitem*) _tmp3_) : NULL; - if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) { - gpointer _tmp4_ = NULL; - PlayerItem* _tmp5_; - const gchar* _tmp6_ = NULL; - metadata_menuitem_should_collapse (metadata_menuitem, TRUE); - dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); - _tmp4_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp5_ = (PlayerItem*) _tmp4_; - _tmp6_ = g_app_info_get_id (self->priv->_app_info); - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp5_, DBUSMENU_MENUITEM_PROP_VISIBLE, g_strcmp0 (_tmp6_, "rhythmbox.desktop") == 0); - _g_object_unref0 (_tmp5_); + _tmp0_ = self->custom_items; + _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) _tmp0_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS); + playlists_menuitem = IS_PLAYLISTS_MENUITEM ((PlayerItem*) _tmp1_) ? ((PlaylistsMenuitem*) ((PlayerItem*) _tmp1_)) : NULL; + _tmp2_ = self->custom_items; + _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + metadata_menuitem = IS_METADATA_MENUITEM ((PlayerItem*) _tmp3_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp3_)) : NULL; + _tmp4_ = self->current_state; + if (_tmp4_ != ((gint) PLAYER_CONTROLLER_STATE_CONNECTED)) { + MetadataMenuitem* _tmp5_; + PlaylistsMenuitem* _tmp6_; + DbusmenuMenuitem* _tmp7_; + GeeArrayList* _tmp8_; + gpointer _tmp9_ = NULL; + PlayerItem* _tmp10_; + GAppInfo* _tmp11_; + const gchar* _tmp12_ = NULL; + _tmp5_ = metadata_menuitem; + metadata_menuitem_should_collapse (_tmp5_, TRUE); + _tmp6_ = playlists_menuitem; + _tmp7_ = _tmp6_->root_item; + dbusmenu_menuitem_property_set_bool (_tmp7_, DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE); + _tmp8_ = self->custom_items; + _tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp10_ = (PlayerItem*) _tmp9_; + _tmp11_ = self->priv->_app_info; + _tmp12_ = g_app_info_get_id (_tmp11_); + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp10_, DBUSMENU_MENUITEM_PROP_VISIBLE, g_strcmp0 (_tmp12_, "rhythmbox.desktop") == 0); + _g_object_unref0 (_tmp10_); _g_object_unref0 (metadata_menuitem); _g_object_unref0 (playlists_menuitem); return; } - _tmp7_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp8_ = (PlayerItem*) _tmp7_; - _tmp9_ = metadata_menuitem_relevant_attributes_for_ui (); - _tmp10_ = _tmp9_; - _tmp11_ = player_item_populated (_tmp8_, _tmp10_); - metadata_menuitem_should_collapse (metadata_menuitem, !_tmp11_); - _g_object_unref0 (_tmp10_); - _g_object_unref0 (_tmp8_); - _tmp12_ = g_app_info_get_id (self->priv->_app_info); - if (g_strcmp0 (_tmp12_, "rhythmbox.desktop") == 0) { - gpointer _tmp13_ = NULL; - PlayerItem* _tmp14_; + _tmp13_ = metadata_menuitem; + _tmp14_ = self->custom_items; + _tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + _tmp16_ = (PlayerItem*) _tmp15_; + _tmp17_ = metadata_menuitem_relevant_attributes_for_ui (); + _tmp18_ = _tmp17_; + _tmp19_ = player_item_populated (_tmp16_, _tmp18_); + metadata_menuitem_should_collapse (_tmp13_, !_tmp19_); + _g_object_unref0 (_tmp18_); + _g_object_unref0 (_tmp16_); + _tmp20_ = self->priv->_app_info; + _tmp21_ = g_app_info_get_id (_tmp20_); + if (g_strcmp0 (_tmp21_, "rhythmbox.desktop") == 0) { + GeeArrayList* _tmp22_; + gpointer _tmp23_ = NULL; TransportMenuitem* transport; - _tmp13_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp14_ = (PlayerItem*) _tmp13_; - transport = IS_TRANSPORT_MENUITEM (_tmp14_) ? ((TransportMenuitem*) _tmp14_) : NULL; - transport_menuitem_handle_cached_action (transport); + TransportMenuitem* _tmp24_; + _tmp22_ = self->custom_items; + _tmp23_ = gee_abstract_list_get ((GeeAbstractList*) _tmp22_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + transport = IS_TRANSPORT_MENUITEM ((PlayerItem*) _tmp23_) ? ((TransportMenuitem*) ((PlayerItem*) _tmp23_)) : NULL; + _tmp24_ = transport; + transport_menuitem_handle_cached_action (_tmp24_); _g_object_unref0 (transport); } else { - gpointer _tmp15_ = NULL; - PlayerItem* _tmp16_; - _tmp15_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); - _tmp16_ = (PlayerItem*) _tmp15_; - dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp16_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); - _g_object_unref0 (_tmp16_); + GeeArrayList* _tmp25_; + gpointer _tmp26_ = NULL; + PlayerItem* _tmp27_; + _tmp25_ = self->custom_items; + _tmp26_ = gee_abstract_list_get ((GeeAbstractList*) _tmp25_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT); + _tmp27_ = (PlayerItem*) _tmp26_; + dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp27_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE); + _g_object_unref0 (_tmp27_); } - dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, *self->use_playlists); + _tmp28_ = playlists_menuitem; + _tmp29_ = _tmp28_->root_item; + _tmp30_ = self->use_playlists; + dbusmenu_menuitem_property_set_bool (_tmp29_, DBUSMENU_MENUITEM_PROP_VISIBLE, *_tmp30_); _g_object_unref0 (metadata_menuitem); _g_object_unref0 (playlists_menuitem); } static void player_controller_construct_widgets (PlayerController* self) { - PlayerItem* _tmp0_ = NULL; + GeeArrayList* _tmp0_; PlayerItem* _tmp1_; - MetadataMenuitem* _tmp2_ = NULL; + PlayerItem* _tmp2_; + MetadataMenuitem* _tmp3_; MetadataMenuitem* metadata_item; - TransportMenuitem* _tmp3_ = NULL; + GeeArrayList* _tmp4_; + MetadataMenuitem* _tmp5_; + TransportMenuitem* _tmp6_; TransportMenuitem* transport_item; - PlaylistsMenuitem* _tmp4_ = NULL; + GeeArrayList* _tmp7_; + TransportMenuitem* _tmp8_; + PlaylistsMenuitem* _tmp9_; PlaylistsMenuitem* playlist_menuitem; + GeeArrayList* _tmp10_; + PlaylistsMenuitem* _tmp11_; g_return_if_fail (self != NULL); - _tmp0_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR); - _tmp1_ = _tmp0_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp1_); - _g_object_unref0 (_tmp1_); - _tmp2_ = metadata_menuitem_new (self); - metadata_item = _tmp2_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) metadata_item); - _tmp3_ = transport_menuitem_new (self); - transport_item = _tmp3_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) transport_item); - _tmp4_ = playlists_menuitem_new (self); - playlist_menuitem = _tmp4_; - gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) playlist_menuitem); + _tmp0_ = self->custom_items; + _tmp1_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR); + _tmp2_ = _tmp1_; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp0_, _tmp2_); + _g_object_unref0 (_tmp2_); + _tmp3_ = metadata_menuitem_new (self); + metadata_item = _tmp3_; + _tmp4_ = self->custom_items; + _tmp5_ = metadata_item; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp4_, (PlayerItem*) _tmp5_); + _tmp6_ = transport_menuitem_new (self); + transport_item = _tmp6_; + _tmp7_ = self->custom_items; + _tmp8_ = transport_item; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp7_, (PlayerItem*) _tmp8_); + _tmp9_ = playlists_menuitem_new (self); + playlist_menuitem = _tmp9_; + _tmp10_ = self->custom_items; + _tmp11_ = playlist_menuitem; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp10_, (PlayerItem*) _tmp11_); { - GeeArrayList* _tmp5_; + GeeArrayList* _tmp12_; + GeeArrayList* _tmp13_; GeeArrayList* _item_list; - gint _tmp6_; + GeeArrayList* _tmp14_; + gint _tmp15_; + gint _tmp16_; gint _item_size; gint _item_index; - _tmp5_ = _g_object_ref0 (self->custom_items); - _item_list = _tmp5_; - _tmp6_ = gee_collection_get_size ((GeeCollection*) _item_list); - _item_size = _tmp6_; + _tmp12_ = self->custom_items; + _tmp13_ = _g_object_ref0 (_tmp12_); + _item_list = _tmp13_; + _tmp14_ = _item_list; + _tmp15_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp14_); + _tmp16_ = _tmp15_; + _item_size = _tmp16_; _item_index = -1; while (TRUE) { - gpointer _tmp7_ = NULL; + gint _tmp17_; + gint _tmp18_; + gint _tmp19_; + GeeArrayList* _tmp20_; + gint _tmp21_; + gpointer _tmp22_ = NULL; PlayerItem* item; - gint _tmp8_; - _item_index = _item_index + 1; - if (!(_item_index < _item_size)) { + GeeArrayList* _tmp23_; + PlayerItem* _tmp24_; + gint _tmp25_ = 0; + _tmp17_ = _item_index; + _item_index = _tmp17_ + 1; + _tmp18_ = _item_index; + _tmp19_ = _item_size; + if (!(_tmp18_ < _tmp19_)) { break; } - _tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _item_list, _item_index); - item = (PlayerItem*) _tmp7_; - _tmp8_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item); - if (_tmp8_ == (PLAYER_CONTROLLER_WIDGET_QUANTITY - 1)) { - PlayerItem* _tmp9_; - PlaylistsMenuitem* _tmp10_; + _tmp20_ = _item_list; + _tmp21_ = _item_index; + _tmp22_ = gee_abstract_list_get ((GeeAbstractList*) _tmp20_, _tmp21_); + item = (PlayerItem*) _tmp22_; + _tmp23_ = self->custom_items; + _tmp24_ = item; + _tmp25_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp23_, _tmp24_); + if (_tmp25_ == (PLAYER_CONTROLLER_WIDGET_QUANTITY - 1)) { + PlayerItem* _tmp26_; + PlaylistsMenuitem* _tmp27_; PlaylistsMenuitem* playlists_menuitem; - gint _tmp11_; - _tmp9_ = item; - _tmp10_ = _g_object_ref0 (IS_PLAYLISTS_MENUITEM (_tmp9_) ? ((PlaylistsMenuitem*) _tmp9_) : NULL); - playlists_menuitem = _tmp10_; - _tmp11_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item); - dbusmenu_menuitem_child_add_position (self->root_menu, playlists_menuitem->root_item, (guint) (self->priv->_menu_offset + _tmp11_)); + DbusmenuMenuitem* _tmp28_; + PlaylistsMenuitem* _tmp29_; + DbusmenuMenuitem* _tmp30_; + gint _tmp31_; + GeeArrayList* _tmp32_; + PlayerItem* _tmp33_; + gint _tmp34_ = 0; + _tmp26_ = item; + _tmp27_ = _g_object_ref0 (IS_PLAYLISTS_MENUITEM (_tmp26_) ? ((PlaylistsMenuitem*) _tmp26_) : NULL); + playlists_menuitem = _tmp27_; + _tmp28_ = self->root_menu; + _tmp29_ = playlists_menuitem; + _tmp30_ = _tmp29_->root_item; + _tmp31_ = self->priv->_menu_offset; + _tmp32_ = self->custom_items; + _tmp33_ = item; + _tmp34_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp32_, _tmp33_); + dbusmenu_menuitem_child_add_position (_tmp28_, _tmp30_, (guint) (_tmp31_ + _tmp34_)); _g_object_unref0 (playlists_menuitem); } else { - gint _tmp12_; - _tmp12_ = gee_abstract_list_index_of ((GeeAbstractList*) self->custom_items, item); - dbusmenu_menuitem_child_add_position (self->root_menu, (DbusmenuMenuitem*) item, (guint) (self->priv->_menu_offset + _tmp12_)); + DbusmenuMenuitem* _tmp35_; + PlayerItem* _tmp36_; + gint _tmp37_; + GeeArrayList* _tmp38_; + PlayerItem* _tmp39_; + gint _tmp40_ = 0; + _tmp35_ = self->root_menu; + _tmp36_ = item; + _tmp37_ = self->priv->_menu_offset; + _tmp38_ = self->custom_items; + _tmp39_ = item; + _tmp40_ = gee_abstract_list_index_of ((GeeAbstractList*) _tmp38_, _tmp39_); + dbusmenu_menuitem_child_add_position (_tmp35_, (DbusmenuMenuitem*) _tmp36_, (guint) (_tmp37_ + _tmp40_)); } _g_object_unref0 (item); } @@ -699,19 +875,25 @@ static void player_controller_construct_widgets (PlayerController* self) { static void player_controller_determine_state (PlayerController* self) { - gboolean _tmp0_; + Mpris2Controller* _tmp0_; + gboolean _tmp1_ = FALSE; g_return_if_fail (self != NULL); - _tmp0_ = mpris2_controller_connected (self->mpris_bridge); - if (_tmp0_ == TRUE) { - gpointer _tmp1_ = NULL; - PlayerItem* _tmp2_; + _tmp0_ = self->mpris_bridge; + _tmp1_ = mpris2_controller_connected (_tmp0_); + if (_tmp1_ == TRUE) { + GeeArrayList* _tmp2_; + gpointer _tmp3_ = NULL; MetadataMenuitem* md; + MetadataMenuitem* _tmp4_; + Mpris2Controller* _tmp5_; player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED); - _tmp1_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); - _tmp2_ = (PlayerItem*) _tmp1_; - md = IS_METADATA_MENUITEM (_tmp2_) ? ((MetadataMenuitem*) _tmp2_) : NULL; - metadata_menuitem_toggle_active_triangle (md, TRUE); - mpris2_controller_initial_update (self->mpris_bridge); + _tmp2_ = self->custom_items; + _tmp3_ = gee_abstract_list_get ((GeeAbstractList*) _tmp2_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA); + md = IS_METADATA_MENUITEM ((PlayerItem*) _tmp3_) ? ((MetadataMenuitem*) ((PlayerItem*) _tmp3_)) : NULL; + _tmp4_ = md; + metadata_menuitem_toggle_active_triangle (_tmp4_, TRUE); + _tmp5_ = self->mpris_bridge; + mpris2_controller_initial_update (_tmp5_); _g_object_unref0 (md); } else { player_controller_update_state (self, PLAYER_CONTROLLER_STATE_DISCONNECTED); @@ -721,69 +903,85 @@ static void player_controller_determine_state (PlayerController* self) { const gchar* player_controller_get_dbus_name (PlayerController* self) { const gchar* result; + const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_dbus_name; + _tmp0_ = self->priv->_dbus_name; + result = _tmp0_; return result; } void player_controller_set_dbus_name (PlayerController* self, const gchar* value) { - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup (value); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->_dbus_name); - self->priv->_dbus_name = _tmp0_; + self->priv->_dbus_name = _tmp1_; g_object_notify ((GObject *) self, "dbus-name"); } GAppInfo* player_controller_get_app_info (PlayerController* self) { GAppInfo* result; + GAppInfo* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_app_info; + _tmp0_ = self->priv->_app_info; + result = _tmp0_; return result; } void player_controller_set_app_info (PlayerController* self, GAppInfo* value) { GAppInfo* _tmp0_; + GAppInfo* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = _g_object_ref0 (value); + _tmp0_ = value; + _tmp1_ = _g_object_ref0 (_tmp0_); _g_object_unref0 (self->priv->_app_info); - self->priv->_app_info = _tmp0_; + self->priv->_app_info = _tmp1_; g_object_notify ((GObject *) self, "app-info"); } gint player_controller_get_menu_offset (PlayerController* self) { gint result; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - result = self->priv->_menu_offset; + _tmp0_ = self->priv->_menu_offset; + result = _tmp0_; return result; } void player_controller_set_menu_offset (PlayerController* self, gint value) { + gint _tmp0_; g_return_if_fail (self != NULL); - self->priv->_menu_offset = value; + _tmp0_ = value; + self->priv->_menu_offset = _tmp0_; g_object_notify ((GObject *) self, "menu-offset"); } const gchar* player_controller_get_icon_name (PlayerController* self) { const gchar* result; + const gchar* _tmp0_; g_return_val_if_fail (self != NULL, NULL); - result = self->priv->_icon_name; + _tmp0_ = self->priv->_icon_name; + result = _tmp0_; return result; } void player_controller_set_icon_name (PlayerController* self, const gchar* value) { - gchar* _tmp0_; + const gchar* _tmp0_; + gchar* _tmp1_; g_return_if_fail (self != NULL); - _tmp0_ = g_strdup (value); + _tmp0_ = value; + _tmp1_ = g_strdup (_tmp0_); _g_free0 (self->priv->_icon_name); - self->priv->_icon_name = _tmp0_; + self->priv->_icon_name = _tmp1_; g_object_notify ((GObject *) self, "icon-name"); } |