diff options
Diffstat (limited to 'src/music-player-bridge.c')
-rw-r--r-- | src/music-player-bridge.c | 875 |
1 files changed, 306 insertions, 569 deletions
diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c index 5e1e87e..5c3be87 100644 --- a/src/music-player-bridge.c +++ b/src/music-player-bridge.c @@ -1,4 +1,4 @@ -/* music-player-bridge.c generated by valac 0.14.0, the Vala compiler +/* music-player-bridge.c generated by valac 0.12.1, the Vala compiler * generated from music-player-bridge.vala, do not modify */ /* @@ -213,170 +213,109 @@ MusicPlayerBridge* music_player_bridge_new (void) { static void music_player_bridge_on_blacklist_update (MusicPlayerBridge* self, gchar** blacklist, int blacklist_length1) { - gchar** _tmp0_; - gint _tmp0__length1; - Mpris2Watcher* _tmp15_; g_return_if_fail (self != NULL); g_debug ("music-player-bridge.vala:45: some blacklist update"); - _tmp0_ = blacklist; - _tmp0__length1 = blacklist_length1; { - gchar** s_collection = NULL; - gint s_collection_length1 = 0; - gint _s_collection_size_ = 0; - gint s_it = 0; - s_collection = _tmp0_; - s_collection_length1 = _tmp0__length1; - for (s_it = 0; s_it < _tmp0__length1; s_it = s_it + 1) { - gchar* _tmp1_; - gchar* s = NULL; - _tmp1_ = g_strdup (s_collection[s_it]); - s = _tmp1_; + gchar** s_collection; + int s_collection_length1; + int s_it; + s_collection = blacklist; + s_collection_length1 = blacklist_length1; + for (s_it = 0; s_it < blacklist_length1; s_it = s_it + 1) { + gchar* _tmp0_; + gchar* s; + _tmp0_ = g_strdup (s_collection[s_it]); + s = _tmp0_; { - const gchar* _tmp2_; - gchar* _tmp3_; - gchar* _tmp4_ = NULL; + gchar* _tmp1_; + gchar* _tmp2_ = NULL; gchar* key; - GeeHashMap* _tmp5_; - const gchar* _tmp6_; - gboolean _tmp7_ = FALSE; - _tmp2_ = s; - _tmp3_ = g_strdup (_tmp2_); - _tmp4_ = music_player_bridge_determine_key (_tmp3_); - key = _tmp4_; - _tmp5_ = self->priv->registered_clients; - _tmp6_ = key; - _tmp7_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp5_, _tmp6_); - if (_tmp7_) { - const gchar* _tmp8_; - GeeHashMap* _tmp9_; - const gchar* _tmp10_; - gpointer _tmp11_ = NULL; - PlayerController* _tmp12_; - GeeHashMap* _tmp13_; - const gchar* _tmp14_; - _tmp8_ = key; + gboolean _tmp3_; + _tmp1_ = g_strdup (s); + _tmp2_ = music_player_bridge_determine_key (_tmp1_); + key = _tmp2_; + _tmp3_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, key); + if (_tmp3_) { + gpointer _tmp4_ = NULL; + PlayerController* _tmp5_; g_debug ("music-player-bridge.vala:50: Apparently %s is now blacklisted - remove" \ -" thy self", _tmp8_); - _tmp9_ = self->priv->registered_clients; - _tmp10_ = key; - _tmp11_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp9_, _tmp10_); - _tmp12_ = (PlayerController*) _tmp11_; - player_controller_remove_from_menu (_tmp12_); - _g_object_unref0 (_tmp12_); - _tmp13_ = self->priv->registered_clients; - _tmp14_ = key; - gee_abstract_map_unset ((GeeAbstractMap*) _tmp13_, _tmp14_, NULL); +" thy self", key); + _tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, key); + _tmp5_ = (PlayerController*) _tmp4_; + player_controller_remove_from_menu (_tmp5_); + _g_object_unref0 (_tmp5_); + gee_abstract_map_unset ((GeeAbstractMap*) self->priv->registered_clients, key, NULL); } _g_free0 (key); _g_free0 (s); } } } - _tmp15_ = self->priv->watcher; - mpris2_watcher_check_for_active_clients (_tmp15_, NULL, NULL); + mpris2_watcher_check_for_active_clients (self->priv->watcher, NULL, NULL); } static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlayerBridge* self) { g_return_if_fail (self != NULL); { - SettingsManager* _tmp0_; - GeeArrayList* _tmp1_ = NULL; + GeeArrayList* _tmp0_ = NULL; GeeArrayList* _desktop_list; - GeeArrayList* _tmp2_; - gint _tmp3_; - gint _tmp4_; + gint _tmp1_; gint _desktop_size; gint _desktop_index; - _tmp0_ = self->priv->settings_manager; - _tmp1_ = settings_manager_fetch_interested (_tmp0_); - _desktop_list = _tmp1_; - _tmp2_ = _desktop_list; - _tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_); - _tmp4_ = _tmp3_; - _desktop_size = _tmp4_; + _tmp0_ = settings_manager_fetch_interested (self->priv->settings_manager); + _desktop_list = _tmp0_; + _tmp1_ = gee_collection_get_size ((GeeCollection*) _desktop_list); + _desktop_size = _tmp1_; _desktop_index = -1; while (TRUE) { - gint _tmp5_; - gint _tmp6_; - gint _tmp7_; - GeeArrayList* _tmp8_; - gint _tmp9_; - gpointer _tmp10_ = NULL; + gpointer _tmp2_ = NULL; gchar* desktop; - const gchar* _tmp11_; - const gchar* _tmp12_; - gchar* _tmp13_ = NULL; - gchar* _tmp14_; - GAppInfo* _tmp15_ = NULL; - GAppInfo* _tmp16_; + gchar* _tmp3_ = NULL; + gchar* _tmp4_; + GAppInfo* _tmp5_ = NULL; + GAppInfo* _tmp6_; GAppInfo* app_info; - GAppInfo* _tmp17_; - const gchar* _tmp19_; - gchar* _tmp20_; - gchar* _tmp21_ = NULL; + gchar* _tmp7_; + gchar* _tmp8_ = NULL; gchar* mpris_key; - DbusmenuMenuitem* _tmp22_; - GAppInfo* _tmp23_; - const gchar* _tmp24_; - gchar* _tmp25_ = NULL; - gchar* _tmp26_; - gint _tmp27_ = 0; - PlayerController* _tmp28_; - PlayerController* _tmp29_; + gchar* _tmp9_ = NULL; + gchar* _tmp10_; + gint _tmp11_; + PlayerController* _tmp12_ = NULL; + PlayerController* _tmp13_; PlayerController* ctrl; - GeeHashMap* _tmp30_; - const gchar* _tmp31_; - PlayerController* _tmp32_; - _tmp5_ = _desktop_index; - _desktop_index = _tmp5_ + 1; - _tmp6_ = _desktop_index; - _tmp7_ = _desktop_size; - if (!(_tmp6_ < _tmp7_)) { + _desktop_index = _desktop_index + 1; + if (!(_desktop_index < _desktop_size)) { break; } - _tmp8_ = _desktop_list; - _tmp9_ = _desktop_index; - _tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_); - desktop = (gchar*) _tmp10_; - _tmp11_ = desktop; - g_debug ("music-player-bridge.vala:62: interested client found : %s", _tmp11_); - _tmp12_ = desktop; - _tmp13_ = g_strconcat (_tmp12_, ".desktop", NULL); - _tmp14_ = _tmp13_; - _tmp15_ = music_player_bridge_create_app_info (_tmp14_); - _tmp16_ = _tmp15_; - _g_free0 (_tmp14_); - app_info = _tmp16_; - _tmp17_ = app_info; - if (_tmp17_ == NULL) { - const gchar* _tmp18_; - _tmp18_ = desktop; + _tmp2_ = gee_abstract_list_get ((GeeAbstractList*) _desktop_list, _desktop_index); + desktop = (gchar*) _tmp2_; + g_debug ("music-player-bridge.vala:62: interested client found : %s", desktop); + _tmp3_ = g_strconcat (desktop, ".desktop", NULL); + _tmp4_ = _tmp3_; + _tmp5_ = music_player_bridge_create_app_info (_tmp4_); + _tmp6_ = _tmp5_; + _g_free0 (_tmp4_); + app_info = _tmp6_; + if (app_info == NULL) { g_warning ("music-player-bridge.vala:65: Could not create app_info for path %s \n" \ -" Getting out of here ", _tmp18_); +" Getting out of here ", desktop); _g_object_unref0 (app_info); _g_free0 (desktop); continue; } - _tmp19_ = desktop; - _tmp20_ = g_strdup (_tmp19_); - _tmp21_ = music_player_bridge_determine_key (_tmp20_); - mpris_key = _tmp21_; - _tmp22_ = self->priv->root_menu; - _tmp23_ = app_info; - _tmp24_ = desktop; - _tmp25_ = music_player_bridge_fetch_icon_name (_tmp24_); - _tmp26_ = _tmp25_; - _tmp27_ = music_player_bridge_calculate_menu_position (self); - _tmp28_ = player_controller_new (_tmp22_, _tmp23_, NULL, _tmp26_, _tmp27_, NULL, PLAYER_CONTROLLER_STATE_OFFLINE); - _tmp29_ = _tmp28_; - _g_free0 (_tmp26_); - ctrl = _tmp29_; - _tmp30_ = self->priv->registered_clients; - _tmp31_ = mpris_key; - _tmp32_ = ctrl; - gee_abstract_map_set ((GeeAbstractMap*) _tmp30_, _tmp31_, _tmp32_); + _tmp7_ = g_strdup (desktop); + _tmp8_ = music_player_bridge_determine_key (_tmp7_); + mpris_key = _tmp8_; + _tmp9_ = music_player_bridge_fetch_icon_name (desktop); + _tmp10_ = _tmp9_; + _tmp11_ = music_player_bridge_calculate_menu_position (self); + _tmp12_ = player_controller_new (self->priv->root_menu, app_info, NULL, _tmp10_, _tmp11_, NULL, PLAYER_CONTROLLER_STATE_OFFLINE); + _tmp13_ = _tmp12_; + _g_free0 (_tmp10_); + ctrl = _tmp13_; + gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl); _g_object_unref0 (ctrl); _g_free0 (mpris_key); _g_object_unref0 (app_info); @@ -389,24 +328,16 @@ static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlaye static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self) { gint result = 0; - GeeHashMap* _tmp0_; - gint _tmp1_; - gint _tmp2_; + gint _tmp0_; g_return_val_if_fail (self != NULL, 0); - _tmp0_ = self->priv->registered_clients; - _tmp1_ = gee_map_get_size ((GeeMap*) _tmp0_); - _tmp2_ = _tmp1_; - if (_tmp2_ == 0) { + _tmp0_ = gee_map_get_size ((GeeMap*) self->priv->registered_clients); + if (_tmp0_ == 0) { result = MUSIC_PLAYER_BRIDGE_DEVICE_ITEMS_COUNT; return result; } else { - GeeHashMap* _tmp3_; - gint _tmp4_; - gint _tmp5_; - _tmp3_ = self->priv->registered_clients; - _tmp4_ = gee_map_get_size ((GeeMap*) _tmp3_); - _tmp5_ = _tmp4_; - result = MUSIC_PLAYER_BRIDGE_DEVICE_ITEMS_COUNT + (_tmp5_ * PLAYER_CONTROLLER_WIDGET_QUANTITY); + gint _tmp1_; + _tmp1_ = gee_map_get_size ((GeeMap*) self->priv->registered_clients); + result = MUSIC_PLAYER_BRIDGE_DEVICE_ITEMS_COUNT + (_tmp1_ * PLAYER_CONTROLLER_WIDGET_QUANTITY); return result; } } @@ -454,183 +385,111 @@ static gchar* bool_to_string (gboolean self) { void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name, gboolean use_playlists) { gboolean _tmp0_ = FALSE; - const gchar* _tmp1_; - gboolean _tmp3_; - const gchar* _tmp5_; - SettingsManager* _tmp6_; - gint _tmp7_ = 0; - gchar** _tmp8_ = NULL; - gchar** _tmp9_; - gint _tmp9__length1; - gboolean _tmp10_; - const gchar* _tmp12_; - const gchar* _tmp13_; - gchar* _tmp14_ = NULL; - gchar* _tmp15_; - GAppInfo* _tmp16_ = NULL; - GAppInfo* _tmp17_; + gint _tmp1_; + gchar** _tmp2_ = NULL; + gchar** _tmp3_; + gint _tmp3__length1; + gboolean _tmp4_; + gchar* _tmp5_ = NULL; + gchar* _tmp6_; + GAppInfo* _tmp7_ = NULL; + GAppInfo* _tmp8_; GAppInfo* app_info; - GAppInfo* _tmp18_; - const gchar* _tmp20_; - gchar* _tmp21_; - gchar* _tmp22_ = NULL; + gchar* _tmp9_; + gchar* _tmp10_ = NULL; gchar* mpris_key; - GeeHashMap* _tmp23_; - const gchar* _tmp24_; - gboolean _tmp25_ = FALSE; + gboolean _tmp11_; g_return_if_fail (self != NULL); g_return_if_fail (desktop != NULL); g_return_if_fail (dbus_name != NULL); - _tmp1_ = desktop; - if (_tmp1_ == NULL) { + if (desktop == NULL) { _tmp0_ = TRUE; } else { - const gchar* _tmp2_; - _tmp2_ = desktop; - _tmp0_ = g_strcmp0 (_tmp2_, "") == 0; + _tmp0_ = g_strcmp0 (desktop, "") == 0; } - _tmp3_ = _tmp0_; - if (_tmp3_) { - const gchar* _tmp4_; - _tmp4_ = dbus_name; + if (_tmp0_) { g_warning ("music-player-bridge.vala:96: Client %s attempting to register without " \ -"desktop entry being set on the mpris root", _tmp4_); +"desktop entry being set on the mpris root", dbus_name); return; } - _tmp5_ = desktop; - _tmp6_ = self->priv->settings_manager; - _tmp8_ = settings_manager_fetch_blacklist (_tmp6_, &_tmp7_); - _tmp9_ = _tmp8_; - _tmp9__length1 = _tmp7_; - _tmp10_ = _vala_string_array_contains (_tmp9_, _tmp7_, _tmp5_); - _tmp9_ = (_vala_array_free (_tmp9_, _tmp9__length1, (GDestroyNotify) g_free), NULL); - if (_tmp10_) { - const gchar* _tmp11_; - _tmp11_ = desktop; + _tmp2_ = settings_manager_fetch_blacklist (self->priv->settings_manager, &_tmp1_); + _tmp3_ = _tmp2_; + _tmp3__length1 = _tmp1_; + _tmp4_ = _vala_string_array_contains (_tmp3_, _tmp1_, desktop); + _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL); + if (_tmp4_) { g_debug ("music-player-bridge.vala:101: Client %s attempting to register but I'm" \ -" afraid it is blacklisted", _tmp11_); +" afraid it is blacklisted", desktop); return; } - _tmp12_ = desktop; - g_debug ("music-player-bridge.vala:106: client_has_become_available %s", _tmp12_); - _tmp13_ = desktop; - _tmp14_ = g_strconcat (_tmp13_, ".desktop", NULL); - _tmp15_ = _tmp14_; - _tmp16_ = music_player_bridge_create_app_info (_tmp15_); - _tmp17_ = _tmp16_; - _g_free0 (_tmp15_); - app_info = _tmp17_; - _tmp18_ = app_info; - if (_tmp18_ == NULL) { - const gchar* _tmp19_; - _tmp19_ = desktop; + g_debug ("music-player-bridge.vala:106: client_has_become_available %s", desktop); + _tmp5_ = g_strconcat (desktop, ".desktop", NULL); + _tmp6_ = _tmp5_; + _tmp7_ = music_player_bridge_create_app_info (_tmp6_); + _tmp8_ = _tmp7_; + _g_free0 (_tmp6_); + app_info = _tmp8_; + if (app_info == NULL) { g_warning ("music-player-bridge.vala:109: Could not create app_info for path %s \n" \ -" Getting out of here ", _tmp19_); +" Getting out of here ", desktop); _g_object_unref0 (app_info); return; } - _tmp20_ = desktop; - _tmp21_ = g_strdup (_tmp20_); - _tmp22_ = music_player_bridge_determine_key (_tmp21_); - mpris_key = _tmp22_; - _tmp23_ = self->priv->registered_clients; - _tmp24_ = mpris_key; - _tmp25_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp23_, _tmp24_); - if (_tmp25_ == FALSE) { - const gchar* _tmp26_; - DbusmenuMenuitem* _tmp27_; - GAppInfo* _tmp28_; - const gchar* _tmp29_; - const gchar* _tmp30_; - gchar* _tmp31_ = NULL; - gchar* _tmp32_; - gint _tmp33_ = 0; - gboolean _tmp34_; - PlayerController* _tmp35_; - PlayerController* _tmp36_; + _tmp9_ = g_strdup (desktop); + _tmp10_ = music_player_bridge_determine_key (_tmp9_); + mpris_key = _tmp10_; + _tmp11_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + if (_tmp11_ == FALSE) { + gchar* _tmp12_ = NULL; + gchar* _tmp13_; + gint _tmp14_; + PlayerController* _tmp15_ = NULL; + PlayerController* _tmp16_; PlayerController* ctrl; - GeeHashMap* _tmp37_; - const gchar* _tmp38_; - PlayerController* _tmp39_; - const gchar* _tmp40_; - SettingsManager* _tmp41_; - const gchar* _tmp42_; - _tmp26_ = dbus_name; g_debug ("music-player-bridge.vala:117: New client has registered that we have n" \ -"ot seen before: %s", _tmp26_); - _tmp27_ = self->priv->root_menu; - _tmp28_ = app_info; - _tmp29_ = dbus_name; - _tmp30_ = desktop; - _tmp31_ = music_player_bridge_fetch_icon_name (_tmp30_); - _tmp32_ = _tmp31_; - _tmp33_ = music_player_bridge_calculate_menu_position (self); - _tmp34_ = use_playlists; - _tmp35_ = player_controller_new (_tmp27_, _tmp28_, _tmp29_, _tmp32_, _tmp33_, &_tmp34_, PLAYER_CONTROLLER_STATE_READY); - _tmp36_ = _tmp35_; - _g_free0 (_tmp32_); - ctrl = _tmp36_; - _tmp37_ = self->priv->registered_clients; - _tmp38_ = mpris_key; - _tmp39_ = ctrl; - gee_abstract_map_set ((GeeAbstractMap*) _tmp37_, _tmp38_, _tmp39_); - _tmp40_ = desktop; +"ot seen before: %s", dbus_name); + _tmp12_ = music_player_bridge_fetch_icon_name (desktop); + _tmp13_ = _tmp12_; + _tmp14_ = music_player_bridge_calculate_menu_position (self); + _tmp15_ = player_controller_new (self->priv->root_menu, app_info, dbus_name, _tmp13_, _tmp14_, &use_playlists, PLAYER_CONTROLLER_STATE_READY); + _tmp16_ = _tmp15_; + _g_free0 (_tmp13_); + ctrl = _tmp16_; + gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl); g_debug ("music-player-bridge.vala:126: Have not seen this %s before, new contro" \ -"ller created.", _tmp40_); - _tmp41_ = self->priv->settings_manager; - _tmp42_ = desktop; - settings_manager_add_interested (_tmp41_, _tmp42_); +"ller created.", desktop); + settings_manager_add_interested (self->priv->settings_manager, desktop); g_debug ("music-player-bridge.vala:128: application added to the interested list"); _g_object_unref0 (ctrl); } else { - GeeHashMap* _tmp43_; - const gchar* _tmp44_; - gpointer _tmp45_ = NULL; - PlayerController* _tmp46_; - gboolean _tmp47_; - gboolean* _tmp48_; - GeeHashMap* _tmp49_; - const gchar* _tmp50_; - gpointer _tmp51_ = NULL; - PlayerController* _tmp52_; - GeeHashMap* _tmp53_; - const gchar* _tmp54_; - gpointer _tmp55_ = NULL; - PlayerController* _tmp56_; - const gchar* _tmp57_; - const gchar* _tmp58_; - gboolean _tmp59_; - gchar* _tmp60_ = NULL; - gchar* _tmp61_; - _tmp43_ = self->priv->registered_clients; - _tmp44_ = mpris_key; - _tmp45_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp43_, _tmp44_); - _tmp46_ = (PlayerController*) _tmp45_; - _tmp47_ = use_playlists; - _tmp48_ = __bool_dup0 (&_tmp47_); - _g_free0 (_tmp46_->use_playlists); - _tmp46_->use_playlists = _tmp48_; - _g_object_unref0 (_tmp46_); - _tmp49_ = self->priv->registered_clients; - _tmp50_ = mpris_key; - _tmp51_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp49_, _tmp50_); - _tmp52_ = (PlayerController*) _tmp51_; - player_controller_update_state (_tmp52_, PLAYER_CONTROLLER_STATE_READY); - _g_object_unref0 (_tmp52_); - _tmp53_ = self->priv->registered_clients; - _tmp54_ = mpris_key; - _tmp55_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp53_, _tmp54_); - _tmp56_ = (PlayerController*) _tmp55_; - _tmp57_ = dbus_name; - player_controller_activate (_tmp56_, _tmp57_); - _g_object_unref0 (_tmp56_); - _tmp58_ = dbus_name; - _tmp59_ = use_playlists; - _tmp60_ = bool_to_string (_tmp59_); - _tmp61_ = _tmp60_; + gpointer _tmp17_ = NULL; + PlayerController* _tmp18_; + gboolean* _tmp19_; + gpointer _tmp20_ = NULL; + PlayerController* _tmp21_; + gpointer _tmp22_ = NULL; + PlayerController* _tmp23_; + gchar* _tmp24_ = NULL; + gchar* _tmp25_; + _tmp17_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp18_ = (PlayerController*) _tmp17_; + _tmp19_ = __bool_dup0 (&use_playlists); + _g_free0 (_tmp18_->use_playlists); + _tmp18_->use_playlists = _tmp19_; + _g_object_unref0 (_tmp18_); + _tmp20_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp21_ = (PlayerController*) _tmp20_; + player_controller_update_state (_tmp21_, PLAYER_CONTROLLER_STATE_READY); + _g_object_unref0 (_tmp21_); + _tmp22_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp23_ = (PlayerController*) _tmp22_; + player_controller_activate (_tmp23_, dbus_name); + _g_object_unref0 (_tmp23_); + _tmp24_ = bool_to_string (use_playlists); + _tmp25_ = _tmp24_; g_debug ("music-player-bridge.vala:134: Application has already registered - awa" \ -"ken the hibernation: %s with playlists %s \n", _tmp58_, _tmp61_); - _g_free0 (_tmp61_); +"ken the hibernation: %s with playlists %s \n", dbus_name, _tmp25_); + _g_free0 (_tmp25_); } _g_free0 (mpris_key); _g_object_unref0 (app_info); @@ -638,56 +497,34 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface) { - const gchar* _tmp0_; - DbusmenuMenuitem* _tmp1_; g_return_if_fail (self != NULL); g_return_if_fail (mpris_root_interface != NULL); - _tmp0_ = mpris_root_interface; g_debug ("music-player-bridge.vala:140: MusicPlayerBridge -> client with dbus in" \ -"terface %s has vanished", _tmp0_); - _tmp1_ = self->priv->root_menu; - if (_tmp1_ != NULL) { - const gchar* _tmp2_; - const gchar* _tmp3_; - gchar* _tmp4_; - gchar* _tmp5_ = NULL; +"terface %s has vanished", mpris_root_interface); + if (self->priv->root_menu != NULL) { + gchar* _tmp0_; + gchar* _tmp1_ = NULL; gchar* mpris_key; - gboolean _tmp6_ = FALSE; - const gchar* _tmp7_; - gboolean _tmp11_; - _tmp2_ = mpris_root_interface; - g_debug ("music-player-bridge.vala:143: attempt to remove %s", _tmp2_); - _tmp3_ = mpris_root_interface; - _tmp4_ = g_strdup (_tmp3_); - _tmp5_ = music_player_bridge_determine_key (_tmp4_); - mpris_key = _tmp5_; - _tmp7_ = mpris_key; - if (_tmp7_ != NULL) { - GeeHashMap* _tmp8_; - const gchar* _tmp9_; - gboolean _tmp10_ = FALSE; - _tmp8_ = self->priv->registered_clients; - _tmp9_ = mpris_key; - _tmp10_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp8_, _tmp9_); - _tmp6_ = _tmp10_; + gboolean _tmp2_ = FALSE; + g_debug ("music-player-bridge.vala:143: attempt to remove %s", mpris_root_interface); + _tmp0_ = g_strdup (mpris_root_interface); + _tmp1_ = music_player_bridge_determine_key (_tmp0_); + mpris_key = _tmp1_; + if (mpris_key != NULL) { + gboolean _tmp3_; + _tmp3_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp2_ = _tmp3_; } else { - _tmp6_ = FALSE; + _tmp2_ = FALSE; } - _tmp11_ = _tmp6_; - if (_tmp11_) { - GeeHashMap* _tmp12_; - const gchar* _tmp13_; - gpointer _tmp14_ = NULL; - PlayerController* _tmp15_; - const gchar* _tmp16_; - _tmp12_ = self->priv->registered_clients; - _tmp13_ = mpris_key; - _tmp14_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp12_, _tmp13_); - _tmp15_ = (PlayerController*) _tmp14_; - player_controller_hibernate (_tmp15_); - _g_object_unref0 (_tmp15_); - _tmp16_ = mpris_key; - g_debug ("music-player-bridge.vala:147: Successively offlined client %s", _tmp16_); + if (_tmp2_) { + gpointer _tmp4_ = NULL; + PlayerController* _tmp5_; + _tmp4_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp5_ = (PlayerController*) _tmp4_; + player_controller_hibernate (_tmp5_); + _g_object_unref0 (_tmp5_); + g_debug ("music-player-bridge.vala:147: Successively offlined client %s", mpris_key); } _g_free0 (mpris_key); } @@ -711,147 +548,103 @@ static void _music_player_bridge_client_has_vanished_mpris2_watcher_client_disap void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu) { DbusmenuMenuitem* _tmp0_; - DbusmenuMenuitem* _tmp1_; - Mpris2Watcher* _tmp2_; - Mpris2Watcher* _tmp3_; - Mpris2Watcher* _tmp4_; + Mpris2Watcher* _tmp1_ = NULL; g_return_if_fail (self != NULL); g_return_if_fail (menu != NULL); - _tmp0_ = menu; - _tmp1_ = _g_object_ref0 (_tmp0_); + _tmp0_ = _g_object_ref0 (menu); _g_object_unref0 (self->priv->root_menu); - self->priv->root_menu = _tmp1_; + self->priv->root_menu = _tmp0_; music_player_bridge_try_to_add_inactive_familiar_clients (self); - _tmp2_ = mpris2_watcher_new (); + _tmp1_ = mpris2_watcher_new (); _g_object_unref0 (self->priv->watcher); - self->priv->watcher = _tmp2_; - _tmp3_ = self->priv->watcher; - g_signal_connect_object (_tmp3_, "client-appeared", (GCallback) _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared, self, 0); - _tmp4_ = self->priv->watcher; - g_signal_connect_object (_tmp4_, "client-disappeared", (GCallback) _music_player_bridge_client_has_vanished_mpris2_watcher_client_disappeared, self, 0); + self->priv->watcher = _tmp1_; + g_signal_connect_object (self->priv->watcher, "client-appeared", (GCallback) _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared, self, 0); + g_signal_connect_object (self->priv->watcher, "client-disappeared", (GCallback) _music_player_bridge_client_has_vanished_mpris2_watcher_client_disappeared, self, 0); } void music_player_bridge_enable_player_specific_items_for_client (MusicPlayerBridge* self, const gchar* object_path, const gchar* desktop_id) { - const gchar* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_ = NULL; + gchar* _tmp0_; + gchar* _tmp1_ = NULL; gchar* mpris_key; - GeeHashMap* _tmp3_; - const gchar* _tmp4_; - gboolean _tmp5_ = FALSE; - GeeHashMap* _tmp7_; - const gchar* _tmp8_; - gpointer _tmp9_ = NULL; - PlayerController* _tmp10_; - const gchar* _tmp11_; + gboolean _tmp2_; + gpointer _tmp3_ = NULL; + PlayerController* _tmp4_; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); g_return_if_fail (desktop_id != NULL); - _tmp0_ = desktop_id; - _tmp1_ = g_strdup (_tmp0_); - _tmp2_ = music_player_bridge_determine_key (_tmp1_); - mpris_key = _tmp2_; - _tmp3_ = self->priv->registered_clients; - _tmp4_ = mpris_key; - _tmp5_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp3_, _tmp4_); - if (_tmp5_ == FALSE) { - const gchar* _tmp6_; - _tmp6_ = desktop_id; + _tmp0_ = g_strdup (desktop_id); + _tmp1_ = music_player_bridge_determine_key (_tmp0_); + mpris_key = _tmp1_; + _tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + if (_tmp2_ == FALSE) { g_warning ("music-player-bridge.vala:166: we don't have a client with desktop id %" \ -"s registered", _tmp6_); +"s registered", desktop_id); _g_free0 (mpris_key); return; } - _tmp7_ = self->priv->registered_clients; - _tmp8_ = mpris_key; - _tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp7_, _tmp8_); - _tmp10_ = (PlayerController*) _tmp9_; - _tmp11_ = object_path; - player_controller_enable_player_specific_items (_tmp10_, _tmp11_); - _g_object_unref0 (_tmp10_); + _tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp4_ = (PlayerController*) _tmp3_; + player_controller_enable_player_specific_items (_tmp4_, object_path); + _g_object_unref0 (_tmp4_); _g_free0 (mpris_key); } void music_player_bridge_enable_track_specific_items_for_client (MusicPlayerBridge* self, const gchar* object_path, const gchar* desktop_id) { - const gchar* _tmp0_; - gchar* _tmp1_; - gchar* _tmp2_ = NULL; + gchar* _tmp0_; + gchar* _tmp1_ = NULL; gchar* mpris_key; - GeeHashMap* _tmp3_; - const gchar* _tmp4_; - gboolean _tmp5_ = FALSE; - GeeHashMap* _tmp7_; - const gchar* _tmp8_; - gpointer _tmp9_ = NULL; - PlayerController* _tmp10_; - const gchar* _tmp11_; + gboolean _tmp2_; + gpointer _tmp3_ = NULL; + PlayerController* _tmp4_; g_return_if_fail (self != NULL); g_return_if_fail (object_path != NULL); g_return_if_fail (desktop_id != NULL); - _tmp0_ = desktop_id; - _tmp1_ = g_strdup (_tmp0_); - _tmp2_ = music_player_bridge_determine_key (_tmp1_); - mpris_key = _tmp2_; - _tmp3_ = self->priv->registered_clients; - _tmp4_ = mpris_key; - _tmp5_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp3_, _tmp4_); - if (_tmp5_ == FALSE) { - const gchar* _tmp6_; - _tmp6_ = desktop_id; + _tmp0_ = g_strdup (desktop_id); + _tmp1_ = music_player_bridge_determine_key (_tmp0_); + mpris_key = _tmp1_; + _tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + if (_tmp2_ == FALSE) { g_warning ("music-player-bridge.vala:177: we don't have a client with desktop id %" \ -"s registered", _tmp6_); +"s registered", desktop_id); _g_free0 (mpris_key); return; } - _tmp7_ = self->priv->registered_clients; - _tmp8_ = mpris_key; - _tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp7_, _tmp8_); - _tmp10_ = (PlayerController*) _tmp9_; - _tmp11_ = object_path; - player_controller_enable_track_specific_items (_tmp10_, _tmp11_); - _g_object_unref0 (_tmp10_); + _tmp3_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key); + _tmp4_ = (PlayerController*) _tmp3_; + player_controller_enable_track_specific_items (_tmp4_, object_path); + _g_object_unref0 (_tmp4_); _g_free0 (mpris_key); } static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop) { GAppInfo* result = NULL; - const gchar* _tmp0_; - GDesktopAppInfo* _tmp1_; + GDesktopAppInfo* _tmp0_ = NULL; GDesktopAppInfo* info; - gboolean _tmp2_ = FALSE; - const gchar* _tmp3_; - gboolean _tmp5_; - GDesktopAppInfo* _tmp7_; - GAppInfo* _tmp8_; + gboolean _tmp1_ = FALSE; + GDesktopAppInfo* _tmp2_; + GAppInfo* _tmp3_; GAppInfo* app_info; g_return_val_if_fail (desktop != NULL, NULL); - _tmp0_ = desktop; - _tmp1_ = g_desktop_app_info_new (_tmp0_); - info = _tmp1_; - _tmp3_ = desktop; - if (_tmp3_ == NULL) { - _tmp2_ = TRUE; + _tmp0_ = g_desktop_app_info_new (desktop); + info = _tmp0_; + if (desktop == NULL) { + _tmp1_ = TRUE; } else { - GDesktopAppInfo* _tmp4_; - _tmp4_ = info; - _tmp2_ = _tmp4_ == NULL; + _tmp1_ = info == NULL; } - _tmp5_ = _tmp2_; - if (_tmp5_) { - const gchar* _tmp6_; - _tmp6_ = desktop; + if (_tmp1_) { g_warning ("music-player-bridge.vala:187: Could not create a desktopappinfo instan" \ -"ce from app: %s", _tmp6_); +"ce from app: %s", desktop); result = NULL; _g_object_unref0 (info); return result; } - _tmp7_ = info; - _tmp8_ = _g_object_ref0 (G_IS_APP_INFO (_tmp7_) ? ((GAppInfo*) _tmp7_) : NULL); - app_info = _tmp8_; + _tmp2_ = info; + _tmp3_ = _g_object_ref0 (G_IS_APP_INFO (_tmp2_) ? ((GAppInfo*) _tmp2_) : NULL); + app_info = _tmp3_; result = app_info; _g_object_unref0 (info); return result; @@ -860,51 +653,45 @@ static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop) { static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { gchar* result = NULL; - const gchar* _tmp0_; - gchar* _tmp1_ = NULL; - gchar* _tmp2_; + gchar* _tmp0_ = NULL; + gchar* _tmp1_; + GDesktopAppInfo* _tmp2_ = NULL; GDesktopAppInfo* _tmp3_; - GDesktopAppInfo* _tmp4_; GDesktopAppInfo* info; - GKeyFile* _tmp5_; + GKeyFile* _tmp4_ = NULL; GKeyFile* desktop_keyfile; + const gchar* _tmp5_ = NULL; + gchar* _tmp6_ = NULL; + gchar* _tmp7_; GError * _inner_error_ = NULL; g_return_val_if_fail (desktop != NULL, NULL); - _tmp0_ = desktop; - _tmp1_ = g_strconcat (_tmp0_, ".desktop", NULL); - _tmp2_ = _tmp1_; - _tmp3_ = g_desktop_app_info_new (_tmp2_); - _tmp4_ = _tmp3_; - _g_free0 (_tmp2_); - info = _tmp4_; - _tmp5_ = g_key_file_new (); - desktop_keyfile = _tmp5_; - { - GKeyFile* _tmp6_; - GDesktopAppInfo* _tmp7_; - const gchar* _tmp8_ = NULL; - _tmp6_ = desktop_keyfile; - _tmp7_ = info; - _tmp8_ = g_desktop_app_info_get_filename (_tmp7_); - g_key_file_load_from_file (_tmp6_, _tmp8_, G_KEY_FILE_NONE, &_inner_error_); - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_FILE_ERROR) { - goto __catch0_g_file_error; - } - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch0_g_key_file_error; - } - _g_key_file_free0 (desktop_keyfile); - _g_object_unref0 (info); - 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); - g_clear_error (&_inner_error_); - return NULL; + _tmp0_ = g_strconcat (desktop, ".desktop", NULL); + _tmp1_ = _tmp0_; + _tmp2_ = g_desktop_app_info_new (_tmp1_); + _tmp3_ = _tmp2_; + _g_free0 (_tmp1_); + info = _tmp3_; + _tmp4_ = g_key_file_new (); + desktop_keyfile = _tmp4_; + _tmp5_ = g_desktop_app_info_get_filename (info); + g_key_file_load_from_file (desktop_keyfile, _tmp5_, G_KEY_FILE_NONE, &_inner_error_); + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_FILE_ERROR) { + goto __catch0_g_file_error; + } + if (_inner_error_->domain == G_KEY_FILE_ERROR) { + goto __catch0_g_key_file_error; } + _g_key_file_free0 (desktop_keyfile); + _g_object_unref0 (info); + 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); + g_clear_error (&_inner_error_); + return NULL; } goto __finally0; __catch0_g_file_error: { - GError* _error_ = NULL; + GError * _error_; _error_ = _inner_error_; _inner_error_ = NULL; g_warning ("music-player-bridge.vala:203: Error loading keyfile - FileError"); @@ -917,7 +704,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { goto __finally0; __catch0_g_key_file_error: { - GError* _error_ = NULL; + GError * _error_; _error_ = _inner_error_; _inner_error_ = NULL; g_warning ("music-player-bridge.vala:207: Error loading keyfile - KeyFileError"); @@ -935,32 +722,26 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { g_clear_error (&_inner_error_); return NULL; } - { - GKeyFile* _tmp9_; - gchar* _tmp10_ = NULL; - gchar* _tmp11_; - _tmp9_ = desktop_keyfile; - _tmp10_ = g_key_file_get_string (_tmp9_, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, &_inner_error_); - _tmp11_ = _tmp10_; - if (_inner_error_ != NULL) { - if (_inner_error_->domain == G_KEY_FILE_ERROR) { - goto __catch1_g_key_file_error; - } - _g_key_file_free0 (desktop_keyfile); - _g_object_unref0 (info); - 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); - g_clear_error (&_inner_error_); - return NULL; + _tmp6_ = g_key_file_get_string (desktop_keyfile, G_KEY_FILE_DESKTOP_GROUP, G_KEY_FILE_DESKTOP_KEY_ICON, &_inner_error_); + _tmp7_ = _tmp6_; + if (_inner_error_ != NULL) { + if (_inner_error_->domain == G_KEY_FILE_ERROR) { + goto __catch1_g_key_file_error; } - result = _tmp11_; _g_key_file_free0 (desktop_keyfile); _g_object_unref0 (info); - return result; + 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); + g_clear_error (&_inner_error_); + return NULL; } + result = _tmp7_; + _g_key_file_free0 (desktop_keyfile); + _g_object_unref0 (info); + return result; goto __finally1; __catch1_g_key_file_error: { - GError* _error_ = NULL; + GError * _error_; _error_ = _inner_error_; _inner_error_ = NULL; g_warning ("music-player-bridge.vala:216: Error trying to fetch the icon name from" \ @@ -982,94 +763,52 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) { static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface) { gchar* result = NULL; - const gchar* _tmp0_; - gchar* _tmp1_; + gchar* _tmp0_; gchar* _result_; - const gchar* _tmp2_; - gchar** _tmp3_; - gchar** _tmp4_ = NULL; + gchar** _tmp1_; + gchar** _tmp2_ = NULL; gchar** tokens; gint tokens_length1; gint _tokens_size_; - gboolean _tmp5_ = FALSE; - gchar** _tmp6_; - gint _tmp6__length1; - gboolean _tmp8_; - const gchar* _tmp13_; - gchar** _tmp14_; - gchar** _tmp15_ = NULL; + gboolean _tmp3_ = FALSE; + gchar** _tmp5_; + gchar** _tmp6_ = NULL; gchar** temp; gint temp_length1; gint _temp_size_; - gboolean _tmp16_ = FALSE; - gchar** _tmp17_; - gint _tmp17__length1; - gboolean _tmp19_; + gboolean _tmp7_ = FALSE; g_return_val_if_fail (desktop_or_interface != NULL, NULL); - _tmp0_ = desktop_or_interface; - _tmp1_ = g_strdup (_tmp0_); - _result_ = _tmp1_; - _tmp2_ = desktop_or_interface; - _tmp4_ = _tmp3_ = g_strsplit (_tmp2_, ".", 0); - tokens = _tmp4_; - tokens_length1 = _vala_array_length (_tmp3_); - _tokens_size_ = tokens_length1; - _tmp6_ = tokens; - _tmp6__length1 = tokens_length1; - if (_tmp6_ != NULL) { - gchar** _tmp7_; - gint _tmp7__length1; - _tmp7_ = tokens; - _tmp7__length1 = tokens_length1; - _tmp5_ = _tmp7__length1 > 1; + _tmp0_ = g_strdup (desktop_or_interface); + _result_ = _tmp0_; + _tmp2_ = _tmp1_ = g_strsplit (desktop_or_interface, ".", 0); + tokens = _tmp2_; + tokens_length1 = _vala_array_length (_tmp1_); + _tokens_size_ = _vala_array_length (_tmp1_); + if (tokens != NULL) { + _tmp3_ = tokens_length1 > 1; } else { - _tmp5_ = FALSE; + _tmp3_ = FALSE; } - _tmp8_ = _tmp5_; - if (_tmp8_) { - gchar** _tmp9_; - gint _tmp9__length1; - gchar** _tmp10_; - gint _tmp10__length1; - const gchar* _tmp11_; - gchar* _tmp12_; - _tmp9_ = tokens; - _tmp9__length1 = tokens_length1; - _tmp10_ = tokens; - _tmp10__length1 = tokens_length1; - _tmp11_ = _tmp9_[_tmp10__length1 - 1]; - _tmp12_ = g_strdup (_tmp11_); + if (_tmp3_) { + gchar* _tmp4_; + _tmp4_ = g_strdup (tokens[tokens_length1 - 1]); _g_free0 (_result_); - _result_ = _tmp12_; + _result_ = _tmp4_; } - _tmp13_ = _result_; - _tmp15_ = _tmp14_ = g_strsplit (_tmp13_, "-", 0); - temp = _tmp15_; - temp_length1 = _vala_array_length (_tmp14_); - _temp_size_ = temp_length1; - _tmp17_ = temp; - _tmp17__length1 = temp_length1; - if (_tmp17_ != NULL) { - gchar** _tmp18_; - gint _tmp18__length1; - _tmp18_ = temp; - _tmp18__length1 = temp_length1; - _tmp16_ = _tmp18__length1 > 1; + _tmp6_ = _tmp5_ = g_strsplit (_result_, "-", 0); + temp = _tmp6_; + temp_length1 = _vala_array_length (_tmp5_); + _temp_size_ = _vala_array_length (_tmp5_); + if (temp != NULL) { + _tmp7_ = temp_length1 > 1; } else { - _tmp16_ = FALSE; + _tmp7_ = FALSE; } - _tmp19_ = _tmp16_; - if (_tmp19_) { - gchar** _tmp20_; - gint _tmp20__length1; - const gchar* _tmp21_; - gchar* _tmp22_; - _tmp20_ = temp; - _tmp20__length1 = temp_length1; - _tmp21_ = _tmp20_[0]; - _tmp22_ = g_strdup (_tmp21_); + if (_tmp7_) { + gchar* _tmp8_; + _tmp8_ = g_strdup (temp[0]); _g_free0 (_result_); - _result_ = _tmp22_; + _result_ = _tmp8_; } result = _result_; temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL); @@ -1088,9 +827,8 @@ static GObject * music_player_bridge_constructor (GType type, guint n_construct_ GObject * obj; GObjectClass * parent_class; MusicPlayerBridge * self; - GeeHashMap* _tmp0_; - SettingsManager* _tmp1_; - SettingsManager* _tmp2_; + GeeHashMap* _tmp0_ = NULL; + SettingsManager* _tmp1_ = NULL; parent_class = G_OBJECT_CLASS (music_player_bridge_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = MUSIC_PLAYER_BRIDGE (obj); @@ -1100,8 +838,7 @@ static GObject * music_player_bridge_constructor (GType type, guint n_construct_ _tmp1_ = settings_manager_new (); _g_object_unref0 (self->priv->settings_manager); self->priv->settings_manager = _tmp1_; - _tmp2_ = self->priv->settings_manager; - g_signal_connect_object (_tmp2_, "blacklist-updates", (GCallback) _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates, self, 0); + g_signal_connect_object (self->priv->settings_manager, "blacklist-updates", (GCallback) _music_player_bridge_on_blacklist_update_settings_manager_blacklist_updates, self, 0); return obj; } |