aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2012-07-12 19:52:11 +0200
committerSebastien Bacher <seb128@ubuntu.com>2012-07-12 19:52:11 +0200
commit612866753e2b554abb0b448ae6a8c8ce1c2f4d87 (patch)
tree03ced96344802a4e338eb53d35d1c677f8354460 /src/player-controller.c
parent31b5a5a6508535ed1af86919c79d75571f1a65ef (diff)
parent2900797204c4446a7f46515364c6aa868a5f4fab (diff)
downloadayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.gz
ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.bz2
ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.zip
Import upstream version 12.10.0
Diffstat (limited to 'src/player-controller.c')
-rw-r--r--src/player-controller.c139
1 files changed, 92 insertions, 47 deletions
diff --git a/src/player-controller.c b/src/player-controller.c
index d086e5d..1f9ae8d 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -1,4 +1,4 @@
-/* player-controller.c generated by valac 0.14.2, the Vala compiler
+/* player-controller.c generated by valac 0.16.1, the Vala compiler
* generated from player-controller.vala, do not modify */
/*
@@ -137,6 +137,7 @@ struct _PlayerControllerPrivate {
GAppInfo* _app_info;
gint _menu_offset;
gchar* _icon_name;
+ gboolean _is_preferred;
SpecificItemsManager* track_specific_mgr;
SpecificItemsManager* player_specific_mgr;
};
@@ -193,18 +194,20 @@ enum {
PLAYER_CONTROLLER_DBUS_NAME,
PLAYER_CONTROLLER_APP_INFO,
PLAYER_CONTROLLER_MENU_OFFSET,
- PLAYER_CONTROLLER_ICON_NAME
+ PLAYER_CONTROLLER_ICON_NAME,
+ PLAYER_CONTROLLER_IS_PREFERRED
};
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 4
-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);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred);
+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, gboolean is_preferred);
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);
void player_controller_set_menu_offset (PlayerController* self, gint value);
+static void player_controller_set_is_preferred (PlayerController* self, gboolean value);
static void player_controller_construct_widgets (PlayerController* self);
static void player_controller_establish_mpris_connection (PlayerController* self);
void player_controller_update_layout (PlayerController* self);
@@ -227,6 +230,7 @@ static void player_controller_determine_state (PlayerController* self);
void player_controller_remove_from_menu (PlayerController* self);
static gboolean _bool_equal (const gboolean* s1, const gboolean* s2);
GType playlists_menuitem_get_type (void) G_GNUC_CONST;
+void player_controller_set_as_preferred (PlayerController* self, gboolean val);
void player_controller_hibernate (PlayerController* self);
GType transport_menuitem_get_type (void) G_GNUC_CONST;
void transport_menuitem_change_play_state (TransportMenuitem* self, TransportState update);
@@ -235,6 +239,7 @@ GeeHashSet* metadata_menuitem_relevant_attributes_for_ui (void);
GType metadata_menuitem_get_type (void) G_GNUC_CONST;
void metadata_menuitem_toggle_active_triangle (MetadataMenuitem* self, gboolean update);
void metadata_menuitem_should_collapse (MetadataMenuitem* self, gboolean collapse);
+gboolean player_controller_get_is_preferred (PlayerController* self);
gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
void transport_menuitem_handle_cached_action (TransportMenuitem* self);
PlayerItem* player_item_new (const gchar* type);
@@ -295,7 +300,7 @@ static gpointer _g_object_ref0 (gpointer self) {
}
-PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state) {
+PlayerController* 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, gboolean is_preferred) {
PlayerController * self = NULL;
gboolean* _tmp0_;
gboolean* _tmp1_;
@@ -307,9 +312,10 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
GeeArrayList* _tmp7_;
PlayerControllerstate _tmp8_;
gint _tmp9_;
- GAppInfo* _tmp10_;
- const gchar* _tmp11_ = NULL;
- const gchar* _tmp12_;
+ gboolean _tmp10_;
+ GAppInfo* _tmp11_;
+ const gchar* _tmp12_ = NULL;
+ const gchar* _tmp13_;
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);
@@ -335,20 +341,22 @@ PlayerController* player_controller_construct (GType object_type, DbusmenuMenuit
self->current_state = (gint) _tmp8_;
_tmp9_ = offset;
player_controller_set_menu_offset (self, _tmp9_);
+ _tmp10_ = is_preferred;
+ player_controller_set_is_preferred (self, _tmp10_);
player_controller_construct_widgets (self);
player_controller_establish_mpris_connection (self);
player_controller_update_layout (self);
- _tmp10_ = self->priv->_app_info;
- _tmp11_ = g_app_info_get_name (_tmp10_);
- _tmp12_ = self->priv->_icon_name;
- g_debug ("player-controller.vala:74: New player controller for %s with icon nam" \
-"e %s", _tmp11_, _tmp12_);
+ _tmp11_ = self->priv->_app_info;
+ _tmp12_ = g_app_info_get_name (_tmp11_);
+ _tmp13_ = self->priv->_icon_name;
+ g_debug ("player-controller.vala:78: New player controller for %s with icon nam" \
+"e %s", _tmp12_, _tmp13_);
return self;
}
-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);
+PlayerController* player_controller_new (DbusmenuMenuitem* root, GAppInfo* app, const gchar* dbus_name, const gchar* icon_name, gint offset, gboolean* use_playlists, PlayerControllerstate initial_state, gboolean is_preferred) {
+ return player_controller_construct (TYPE_PLAYER_CONTROLLER, root, app, dbus_name, icon_name, offset, use_playlists, initial_state, is_preferred);
}
@@ -361,7 +369,7 @@ void player_controller_update_state (PlayerController* self, PlayerControllersta
_tmp0_ = self->priv->_app_info;
_tmp1_ = g_app_info_get_name (_tmp0_);
_tmp2_ = new_state;
- g_debug ("player-controller.vala:79: update_state - player controller %s : new s" \
+ g_debug ("player-controller.vala:83: update_state - player controller %s : new s" \
"tate %i", _tmp1_, (gint) _tmp2_);
_tmp3_ = new_state;
self->current_state = (gint) _tmp3_;
@@ -386,7 +394,7 @@ void player_controller_instantiate (PlayerController* self) {
g_return_if_fail (self != NULL);
_tmp0_ = self->priv->_app_info;
_tmp1_ = g_app_info_get_name (_tmp0_);
- g_debug ("player-controller.vala:99: instantiate in player controller for %s", _tmp1_);
+ g_debug ("player-controller.vala:103: instantiate in player controller for %s", _tmp1_);
{
GAppInfo* _tmp2_;
_tmp2_ = self->priv->_app_info;
@@ -410,7 +418,7 @@ void player_controller_instantiate (PlayerController* self) {
_tmp4_ = g_app_info_get_name (_tmp3_);
_tmp5_ = _error_;
_tmp6_ = _tmp5_->message;
- g_warning ("player-controller.vala:105: Failed to launch app %s with error message" \
+ g_warning ("player-controller.vala:109: Failed to launch app %s with error message" \
": %s", _tmp4_, _tmp6_);
_g_error_free0 (_error_);
}
@@ -514,14 +522,14 @@ static void player_controller_establish_mpris_connection (PlayerController* self
}
_tmp3_ = _tmp0_;
if (_tmp3_) {
- g_debug ("player-controller.vala:139: establish_mpris_connection - Not ready to " \
+ g_debug ("player-controller.vala:143: establish_mpris_connection - Not ready to " \
"connect");
return;
}
_tmp4_ = self->use_playlists;
_tmp5_ = bool_to_string (*_tmp4_);
_tmp6_ = _tmp5_;
- g_debug ("player-controller.vala:142: establish mpris connection - use playlist" \
+ g_debug ("player-controller.vala:146: establish mpris connection - use playlist" \
"s value = %s ", _tmp6_);
_g_free0 (_tmp6_);
_tmp7_ = mpris2_controller_new (self);
@@ -615,6 +623,15 @@ void player_controller_remove_from_menu (PlayerController* self) {
}
+void player_controller_set_as_preferred (PlayerController* self, gboolean val) {
+ gboolean _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = val;
+ player_controller_set_is_preferred (self, _tmp0_);
+ player_controller_update_layout (self);
+}
+
+
void player_controller_hibernate (PlayerController* self) {
GeeArrayList* _tmp0_;
gpointer _tmp1_ = NULL;
@@ -660,15 +677,17 @@ void player_controller_update_layout (PlayerController* self) {
gpointer _tmp3_ = NULL;
MetadataMenuitem* metadata_menuitem;
gint _tmp4_;
- MetadataMenuitem* _tmp13_;
- GeeArrayList* _tmp14_;
- gpointer _tmp15_ = NULL;
- PlayerItem* _tmp16_;
- GeeHashSet* _tmp17_ = NULL;
- GeeHashSet* _tmp18_;
- gboolean _tmp19_ = FALSE;
- GAppInfo* _tmp20_;
- const gchar* _tmp21_ = NULL;
+ GeeArrayList* _tmp12_;
+ gpointer _tmp13_ = NULL;
+ PlayerItem* _tmp14_;
+ GeeHashSet* _tmp15_ = NULL;
+ GeeHashSet* _tmp16_;
+ gboolean _tmp17_ = FALSE;
+ gboolean _tmp18_;
+ gboolean should_collapse;
+ MetadataMenuitem* _tmp19_;
+ gboolean _tmp20_;
+ gboolean _tmp21_;
PlaylistsMenuitem* _tmp28_;
DbusmenuMenuitem* _tmp29_;
gboolean* _tmp30_;
@@ -687,8 +706,7 @@ void player_controller_update_layout (PlayerController* self) {
GeeArrayList* _tmp8_;
gpointer _tmp9_ = NULL;
PlayerItem* _tmp10_;
- GAppInfo* _tmp11_;
- const gchar* _tmp12_ = NULL;
+ gboolean _tmp11_;
_tmp5_ = metadata_menuitem;
metadata_menuitem_should_collapse (_tmp5_, TRUE);
_tmp6_ = playlists_menuitem;
@@ -697,27 +715,28 @@ void player_controller_update_layout (PlayerController* self) {
_tmp8_ = self->custom_items;
_tmp9_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT);
_tmp10_ = (PlayerItem*) _tmp9_;
- _tmp11_ = self->priv->_app_info;
- _tmp12_ = g_app_info_get_id (_tmp11_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp10_, DBUSMENU_MENUITEM_PROP_VISIBLE, g_strcmp0 (_tmp12_, "rhythmbox.desktop") == 0);
+ _tmp11_ = self->priv->_is_preferred;
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) _tmp10_, DBUSMENU_MENUITEM_PROP_VISIBLE, _tmp11_);
_g_object_unref0 (_tmp10_);
_g_object_unref0 (metadata_menuitem);
_g_object_unref0 (playlists_menuitem);
return;
}
- _tmp13_ = metadata_menuitem;
- _tmp14_ = self->custom_items;
- _tmp15_ = gee_abstract_list_get ((GeeAbstractList*) _tmp14_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
- _tmp16_ = (PlayerItem*) _tmp15_;
- _tmp17_ = metadata_menuitem_relevant_attributes_for_ui ();
- _tmp18_ = _tmp17_;
- _tmp19_ = player_item_populated (_tmp16_, _tmp18_);
- metadata_menuitem_should_collapse (_tmp13_, !_tmp19_);
- _g_object_unref0 (_tmp18_);
+ _tmp12_ = self->custom_items;
+ _tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _tmp12_, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA);
+ _tmp14_ = (PlayerItem*) _tmp13_;
+ _tmp15_ = metadata_menuitem_relevant_attributes_for_ui ();
+ _tmp16_ = _tmp15_;
+ _tmp17_ = player_item_populated (_tmp14_, _tmp16_);
+ _tmp18_ = !_tmp17_;
_g_object_unref0 (_tmp16_);
- _tmp20_ = self->priv->_app_info;
- _tmp21_ = g_app_info_get_id (_tmp20_);
- if (g_strcmp0 (_tmp21_, "rhythmbox.desktop") == 0) {
+ _g_object_unref0 (_tmp14_);
+ should_collapse = _tmp18_;
+ _tmp19_ = metadata_menuitem;
+ _tmp20_ = should_collapse;
+ metadata_menuitem_should_collapse (_tmp19_, _tmp20_);
+ _tmp21_ = self->priv->_is_preferred;
+ if (_tmp21_) {
GeeArrayList* _tmp22_;
gpointer _tmp23_ = NULL;
TransportMenuitem* transport;
@@ -986,6 +1005,25 @@ void player_controller_set_icon_name (PlayerController* self, const gchar* value
}
+gboolean player_controller_get_is_preferred (PlayerController* self) {
+ gboolean result;
+ gboolean _tmp0_;
+ g_return_val_if_fail (self != NULL, FALSE);
+ _tmp0_ = self->priv->_is_preferred;
+ result = _tmp0_;
+ return result;
+}
+
+
+static void player_controller_set_is_preferred (PlayerController* self, gboolean value) {
+ gboolean _tmp0_;
+ g_return_if_fail (self != NULL);
+ _tmp0_ = value;
+ self->priv->_is_preferred = _tmp0_;
+ g_object_notify ((GObject *) self, "is-preferred");
+}
+
+
static void player_controller_class_init (PlayerControllerClass * klass) {
player_controller_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (PlayerControllerPrivate));
@@ -993,9 +1031,10 @@ static void player_controller_class_init (PlayerControllerClass * klass) {
G_OBJECT_CLASS (klass)->set_property = _vala_player_controller_set_property;
G_OBJECT_CLASS (klass)->finalize = player_controller_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_DBUS_NAME, g_param_spec_string ("dbus-name", "dbus-name", "dbus-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
- g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_APP_INFO, g_param_spec_object ("app-info", "app-info", "app-info", G_TYPE_APP_INFO, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_APP_INFO, g_param_spec_object ("app-info", "app-info", "app-info", g_app_info_get_type (), G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_MENU_OFFSET, g_param_spec_int ("menu-offset", "menu-offset", "menu-offset", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_ICON_NAME, g_param_spec_string ("icon-name", "icon-name", "icon-name", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), PLAYER_CONTROLLER_IS_PREFERRED, g_param_spec_boolean ("is-preferred", "is-preferred", "is-preferred", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}
@@ -1049,6 +1088,9 @@ static void _vala_player_controller_get_property (GObject * object, guint proper
case PLAYER_CONTROLLER_ICON_NAME:
g_value_set_string (value, player_controller_get_icon_name (self));
break;
+ case PLAYER_CONTROLLER_IS_PREFERRED:
+ g_value_set_boolean (value, player_controller_get_is_preferred (self));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1072,6 +1114,9 @@ static void _vala_player_controller_set_property (GObject * object, guint proper
case PLAYER_CONTROLLER_ICON_NAME:
player_controller_set_icon_name (self, g_value_get_string (value));
break;
+ case PLAYER_CONTROLLER_IS_PREFERRED:
+ player_controller_set_is_preferred (self, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;