aboutsummaryrefslogtreecommitdiff
path: root/src/music-player-bridge.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/music-player-bridge.c')
-rw-r--r--src/music-player-bridge.c132
1 files changed, 97 insertions, 35 deletions
diff --git a/src/music-player-bridge.c b/src/music-player-bridge.c
index 2b8fc17..04c2a3e 100644
--- a/src/music-player-bridge.c
+++ b/src/music-player-bridge.c
@@ -1,4 +1,4 @@
-/* music-player-bridge.c generated by valac 0.11.2, the Vala compiler
+/* music-player-bridge.c generated by valac 0.11.3, the Vala compiler
* generated from music-player-bridge.vala, do not modify */
/*
@@ -77,6 +77,27 @@ typedef struct _Mpris2WatcherClass Mpris2WatcherClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define PLAYER_CONTROLLER_TYPE_STATE (player_controller_state_get_type ())
+typedef struct _PlayerControllerPrivate PlayerControllerPrivate;
+
+#define TYPE_PLAYER_ITEM (player_item_get_type ())
+#define PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PLAYER_ITEM, PlayerItem))
+#define PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PLAYER_ITEM, PlayerItemClass))
+#define IS_PLAYER_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PLAYER_ITEM))
+#define IS_PLAYER_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PLAYER_ITEM))
+#define PLAYER_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PLAYER_ITEM, PlayerItemClass))
+
+typedef struct _PlayerItem PlayerItem;
+typedef struct _PlayerItemClass PlayerItemClass;
+
+#define TYPE_MPRIS2_CONTROLLER (mpris2_controller_get_type ())
+#define MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2Controller))
+#define MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass))
+#define IS_MPRIS2_CONTROLLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MPRIS2_CONTROLLER))
+#define IS_MPRIS2_CONTROLLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MPRIS2_CONTROLLER))
+#define MPRIS2_CONTROLLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MPRIS2_CONTROLLER, Mpris2ControllerClass))
+
+typedef struct _Mpris2Controller Mpris2Controller;
+typedef struct _Mpris2ControllerClass Mpris2ControllerClass;
#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
@@ -104,6 +125,19 @@ typedef enum {
PLAYER_CONTROLLER_STATE_DISCONNECTED
} PlayerControllerstate;
+struct _PlayerController {
+ GObject parent_instance;
+ PlayerControllerPrivate * priv;
+ gint current_state;
+ GeeArrayList* custom_items;
+ Mpris2Controller* mpris_bridge;
+ gboolean* use_playlists;
+};
+
+struct _PlayerControllerClass {
+ GObjectClass parent_class;
+};
+
static gpointer music_player_bridge_parent_class = NULL;
@@ -125,13 +159,16 @@ static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface);
static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop);
static gint music_player_bridge_calculate_menu_position (MusicPlayerBridge* self);
GType player_controller_state_get_type (void) G_GNUC_CONST;
-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);
#define PLAYER_CONTROLLER_WIDGET_QUANTITY 5
-void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name);
+void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name, gboolean use_playlists);
gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1);
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name);
+GType player_item_get_type (void) G_GNUC_CONST;
+GType mpris2_controller_get_type (void) G_GNUC_CONST;
+static gboolean* _bool_dup (gboolean* self);
void player_controller_update_state (PlayerController* self, PlayerControllerstate new_state);
void player_controller_activate (PlayerController* self, const gchar* dbus_name);
void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface);
@@ -139,7 +176,7 @@ void player_controller_hibernate (PlayerController* self);
void music_player_bridge_set_root_menu_item (MusicPlayerBridge* self, DbusmenuMenuitem* menu);
Mpris2Watcher* mpris2_watcher_new (void);
Mpris2Watcher* mpris2_watcher_construct (GType object_type);
-static void _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared (Mpris2Watcher* _sender, const gchar* desktop_file_name, const gchar* dbus_name, gpointer self);
+static void _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared (Mpris2Watcher* _sender, const gchar* desktop_file_name, const gchar* dbus_name, gboolean use_playlists, gpointer self);
static void _music_player_bridge_client_has_vanished_mpris2_watcher_client_disappeared (Mpris2Watcher* _sender, const gchar* dbus_name, gpointer self);
static GObject * music_player_bridge_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
SettingsManager* settings_manager_new (void);
@@ -223,7 +260,7 @@ static void music_player_bridge_try_to_add_inactive_familiar_clients (MusicPlaye
_tmp9_ = music_player_bridge_fetch_icon_name (desktop);
_tmp10_ = _tmp9_;
_tmp11_ = music_player_bridge_calculate_menu_position (self);
- _tmp12_ = player_controller_new (self->priv->root_menu, app_info, NULL, _tmp10_, _tmp11_, PLAYER_CONTROLLER_STATE_OFFLINE);
+ _tmp12_ = player_controller_new (self->priv->root_menu, app_info, NULL, _tmp10_, _tmp11_, NULL, PLAYER_CONTROLLER_STATE_OFFLINE);
ctrl = (_tmp13_ = _tmp12_, _g_free0 (_tmp10_), _tmp13_);
gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl);
_g_object_unref0 (ctrl);
@@ -264,7 +301,20 @@ static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gc
}
-void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name) {
+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;
+}
+
+
+void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, const gchar* desktop, const gchar* dbus_name, gboolean use_playlists) {
gboolean _tmp0_ = FALSE;
gint _tmp1_;
gchar** _tmp2_ = NULL;
@@ -289,7 +339,7 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
_tmp0_ = g_strcmp0 (desktop, "") == 0;
}
if (_tmp0_) {
- g_warning ("music-player-bridge.vala:80: Client %s attempting to register without " \
+ g_warning ("music-player-bridge.vala:83: Client %s attempting to register without " \
"desktop entry being set on the mpris root", dbus_name);
return;
}
@@ -297,16 +347,17 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
_tmp3_ = _tmp2_;
_tmp3__length1 = _tmp1_;
if ((_tmp4_ = _vala_string_array_contains (_tmp3_, _tmp1_, desktop), _tmp3_ = (_vala_array_free (_tmp3_, _tmp3__length1, (GDestroyNotify) g_free), NULL), _tmp4_)) {
- g_debug ("music-player-bridge.vala:85: Client %s attempting to register but it h" \
-"as been blacklisted", desktop);
+ g_debug ("music-player-bridge.vala:88: Client %s attempting to register but I'm " \
+"afraid it is blacklisted", desktop);
+ return;
}
- g_debug ("music-player-bridge.vala:89: client_has_become_available %s", desktop);
+ g_debug ("music-player-bridge.vala:93: client_has_become_available %s", desktop);
_tmp5_ = g_strconcat (desktop, ".desktop", NULL);
_tmp6_ = _tmp5_;
_tmp7_ = music_player_bridge_create_app_info (_tmp6_);
app_info = (_tmp8_ = _tmp7_, _g_free0 (_tmp6_), _tmp8_);
if (app_info == NULL) {
- g_warning ("music-player-bridge.vala:92: Could not create app_info for path %s \n" \
+ g_warning ("music-player-bridge.vala:96: Could not create app_info for path %s \n" \
" Getting out of here ", desktop);
_g_object_unref0 (app_info);
return;
@@ -322,33 +373,44 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
PlayerController* _tmp15_ = NULL;
PlayerController* _tmp16_;
PlayerController* ctrl;
- g_debug ("music-player-bridge.vala:100: New client has registered that we have n" \
+ g_debug ("music-player-bridge.vala:104: New client has registered that we have n" \
"ot seen before: %s", dbus_name);
_tmp12_ = music_player_bridge_fetch_icon_name (desktop);
_tmp13_ = _tmp12_;
_tmp14_ = music_player_bridge_calculate_menu_position (self);
- _tmp15_ = player_controller_new (self->priv->root_menu, app_info, dbus_name, _tmp13_, _tmp14_, PLAYER_CONTROLLER_STATE_READY);
+ _tmp15_ = player_controller_new (self->priv->root_menu, app_info, dbus_name, _tmp13_, _tmp14_, &use_playlists, PLAYER_CONTROLLER_STATE_READY);
ctrl = (_tmp16_ = _tmp15_, _g_free0 (_tmp13_), _tmp16_);
gee_abstract_map_set ((GeeAbstractMap*) self->priv->registered_clients, mpris_key, ctrl);
- g_debug ("music-player-bridge.vala:108: Have not seen this %s before, new contro" \
+ g_debug ("music-player-bridge.vala:113: Have not seen this %s before, new contro" \
"ller created.", desktop);
settings_manager_add_interested (self->priv->settings_manager, desktop);
- g_debug ("music-player-bridge.vala:110: application added to the interested list");
+ g_debug ("music-player-bridge.vala:115: application added to the interested list");
_g_object_unref0 (ctrl);
} else {
gpointer _tmp17_ = NULL;
PlayerController* _tmp18_;
- gpointer _tmp19_ = NULL;
- PlayerController* _tmp20_;
+ gboolean* _tmp19_;
+ gboolean* _tmp20_;
+ gpointer _tmp21_ = NULL;
+ PlayerController* _tmp22_;
+ gpointer _tmp23_ = NULL;
+ PlayerController* _tmp24_;
_tmp17_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
_tmp18_ = (PlayerController*) _tmp17_;
- player_controller_update_state (_tmp18_, PLAYER_CONTROLLER_STATE_READY);
+ _tmp19_ = __bool_dup0 (&use_playlists);
+ _tmp20_ = _tmp19_;
+ _g_free0 (_tmp18_->use_playlists);
+ _tmp18_->use_playlists = _tmp20_;
_g_object_unref0 (_tmp18_);
- _tmp19_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
- _tmp20_ = (PlayerController*) _tmp19_;
- player_controller_activate (_tmp20_, dbus_name);
- _g_object_unref0 (_tmp20_);
- g_debug ("music-player-bridge.vala:115: Application has already registered - awa" \
+ _tmp21_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
+ _tmp22_ = (PlayerController*) _tmp21_;
+ player_controller_update_state (_tmp22_, PLAYER_CONTROLLER_STATE_READY);
+ _g_object_unref0 (_tmp22_);
+ _tmp23_ = gee_abstract_map_get ((GeeAbstractMap*) self->priv->registered_clients, mpris_key);
+ _tmp24_ = (PlayerController*) _tmp23_;
+ player_controller_activate (_tmp24_, dbus_name);
+ _g_object_unref0 (_tmp24_);
+ g_debug ("music-player-bridge.vala:121: Application has already registered - awa" \
"ken the hibernation: %s \n", dbus_name);
}
_g_free0 (mpris_key);
@@ -359,14 +421,14 @@ void music_player_bridge_client_has_become_available (MusicPlayerBridge* self, c
void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gchar* mpris_root_interface) {
g_return_if_fail (self != NULL);
g_return_if_fail (mpris_root_interface != NULL);
- g_debug ("music-player-bridge.vala:121: MusicPlayerBridge -> on_server_removed w" \
-"ith value %s", mpris_root_interface);
+ g_debug ("music-player-bridge.vala:127: MusicPlayerBridge -> client with dbus in" \
+"terface %s has vanished", mpris_root_interface);
if (self->priv->root_menu != NULL) {
gchar* _tmp0_;
gchar* _tmp1_ = NULL;
gchar* mpris_key;
gboolean _tmp2_ = FALSE;
- g_debug ("music-player-bridge.vala:123: attempt to remove %s", mpris_root_interface);
+ g_debug ("music-player-bridge.vala:130: attempt to remove %s", mpris_root_interface);
_tmp0_ = g_strdup (mpris_root_interface);
_tmp1_ = music_player_bridge_determine_key (_tmp0_);
mpris_key = _tmp1_;
@@ -384,7 +446,7 @@ void music_player_bridge_client_has_vanished (MusicPlayerBridge* self, const gch
_tmp5_ = (PlayerController*) _tmp4_;
player_controller_hibernate (_tmp5_);
_g_object_unref0 (_tmp5_);
- g_debug ("music-player-bridge.vala:127: Successively offlined client %s", mpris_key);
+ g_debug ("music-player-bridge.vala:134: Successively offlined client %s", mpris_key);
}
_g_free0 (mpris_key);
}
@@ -396,8 +458,8 @@ static gpointer _g_object_ref0 (gpointer self) {
}
-static void _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared (Mpris2Watcher* _sender, const gchar* desktop_file_name, const gchar* dbus_name, gpointer self) {
- music_player_bridge_client_has_become_available (self, desktop_file_name, dbus_name);
+static void _music_player_bridge_client_has_become_available_mpris2_watcher_client_appeared (Mpris2Watcher* _sender, const gchar* desktop_file_name, const gchar* dbus_name, gboolean use_playlists, gpointer self) {
+ music_player_bridge_client_has_become_available (self, desktop_file_name, dbus_name, use_playlists);
}
@@ -444,7 +506,7 @@ static GAppInfo* music_player_bridge_create_app_info (const gchar* desktop) {
_tmp1_ = info == NULL;
}
if (_tmp1_) {
- g_warning ("music-player-bridge.vala:146: Could not create a desktopappinfo instan" \
+ g_warning ("music-player-bridge.vala:153: Could not create a desktopappinfo instan" \
"ce from app: %s", desktop);
result = NULL;
_g_object_unref0 (info);
@@ -499,7 +561,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) {
GError * _error_;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:162: Error loading keyfile - FileError");
+ g_warning ("music-player-bridge.vala:169: Error loading keyfile - FileError");
result = NULL;
_g_error_free0 (_error_);
_g_key_file_free0 (desktop_keyfile);
@@ -512,7 +574,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) {
GError * _error_;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:166: Error loading keyfile - KeyFileError");
+ g_warning ("music-player-bridge.vala:173: Error loading keyfile - KeyFileError");
result = NULL;
_g_error_free0 (_error_);
_g_key_file_free0 (desktop_keyfile);
@@ -549,7 +611,7 @@ static gchar* music_player_bridge_fetch_icon_name (const gchar* desktop) {
GError * _error_;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:175: Error trying to fetch the icon name from" \
+ g_warning ("music-player-bridge.vala:182: Error trying to fetch the icon name from" \
" the keyfile");
result = NULL;
_g_error_free0 (_error_);
@@ -611,7 +673,7 @@ static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface) {
_g_free0 (_result_);
_result_ = _tmp10_;
}
- g_debug ("music-player-bridge.vala:198: determine key result = %s", _result_);
+ g_debug ("music-player-bridge.vala:205: determine key result = %s", _result_);
result = _result_;
temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL);
tokens = (_vala_array_free (tokens, tokens_length1, (GDestroyNotify) g_free), NULL);