diff options
Diffstat (limited to 'src/transport-menu-item.c')
-rw-r--r-- | src/transport-menu-item.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/transport-menu-item.c b/src/transport-menu-item.c index ff00f5f..0181bd3 100644 --- a/src/transport-menu-item.c +++ b/src/transport-menu-item.c @@ -56,6 +56,8 @@ typedef struct _TransportMenuitemPrivate TransportMenuitemPrivate; #define TRANSPORT_MENUITEM_TYPE_ACTION (transport_menuitem_action_get_type ()) +#define TRANSPORT_MENUITEM_TYPE_STATE (transport_menuitem_state_get_type ()) + #define TYPE_PLAYER_CONTROLLER (player_controller_get_type ()) #define PLAYER_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_CONTROLLER, PlayerController)) #define PLAYER_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_CONTROLLER, PlayerControllerClass)) @@ -103,6 +105,11 @@ typedef enum { TRANSPORT_MENUITEM_ACTION_NEXT } TransportMenuitemaction; +typedef enum { + TRANSPORT_MENUITEM_STATE_PLAYING, + TRANSPORT_MENUITEM_STATE_PAUSED +} TransportMenuitemstate; + struct _PlayerController { GObject parent_instance; PlayerControllerPrivate * priv; @@ -124,10 +131,11 @@ enum { TRANSPORT_MENUITEM_DUMMY_PROPERTY }; GType transport_menuitem_action_get_type (void) G_GNUC_CONST; +GType transport_menuitem_state_get_type (void) G_GNUC_CONST; GType player_controller_get_type (void) G_GNUC_CONST; TransportMenuitem* transport_menuitem_new (PlayerController* parent); TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent); -void transport_menuitem_change_play_state (TransportMenuitem* self, gint state); +void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update); static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const char* name, GValue* input_value, guint timestamp); PlayerController* player_item_get_owner (PlayerItem* self); const char* player_controller_get_name (PlayerController* self); @@ -149,6 +157,18 @@ GType transport_menuitem_action_get_type (void) { } +GType transport_menuitem_state_get_type (void) { + static volatile gsize transport_menuitem_state_type_id__volatile = 0; + if (g_once_init_enter (&transport_menuitem_state_type_id__volatile)) { + static const GEnumValue values[] = {{TRANSPORT_MENUITEM_STATE_PLAYING, "TRANSPORT_MENUITEM_STATE_PLAYING", "playing"}, {TRANSPORT_MENUITEM_STATE_PAUSED, "TRANSPORT_MENUITEM_STATE_PAUSED", "paused"}, {0, NULL, NULL}}; + GType transport_menuitem_state_type_id; + transport_menuitem_state_type_id = g_enum_register_static ("TransportMenuitemstate", values); + g_once_init_leave (&transport_menuitem_state_type_id__volatile, transport_menuitem_state_type_id); + } + return transport_menuitem_state_type_id__volatile; +} + + TransportMenuitem* transport_menuitem_construct (GType object_type, PlayerController* parent) { TransportMenuitem * self; g_return_val_if_fail (parent != NULL, NULL); @@ -163,9 +183,9 @@ TransportMenuitem* transport_menuitem_new (PlayerController* parent) { } -void transport_menuitem_change_play_state (TransportMenuitem* self, gint state) { +void transport_menuitem_change_play_state (TransportMenuitem* self, TransportMenuitemstate update) { g_return_if_fail (self != NULL); - dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, state); + dbusmenu_menuitem_property_set_int ((DbusmenuMenuitem*) self, DBUSMENU_TRANSPORT_MENUITEM_PLAY_STATE, (gint) update); } @@ -176,9 +196,9 @@ static void transport_menuitem_real_handle_event (DbusmenuMenuitem* base, const self = (TransportMenuitem*) base; g_return_if_fail (name != NULL); input = g_value_get_int (input_value); - g_debug ("transport-menu-item.vala:46: handle_event with value %s", _tmp0_ = g_strdup_printf ("%i", input)); + g_debug ("transport-menu-item.vala:51: handle_event with value %s", _tmp0_ = g_strdup_printf ("%i", input)); _g_free0 (_tmp0_); - g_debug ("transport-menu-item.vala:47: transport owner name = %s", player_controller_get_name (player_item_get_owner ((PlayerItem*) self))); + g_debug ("transport-menu-item.vala:52: transport owner name = %s", player_controller_get_name (player_item_get_owner ((PlayerItem*) self))); mpris2_controller_transport_update (player_item_get_owner ((PlayerItem*) self)->mpris_bridge, (TransportMenuitemaction) input); } |