aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2010-07-29 11:26:41 -0400
committerKen VanDine <ken.vandine@canonical.com>2010-07-29 11:26:41 -0400
commit986fc648fc6544aaa3bb40a17e1345e0247a4b57 (patch)
treeda2904b0c642c44d65629a9657b550c2c26a7b08 /src/player-controller.c
parent1777ee4291dc792ca3d4df087c8af23cd8458961 (diff)
parent859c48c87009fb12e0acc15fdeb8d69e42247176 (diff)
downloadayatana-indicator-sound-986fc648fc6544aaa3bb40a17e1345e0247a4b57.tar.gz
ayatana-indicator-sound-986fc648fc6544aaa3bb40a17e1345e0247a4b57.tar.bz2
ayatana-indicator-sound-986fc648fc6544aaa3bb40a17e1345e0247a4b57.zip
Import upstream version 0.3.9
Diffstat (limited to 'src/player-controller.c')
-rw-r--r--src/player-controller.c171
1 files changed, 114 insertions, 57 deletions
diff --git a/src/player-controller.c b/src/player-controller.c
index acb2da2..55b097f 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -71,16 +71,6 @@ typedef struct _MprisControllerClass MprisControllerClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
-#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ())
-#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem))
-#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
-#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM))
-#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM))
-#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
-
-typedef struct _MetadataMenuitem MetadataMenuitem;
-typedef struct _MetadataMenuitemClass MetadataMenuitemClass;
-
#define TYPE_TITLE_MENUITEM (title_menuitem_get_type ())
#define TITLE_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TITLE_MENUITEM, TitleMenuitem))
#define TITLE_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TITLE_MENUITEM, TitleMenuitemClass))
@@ -91,6 +81,16 @@ typedef struct _MetadataMenuitemClass MetadataMenuitemClass;
typedef struct _TitleMenuitem TitleMenuitem;
typedef struct _TitleMenuitemClass TitleMenuitemClass;
+#define TYPE_METADATA_MENUITEM (metadata_menuitem_get_type ())
+#define METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitem))
+#define METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
+#define IS_METADATA_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_METADATA_MENUITEM))
+#define IS_METADATA_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_METADATA_MENUITEM))
+#define METADATA_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_METADATA_MENUITEM, MetadataMenuitemClass))
+
+typedef struct _MetadataMenuitem MetadataMenuitem;
+typedef struct _MetadataMenuitemClass MetadataMenuitemClass;
+
#define TYPE_SCRUB_MENUITEM (scrub_menuitem_get_type ())
#define SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitem))
#define SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass))
@@ -135,7 +135,8 @@ typedef enum {
PLAYER_CONTROLLER_WIDGET_ORDER_TITLE,
PLAYER_CONTROLLER_WIDGET_ORDER_METADATA,
PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB,
- PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT
+ PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT,
+ PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST
} PlayerControllerwidget_order;
typedef enum {
@@ -149,9 +150,9 @@ typedef enum {
static gpointer player_controller_parent_class = NULL;
-GType player_controller_get_type (void);
-GType player_item_get_type (void);
-GType mpris_controller_get_type (void);
+GType player_controller_get_type (void) G_GNUC_CONST;
+GType player_item_get_type (void) G_GNUC_CONST;
+GType mpris_controller_get_type (void) G_GNUC_CONST;
#define PLAYER_CONTROLLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_PLAYER_CONTROLLER, PlayerControllerPrivate))
enum {
PLAYER_CONTROLLER_DUMMY_PROPERTY,
@@ -159,12 +160,11 @@ enum {
PLAYER_CONTROLLER_APP_INFO,
PLAYER_CONTROLLER_MENU_OFFSET
};
-GType player_controller_widget_order_get_type (void);
-GType player_controller_state_get_type (void);
-#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5
+GType player_controller_widget_order_get_type (void) G_GNUC_CONST;
+GType player_controller_state_get_type (void) G_GNUC_CONST;
+#define PLAYER_CONTROLLER_WIDGET_QUANTITY 6
static char* player_controller_format_client_name (const char* client_name);
void player_controller_set_name (PlayerController* self, const char* value);
-void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state);
void player_controller_set_menu_offset (PlayerController* self, gint value);
static void player_controller_construct_widgets (PlayerController* self);
static void player_controller_establish_mpris_connection (PlayerController* self);
@@ -172,6 +172,7 @@ void player_controller_update_layout (PlayerController* self);
PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state);
PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state);
const char* player_controller_get_name (PlayerController* self);
+void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state);
void player_controller_activate (PlayerController* self);
GAppInfo* player_controller_get_app_info (PlayerController* self);
void player_controller_instantiate (PlayerController* self);
@@ -179,20 +180,24 @@ MprisController* mpris_controller_new (PlayerController* ctrl, const char* inter
MprisController* mpris_controller_construct (GType object_type, PlayerController* ctrl, const char* inter);
gboolean mpris_controller_connected (MprisController* self);
void player_controller_vanish (PlayerController* self);
-GType metadata_menuitem_get_type (void);
+gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
+GeeHashSet* metadata_menuitem_attributes_format (void);
+GeeHashSet* scrub_menuitem_attributes_format (void);
PlayerItem* player_item_new (const char* type);
PlayerItem* player_item_construct (GType object_type, const char* type);
TitleMenuitem* title_menuitem_new (PlayerController* parent);
TitleMenuitem* title_menuitem_construct (GType object_type, PlayerController* parent);
-GType title_menuitem_get_type (void);
+GType title_menuitem_get_type (void) G_GNUC_CONST;
MetadataMenuitem* metadata_menuitem_new (void);
MetadataMenuitem* metadata_menuitem_construct (GType object_type);
+GType metadata_menuitem_get_type (void) G_GNUC_CONST;
ScrubMenuitem* scrub_menuitem_new (PlayerController* parent);
ScrubMenuitem* scrub_menuitem_construct (GType object_type, PlayerController* parent);
-GType scrub_menuitem_get_type (void);
+GType scrub_menuitem_get_type (void) G_GNUC_CONST;
TransportMenuitem* transport_menuitem_new (PlayerController* parent);
TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent);
-GType transport_menuitem_get_type (void);
+GType transport_menuitem_get_type (void) G_GNUC_CONST;
+static PlayerItem* player_controller_create_playlist (PlayerController* self);
gint player_controller_get_menu_offset (PlayerController* self);
void player_controller_set_app_info (PlayerController* self, GAppInfo* value);
static void player_controller_finalize (GObject* obj);
@@ -205,7 +210,7 @@ static int _vala_strcmp0 (const char * str1, const char * str2);
GType player_controller_widget_order_get_type (void) {
static volatile gsize player_controller_widget_order_type_id__volatile = 0;
if (g_once_init_enter (&player_controller_widget_order_type_id__volatile)) {
- static const GEnumValue values[] = {{PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, "PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR", "separator"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, "PLAYER_CONTROLLER_WIDGET_ORDER_TITLE", "title"}, {PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, "PLAYER_CONTROLLER_WIDGET_ORDER_METADATA", "metadata"}, {PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, "PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB", "scrub"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {0, NULL, NULL}};
+ static const GEnumValue values[] = {{PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR, "PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR", "separator"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TITLE, "PLAYER_CONTROLLER_WIDGET_ORDER_TITLE", "title"}, {PLAYER_CONTROLLER_WIDGET_ORDER_METADATA, "PLAYER_CONTROLLER_WIDGET_ORDER_METADATA", "metadata"}, {PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB, "PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB", "scrub"}, {PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST, "PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST", "playlist"}, {0, NULL, NULL}};
GType player_controller_widget_order_type_id;
player_controller_widget_order_type_id = g_enum_register_static ("PlayerControllerwidget_order", values);
g_once_init_leave (&player_controller_widget_order_type_id__volatile, player_controller_widget_order_type_id);
@@ -256,7 +261,7 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
_g_free0 (_tmp2_);
_g_free0 (_tmp1_);
self->custom_items = (_tmp3_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->custom_items), _tmp3_);
- player_controller_update_state (self, initial_state);
+ self->current_state = (gint) initial_state;
player_controller_set_menu_offset (self, offset);
player_controller_construct_widgets (self);
player_controller_establish_mpris_connection (self);
@@ -272,9 +277,10 @@ PlayerController* player_controller_new (DbusmenuMenuitem* root, const char* cli
void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state) {
g_return_if_fail (self != NULL);
- g_debug ("player-controller.vala:68: update_state - player controller %s : new s" \
+ g_debug ("player-controller.vala:69: update_state - player controller %s : new s" \
"tate %i", self->priv->_name, (gint) new_state);
self->current_state = (gint) new_state;
+ player_controller_update_layout (self);
}
@@ -291,7 +297,7 @@ void player_controller_instantiate (PlayerController* self) {
GError * _inner_error_;
g_return_if_fail (self != NULL);
_inner_error_ = NULL;
- g_debug ("player-controller.vala:87: instantiate in player controller for %s", self->priv->_name);
+ g_debug ("player-controller.vala:88: instantiate in player controller for %s", self->priv->_name);
{
g_app_info_launch (self->priv->_app_info, NULL, NULL, &_inner_error_);
if (_inner_error_ != NULL) {
@@ -306,7 +312,7 @@ void player_controller_instantiate (PlayerController* self) {
_error_ = _inner_error_;
_inner_error_ = NULL;
{
- g_warning ("player-controller.vala:93: Failed to launch app %s with error message:" \
+ g_warning ("player-controller.vala:94: Failed to launch app %s with error message:" \
" %s", self->priv->_name, _error_->message);
_g_error_free0 (_error_);
}
@@ -323,25 +329,24 @@ void player_controller_instantiate (PlayerController* self) {
static void player_controller_establish_mpris_connection (PlayerController* self) {
g_return_if_fail (self != NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_READY) {
- g_debug ("player-controller.vala:100: establish_mpris_connection - Not ready to " \
+ g_debug ("player-controller.vala:101: establish_mpris_connection - Not ready to " \
"connect");
return;
}
if (_vala_strcmp0 (self->priv->_name, "Vlc") == 0) {
MprisController* _tmp0_;
- g_debug ("player-controller.vala:105: establishing a vlc mpris controller");
+ g_debug ("player-controller.vala:106: establishing a vlc mpris controller");
self->mpris_adaptor = (_tmp0_ = mpris_controller_new (self, "org.mpris.MediaPlayer.Player"), _g_object_unref0 (self->mpris_adaptor), _tmp0_);
} else {
MprisController* _tmp1_;
self->mpris_adaptor = (_tmp1_ = mpris_controller_new (self, "org.freedesktop.MediaPlayer"), _g_object_unref0 (self->mpris_adaptor), _tmp1_);
}
if (mpris_controller_connected (self->mpris_adaptor) == TRUE) {
- g_debug ("player-controller.vala:113: yup I'm connected");
+ g_debug ("player-controller.vala:114: yup I'm connected");
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_CONNECTED);
} else {
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_DISCONNECTED);
}
- player_controller_update_layout (self);
}
@@ -377,33 +382,56 @@ static char* bool_to_string (gboolean self) {
void player_controller_update_layout (PlayerController* self) {
- gboolean visibility;
- PlayerItem* _tmp0_;
- MetadataMenuitem* meta_item;
- char* _tmp1_;
- PlayerItem* _tmp2_;
- PlayerItem* _tmp3_;
+ char* _tmp6_;
+ GeeHashSet* _tmp5_;
PlayerItem* _tmp4_;
+ GeeHashSet* _tmp9_;
+ PlayerItem* _tmp8_;
+ PlayerItem* _tmp7_;
+ char* _tmp12_;
+ GeeHashSet* _tmp11_;
+ PlayerItem* _tmp10_;
+ GeeHashSet* _tmp15_;
+ PlayerItem* _tmp14_;
+ PlayerItem* _tmp13_;
+ PlayerItem* _tmp16_;
+ PlayerItem* _tmp17_;
g_return_if_fail (self != NULL);
- visibility = TRUE;
- meta_item = (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), IS_METADATA_MENUITEM (_tmp0_) ? ((MetadataMenuitem*) _tmp0_) : NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) {
- visibility = FALSE;
+ PlayerItem* _tmp0_;
+ PlayerItem* _tmp1_;
+ PlayerItem* _tmp2_;
+ PlayerItem* _tmp3_;
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ _g_object_unref0 (_tmp0_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp1_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ _g_object_unref0 (_tmp1_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ _g_object_unref0 (_tmp2_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST)), DBUSMENU_MENUITEM_PROP_VISIBLE, FALSE);
+ _g_object_unref0 (_tmp3_);
+ return;
}
- g_debug ("player-controller.vala:137: about the set the visibility on both the t" \
-"ransport and metadata widget to %s", _tmp1_ = bool_to_string (visibility));
- _g_free0 (_tmp1_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
- _g_object_unref0 (_tmp2_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
- _g_object_unref0 (_tmp3_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, visibility);
+ g_debug ("player-controller.vala:143: update layout - metadata %s", _tmp6_ = bool_to_string (player_item_populated (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp5_ = metadata_menuitem_attributes_format ())));
+ _g_free0 (_tmp6_);
+ _g_object_unref0 (_tmp5_);
_g_object_unref0 (_tmp4_);
- if (visibility == FALSE) {
- g_warning ("player-controller.vala:143: Update layout of client %s is setting widg" \
-"ets to invisibile!", self->priv->_name);
- }
- _g_object_unref0 (meta_item);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp7_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp8_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp9_ = metadata_menuitem_attributes_format ()));
+ _g_object_unref0 (_tmp9_);
+ _g_object_unref0 (_tmp8_);
+ _g_object_unref0 (_tmp7_);
+ g_debug ("player-controller.vala:146: update layout - scrub %s", _tmp12_ = bool_to_string (player_item_populated (_tmp10_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp11_ = scrub_menuitem_attributes_format ())));
+ _g_free0 (_tmp12_);
+ _g_object_unref0 (_tmp11_);
+ _g_object_unref0 (_tmp10_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp13_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp14_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp15_ = scrub_menuitem_attributes_format ()));
+ _g_object_unref0 (_tmp15_);
+ _g_object_unref0 (_tmp14_);
+ _g_object_unref0 (_tmp13_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp16_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+ _g_object_unref0 (_tmp16_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp17_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLIST)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+ _g_object_unref0 (_tmp17_);
}
@@ -413,6 +441,7 @@ static void player_controller_construct_widgets (PlayerController* self) {
MetadataMenuitem* metadata_item;
ScrubMenuitem* scrub_item;
TransportMenuitem* transport_item;
+ PlayerItem* _tmp1_;
g_return_if_fail (self != NULL);
gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp0_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR));
_g_object_unref0 (_tmp0_);
@@ -424,6 +453,8 @@ static void player_controller_construct_widgets (PlayerController* self) {
gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) scrub_item);
transport_item = transport_menuitem_new (self);
gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) transport_item);
+ gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp1_ = player_controller_create_playlist (self));
+ _g_object_unref0 (_tmp1_);
{
GeeIterator* _item_it;
_item_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->custom_items);
@@ -438,10 +469,36 @@ static void player_controller_construct_widgets (PlayerController* self) {
}
_g_object_unref0 (_item_it);
}
- _g_object_unref0 (title_menu_item);
- _g_object_unref0 (metadata_item);
- _g_object_unref0 (scrub_item);
_g_object_unref0 (transport_item);
+ _g_object_unref0 (scrub_item);
+ _g_object_unref0 (metadata_item);
+ _g_object_unref0 (title_menu_item);
+}
+
+
+static PlayerItem* player_controller_create_playlist (PlayerController* self) {
+ PlayerItem* result = NULL;
+ PlayerItem* playlist_root;
+ PlayerItem* subentry_1;
+ PlayerItem* subentry_2;
+ PlayerItem* subentry_3;
+ g_return_val_if_fail (self != NULL, NULL);
+ playlist_root = player_item_new (DBUSMENU_CLIENT_TYPES_DEFAULT);
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) playlist_root, DBUSMENU_MENUITEM_PROP_LABEL, "Choose Playlist");
+ subentry_1 = player_item_new (DBUSMENU_CLIENT_TYPES_DEFAULT);
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) subentry_1, DBUSMENU_MENUITEM_PROP_LABEL, "Raster-noton selection");
+ subentry_2 = player_item_new (DBUSMENU_CLIENT_TYPES_DEFAULT);
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) subentry_2, DBUSMENU_MENUITEM_PROP_LABEL, "Rune Grammofon selection");
+ subentry_3 = player_item_new (DBUSMENU_CLIENT_TYPES_DEFAULT);
+ dbusmenu_menuitem_property_set ((DbusmenuMenuitem*) subentry_3, DBUSMENU_MENUITEM_PROP_LABEL, "Kranky selection");
+ dbusmenu_menuitem_child_append ((DbusmenuMenuitem*) playlist_root, (DbusmenuMenuitem*) subentry_1);
+ dbusmenu_menuitem_child_append ((DbusmenuMenuitem*) playlist_root, (DbusmenuMenuitem*) subentry_2);
+ dbusmenu_menuitem_child_append ((DbusmenuMenuitem*) playlist_root, (DbusmenuMenuitem*) subentry_3);
+ result = playlist_root;
+ _g_object_unref0 (subentry_3);
+ _g_object_unref0 (subentry_2);
+ _g_object_unref0 (subentry_1);
+ return result;
}
@@ -490,7 +547,7 @@ static char* player_controller_format_client_name (const char* client_name) {
formatted = (_tmp2_ = g_strconcat (_tmp0_ = g_utf8_strup (client_name, (gssize) 1), _tmp1_ = string_slice (client_name, (glong) 1, g_utf8_strlen (client_name, -1)), NULL), _g_free0 (formatted), _tmp2_);
_g_free0 (_tmp1_);
_g_free0 (_tmp0_);
- g_debug ("player-controller.vala:179: PlayerController->format_client_name - : %" \
+ g_debug ("player-controller.vala:212: PlayerController->format_client_name - : %" \
"s", formatted);
}
result = formatted;