aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.c
diff options
context:
space:
mode:
authorKen VanDine <ken.vandine@canonical.com>2011-01-11 16:44:38 -0600
committerKen VanDine <ken.vandine@canonical.com>2011-01-11 16:44:38 -0600
commit412bffad64182bfae1e2408b89f9488f0da38481 (patch)
tree1617f11e230dcd76678196fd1fde6b95a1742bcd /src/player-controller.c
parent13d392dab3f0fcba861bd6607ce17d68990b9228 (diff)
parent714c7c49776e8a341254a3e4297b465d181206cd (diff)
downloadayatana-indicator-sound-412bffad64182bfae1e2408b89f9488f0da38481.tar.gz
ayatana-indicator-sound-412bffad64182bfae1e2408b89f9488f0da38481.tar.bz2
ayatana-indicator-sound-412bffad64182bfae1e2408b89f9488f0da38481.zip
Import upstream version 0.5.5
Diffstat (limited to 'src/player-controller.c')
-rw-r--r--src/player-controller.c108
1 files changed, 75 insertions, 33 deletions
diff --git a/src/player-controller.c b/src/player-controller.c
index 6a84368..c4583d9 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -1,4 +1,4 @@
-/* player-controller.c generated by valac 0.11.2, the Vala compiler
+/* player-controller.c generated by valac 0.11.3, the Vala compiler
* generated from player-controller.vala, do not modify */
/*
@@ -119,6 +119,7 @@ struct _PlayerController {
gint current_state;
GeeArrayList* custom_items;
Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
};
struct _PlayerControllerClass {
@@ -185,8 +186,9 @@ enum {
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 5
-PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state);
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state);
+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);
+static gboolean* _bool_dup (gboolean* self);
void player_controller_set_app_info (PlayerController* self, GAppInfo* value);
void player_controller_set_dbus_name (PlayerController* self, const gchar* value);
void player_controller_set_icon_name (PlayerController* self, const gchar* value);
@@ -211,7 +213,6 @@ GType title_menuitem_get_type (void) G_GNUC_CONST;
void title_menuitem_toggle_active_triangle (TitleMenuitem* self, gboolean update);
GType playlists_menuitem_get_type (void) G_GNUC_CONST;
gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
-gboolean mpris2_controller_playlists_support_exist (Mpris2Controller* self);
PlayerItem* player_item_new (const gchar* type);
PlayerItem* player_item_construct (GType object_type, const gchar* type);
TitleMenuitem* title_menuitem_new (PlayerController* parent);
@@ -261,32 +262,51 @@ GType player_controller_state_get_type (void) {
}
+static gboolean* _bool_dup (gboolean* self) {
+ gboolean* dup;
+ dup = g_new0 (gboolean, 1);
+ memcpy (dup, self, sizeof (gboolean));
+ return dup;
+}
+
+
+static gpointer __bool_dup0 (gpointer self) {
+ return self ? _bool_dup (self) : NULL;
+}
+
+
static gpointer _g_object_ref0 (gpointer self) {
return self ? g_object_ref (self) : NULL;
}
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) {
+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;
- DbusmenuMenuitem* _tmp0_;
- DbusmenuMenuitem* _tmp1_;
- GeeArrayList* _tmp2_ = NULL;
- GeeArrayList* _tmp3_;
+ gboolean* _tmp0_;
+ gboolean* _tmp1_;
+ DbusmenuMenuitem* _tmp2_;
+ DbusmenuMenuitem* _tmp3_;
+ GeeArrayList* _tmp4_ = NULL;
+ GeeArrayList* _tmp5_;
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_ = _g_object_ref0 (root);
+ _tmp0_ = __bool_dup0 (use_playlists);
_tmp1_ = _tmp0_;
+ _g_free0 (self->use_playlists);
+ self->use_playlists = _tmp1_;
+ _tmp2_ = _g_object_ref0 (root);
+ _tmp3_ = _tmp2_;
_g_object_unref0 (self->priv->root_menu);
- self->priv->root_menu = _tmp1_;
+ self->priv->root_menu = _tmp3_;
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);
- _tmp3_ = _tmp2_;
+ _tmp4_ = gee_array_list_new (TYPE_PLAYER_ITEM, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
+ _tmp5_ = _tmp4_;
_g_object_unref0 (self->custom_items);
- self->custom_items = _tmp3_;
+ self->custom_items = _tmp5_;
self->current_state = (gint) initial_state;
player_controller_set_menu_offset (self, offset);
player_controller_construct_widgets (self);
@@ -296,8 +316,8 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
}
-PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, PlayerControllerstate initial_state) {
- return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, dbus_name, icon_name, offset, initial_state);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state) {
+ return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, dbus_name, icon_name, offset, use_playlists, initial_state);
}
@@ -305,7 +325,7 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta
const gchar* _tmp0_ = NULL;
g_return_if_fail (self != NULL);
_tmp0_ = g_app_info_get_name (self->priv->_app_info);
- g_debug ("player-controller.vala:75: update_state - player controller %s : new s" \
+ g_debug ("player-controller.vala:78: update_state - player controller %s : new s" \
"tate %i", _tmp0_, (gint) new_state);
self->current_state = (gint) new_state;
player_controller_update_layout (self);
@@ -325,7 +345,7 @@ void player_controller_instantiate (PlayerController* self) {
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:95: instantiate in player controller for %s", _tmp0_);
+ g_debug ("player-controller.vala:98: 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;
@@ -339,7 +359,7 @@ void player_controller_instantiate (PlayerController* self) {
_error_ = _inner_error_;
_inner_error_ = NULL;
_tmp1_ = g_app_info_get_name (self->priv->_app_info);
- g_warning ("player-controller.vala:101: Failed to launch app %s with error message" \
+ g_warning ("player-controller.vala:104: Failed to launch app %s with error message" \
": %s", _tmp1_, _error_->message);
_g_error_free0 (_error_);
}
@@ -352,10 +372,28 @@ void player_controller_instantiate (PlayerController* self) {
}
+static gchar* bool_to_string (gboolean self) {
+ gchar* result = NULL;
+ if (self) {
+ gchar* _tmp0_;
+ _tmp0_ = g_strdup ("true");
+ result = _tmp0_;
+ return result;
+ } else {
+ gchar* _tmp1_;
+ _tmp1_ = g_strdup ("false");
+ result = _tmp1_;
+ return result;
+ }
+}
+
+
static void player_controller_establish_mpris_connection (PlayerController* self) {
gboolean _tmp0_ = FALSE;
- Mpris2Controller* _tmp1_ = NULL;
- Mpris2Controller* _tmp2_;
+ gchar* _tmp1_ = NULL;
+ gchar* _tmp2_;
+ Mpris2Controller* _tmp3_ = NULL;
+ Mpris2Controller* _tmp4_;
g_return_if_fail (self != NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_READY) {
_tmp0_ = TRUE;
@@ -363,14 +401,19 @@ static void player_controller_establish_mpris_connection (PlayerController* self
_tmp0_ = self->priv->_dbus_name == NULL;
}
if (_tmp0_) {
- g_debug ("player-controller.vala:109: establish_mpris_connection - Not ready to " \
+ g_debug ("player-controller.vala:112: establish_mpris_connection - Not ready to " \
"connect");
return;
}
- _tmp1_ = mpris2_controller_new (self);
+ _tmp1_ = bool_to_string (*self->use_playlists);
_tmp2_ = _tmp1_;
+ g_debug ("player-controller.vala:115: establish mpris connection - use playlist" \
+"s value = %s ", _tmp2_);
+ _g_free0 (_tmp2_);
+ _tmp3_ = mpris2_controller_new (self);
+ _tmp4_ = _tmp3_;
_g_object_unref0 (self->mpris_bridge);
- self->mpris_bridge = _tmp2_;
+ self->mpris_bridge = _tmp4_;
player_controller_determine_state (self);
}
@@ -457,7 +500,6 @@ void player_controller_update_layout (PlayerController* self) {
gboolean _tmp12_;
gpointer _tmp13_ = NULL;
PlayerItem* _tmp14_;
- gboolean _tmp15_;
g_return_if_fail (self != NULL);
_tmp0_ = gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_PLAYLISTS);
playlists_menuitem = (_tmp1_ = (PlayerItem*) _tmp0_, IS_PLAYLISTS_MENUITEM (_tmp1_) ? ((PlaylistsMenuitem*) _tmp1_) : NULL);
@@ -493,8 +535,7 @@ void player_controller_update_layout (PlayerController* self) {
_tmp14_ = (PlayerItem*) _tmp13_;
dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp14_, DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
_g_object_unref0 (_tmp14_);
- _tmp15_ = mpris2_controller_playlists_support_exist (self->mpris_bridge);
- dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp15_);
+ dbusmenu_menuitem_property_set_bool (playlists_menuitem->root_item, DBUSMENU_MENUITEM_PROP_VISIBLE, *self->use_playlists);
_g_object_unref0 (playlists_menuitem);
}
@@ -598,7 +639,7 @@ static const gchar* string_offset (const gchar* self, glong offset) {
static gchar* string_slice (const gchar* self, glong start, glong end) {
gchar* result = NULL;
- glong _tmp0_;
+ gint _tmp0_;
glong string_length;
gboolean _tmp1_ = FALSE;
gboolean _tmp2_ = FALSE;
@@ -608,7 +649,7 @@ static gchar* string_slice (const gchar* self, glong start, glong end) {
gchar* _tmp5_ = NULL;
g_return_val_if_fail (self != NULL, NULL);
_tmp0_ = strlen (self);
- string_length = _tmp0_;
+ string_length = (glong) _tmp0_;
if (start < 0) {
start = string_length + start;
}
@@ -650,7 +691,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) {
gint _tokens_size_;
gchar** _tmp6_;
gchar** tokens;
- glong _tmp9_;
+ gint _tmp9_;
g_return_val_if_fail (app_info_name != NULL, NULL);
_tmp0_ = g_utf8_strdown (app_info_name, (gssize) (-1));
_tmp1_ = _tmp0_;
@@ -673,7 +714,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) {
if (_tmp9_ > 1) {
gchar* _tmp10_ = NULL;
gchar* _tmp11_;
- glong _tmp12_;
+ gint _tmp12_;
gchar* _tmp13_ = NULL;
gchar* _tmp14_;
gchar* _tmp15_ = NULL;
@@ -681,7 +722,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) {
_tmp10_ = g_utf8_strup (_result_, (gssize) 1);
_tmp11_ = _tmp10_;
_tmp12_ = strlen (_result_);
- _tmp13_ = string_slice (_result_, (glong) 1, _tmp12_);
+ _tmp13_ = string_slice (_result_, (glong) 1, (glong) _tmp12_);
_tmp14_ = _tmp13_;
_tmp15_ = g_strconcat (_tmp11_, _tmp14_, NULL);
_tmp16_ = _tmp15_;
@@ -690,7 +731,7 @@ static gchar* player_controller_format_player_name (gchar* app_info_name) {
_g_free0 (_tmp14_);
_g_free0 (_tmp11_);
}
- g_debug ("player-controller.vala:197: PlayerController->format_player_name - : %" \
+ g_debug ("player-controller.vala:202: PlayerController->format_player_name - : %" \
"s", _result_);
result = _result_;
tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);
@@ -822,6 +863,7 @@ static void player_controller_finalize (GObject* obj) {
_g_object_unref0 (self->mpris_bridge);
_g_object_unref0 (self->priv->_app_info);
_g_free0 (self->priv->_icon_name);
+ _g_free0 (self->use_playlists);
G_OBJECT_CLASS (player_controller_parent_class)->finalize (obj);
}