comparison src/libaudclient/audctrl.c @ 3879:b03425e7f02c

Automated merge with ssh://hg.atheme.org//hg/audacious
author William Pitcock <nenolod@atheme.org>
date Thu, 01 Nov 2007 10:17:11 -0500
parents f3341c2d6b9e
children 44ab3d6057da
comparison
equal deleted inserted replaced
3878:cc4781a8781d 3879:b03425e7f02c
19 # include "config.h" 19 # include "config.h"
20 #endif 20 #endif
21 21
22 #include <stdlib.h> 22 #include <stdlib.h>
23 #include <glib.h> 23 #include <glib.h>
24 #include <string.h>
24 #include <dbus/dbus-glib.h> 25 #include <dbus/dbus-glib.h>
25 #include "audacious/dbus.h" 26 #include "audacious/dbus.h"
26 #include "audacious/dbus-client-bindings.h" 27 #include "audacious/dbus-client-bindings.h"
27 #include "audctrl.h" 28 #include "audctrl.h"
28 29
35 * @num: Number of URIs to play. 36 * @num: Number of URIs to play.
36 * @enqueue: Whether or not the new playlist should be added on, or replace the current playlist. 37 * @enqueue: Whether or not the new playlist should be added on, or replace the current playlist.
37 * 38 *
38 * Sends a playlist to audacious. 39 * Sends a playlist to audacious.
39 **/ 40 **/
40 void audacious_remote_playlist(DBusGProxy *proxy, gchar **list, gint num, 41 void audacious_remote_playlist(DBusGProxy *proxy, gchar **list, gint num, gboolean enqueue) {
41 gboolean enqueue) { 42 GList *glist = NULL;
42 //XXX 43 gchar **data = list;
44
45 g_return_if_fail(list != NULL);
46 g_return_if_fail(num > 0);
47
48 if (!enqueue)
49 audacious_remote_playlist_clear(proxy);
50
51 // construct a GList
52 while(data) {
53 glist = g_list_append(glist, (gpointer)data);
54 data++;
55 }
56
57 org_atheme_audacious_playlist_add(proxy, (gpointer)glist, &error);
58
59 g_list_free(glist);
60 glist = NULL;
61
62 if (!enqueue)
63 audacious_remote_play(proxy);
43 } 64 }
44 65
45 /** 66 /**
46 * audacious_remote_get_version: 67 * audacious_remote_get_version:
47 * @proxy: DBus proxy for audacious 68 * @proxy: DBus proxy for audacious
48 * 69 *
49 * Queries audacious for it's protocol version. 70 * Queries audacious for it's version.
50 * 71 *
51 * Return value: The protocol version used by Audacious. 72 * Return value: The version of Audacious.
52 **/ 73 **/
53 gint audacious_remote_get_version(DBusGProxy *proxy) { 74 gchar *audacious_remote_get_version(DBusGProxy *proxy) {
54 return 0x09a3; // XXX should do actual dbus call. 75 char *string = NULL;
76 org_atheme_audacious_version(proxy, &string, &error);
77 g_clear_error(&error);
78
79 return (string ? string : NULL);
55 } 80 }
56 81
57 /** 82 /**
58 * audacious_remote_playlist_add: 83 * audacious_remote_playlist_add:
59 * @proxy: DBus proxy for audacious 84 * @proxy: DBus proxy for audacious
62 * Sends a list of URIs to Audacious to add to the playlist. 87 * Sends a list of URIs to Audacious to add to the playlist.
63 **/ 88 **/
64 void audacious_remote_playlist_add(DBusGProxy *proxy, GList *list) { 89 void audacious_remote_playlist_add(DBusGProxy *proxy, GList *list) {
65 GList *iter; 90 GList *iter;
66 for (iter = list; iter != NULL; iter = g_list_next(iter)) 91 for (iter = list; iter != NULL; iter = g_list_next(iter))
67 org_atheme_audacious_add(proxy, iter->data, &error); 92 org_atheme_audacious_playlist_add(proxy, iter->data, &error);
68 g_clear_error(&error); 93 g_clear_error(&error);
69 } 94 }
70 95
71 /** 96 /**
72 * audacious_remote_playlist_delete: 97 * audacious_remote_playlist_delete:
74 * @pos: The playlist position to delete. 99 * @pos: The playlist position to delete.
75 * 100 *
76 * Deletes a playlist entry. 101 * Deletes a playlist entry.
77 **/ 102 **/
78 void audacious_remote_playlist_delete(DBusGProxy *proxy, guint pos) { 103 void audacious_remote_playlist_delete(DBusGProxy *proxy, guint pos) {
79 //XXX 104 org_atheme_audacious_delete(proxy, pos, &error);
105 g_clear_error(&error);
80 } 106 }
81 107
82 /** 108 /**
83 * audacious_remote_play: 109 * audacious_remote_play:
84 * @proxy: DBus proxy for audacious 110 * @proxy: DBus proxy for audacious
338 * Queries Audacious about it's skin. 364 * Queries Audacious about it's skin.
339 * 365 *
340 * Return value: A path to the currently selected skin. 366 * Return value: A path to the currently selected skin.
341 **/ 367 **/
342 gchar *audacious_remote_get_skin(DBusGProxy *proxy) { 368 gchar *audacious_remote_get_skin(DBusGProxy *proxy) {
343 //XXX 369 gchar *skin = NULL;
344 return NULL; 370 org_atheme_audacious_get_skin (proxy, &skin, &error); // xxx
371 g_clear_error(&error);
372 return skin;
345 } 373 }
346 374
347 /** 375 /**
348 * audacious_remote_set_skin: 376 * audacious_remote_set_skin:
349 * @proxy: DBus proxy for audacious 377 * @proxy: DBus proxy for audacious
350 * @skinfile: Path to a skinfile to use with Audacious. 378 * @skinfile: Path to a skinfile to use with Audacious.
351 * 379 *
352 * Tells audacious to start using the skinfile provided. 380 * Tells audacious to start using the skinfile provided.
353 **/ 381 **/
354 void audacious_remote_set_skin(DBusGProxy *proxy, gchar *skinfile) { 382 void audacious_remote_set_skin(DBusGProxy *proxy, gchar *skinfile) {
355 //XXX 383 org_atheme_audacious_set_skin(proxy, skinfile, &error);
384 g_clear_error(&error);
356 } 385 }
357 386
358 /** 387 /**
359 * audacious_remote_get_playlist_file: 388 * audacious_remote_get_playlist_file:
360 * @proxy: DBus proxy for audacious 389 * @proxy: DBus proxy for audacious
504 * @proxy: DBus proxy for audacious 533 * @proxy: DBus proxy for audacious
505 * 534 *
506 * Tells audacious to show the preferences pane. 535 * Tells audacious to show the preferences pane.
507 **/ 536 **/
508 void audacious_remote_show_prefs_box(DBusGProxy *proxy) { 537 void audacious_remote_show_prefs_box(DBusGProxy *proxy) {
509 //XXX 538 org_atheme_audacious_show_prefs_box(proxy, &error);
539 g_clear_error(&error);
540 }
541
542 /**
543 * audacious_remote_show_about_box:
544 * @proxy: DBus proxy for audacious
545 *
546 * Tells audacious to show the about box.
547 **/
548 void audacious_remote_show_about_box(DBusGProxy *proxy) {
549 org_atheme_audacious_show_about_box(proxy, &error);
550 g_clear_error(&error);
510 } 551 }
511 552
512 /** 553 /**
513 * audacious_remote_toggle_aot: 554 * audacious_remote_toggle_aot:
514 * @proxy: DBus proxy for audacious 555 * @proxy: DBus proxy for audacious
515 * @ontop: Whether or not Audacious should be always-on-top. 556 * @ontop: Whether or not Audacious should be always-on-top.
516 * 557 *
517 * Tells audacious to toggle the always-on-top feature. 558 * Tells audacious to toggle the always-on-top feature.
518 **/ 559 **/
519 void audacious_remote_toggle_aot(DBusGProxy *proxy, gboolean ontop) { 560 void audacious_remote_toggle_aot(DBusGProxy *proxy, gboolean ontop) {
520 //XXX 561 org_atheme_audacious_toggle_aot(proxy, ontop, &error);
562 g_clear_error(&error);
521 } 563 }
522 564
523 /** 565 /**
524 * audacious_remote_eject: 566 * audacious_remote_eject:
525 * @proxy: DBus proxy for audacious 567 * @proxy: DBus proxy for audacious
731 * @proxy: DBus proxy for audacious 773 * @proxy: DBus proxy for audacious
732 * 774 *
733 * Tells audacious to either play or pause. 775 * Tells audacious to either play or pause.
734 **/ 776 **/
735 void audacious_remote_play_pause(DBusGProxy *proxy) { 777 void audacious_remote_play_pause(DBusGProxy *proxy) {
736 //XXX 778 org_atheme_audacious_play_pause(proxy, &error);
737 } 779 }
738 780
739 /** 781 /**
740 * audacious_remote_playlist_ins_url_string: 782 * audacious_remote_playlist_ins_url_string:
741 * @proxy: DBus proxy for audacious 783 * @proxy: DBus proxy for audacious
744 * 786 *
745 * Tells audacious to add an URI to the playlist at a specific position. 787 * Tells audacious to add an URI to the playlist at a specific position.
746 **/ 788 **/
747 void audacious_remote_playlist_ins_url_string(DBusGProxy *proxy, 789 void audacious_remote_playlist_ins_url_string(DBusGProxy *proxy,
748 gchar *string, guint pos) { 790 gchar *string, guint pos) {
749 //XXX 791 org_atheme_audacious_playlist_ins_url_string (proxy, string, pos, &error);
792 g_clear_error(&error);
750 } 793 }
751 794
752 /** 795 /**
753 * audacious_remote_playqueue_add: 796 * audacious_remote_playqueue_add:
754 * @proxy: DBus proxy for audacious 797 * @proxy: DBus proxy for audacious
755 * @pos: The playlist position to add to the queue. 798 * @pos: The playlist position to add to the queue.
756 * 799 *
757 * Tells audacious to add a playlist entry to the playqueue. 800 * Tells audacious to add a playlist entry to the playqueue.
758 **/ 801 **/
759 void audacious_remote_playqueue_add(DBusGProxy *proxy, guint pos) { 802 void audacious_remote_playqueue_add(DBusGProxy *proxy, guint pos) {
760 //XXX 803 org_atheme_audacious_playqueue_add (proxy, pos, &error);
804 g_clear_error(&error);
761 } 805 }
762 806
763 /** 807 /**
764 * audacious_remote_playqueue_remove: 808 * audacious_remote_playqueue_remove:
765 * @proxy: DBus proxy for audacious 809 * @proxy: DBus proxy for audacious
766 * @pos: The playlist position to remove from the queue. 810 * @pos: The playlist position to remove from the queue.
767 * 811 *
768 * Tells audacious to remove a playlist entry from the playqueue. 812 * Tells audacious to remove a playlist entry from the playqueue.
769 **/ 813 **/
770 void audacious_remote_playqueue_remove(DBusGProxy *proxy, guint pos) { 814 void audacious_remote_playqueue_remove(DBusGProxy *proxy, guint pos) {
771 //XXX 815 org_atheme_audacious_playqueue_remove (proxy, pos, &error);
816 g_clear_error(&error);
772 } 817 }
773 818
774 /** 819 /**
775 * audacious_remote_get_playqueue_length: 820 * audacious_remote_get_playqueue_length:
776 * @proxy: DBus proxy for audacious 821 * @proxy: DBus proxy for audacious
818 * @proxy: DBus proxy for audacious 863 * @proxy: DBus proxy for audacious
819 * 864 *
820 * Tells audacious to display the main window and become the selected window. 865 * Tells audacious to display the main window and become the selected window.
821 **/ 866 **/
822 void audacious_remote_activate(DBusGProxy *proxy) { 867 void audacious_remote_activate(DBusGProxy *proxy) {
823 //XXX 868 org_atheme_audacious_activate(proxy, &error);
869 g_clear_error(&error);
824 } 870 }
825 871
826 /** 872 /**
827 * audacious_remote_show_jtf_box: 873 * audacious_remote_show_jtf_box:
828 * @proxy: DBus proxy for audacious 874 * @proxy: DBus proxy for audacious
829 * 875 *
830 * Tells audacious to show the Jump-to-File pane. 876 * Tells audacious to show the Jump-to-File pane.
831 **/ 877 **/
832 void audacious_remote_show_jtf_box(DBusGProxy *proxy) { 878 void audacious_remote_show_jtf_box(DBusGProxy *proxy) {
833 //XXX 879 org_atheme_audacious_show_jtf_box(proxy, &error);
880 g_clear_error(&error);
834 } 881 }
835 882
836 /** 883 /**
837 * audacious_remote_playqueue_clear: 884 * audacious_remote_playqueue_clear:
838 * @proxy: DBus proxy for audacious 885 * @proxy: DBus proxy for audacious
839 * 886 *
840 * Tells audacious to clear the playqueue. 887 * Tells audacious to clear the playqueue.
841 **/ 888 **/
842 void audacious_remote_playqueue_clear(DBusGProxy *proxy) { 889 void audacious_remote_playqueue_clear(DBusGProxy *proxy) {
843 //XXX 890 org_atheme_audacious_playqueue_clear(proxy, &error);
891 g_clear_error(&error);
844 } 892 }
845 893
846 /** 894 /**
847 * audacious_remote_playqueue_is_queued: 895 * audacious_remote_playqueue_is_queued:
848 * @proxy: DBus proxy for audacious 896 * @proxy: DBus proxy for audacious
851 * Queries audacious about whether or not a playlist entry is in the playqueue. 899 * Queries audacious about whether or not a playlist entry is in the playqueue.
852 * 900 *
853 * Return value: TRUE if yes, FALSE otherwise. 901 * Return value: TRUE if yes, FALSE otherwise.
854 **/ 902 **/
855 gboolean audacious_remote_playqueue_is_queued(DBusGProxy *proxy, guint pos) { 903 gboolean audacious_remote_playqueue_is_queued(DBusGProxy *proxy, guint pos) {
856 //XXX 904 gboolean is_queued;
857 return FALSE; 905 org_atheme_audacious_playqueue_is_queued (proxy, pos, &is_queued, &error);
858 } 906 g_clear_error(&error);
859 907 return is_queued;
860 /** 908 }
861 * audacious_remote_get_playqueue_position: 909
910 /**
911 * audacious_remote_get_playqueue_queue_position:
862 * @proxy: DBus proxy for audacious 912 * @proxy: DBus proxy for audacious
863 * @pos: Position to check queue for. 913 * @pos: Position to check queue for.
864 * 914 *
865 * Queries audacious about what the playqueue position is for a playlist entry. 915 * Queries audacious about what the playqueue position is for a playlist entry.
866 * 916 *
867 * Return value: TRUE if yes, FALSE otherwise. 917 * Return value: the playqueue position for a playlist entry
868 **/ 918 **/
869 gint audacious_remote_get_playqueue_position(DBusGProxy *proxy, guint pos) { 919 gint audacious_remote_get_playqueue_queue_position(DBusGProxy *proxy, guint pos) {
870 //XXX 920 guint qpos = 0;
871 return 0; 921 org_atheme_audacious_queue_get_queue_pos (proxy, pos, &qpos, &error);
872 } 922 g_clear_error(&error);
873 923 return qpos;
874 /** 924 }
875 * audacious_remote_get_playqueue_queue_position: 925
926 /**
927 * audacious_remote_get_playqueue_list_position:
876 * @proxy: DBus proxy for audacious 928 * @proxy: DBus proxy for audacious
877 * @pos: Position to check queue for. 929 * @pos: Position to check queue for.
878 * 930 *
879 * Queries audacious about what the playlist position is for a playqueue entry. 931 * Queries audacious about what the playlist position is for a playqueue entry.
880 * 932 *
881 * Return value: TRUE if yes, FALSE otherwise. 933 * Return value: the playlist position for a playqueue entry
882 **/ 934 **/
883 gint audacious_remote_get_playqueue_queue_position(DBusGProxy *proxy, 935 gint audacious_remote_get_playqueue_list_position(DBusGProxy *proxy, guint qpos) {
884 guint pos) { 936 guint pos = 0;
885 //XXX 937 org_atheme_audacious_queue_get_list_pos (proxy, qpos, &pos, &error);
886 return 0; 938 g_clear_error(&error);
939 return pos;
887 } 940 }
888 941
889 /** 942 /**
890 * audacious_remote_playlist_enqueue_to_temp: 943 * audacious_remote_playlist_enqueue_to_temp:
891 * @proxy: DBus proxy for audacious 944 * @proxy: DBus proxy for audacious
893 * 946 *
894 * Tells audacious to add an URI to a temporary playlist. 947 * Tells audacious to add an URI to a temporary playlist.
895 **/ 948 **/
896 void audacious_remote_playlist_enqueue_to_temp(DBusGProxy *proxy, 949 void audacious_remote_playlist_enqueue_to_temp(DBusGProxy *proxy,
897 gchar *string) { 950 gchar *string) {
898 //XXX 951 org_atheme_audacious_playlist_enqueue_to_temp(proxy, string, &error);
952 g_clear_error(&error);
899 } 953 }
900 954
901 /** 955 /**
902 * audacious_get_tuple_field_data: 956 * audacious_get_tuple_field_data:
903 * @proxy: DBus proxy for audacious 957 * @proxy: DBus proxy for audacious
909 * Return value: The requested field's data for the entry in the playlist at %pos position. 963 * Return value: The requested field's data for the entry in the playlist at %pos position.
910 **/ 964 **/
911 gchar *audacious_get_tuple_field_data(DBusGProxy *proxy, gchar *field, 965 gchar *audacious_get_tuple_field_data(DBusGProxy *proxy, gchar *field,
912 guint pos) { 966 guint pos) {
913 //XXX 967 //XXX
968 g_clear_error(&error);
914 return NULL; 969 return NULL;
915 } 970 }
971