aboutsummaryrefslogtreecommitdiff
path: root/src/player-controller.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/player-controller.c')
-rw-r--r--src/player-controller.c89
1 files changed, 27 insertions, 62 deletions
diff --git a/src/player-controller.c b/src/player-controller.c
index 39189f3..28bb28c 100644
--- a/src/player-controller.c
+++ b/src/player-controller.c
@@ -1,4 +1,4 @@
-/* player-controller.c generated by valac 0.9.5, the Vala compiler
+/* player-controller.c generated by valac 0.9.7, the Vala compiler
* generated from player-controller.vala, do not modify */
/*
@@ -91,16 +91,6 @@ typedef struct _TitleMenuitemClass TitleMenuitemClass;
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))
-#define IS_SCRUB_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_SCRUB_MENUITEM))
-#define IS_SCRUB_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_SCRUB_MENUITEM))
-#define SCRUB_MENUITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_SCRUB_MENUITEM, ScrubMenuitemClass))
-
-typedef struct _ScrubMenuitem ScrubMenuitem;
-typedef struct _ScrubMenuitemClass ScrubMenuitemClass;
-
#define TYPE_TRANSPORT_MENUITEM (transport_menuitem_get_type ())
#define TRANSPORT_MENUITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRANSPORT_MENUITEM, TransportMenuitem))
#define TRANSPORT_MENUITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRANSPORT_MENUITEM, TransportMenuitemClass))
@@ -134,7 +124,6 @@ typedef enum {
PLAYER_CONTROLLER_WIDGET_ORDER_SEPARATOR,
PLAYER_CONTROLLER_WIDGET_ORDER_TITLE,
PLAYER_CONTROLLER_WIDGET_ORDER_METADATA,
- PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB,
PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT
} PlayerControllerwidget_order;
@@ -161,29 +150,28 @@ 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
+#define PLAYER_CONTROLLER_WIDGET_QUANTITY 4
+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);
static char* player_controller_format_client_name (const char* client_name);
void player_controller_set_name (PlayerController* self, const char* value);
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);
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);
+const char* player_controller_get_name (PlayerController* self);
void player_controller_activate (PlayerController* self);
-GAppInfo* player_controller_get_app_info (PlayerController* self);
void player_controller_instantiate (PlayerController* self);
+GAppInfo* player_controller_get_app_info (PlayerController* self);
MprisBridge* mpris_bridge_new (PlayerController* ctrl);
MprisBridge* mpris_bridge_construct (GType object_type, PlayerController* ctrl);
void player_controller_determine_state (PlayerController* self);
void player_controller_vanish (PlayerController* self);
+void player_controller_hibernate (PlayerController* self);
void player_item_reset (PlayerItem* self, GeeHashSet* attrs);
GeeHashSet* transport_menuitem_attributes_format (void);
GeeHashSet* metadata_menuitem_attributes_format (void);
-GeeHashSet* scrub_menuitem_attributes_format (void);
-void player_controller_hibernate (PlayerController* self);
gboolean player_item_populated (PlayerItem* self, GeeHashSet* attrs);
PlayerItem* player_item_new (const char* type);
PlayerItem* player_item_construct (GType object_type, const char* type);
@@ -193,9 +181,6 @@ 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) G_GNUC_CONST;
TransportMenuitem* transport_menuitem_new (PlayerController* parent);
TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent);
GType transport_menuitem_get_type (void) G_GNUC_CONST;
@@ -211,7 +196,7 @@ static void player_controller_set_property (GObject * object, guint property_id,
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_TRANSPORT, "PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT", "transport"}, {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);
@@ -251,8 +236,8 @@ static char* string_strip (const char* self) {
PlayerController* player_controller_construct (GType object_type, DbusmenuMenuitem* root, const char* client_name, gint offset, PlayerControllerstate initial_state) {
PlayerController * self;
DbusmenuMenuitem* _tmp0_;
- char* _tmp2_;
char* _tmp1_;
+ char* _tmp2_;
GeeArrayList* _tmp3_;
g_return_val_if_fail (root != NULL, NULL);
g_return_val_if_fail (client_name != NULL, NULL);
@@ -278,7 +263,7 @@ 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:67: update_state - player controller %s : new s" \
+ g_debug ("player-controller.vala:66: 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);
@@ -292,10 +277,9 @@ void player_controller_activate (PlayerController* self) {
void player_controller_instantiate (PlayerController* self) {
- GError * _inner_error_;
+ GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
- _inner_error_ = NULL;
- g_debug ("player-controller.vala:85: instantiate in player controller for %s", self->priv->_name);
+ g_debug ("player-controller.vala:84: 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) {
@@ -310,7 +294,7 @@ void player_controller_instantiate (PlayerController* self) {
_error_ = _inner_error_;
_inner_error_ = NULL;
{
- g_warning ("player-controller.vala:91: Failed to launch app %s with error message:" \
+ g_warning ("player-controller.vala:90: Failed to launch app %s with error message:" \
" %s", self->priv->_name, _error_->message);
_g_error_free0 (_error_);
}
@@ -328,7 +312,7 @@ static void player_controller_establish_mpris_connection (PlayerController* self
MprisBridge* _tmp0_;
g_return_if_fail (self != NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_READY) {
- g_debug ("player-controller.vala:98: establish_mpris_connection - Not ready to c" \
+ g_debug ("player-controller.vala:97: establish_mpris_connection - Not ready to c" \
"onnect");
return;
}
@@ -357,12 +341,10 @@ void player_controller_vanish (PlayerController* self) {
void player_controller_hibernate (PlayerController* self) {
- GeeHashSet* _tmp1_;
PlayerItem* _tmp0_;
- GeeHashSet* _tmp3_;
+ GeeHashSet* _tmp1_;
PlayerItem* _tmp2_;
- GeeHashSet* _tmp5_;
- PlayerItem* _tmp4_;
+ GeeHashSet* _tmp3_;
g_return_if_fail (self != NULL);
player_controller_update_state (self, PLAYER_CONTROLLER_STATE_OFFLINE);
player_item_reset (_tmp0_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT), _tmp1_ = transport_menuitem_attributes_format ());
@@ -371,43 +353,30 @@ void player_controller_hibernate (PlayerController* self) {
player_item_reset (_tmp2_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp3_ = metadata_menuitem_attributes_format ());
_g_object_unref0 (_tmp3_);
_g_object_unref0 (_tmp2_);
- player_item_reset (_tmp4_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp5_ = scrub_menuitem_attributes_format ());
- _g_object_unref0 (_tmp5_);
- _g_object_unref0 (_tmp4_);
}
void player_controller_update_layout (PlayerController* self) {
- GeeHashSet* _tmp5_;
- PlayerItem* _tmp4_;
+ PlayerItem* _tmp2_;
PlayerItem* _tmp3_;
- GeeHashSet* _tmp8_;
- PlayerItem* _tmp7_;
- PlayerItem* _tmp6_;
- PlayerItem* _tmp9_;
+ GeeHashSet* _tmp4_;
+ PlayerItem* _tmp5_;
g_return_if_fail (self != NULL);
if (self->current_state != PLAYER_CONTROLLER_STATE_CONNECTED) {
PlayerItem* _tmp0_;
PlayerItem* _tmp1_;
- PlayerItem* _tmp2_;
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);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp1_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), 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_);
return;
}
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA)), DBUSMENU_MENUITEM_PROP_VISIBLE, 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_object_unref0 (_tmp5_);
+ 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, player_item_populated (_tmp3_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_METADATA), _tmp4_ = metadata_menuitem_attributes_format ()));
_g_object_unref0 (_tmp4_);
_g_object_unref0 (_tmp3_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp6_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB)), DBUSMENU_MENUITEM_PROP_VISIBLE, player_item_populated (_tmp7_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_SCRUB), _tmp8_ = scrub_menuitem_attributes_format ()));
- _g_object_unref0 (_tmp8_);
- _g_object_unref0 (_tmp7_);
- _g_object_unref0 (_tmp6_);
- dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp9_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
- _g_object_unref0 (_tmp9_);
+ _g_object_unref0 (_tmp2_);
+ dbusmenu_menuitem_property_set_bool ((DbusmenuMenuitem*) (_tmp5_ = (PlayerItem*) gee_abstract_list_get ((GeeAbstractList*) self->custom_items, (gint) PLAYER_CONTROLLER_WIDGET_ORDER_TRANSPORT)), DBUSMENU_MENUITEM_PROP_VISIBLE, TRUE);
+ _g_object_unref0 (_tmp5_);
}
@@ -415,7 +384,6 @@ static void player_controller_construct_widgets (PlayerController* self) {
PlayerItem* _tmp0_;
TitleMenuitem* title_menu_item;
MetadataMenuitem* metadata_item;
- ScrubMenuitem* scrub_item;
TransportMenuitem* transport_item;
g_return_if_fail (self != NULL);
gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, _tmp0_ = player_item_new (DBUSMENU_CLIENT_TYPES_SEPARATOR));
@@ -424,8 +392,6 @@ static void player_controller_construct_widgets (PlayerController* self) {
gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) title_menu_item);
metadata_item = metadata_menuitem_new ();
gee_abstract_collection_add ((GeeAbstractCollection*) self->custom_items, (PlayerItem*) metadata_item);
- scrub_item = scrub_menuitem_new (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);
{
@@ -443,7 +409,6 @@ static void player_controller_construct_widgets (PlayerController* self) {
_g_object_unref0 (_item_it);
}
_g_object_unref0 (transport_item);
- _g_object_unref0 (scrub_item);
_g_object_unref0 (metadata_item);
_g_object_unref0 (title_menu_item);
}
@@ -488,13 +453,13 @@ static char* player_controller_format_client_name (const char* client_name) {
g_return_val_if_fail (client_name != NULL, NULL);
formatted = g_strdup (client_name);
if (g_utf8_strlen (formatted, -1) > 1) {
- char* _tmp2_;
- char* _tmp1_;
char* _tmp0_;
+ char* _tmp1_;
+ char* _tmp2_;
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:171: PlayerController->format_client_name - : %" \
+ g_debug ("player-controller.vala:160: PlayerController->format_client_name - : %" \
"s", formatted);
}
result = formatted;