aboutsummaryrefslogtreecommitdiff
path: root/src/playlists-menu-item.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-10-28 09:45:22 -0400
committerKen VanDine <ken.vandine@canonical.com>2011-10-28 09:45:22 -0400
commit6c40e13a44770e9bda393e5b0b1ebefa6b8077d5 (patch)
tree8d5e2ee74ab2a728a2af4e514740266424b5b955 /src/playlists-menu-item.c
parent3b17bc829e96005f2cd6897be7cf77fec37ef012 (diff)
parentef3495e8ca6aa257c2d3123a7b0a25067570b0de (diff)
downloadayatana-indicator-sound-6c40e13a44770e9bda393e5b0b1ebefa6b8077d5.tar.gz
ayatana-indicator-sound-6c40e13a44770e9bda393e5b0b1ebefa6b8077d5.tar.bz2
ayatana-indicator-sound-6c40e13a44770e9bda393e5b0b1ebefa6b8077d5.zip
Import upstream version 0.7.9.1
Diffstat (limited to 'src/playlists-menu-item.c')
-rw-r--r--src/playlists-menu-item.c587
1 files changed, 247 insertions, 340 deletions
diff --git a/src/playlists-menu-item.c b/src/playlists-menu-item.c
index fbef772..5758f66 100644
--- a/src/playlists-menu-item.c
+++ b/src/playlists-menu-item.c
@@ -1,4 +1,4 @@
-/* playlists-menu-item.c generated by valac 0.14.0, the Vala compiler
+/* playlists-menu-item.c generated by valac 0.12.1, the Vala compiler
* generated from playlists-menu-item.vala, do not modify */
/*
@@ -156,9 +156,10 @@ static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (Block1Data* _data1_);
static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
static gboolean playlists_menuitem_is_video_related (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
-static void ____lambda1_ (Block1Data* _data1_);
+static gchar* playlists_menuitem_truncate_item_label_if_needs_be (PlaylistsMenuitem* self, const gchar* item_label);
+static void _lambda1_ (Block1Data* _data1_);
static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self, gint menu_item_id);
-static void _____lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self);
+static void __lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self);
void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail);
void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail);
PlayerController* player_item_get_owner (PlayerItem* self);
@@ -171,10 +172,8 @@ static void playlists_menuitem_finalize (GObject* obj);
PlaylistsMenuitem* playlists_menuitem_construct (GType object_type, PlayerController* parent) {
PlaylistsMenuitem * self = NULL;
- PlayerController* _tmp0_;
g_return_val_if_fail (parent != NULL, NULL);
- _tmp0_ = parent;
- self = (PlaylistsMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_PLAYLISTS_MENUITEM_TYPE, "owner", _tmp0_, NULL);
+ self = (PlaylistsMenuitem*) g_object_new (object_type, "item-type", DBUSMENU_PLAYLISTS_MENUITEM_TYPE, "owner", parent, NULL);
return self;
}
@@ -199,119 +198,75 @@ static void block1_data_unref (Block1Data* _data1_) {
}
-static void ____lambda1_ (Block1Data* _data1_) {
+static void _lambda1_ (Block1Data* _data1_) {
PlaylistsMenuitem * self;
- DbusmenuMenuitem* _tmp0_;
- gint _tmp1_;
- gint _tmp2_;
+ gint _tmp0_;
self = _data1_->self;
- _tmp0_ = _data1_->menuitem;
- _tmp1_ = dbusmenu_menuitem_get_id (_tmp0_);
- _tmp2_ = _tmp1_;
- playlists_menuitem_submenu_item_activated (self, _tmp2_);
+ _tmp0_ = dbusmenu_menuitem_get_id (_data1_->menuitem);
+ playlists_menuitem_submenu_item_activated (self, _tmp0_);
}
-static void _____lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) {
- ____lambda1_ (self);
+static void __lambda1__dbusmenu_menuitem_item_activated (DbusmenuMenuitem* _sender, guint object, gpointer self) {
+ _lambda1_ (self);
}
void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playlists, int playlists_length1) {
- PlaylistDetails* _tmp0_;
- gint _tmp0__length1;
g_return_if_fail (self != NULL);
- _tmp0_ = playlists;
- _tmp0__length1 = playlists_length1;
{
- PlaylistDetails* detail_collection = NULL;
- gint detail_collection_length1 = 0;
- gint _detail_collection_size_ = 0;
- gint detail_it = 0;
- detail_collection = _tmp0_;
- detail_collection_length1 = _tmp0__length1;
- for (detail_it = 0; detail_it < _tmp0__length1; detail_it = detail_it + 1) {
+ PlaylistDetails* detail_collection;
+ int detail_collection_length1;
+ int detail_it;
+ detail_collection = playlists;
+ detail_collection_length1 = playlists_length1;
+ for (detail_it = 0; detail_it < playlists_length1; detail_it = detail_it + 1) {
+ PlaylistDetails _tmp0_;
PlaylistDetails _tmp1_ = {0};
- PlaylistDetails detail = {0};
+ PlaylistDetails detail;
playlist_details_copy (&detail_collection[detail_it], &_tmp1_);
- detail = _tmp1_;
+ _tmp0_ = _tmp1_;
+ detail = _tmp0_;
{
Block1Data* _data1_;
gboolean _tmp2_ = FALSE;
- PlaylistDetails _tmp3_;
- gboolean _tmp4_ = FALSE;
- gboolean _tmp7_;
- DbusmenuMenuitem* _tmp8_;
- DbusmenuMenuitem* _tmp9_;
- PlaylistDetails _tmp10_;
- const gchar* _tmp11_;
- DbusmenuMenuitem* _tmp12_;
- DbusmenuMenuitem* _tmp13_;
- PlaylistDetails _tmp14_;
- const char* _tmp15_;
- DbusmenuMenuitem* _tmp16_;
- DbusmenuMenuitem* _tmp17_;
- DbusmenuMenuitem* _tmp18_;
- GeeHashMap* _tmp19_;
- DbusmenuMenuitem* _tmp20_;
- gint _tmp21_;
- gint _tmp22_;
- DbusmenuMenuitem* _tmp23_;
- DbusmenuMenuitem* _tmp24_;
- DbusmenuMenuitem* _tmp25_;
- PlaylistDetails _tmp26_;
- const gchar* _tmp27_;
+ gboolean _tmp3_;
+ DbusmenuMenuitem* _tmp5_ = NULL;
+ gchar* _tmp6_ = NULL;
+ gchar* _tmp7_;
+ gint _tmp8_;
_data1_ = g_slice_new0 (Block1Data);
_data1_->_ref_count_ = 1;
_data1_->self = g_object_ref (self);
- _tmp3_ = detail;
- _tmp4_ = playlists_menuitem_already_observed (self, &_tmp3_);
- if (_tmp4_) {
+ _tmp3_ = playlists_menuitem_already_observed (self, &detail);
+ if (_tmp3_) {
_tmp2_ = TRUE;
} else {
- PlaylistDetails _tmp5_;
- gboolean _tmp6_ = FALSE;
- _tmp5_ = detail;
- _tmp6_ = playlists_menuitem_is_video_related (self, &_tmp5_);
- _tmp2_ = _tmp6_;
+ gboolean _tmp4_;
+ _tmp4_ = playlists_menuitem_is_video_related (self, &detail);
+ _tmp2_ = _tmp4_;
}
- _tmp7_ = _tmp2_;
- if (_tmp7_) {
+ if (_tmp2_) {
playlist_details_destroy (&detail);
block1_data_unref (_data1_);
_data1_ = NULL;
continue;
}
- _tmp8_ = dbusmenu_menuitem_new ();
- _data1_->menuitem = _tmp8_;
- _tmp9_ = _data1_->menuitem;
- _tmp10_ = detail;
- _tmp11_ = _tmp10_.name;
- dbusmenu_menuitem_property_set (_tmp9_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp11_);
- _tmp12_ = _data1_->menuitem;
- dbusmenu_menuitem_property_set (_tmp12_, DBUSMENU_MENUITEM_PROP_ICON_NAME, "playlist-symbolic");
- _tmp13_ = _data1_->menuitem;
- _tmp14_ = detail;
- _tmp15_ = _tmp14_.path;
- dbusmenu_menuitem_property_set (_tmp13_, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) _tmp15_);
- _tmp16_ = _data1_->menuitem;
- dbusmenu_menuitem_property_set_bool (_tmp16_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- _tmp17_ = _data1_->menuitem;
- dbusmenu_menuitem_property_set_bool (_tmp17_, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
- _tmp18_ = _data1_->menuitem;
- g_signal_connect_data (_tmp18_, "item-activated", (GCallback) _____lambda1__dbusmenu_menuitem_item_activated, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
- _tmp19_ = self->priv->current_playlists;
- _tmp20_ = _data1_->menuitem;
- _tmp21_ = dbusmenu_menuitem_get_id (_tmp20_);
- _tmp22_ = _tmp21_;
- _tmp23_ = _data1_->menuitem;
- gee_abstract_map_set ((GeeAbstractMap*) _tmp19_, GINT_TO_POINTER (_tmp22_), _tmp23_);
- _tmp24_ = self->root_item;
- _tmp25_ = _data1_->menuitem;
- dbusmenu_menuitem_child_append (_tmp24_, _tmp25_);
- _tmp26_ = detail;
- _tmp27_ = _tmp26_.name;
- g_debug ("playlists-menu-item.vala:65: populating valid playlists %s", _tmp27_);
+ _tmp5_ = dbusmenu_menuitem_new ();
+ _data1_->menuitem = _tmp5_;
+ _tmp6_ = playlists_menuitem_truncate_item_label_if_needs_be (self, detail.name);
+ _tmp7_ = _tmp6_;
+ dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_LABEL, _tmp7_);
+ _g_free0 (_tmp7_);
+ dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_ICON_NAME, "playlist-symbolic");
+ dbusmenu_menuitem_property_set (_data1_->menuitem, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) detail.path);
+ dbusmenu_menuitem_property_set_bool (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+ dbusmenu_menuitem_property_set_bool (_data1_->menuitem, DBUSMENU_MENUITEM_PROP_ENABLED, TRUE);
+ g_signal_connect_data (_data1_->menuitem, "item-activated", (GCallback) __lambda1__dbusmenu_menuitem_item_activated, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
+ _tmp8_ = dbusmenu_menuitem_get_id (_data1_->menuitem);
+ gee_abstract_map_set ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (_tmp8_), _data1_->menuitem);
+ dbusmenu_menuitem_child_append (self->root_item, _data1_->menuitem);
+ g_debug ("playlists-menu-item.vala:66: populating valid playlists %s", detail.name);
playlist_details_destroy (&detail);
block1_data_unref (_data1_);
_data1_ = NULL;
@@ -319,64 +274,46 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
}
}
{
- GeeHashMap* _tmp28_;
- GeeCollection* _tmp29_;
- GeeCollection* _tmp30_;
- GeeCollection* _tmp31_;
- GeeIterator* _tmp32_ = NULL;
- GeeIterator* _tmp33_;
+ GeeCollection* _tmp9_ = NULL;
+ GeeCollection* _tmp10_;
+ GeeIterator* _tmp11_ = NULL;
+ GeeIterator* _tmp12_;
GeeIterator* _item_it;
- _tmp28_ = self->priv->current_playlists;
- _tmp29_ = gee_map_get_values ((GeeMap*) _tmp28_);
- _tmp30_ = _tmp29_;
- _tmp31_ = _tmp30_;
- _tmp32_ = gee_iterable_iterator ((GeeIterable*) _tmp31_);
- _tmp33_ = _tmp32_;
- _g_object_unref0 (_tmp31_);
- _item_it = _tmp33_;
+ _tmp9_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists);
+ _tmp10_ = _tmp9_;
+ _tmp11_ = gee_iterable_iterator ((GeeIterable*) _tmp10_);
+ _tmp12_ = _tmp11_;
+ _g_object_unref0 (_tmp10_);
+ _item_it = _tmp12_;
while (TRUE) {
- GeeIterator* _tmp34_;
- gboolean _tmp35_ = FALSE;
- GeeIterator* _tmp36_;
- gpointer _tmp37_ = NULL;
+ gboolean _tmp13_;
+ gpointer _tmp14_ = NULL;
DbusmenuMenuitem* item;
gboolean within;
- PlaylistDetails* _tmp38_;
- gint _tmp38__length1;
- gboolean _tmp44_;
- _tmp34_ = _item_it;
- _tmp35_ = gee_iterator_next (_tmp34_);
- if (!_tmp35_) {
+ _tmp13_ = gee_iterator_next (_item_it);
+ if (!_tmp13_) {
break;
}
- _tmp36_ = _item_it;
- _tmp37_ = gee_iterator_get (_tmp36_);
- item = (DbusmenuMenuitem*) _tmp37_;
+ _tmp14_ = gee_iterator_get (_item_it);
+ item = (DbusmenuMenuitem*) _tmp14_;
within = FALSE;
- _tmp38_ = playlists;
- _tmp38__length1 = playlists_length1;
{
- PlaylistDetails* detail_collection = NULL;
- gint detail_collection_length1 = 0;
- gint _detail_collection_size_ = 0;
- gint detail_it = 0;
- detail_collection = _tmp38_;
- detail_collection_length1 = _tmp38__length1;
- for (detail_it = 0; detail_it < _tmp38__length1; detail_it = detail_it + 1) {
- PlaylistDetails _tmp39_ = {0};
- PlaylistDetails detail = {0};
- playlist_details_copy (&detail_collection[detail_it], &_tmp39_);
- detail = _tmp39_;
+ PlaylistDetails* detail_collection;
+ int detail_collection_length1;
+ int detail_it;
+ detail_collection = playlists;
+ detail_collection_length1 = playlists_length1;
+ for (detail_it = 0; detail_it < playlists_length1; detail_it = detail_it + 1) {
+ PlaylistDetails _tmp15_;
+ PlaylistDetails _tmp16_ = {0};
+ PlaylistDetails detail;
+ playlist_details_copy (&detail_collection[detail_it], &_tmp16_);
+ _tmp15_ = _tmp16_;
+ detail = _tmp15_;
{
- PlaylistDetails _tmp40_;
- const char* _tmp41_;
- DbusmenuMenuitem* _tmp42_;
- const gchar* _tmp43_ = NULL;
- _tmp40_ = detail;
- _tmp41_ = _tmp40_.path;
- _tmp42_ = item;
- _tmp43_ = dbusmenu_menuitem_property_get (_tmp42_, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- if (g_strcmp0 (_tmp41_, _tmp43_) == 0) {
+ const gchar* _tmp17_ = NULL;
+ _tmp17_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 (detail.path, _tmp17_) == 0) {
within = TRUE;
playlist_details_destroy (&detail);
break;
@@ -385,28 +322,17 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
}
}
}
- _tmp44_ = within;
- if (_tmp44_ == FALSE) {
- DbusmenuMenuitem* _tmp45_;
- const gchar* _tmp46_ = NULL;
- DbusmenuMenuitem* _tmp47_;
- const gchar* _tmp48_ = NULL;
- DbusmenuMenuitem* _tmp51_;
- DbusmenuMenuitem* _tmp52_;
- _tmp45_ = self->root_item;
- _tmp46_ = dbusmenu_menuitem_property_get (_tmp45_, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- _tmp47_ = item;
- _tmp48_ = dbusmenu_menuitem_property_get (_tmp47_, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- if (g_strcmp0 (_tmp46_, _tmp48_) == 0) {
- DbusmenuMenuitem* _tmp49_;
- const gchar* _tmp50_ = NULL;
- _tmp49_ = self->root_item;
- _tmp50_ = _ ("Choose Playlist");
- dbusmenu_menuitem_property_set (_tmp49_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp50_);
+ if (within == FALSE) {
+ const gchar* _tmp18_ = NULL;
+ const gchar* _tmp19_ = NULL;
+ _tmp18_ = dbusmenu_menuitem_property_get (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ _tmp19_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 (_tmp18_, _tmp19_) == 0) {
+ const gchar* _tmp20_ = NULL;
+ _tmp20_ = _ ("Choose Playlist");
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, _tmp20_);
}
- _tmp51_ = self->root_item;
- _tmp52_ = item;
- dbusmenu_menuitem_child_delete (_tmp51_, _tmp52_);
+ dbusmenu_menuitem_child_delete (self->root_item, item);
}
_g_object_unref0 (item);
}
@@ -416,75 +342,52 @@ void playlists_menuitem_update (PlaylistsMenuitem* self, PlaylistDetails* playli
void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, PlaylistDetails* new_detail) {
- DbusmenuMenuitem* _tmp17_;
- const gchar* _tmp18_ = NULL;
- PlaylistDetails _tmp19_;
- const char* _tmp20_;
+ const gchar* _tmp9_ = NULL;
g_return_if_fail (self != NULL);
- g_return_if_fail (new_detail != NULL);
{
- GeeHashMap* _tmp0_;
+ GeeCollection* _tmp0_ = NULL;
GeeCollection* _tmp1_;
- GeeCollection* _tmp2_;
- GeeCollection* _tmp3_;
- GeeIterator* _tmp4_ = NULL;
- GeeIterator* _tmp5_;
+ GeeIterator* _tmp2_ = NULL;
+ GeeIterator* _tmp3_;
GeeIterator* _item_it;
- _tmp0_ = self->priv->current_playlists;
- _tmp1_ = gee_map_get_values ((GeeMap*) _tmp0_);
- _tmp2_ = _tmp1_;
+ _tmp0_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists);
+ _tmp1_ = _tmp0_;
+ _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_);
_tmp3_ = _tmp2_;
- _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
- _tmp5_ = _tmp4_;
- _g_object_unref0 (_tmp3_);
- _item_it = _tmp5_;
+ _g_object_unref0 (_tmp1_);
+ _item_it = _tmp3_;
while (TRUE) {
- GeeIterator* _tmp6_;
- gboolean _tmp7_ = FALSE;
- GeeIterator* _tmp8_;
- gpointer _tmp9_ = NULL;
+ gboolean _tmp4_;
+ gpointer _tmp5_ = NULL;
DbusmenuMenuitem* item;
- PlaylistDetails _tmp10_;
- const char* _tmp11_;
- DbusmenuMenuitem* _tmp12_;
- const gchar* _tmp13_ = NULL;
- _tmp6_ = _item_it;
- _tmp7_ = gee_iterator_next (_tmp6_);
- if (!_tmp7_) {
+ const gchar* _tmp6_ = NULL;
+ _tmp4_ = gee_iterator_next (_item_it);
+ if (!_tmp4_) {
break;
}
- _tmp8_ = _item_it;
- _tmp9_ = gee_iterator_get (_tmp8_);
- item = (DbusmenuMenuitem*) _tmp9_;
- _tmp10_ = *new_detail;
- _tmp11_ = _tmp10_.path;
- _tmp12_ = item;
- _tmp13_ = dbusmenu_menuitem_property_get (_tmp12_, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- if (g_strcmp0 (_tmp11_, _tmp13_) == 0) {
- DbusmenuMenuitem* _tmp14_;
- PlaylistDetails _tmp15_;
- const gchar* _tmp16_;
- _tmp14_ = item;
- _tmp15_ = *new_detail;
- _tmp16_ = _tmp15_.name;
- dbusmenu_menuitem_property_set (_tmp14_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp16_);
+ _tmp5_ = gee_iterator_get (_item_it);
+ item = (DbusmenuMenuitem*) _tmp5_;
+ _tmp6_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 ((*new_detail).path, _tmp6_) == 0) {
+ gchar* _tmp7_ = NULL;
+ gchar* _tmp8_;
+ _tmp7_ = playlists_menuitem_truncate_item_label_if_needs_be (self, (*new_detail).name);
+ _tmp8_ = _tmp7_;
+ dbusmenu_menuitem_property_set (item, DBUSMENU_MENUITEM_PROP_LABEL, _tmp8_);
+ _g_free0 (_tmp8_);
}
_g_object_unref0 (item);
}
_g_object_unref0 (_item_it);
}
- _tmp17_ = self->root_item;
- _tmp18_ = dbusmenu_menuitem_property_get (_tmp17_, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- _tmp19_ = *new_detail;
- _tmp20_ = _tmp19_.path;
- if (g_strcmp0 (_tmp18_, _tmp20_) == 0) {
- DbusmenuMenuitem* _tmp21_;
- PlaylistDetails _tmp22_;
- const gchar* _tmp23_;
- _tmp21_ = self->root_item;
- _tmp22_ = *new_detail;
- _tmp23_ = _tmp22_.name;
- dbusmenu_menuitem_property_set (_tmp21_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp23_);
+ _tmp9_ = dbusmenu_menuitem_property_get (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ if (g_strcmp0 (_tmp9_, (*new_detail).path) == 0) {
+ gchar* _tmp10_ = NULL;
+ gchar* _tmp11_;
+ _tmp10_ = playlists_menuitem_truncate_item_label_if_needs_be (self, (*new_detail).name);
+ _tmp11_ = _tmp10_;
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, _tmp11_);
+ _g_free0 (_tmp11_);
}
}
@@ -492,52 +395,35 @@ void playlists_menuitem_update_individual_playlist (PlaylistsMenuitem* self, Pla
static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, PlaylistDetails* new_detail) {
gboolean result = FALSE;
g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (new_detail != NULL, FALSE);
{
- GeeHashMap* _tmp0_;
+ GeeCollection* _tmp0_ = NULL;
GeeCollection* _tmp1_;
- GeeCollection* _tmp2_;
- GeeCollection* _tmp3_;
- GeeIterator* _tmp4_ = NULL;
- GeeIterator* _tmp5_;
+ GeeIterator* _tmp2_ = NULL;
+ GeeIterator* _tmp3_;
GeeIterator* _item_it;
- _tmp0_ = self->priv->current_playlists;
- _tmp1_ = gee_map_get_values ((GeeMap*) _tmp0_);
- _tmp2_ = _tmp1_;
+ _tmp0_ = gee_map_get_values ((GeeMap*) self->priv->current_playlists);
+ _tmp1_ = _tmp0_;
+ _tmp2_ = gee_iterable_iterator ((GeeIterable*) _tmp1_);
_tmp3_ = _tmp2_;
- _tmp4_ = gee_iterable_iterator ((GeeIterable*) _tmp3_);
- _tmp5_ = _tmp4_;
- _g_object_unref0 (_tmp3_);
- _item_it = _tmp5_;
+ _g_object_unref0 (_tmp1_);
+ _item_it = _tmp3_;
while (TRUE) {
- GeeIterator* _tmp6_;
- gboolean _tmp7_ = FALSE;
- GeeIterator* _tmp8_;
- gpointer _tmp9_ = NULL;
+ gboolean _tmp4_;
+ gpointer _tmp5_ = NULL;
DbusmenuMenuitem* item;
- DbusmenuMenuitem* _tmp10_;
- const gchar* _tmp11_ = NULL;
- gchar* _tmp12_;
+ const gchar* _tmp6_ = NULL;
+ gchar* _tmp7_;
gchar* path;
- PlaylistDetails _tmp13_;
- const char* _tmp14_;
- const gchar* _tmp15_;
- _tmp6_ = _item_it;
- _tmp7_ = gee_iterator_next (_tmp6_);
- if (!_tmp7_) {
+ _tmp4_ = gee_iterator_next (_item_it);
+ if (!_tmp4_) {
break;
}
- _tmp8_ = _item_it;
- _tmp9_ = gee_iterator_get (_tmp8_);
- item = (DbusmenuMenuitem*) _tmp9_;
- _tmp10_ = item;
- _tmp11_ = dbusmenu_menuitem_property_get (_tmp10_, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- _tmp12_ = g_strdup (_tmp11_);
- path = _tmp12_;
- _tmp13_ = *new_detail;
- _tmp14_ = _tmp13_.path;
- _tmp15_ = path;
- if (g_strcmp0 (_tmp14_, _tmp15_) == 0) {
+ _tmp5_ = gee_iterator_get (_item_it);
+ item = (DbusmenuMenuitem*) _tmp5_;
+ _tmp6_ = dbusmenu_menuitem_property_get (item, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ _tmp7_ = g_strdup (_tmp6_);
+ path = _tmp7_;
+ if (g_strcmp0 ((*new_detail).path, path) == 0) {
result = TRUE;
_g_free0 (path);
_g_object_unref0 (item);
@@ -556,34 +442,25 @@ static gboolean playlists_menuitem_already_observed (PlaylistsMenuitem* self, Pl
static gboolean string_contains (const gchar* self, const gchar* needle) {
gboolean result = FALSE;
- const gchar* _tmp0_;
- gchar* _tmp1_ = NULL;
+ gchar* _tmp0_ = NULL;
g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (needle != NULL, FALSE);
- _tmp0_ = needle;
- _tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
- result = _tmp1_ != NULL;
+ _tmp0_ = strstr ((gchar*) self, (gchar*) needle);
+ result = _tmp0_ != NULL;
return result;
}
static gboolean playlists_menuitem_is_video_related (PlaylistsMenuitem* self, PlaylistDetails* new_detail) {
gboolean result = FALSE;
- PlaylistDetails _tmp0_;
- const char* _tmp1_;
- gchar* _tmp2_;
+ gchar* _tmp0_;
gchar* location;
- const gchar* _tmp3_;
- gboolean _tmp4_ = FALSE;
+ gboolean _tmp1_;
g_return_val_if_fail (self != NULL, FALSE);
- g_return_val_if_fail (new_detail != NULL, FALSE);
- _tmp0_ = *new_detail;
- _tmp1_ = _tmp0_.path;
- _tmp2_ = g_strdup ((const gchar*) _tmp1_);
- location = _tmp2_;
- _tmp3_ = location;
- _tmp4_ = string_contains (_tmp3_, "/VideoLibrarySource/");
- if (_tmp4_) {
+ _tmp0_ = g_strdup ((const gchar*) (*new_detail).path);
+ location = _tmp0_;
+ _tmp1_ = string_contains (location, "/VideoLibrarySource/");
+ if (_tmp1_) {
result = TRUE;
_g_free0 (location);
return result;
@@ -595,81 +472,115 @@ static gboolean playlists_menuitem_is_video_related (PlaylistsMenuitem* self, Pl
void playlists_menuitem_active_playlist_update (PlaylistsMenuitem* self, PlaylistDetails* detail) {
- PlaylistDetails _tmp0_;
- const gchar* _tmp1_;
- gchar* _tmp2_;
+ gchar* _tmp0_;
gchar* update;
- const gchar* _tmp3_;
- DbusmenuMenuitem* _tmp6_;
- const gchar* _tmp7_;
- DbusmenuMenuitem* _tmp8_;
- PlaylistDetails _tmp9_;
- const char* _tmp10_;
+ gchar* _tmp3_ = NULL;
+ gchar* _tmp4_;
g_return_if_fail (self != NULL);
- g_return_if_fail (detail != NULL);
- _tmp0_ = *detail;
- _tmp1_ = _tmp0_.name;
- _tmp2_ = g_strdup (_tmp1_);
- update = _tmp2_;
- _tmp3_ = update;
- if (g_strcmp0 (_tmp3_, "") == 0) {
- const gchar* _tmp4_ = NULL;
- gchar* _tmp5_;
- _tmp4_ = _ ("Choose Playlist");
- _tmp5_ = g_strdup (_tmp4_);
+ _tmp0_ = g_strdup ((*detail).name);
+ update = _tmp0_;
+ if (g_strcmp0 (update, "") == 0) {
+ const gchar* _tmp1_ = NULL;
+ gchar* _tmp2_;
+ _tmp1_ = _ ("Choose Playlist");
+ _tmp2_ = g_strdup (_tmp1_);
_g_free0 (update);
- update = _tmp5_;
+ update = _tmp2_;
}
- _tmp6_ = self->root_item;
- _tmp7_ = update;
- dbusmenu_menuitem_property_set (_tmp6_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp7_);
- _tmp8_ = self->root_item;
- _tmp9_ = *detail;
- _tmp10_ = _tmp9_.path;
- dbusmenu_menuitem_property_set (_tmp8_, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) _tmp10_);
+ _tmp3_ = playlists_menuitem_truncate_item_label_if_needs_be (self, update);
+ _tmp4_ = _tmp3_;
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, _tmp4_);
+ _g_free0 (_tmp4_);
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH, (const gchar*) (*detail).path);
_g_free0 (update);
}
static void playlists_menuitem_submenu_item_activated (PlaylistsMenuitem* self, gint menu_item_id) {
- GeeHashMap* _tmp0_;
- gint _tmp1_;
- gboolean _tmp2_ = FALSE;
- PlayerController* _tmp4_;
- PlayerController* _tmp5_;
- Mpris2Controller* _tmp6_;
- GeeHashMap* _tmp7_;
- gint _tmp8_;
- gpointer _tmp9_ = NULL;
- DbusmenuMenuitem* _tmp10_;
- const gchar* _tmp11_ = NULL;
+ gboolean _tmp0_;
+ PlayerController* _tmp1_ = NULL;
+ gpointer _tmp2_ = NULL;
+ DbusmenuMenuitem* _tmp3_;
+ const gchar* _tmp4_ = NULL;
g_return_if_fail (self != NULL);
- _tmp0_ = self->priv->current_playlists;
- _tmp1_ = menu_item_id;
- _tmp2_ = gee_abstract_map_has_key ((GeeAbstractMap*) _tmp0_, GINT_TO_POINTER (_tmp1_));
- if (!_tmp2_) {
- gint _tmp3_;
- _tmp3_ = menu_item_id;
- g_warning ("playlists-menu-item.vala:125: item %i was activated but we don't have " \
-"a corresponding playlist", _tmp3_);
+ _tmp0_ = gee_abstract_map_has_key ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (menu_item_id));
+ if (!_tmp0_) {
+ g_warning ("playlists-menu-item.vala:129: item %i was activated but we don't have " \
+"a corresponding playlist", menu_item_id);
return;
}
- _tmp4_ = player_item_get_owner ((PlayerItem*) self);
- _tmp5_ = _tmp4_;
- _tmp6_ = _tmp5_->mpris_bridge;
- _tmp7_ = self->priv->current_playlists;
- _tmp8_ = menu_item_id;
- _tmp9_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp7_, GINT_TO_POINTER (_tmp8_));
- _tmp10_ = (DbusmenuMenuitem*) _tmp9_;
- _tmp11_ = dbusmenu_menuitem_property_get (_tmp10_, DBUSMENU_PLAYLIST_MENUITEM_PATH);
- mpris2_controller_activate_playlist (_tmp6_, (const char*) _tmp11_);
- _g_object_unref0 (_tmp10_);
+ _tmp1_ = player_item_get_owner ((PlayerItem*) self);
+ _tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->current_playlists, GINT_TO_POINTER (menu_item_id));
+ _tmp3_ = (DbusmenuMenuitem*) _tmp2_;
+ _tmp4_ = dbusmenu_menuitem_property_get (_tmp3_, DBUSMENU_PLAYLIST_MENUITEM_PATH);
+ mpris2_controller_activate_playlist (_tmp1_->mpris_bridge, (const char*) _tmp4_);
+ _g_object_unref0 (_tmp3_);
+}
+
+
+static gchar* string_slice (const gchar* self, glong start, glong end) {
+ gchar* result = NULL;
+ gint _tmp0_;
+ glong string_length;
+ gboolean _tmp1_ = FALSE;
+ gboolean _tmp2_ = FALSE;
+ gchar* _tmp3_ = NULL;
+ g_return_val_if_fail (self != NULL, NULL);
+ _tmp0_ = strlen (self);
+ string_length = (glong) _tmp0_;
+ if (start < 0) {
+ start = string_length + start;
+ }
+ if (end < 0) {
+ end = string_length + end;
+ }
+ if (start >= 0) {
+ _tmp1_ = start <= string_length;
+ } else {
+ _tmp1_ = FALSE;
+ }
+ g_return_val_if_fail (_tmp1_, NULL);
+ if (end >= 0) {
+ _tmp2_ = end <= string_length;
+ } else {
+ _tmp2_ = FALSE;
+ }
+ g_return_val_if_fail (_tmp2_, NULL);
+ g_return_val_if_fail (start <= end, NULL);
+ _tmp3_ = g_strndup (((gchar*) self) + start, (gsize) (end - start));
+ result = _tmp3_;
+ return result;
+}
+
+
+static gchar* playlists_menuitem_truncate_item_label_if_needs_be (PlaylistsMenuitem* self, const gchar* item_label) {
+ gchar* result = NULL;
+ gchar* _tmp0_;
+ gchar* _result_;
+ gint _tmp1_;
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (item_label != NULL, NULL);
+ _tmp0_ = g_strdup (item_label);
+ _result_ = _tmp0_;
+ _tmp1_ = g_utf8_strlen (item_label, (gssize) (-1));
+ if (_tmp1_ > 17) {
+ gchar* _tmp2_ = NULL;
+ gchar* _tmp3_;
+ _tmp2_ = string_slice (item_label, (glong) 0, (glong) 15);
+ _g_free0 (_result_);
+ _result_ = _tmp2_;
+ _tmp3_ = g_strconcat (_result_, "…", NULL);
+ _g_free0 (_result_);
+ _result_ = _tmp3_;
+ }
+ result = _result_;
+ return result;
}
GeeHashSet* playlists_menuitem_attributes_format (void) {
GeeHashSet* result = NULL;
- GeeHashSet* _tmp0_;
+ GeeHashSet* _tmp0_ = NULL;
GeeHashSet* attrs;
_tmp0_ = gee_hash_set_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL);
attrs = _tmp0_;
@@ -684,11 +595,9 @@ static GObject * playlists_menuitem_constructor (GType type, guint n_construct_p
GObject * obj;
GObjectClass * parent_class;
PlaylistsMenuitem * self;
- GeeHashMap* _tmp0_;
- DbusmenuMenuitem* _tmp1_;
- DbusmenuMenuitem* _tmp2_;
- const gchar* _tmp3_ = NULL;
- DbusmenuMenuitem* _tmp4_;
+ GeeHashMap* _tmp0_ = NULL;
+ DbusmenuMenuitem* _tmp1_ = NULL;
+ const gchar* _tmp2_ = NULL;
parent_class = G_OBJECT_CLASS (playlists_menuitem_parent_class);
obj = parent_class->constructor (type, n_construct_properties, construct_properties);
self = PLAYLISTS_MENUITEM (obj);
@@ -698,11 +607,9 @@ static GObject * playlists_menuitem_constructor (GType type, guint n_construct_p
_tmp1_ = dbusmenu_menuitem_new ();
_g_object_unref0 (self->root_item);
self->root_item = _tmp1_;
- _tmp2_ = self->root_item;
- _tmp3_ = _ ("Choose Playlist");
- dbusmenu_menuitem_property_set (_tmp2_, DBUSMENU_MENUITEM_PROP_LABEL, _tmp3_);
- _tmp4_ = self->root_item;
- dbusmenu_menuitem_property_set (_tmp4_, DBUSMENU_PLAYLIST_MENUITEM_PATH, "");
+ _tmp2_ = _ ("Choose Playlist");
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_MENUITEM_PROP_LABEL, _tmp2_);
+ dbusmenu_menuitem_property_set (self->root_item, DBUSMENU_PLAYLIST_MENUITEM_PATH, "");
return obj;
}