98
170
GDBusMethodInvocation *invocation,
99
171
RBMprisPlugin *plugin)
101
if (g_strcmp0 (object_path, "/") != 0 ||
102
g_strcmp0 (interface_name, mpris_iface_name) != 0) {
173
if (g_strcmp0 (object_path, MPRIS_OBJECT_NAME) != 0 ||
174
g_strcmp0 (interface_name, MPRIS_ROOT_INTERFACE) != 0) {
175
g_dbus_method_invocation_return_error (invocation,
177
G_DBUS_ERROR_NOT_SUPPORTED,
178
"Method %s.%s not supported",
107
if (g_strcmp0 (method_name, "Identity") == 0) {
108
g_dbus_method_invocation_return_value (invocation,
109
g_variant_new ("(s)", "Rhythmbox " VERSION));
184
if (g_strcmp0 (method_name, "Raise") == 0) {
185
rb_shell_present (plugin->shell, GDK_CURRENT_TIME, NULL);
186
g_dbus_method_invocation_return_value (invocation, NULL);
110
187
} else if (g_strcmp0 (method_name, "Quit") == 0) {
111
188
rb_shell_quit (plugin->shell, NULL);
112
189
g_dbus_method_invocation_return_value (invocation, NULL);
113
} else if (g_strcmp0 (method_name, "MprisVersion") == 0) {
114
g_dbus_method_invocation_return_value (invocation, g_variant_new ("((qq))", 1, 0)); /* what is the version number, anyway? */
192
g_dbus_method_invocation_return_error (invocation,
194
G_DBUS_ERROR_NOT_SUPPORTED,
195
"Method %s.%s not supported",
201
get_root_property (GDBusConnection *connection,
203
const char *object_path,
204
const char *interface_name,
205
const char *property_name,
207
RBMprisPlugin *plugin)
209
if (g_strcmp0 (object_path, MPRIS_OBJECT_NAME) != 0 ||
210
g_strcmp0 (interface_name, MPRIS_ROOT_INTERFACE) != 0) {
213
G_DBUS_ERROR_NOT_SUPPORTED,
214
"Property %s.%s not supported",
220
if (g_strcmp0 (property_name, "CanQuit") == 0) {
221
return g_variant_new_boolean (TRUE);
222
} else if (g_strcmp0 (property_name, "CanRaise") == 0) {
223
return g_variant_new_boolean (TRUE);
224
} else if (g_strcmp0 (property_name, "HasTrackList") == 0) {
225
return g_variant_new_boolean (FALSE);
226
} else if (g_strcmp0 (property_name, "Identity") == 0) {
227
EggDesktopFile *desktop_file;
228
desktop_file = egg_get_desktop_file ();
229
return g_variant_new_string (egg_desktop_file_get_name (desktop_file));
230
} else if (g_strcmp0 (property_name, "DesktopEntry") == 0) {
231
EggDesktopFile *desktop_file;
235
desktop_file = egg_get_desktop_file ();
236
path = g_filename_from_uri (egg_desktop_file_get_source (desktop_file), NULL, error);
238
v = g_variant_new_string (path);
241
g_warning ("Unable to return desktop file path to MPRIS client: %s", (*error)->message);
245
} else if (g_strcmp0 (property_name, "SupportedUriSchemes") == 0) {
246
/* not planning to support this seriously */
247
const char *fake_supported_schemes[] = {
248
"file", "http", "cdda", "smb", "sftp", NULL
250
return g_variant_new_strv (fake_supported_schemes, -1);
251
} else if (g_strcmp0 (property_name, "SupportedMimeTypes") == 0) {
253
const char *fake_supported_mimetypes[] = {
254
"application/ogg", "audio/x-vorbis+ogg", "audio/x-flac", "audio/mpeg", NULL
256
return g_variant_new_strv (fake_supported_mimetypes, -1);
261
G_DBUS_ERROR_NOT_SUPPORTED,
262
"Property %s.%s not supported",
118
268
static const GDBusInterfaceVTable root_vtable =
120
270
(GDBusInterfaceMethodCallFunc) handle_root_method_call,
125
/* MPRIS tracklist object (not implemented) */
128
handle_tracklist_call (GDBusConnection *connection,
130
const char *object_path,
131
const char *interface_name,
132
const char *method_name,
133
GVariant *parameters,
134
GDBusMethodInvocation *invocation,
135
RBMprisPlugin *plugin)
140
static const GDBusInterfaceVTable tracklist_vtable =
142
(GDBusInterfaceMethodCallFunc) handle_tracklist_call,
148
/* MPRIS player object */
271
(GDBusInterfaceGetPropertyFunc) get_root_property,
275
/* MPRIS player interface */
151
278
handle_result (GDBusMethodInvocation *invocation, gboolean ret, GError *error)
346
447
GError *error = NULL;
348
if (g_strcmp0 (object_path, "/Player") != 0 ||
349
g_strcmp0 (interface_name, mpris_iface_name) != 0) {
449
if (g_strcmp0 (object_path, MPRIS_OBJECT_NAME) != 0 ||
450
g_strcmp0 (interface_name, MPRIS_PLAYER_INTERFACE) != 0) {
451
g_dbus_method_invocation_return_error (invocation,
453
G_DBUS_ERROR_NOT_SUPPORTED,
454
"Method %s.%s not supported",
354
460
if (g_strcmp0 (method_name, "Next") == 0) {
355
461
ret = rb_shell_player_do_next (plugin->player, &error);
356
462
handle_result (invocation, ret, error);
357
} else if (g_strcmp0 (method_name, "Prev") == 0) {
463
} else if (g_strcmp0 (method_name, "Previous") == 0) {
358
464
ret = rb_shell_player_do_previous (plugin->player, &error);
359
465
handle_result (invocation, ret, error);
360
} else if ((g_strcmp0 (method_name, "Pause") == 0)
361
|| (g_strcmp0 (method_name, "PlayPause") == 0)) {
466
} else if (g_strcmp0 (method_name, "Pause") == 0) {
467
ret = rb_shell_player_pause (plugin->player, &error);
468
handle_result (invocation, ret, error);
469
} else if (g_strcmp0 (method_name, "PlayPause") == 0) {
362
470
ret = rb_shell_player_playpause (plugin->player, TRUE, &error);
363
471
handle_result (invocation, ret, error);
364
472
} else if (g_strcmp0 (method_name, "Stop") == 0) {
365
473
rb_shell_player_stop (plugin->player);
366
474
handle_result (invocation, TRUE, NULL);
367
475
} else if (g_strcmp0 (method_name, "Play") == 0) {
476
ret = rb_shell_player_play (plugin->player, &error);
477
handle_result (invocation, ret, error);
478
} else if (g_strcmp0 (method_name, "Seek") == 0) {
480
g_variant_get (parameters, "(x)", &offset);
481
rb_shell_player_seek (plugin->player, offset / G_USEC_PER_SEC);
482
g_dbus_method_invocation_return_value (invocation, NULL);
483
} else if (g_strcmp0 (method_name, "SetPositionSet") == 0) {
484
RhythmDBEntry *playing_entry;
485
RhythmDBEntry *client_entry;
487
const char *client_entry_path;
489
playing_entry = rb_shell_player_get_playing_entry (plugin->player);
490
if (playing_entry == NULL) {
491
/* not playing, so we can't seek */
492
g_dbus_method_invocation_return_value (invocation, NULL);
496
g_variant_get (parameters, "(&ox)", &client_entry_path, &position);
498
if (g_str_has_prefix (client_entry_path, ENTRY_OBJECT_PATH_PREFIX) == FALSE) {
499
/* this can't possibly be the current playing track, so ignore it */
500
g_dbus_method_invocation_return_value (invocation, NULL);
501
rhythmdb_entry_unref (playing_entry);
505
client_entry_path += strlen (ENTRY_OBJECT_PATH_PREFIX);
506
client_entry = rhythmdb_entry_lookup_from_string (plugin->db, client_entry_path, TRUE);
507
if (client_entry == NULL) {
509
g_dbus_method_invocation_return_value (invocation, NULL);
510
rhythmdb_entry_unref (playing_entry);
514
if (playing_entry != client_entry) {
515
/* client got the wrong entry, ignore it */
516
g_dbus_method_invocation_return_value (invocation, NULL);
517
rhythmdb_entry_unref (playing_entry);
518
rhythmdb_entry_unref (client_entry);
521
rhythmdb_entry_unref (playing_entry);
522
rhythmdb_entry_unref (client_entry);
524
ret = rb_shell_player_set_playing_time (plugin->player, position / G_USEC_PER_SEC, &error);
525
handle_result (invocation, ret, error);
526
} else if (g_strcmp0 (method_name, "OpenUri") == 0) {
528
g_variant_get (parameters, "(&s)", &uri);
529
ret = rb_shell_load_uri (plugin->shell, uri, TRUE, &error);
530
handle_result (invocation, ret, error);
533
g_dbus_method_invocation_return_error (invocation,
535
G_DBUS_ERROR_NOT_SUPPORTED,
536
"Method %s.%s not supported",
542
get_playback_status (RBMprisPlugin *plugin)
544
RhythmDBEntry *entry;
546
entry = rb_shell_player_get_playing_entry (plugin->player);
548
return g_variant_new_string ("Stopped");
368
551
gboolean playing;
369
g_object_get (plugin->player, "playing", &playing, NULL);
371
ret = rb_shell_player_set_playing_time (plugin->player, 0, &error);
373
ret = rb_shell_player_playpause (plugin->player, TRUE, &error);
375
handle_result (invocation, ret, error);
376
} else if (g_strcmp0 (method_name, "Repeat") == 0) {
377
/* not actually supported */
378
} else if (g_strcmp0 (method_name, "GetStatus") == 0) {
381
state = get_player_state (plugin, &error);
383
handle_result (invocation, FALSE, error);
385
g_dbus_method_invocation_return_value (invocation, state);
388
} else if (g_strcmp0 (method_name, "GetCaps") == 0) {
395
* CAN_PROVIDE_METADATA: 32
396
* CAN_HAS_TRACKLIST: 64
398
g_dbus_method_invocation_return_value (invocation,
399
g_variant_new ("i", 63));
400
} else if (g_strcmp0 (method_name, "GetMetadata") == 0) {
552
if (rb_shell_player_get_playing (plugin->player, &playing, NULL)) {
554
v = g_variant_new_string ("Playing");
556
v = g_variant_new_string ("Paused");
561
rhythmdb_entry_unref (entry);
567
get_loop_status (RBMprisPlugin *plugin)
569
gboolean loop = FALSE;
570
rb_shell_player_get_playback_state (plugin->player, NULL, &loop);
572
return g_variant_new_string ("Playlist");
574
return g_variant_new_string ("None");
579
get_shuffle (RBMprisPlugin *plugin)
581
gboolean random = FALSE;
583
rb_shell_player_get_playback_state (plugin->player, &random, NULL);
584
return g_variant_new_boolean (random);
588
get_volume (RBMprisPlugin *plugin)
591
if (rb_shell_player_get_volume (plugin->player, &vol, NULL)) {
592
return g_variant_new_double (vol);
599
get_can_pause (RBMprisPlugin *plugin)
602
source = rb_shell_player_get_playing_source (plugin->player);
603
if (source != NULL) {
604
return g_variant_new_boolean (rb_source_can_pause (source));
606
return g_variant_new_boolean (TRUE);
611
get_can_seek (RBMprisPlugin *plugin)
616
g_object_get (plugin->player, "player", &player, NULL);
617
if (player != NULL) {
618
v = g_variant_new_boolean (rb_player_seekable (player));
619
g_object_unref (player);
621
v = g_variant_new_boolean (FALSE);
627
get_player_property (GDBusConnection *connection,
629
const char *object_path,
630
const char *interface_name,
631
const char *property_name,
633
RBMprisPlugin *plugin)
637
if (g_strcmp0 (object_path, MPRIS_OBJECT_NAME) != 0 ||
638
g_strcmp0 (interface_name, MPRIS_PLAYER_INTERFACE) != 0) {
641
G_DBUS_ERROR_NOT_SUPPORTED,
642
"Property %s.%s not supported",
648
if (g_strcmp0 (property_name, "PlaybackStatus") == 0) {
649
return get_playback_status (plugin);
650
} else if (g_strcmp0 (property_name, "LoopStatus") == 0) {
651
return get_loop_status (plugin);
652
} else if (g_strcmp0 (property_name, "Rate") == 0) {
653
return g_variant_new_double (1.0);
654
} else if (g_strcmp0 (property_name, "Shuffle") == 0) {
655
return get_shuffle (plugin);
656
} else if (g_strcmp0 (property_name, "Metadata") == 0) {
401
657
RhythmDBEntry *entry;
402
658
GVariantBuilder *builder;
404
builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
661
builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
406
662
entry = rb_shell_player_get_playing_entry (plugin->player);
407
663
if (entry != NULL) {
408
664
build_track_metadata (plugin, builder, entry);
410
g_variant_builder_add (builder,
413
g_variant_new ("s", ""));
416
g_dbus_method_invocation_return_value (invocation,
417
g_variant_new ("(a{sv})", builder));
418
} else if (g_strcmp0 (method_name, "VolumeGet") == 0) {
420
ret = rb_shell_player_get_volume (plugin->player, &v, &error);
422
handle_result (invocation, ret, error);
425
iv = (int)(v * 100.0);
426
g_dbus_method_invocation_return_value (invocation,
427
g_variant_new ("(i)", iv));
429
} else if (g_strcmp0 (method_name, "VolumeSet") == 0) {
432
g_variant_get (parameters, "(i)", &iv);
433
v = ((gdouble)iv / 100.0);
434
ret = rb_shell_player_set_volume (plugin->player, v, &error);
435
handle_result (invocation, ret, error);
437
} else if (g_strcmp0 (method_name, "PositionGet") == 0) {
439
ret = rb_shell_player_get_playing_time (plugin->player, &t, &error);
441
handle_result (invocation, ret, error);
443
g_dbus_method_invocation_return_value (invocation,
444
g_variant_new ("(i)", t * 1000));
446
} else if (g_strcmp0 (method_name, "PositionSet") == 0) {
448
g_variant_get (parameters, "(i)", &t);
449
ret = rb_shell_player_set_playing_time (plugin->player, t, &error);
450
handle_result (invocation, ret, error);
665
rhythmdb_entry_unref (entry);
668
v = g_variant_builder_end (builder);
669
g_variant_builder_unref (builder);
671
} else if (g_strcmp0 (property_name, "Volume") == 0) {
672
return get_volume (plugin);
673
} else if (g_strcmp0 (property_name, "Position") == 0) {
675
ret = rb_shell_player_get_playing_time (plugin->player, &t, error);
677
return g_variant_new_int64 (t * G_USEC_PER_SEC);
681
} else if (g_strcmp0 (property_name, "MinimumRate") == 0) {
682
return g_variant_new_double (1.0);
683
} else if (g_strcmp0 (property_name, "MaximumRate") == 0) {
684
return g_variant_new_double (1.0);
685
} else if (g_strcmp0 (property_name, "CanGoNext") == 0) {
686
return g_variant_new_boolean (gtk_action_get_sensitive (plugin->next_action));
687
} else if (g_strcmp0 (property_name, "CanGoPrevious") == 0) {
688
return g_variant_new_boolean (gtk_action_get_sensitive (plugin->prev_action));
689
} else if (g_strcmp0 (property_name, "CanPlay") == 0) {
690
/* uh.. under what conditions can we not play? nothing in the source? */
691
return g_variant_new_boolean (TRUE);
692
} else if (g_strcmp0 (property_name, "CanPause") == 0) {
693
return get_can_pause (plugin);
694
} else if (g_strcmp0 (property_name, "CanSeek") == 0) {
695
return get_can_seek (plugin);
696
} else if (g_strcmp0 (property_name, "CanControl") == 0) {
697
return g_variant_new_boolean (TRUE);
702
G_DBUS_ERROR_NOT_SUPPORTED,
703
"Property %s.%s not supported",
710
set_player_property (GDBusConnection *connection,
712
const char *object_path,
713
const char *interface_name,
714
const char *property_name,
717
RBMprisPlugin *plugin)
719
if (g_strcmp0 (object_path, MPRIS_OBJECT_NAME) != 0 ||
720
g_strcmp0 (interface_name, MPRIS_PLAYER_INTERFACE) != 0) {
723
G_DBUS_ERROR_NOT_SUPPORTED,
724
"%s:%s not supported",
730
if (g_strcmp0 (property_name, "LoopStatus") == 0) {
735
rb_shell_player_get_playback_state (plugin->player, &shuffle, &repeat);
737
status = g_variant_get_string (value, NULL);
738
if (g_strcmp0 (status, "None") == 0) {
740
} else if (g_strcmp0 (status, "Playlist") == 0) {
745
rb_shell_player_set_playback_state (plugin->player, shuffle, repeat);
747
} else if (g_strcmp0 (property_name, "Rate") == 0) {
749
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_NOT_SUPPORTED, "Can't modify playback rate");
751
} else if (g_strcmp0 (property_name, "Shuffle") == 0) {
755
rb_shell_player_get_playback_state (plugin->player, &shuffle, &repeat);
756
shuffle = g_variant_get_boolean (value);
757
rb_shell_player_set_playback_state (plugin->player, shuffle, repeat);
759
} else if (g_strcmp0 (property_name, "Volume") == 0) {
760
rb_shell_player_set_volume (plugin->player, g_variant_get_double (value), error);
766
G_DBUS_ERROR_NOT_SUPPORTED,
767
"Property %s.%s not supported",
454
773
static const GDBusInterfaceVTable player_vtable =
456
775
(GDBusInterfaceMethodCallFunc) handle_player_method_call,
776
(GDBusInterfaceGetPropertyFunc) get_player_property,
777
(GDBusInterfaceSetPropertyFunc) set_player_property,
464
emit_status_change (RBMprisPlugin *plugin)
466
GError *error = NULL;
468
state = get_player_state (plugin, &error);
470
g_warning ("Unable to emit MPRIS StatusChange signal: %s", error->message);
471
g_error_free (error);
475
g_dbus_connection_emit_signal (plugin->connection,
483
g_warning ("Unable to emit MPRIS StatusChange signal: %s", error->message);
484
g_error_free (error);
489
781
play_order_changed_cb (GObject *object, GParamSpec *pspec, RBMprisPlugin *plugin)
491
emit_status_change (plugin);
783
rb_debug ("emitting LoopStatus and Shuffle change");
784
add_player_property_change (plugin, "LoopStatus", get_loop_status (plugin));
785
add_player_property_change (plugin, "Shuffle", get_shuffle (plugin));
789
volume_changed_cb (GObject *object, GParamSpec *pspec, RBMprisPlugin *plugin)
791
rb_debug ("emitting Volume change");
792
add_player_property_change (plugin, "Volume", get_volume (plugin));
495
796
playing_changed_cb (RBShellPlayer *player, gboolean playing, RBMprisPlugin *plugin)
497
emit_status_change (plugin);
798
rb_debug ("emitting PlaybackStatus change");
799
add_player_property_change (plugin, "PlaybackStatus", get_playback_status (plugin));
501
emit_track_change (RBMprisPlugin *plugin, RhythmDBEntry *entry)
803
metadata_changed (RBMprisPlugin *plugin, RhythmDBEntry *entry)
503
GError *error = NULL;
504
805
GVariantBuilder *builder;
509
builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
510
build_track_metadata (plugin, builder, entry);
512
g_dbus_connection_emit_signal (plugin->connection,
517
g_variant_new ("(a{sv})", builder),
520
g_warning ("Unable to emit MPRIS TrackChange signal: %s", error->message);
521
g_error_free (error);
807
builder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
809
build_track_metadata (plugin, builder, entry);
811
add_player_property_change (plugin, "Metadata", g_variant_builder_end (builder));
812
g_variant_builder_unref (builder);
526
816
playing_entry_changed_cb (RBShellPlayer *player, RhythmDBEntry *entry, RBMprisPlugin *plugin)
528
rb_debug ("emitting track change due to playing entry change");
529
emit_track_change (plugin, entry);
818
rb_debug ("emitting Metadata and CanSeek changed");
819
plugin->last_elapsed = 0;
820
metadata_changed (plugin, entry);
821
add_player_property_change (plugin, "CanSeek", get_can_seek (plugin));
533
825
entry_extra_metadata_notify_cb (RhythmDB *db, RhythmDBEntry *entry, const char *field, GValue *metadata, RBMprisPlugin *plugin)
535
if (entry == rb_shell_player_get_playing_entry (plugin->player)) {
536
rb_debug ("emitting track change due to extra metadata field %s", field);
537
emit_track_change (plugin, entry);
827
RhythmDBEntry *playing_entry = rb_shell_player_get_playing_entry (plugin->player);
828
if (entry == playing_entry) {
829
rb_debug ("emitting Metadata change due to extra metadata field %s", field);
830
metadata_changed (plugin, entry);
832
if (playing_entry != NULL) {
833
rhythmdb_entry_unref (playing_entry);
838
entry_changed_cb (RhythmDB *db, RhythmDBEntry *entry, GValueArray *changes, RBMprisPlugin *plugin)
840
RhythmDBEntry *playing_entry = rb_shell_player_get_playing_entry (plugin->player);
841
if (playing_entry == NULL) {
844
if (playing_entry == entry) {
846
gboolean emit = FALSE;
848
/* make sure there's an interesting property change in there */
849
for (i = 0; i < changes->n_values; i++) {
850
RhythmDBEntryChange *change = g_value_get_boxed (g_value_array_get_nth (changes, i));
851
switch (change->prop) {
852
/* probably not complete */
853
case RHYTHMDB_PROP_MOUNTPOINT:
854
case RHYTHMDB_PROP_MTIME:
855
case RHYTHMDB_PROP_FIRST_SEEN:
856
case RHYTHMDB_PROP_LAST_SEEN:
857
case RHYTHMDB_PROP_LAST_PLAYED:
858
case RHYTHMDB_PROP_MIMETYPE:
859
case RHYTHMDB_PROP_PLAYBACK_ERROR:
869
rb_debug ("emitting Metadata change due to property changes");
870
metadata_changed (plugin, playing_entry);
873
rhythmdb_entry_unref (playing_entry);
877
playing_source_changed_cb (RBShellPlayer *player,
879
RBMprisPlugin *plugin)
881
rb_debug ("emitting CanPause change");
882
add_player_property_change (plugin, "CanPause", get_can_pause (plugin));
886
next_action_sensitive_cb (GObject *object, GParamSpec *pspec, RBMprisPlugin *plugin)
889
rb_debug ("emitting CanGoNext change");
890
v = g_variant_new_boolean (gtk_action_get_sensitive (plugin->next_action));
891
add_player_property_change (plugin, "CanGoNext", v);
895
prev_action_sensitive_cb (GObject *object, GParamSpec *pspec, RBMprisPlugin *plugin)
898
rb_debug ("emitting CanGoPrevious change");
899
v = g_variant_new_boolean (gtk_action_get_sensitive (plugin->prev_action));
900
add_player_property_change (plugin, "CanGoPrevious", v);
904
elapsed_nano_changed_cb (RBShellPlayer *player, gint64 elapsed, RBMprisPlugin *plugin)
906
GError *error = NULL;
908
/* interpret any change in the elapsed time other than an
909
* increase of less than one second as a seek. this includes
910
* the seek back that we do after pausing (with crossfading),
911
* which we intentionally report as a seek to help clients get
912
* their time displays right.
914
if (elapsed >= plugin->last_elapsed &&
915
(elapsed - plugin->last_elapsed < (G_USEC_PER_SEC * 1000))) {
916
plugin->last_elapsed = elapsed;
920
rb_debug ("emitting Seeked; new time %" G_GINT64_FORMAT, elapsed/1000);
921
g_dbus_connection_emit_signal (plugin->connection,
924
MPRIS_PLAYER_INTERFACE,
926
g_variant_new ("(x)", elapsed / 1000),
929
g_warning ("Unable to set MPRIS Seeked signal: %s", error->message);
930
g_clear_error (&error);
932
plugin->last_elapsed = elapsed;
542
938
name_acquired_cb (GDBusConnection *connection, const char *name, RBMprisPlugin *plugin)
544
940
GError *error = NULL;
545
GDBusNodeInfo *nodeinfo;
546
941
GDBusInterfaceInfo *ifaceinfo;
942
GtkUIManager *ui_manager;
548
944
plugin->connection = g_object_ref (connection);
550
/* register root object */
551
nodeinfo = g_dbus_node_info_new_for_xml (mpris_root_spec, &error);
946
/* parse introspection data */
947
plugin->node_info = g_dbus_node_info_new_for_xml (mpris_introspection_xml, &error);
552
948
if (error != NULL) {
553
g_warning ("Unable to read MPRIS root object specificiation: %s", error->message);
554
g_assert_not_reached ();
949
g_error ("Unable to read MPRIS root object specificiation: %s", error->message);
557
ifaceinfo = g_dbus_node_info_lookup_interface (nodeinfo, mpris_iface_name);
953
/* register root interface */
954
ifaceinfo = g_dbus_node_info_lookup_interface (plugin->node_info, MPRIS_ROOT_INTERFACE);
559
955
plugin->root_id = g_dbus_connection_register_object (plugin->connection,
566
962
if (error != NULL) {
567
g_warning ("unable to register MPRIS root object: %s", error->message);
568
g_error_free (error);
571
/* register fake tracklist object */
572
nodeinfo = g_dbus_node_info_new_for_xml (mpris_tracklist_spec, &error);
574
g_warning ("Unable to read MPRIS tracklist object specificiation: %s", error->message);
575
g_assert_not_reached ();
578
ifaceinfo = g_dbus_node_info_lookup_interface (nodeinfo, mpris_iface_name);
580
plugin->tracklist_id = g_dbus_connection_register_object (plugin->connection,
588
g_warning ("unable to register MPRIS tracklist object: %s", error->message);
589
g_error_free (error);
592
/* register player object */
593
nodeinfo = g_dbus_node_info_new_for_xml (mpris_player_spec, &error);
595
g_warning ("Unable to read MPRIS player object specificiation: %s", error->message);
596
g_assert_not_reached ();
599
ifaceinfo = g_dbus_node_info_lookup_interface (nodeinfo, mpris_iface_name);
963
g_warning ("unable to register MPRIS root interface: %s", error->message);
964
g_error_free (error);
967
/* register player interface */
968
ifaceinfo = g_dbus_node_info_lookup_interface (plugin->node_info, MPRIS_PLAYER_INTERFACE);
600
969
plugin->player_id = g_dbus_connection_register_object (plugin->connection,
607
976
if (error != NULL) {
608
g_warning ("Unable to register MPRIS player object: %s", error->message);
977
g_warning ("Unable to register MPRIS player interface: %s", error->message);
609
978
g_error_free (error);