Mercurial > audlegacy
comparison src/libaudclient/audctrl.c @ 3867:e48f2f4c116d
- many remained audacious remote functions have been implemented.
- audtool improvement in progress.
| author | Yoshiki Yazawa <yaz@cc.rim.or.jp> |
|---|---|
| date | Mon, 29 Oct 2007 22:21:42 +0900 |
| parents | 3b6d316f8b09 |
| children | f3341c2d6b9e |
comparison
equal
deleted
inserted
replaced
| 3866:5c5f56a710d1 | 3867:e48f2f4c116d |
|---|---|
| 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 |
| 62 * Sends a list of URIs to Audacious to add to the playlist. | 83 * Sends a list of URIs to Audacious to add to the playlist. |
| 63 **/ | 84 **/ |
| 64 void audacious_remote_playlist_add(DBusGProxy *proxy, GList *list) { | 85 void audacious_remote_playlist_add(DBusGProxy *proxy, GList *list) { |
| 65 GList *iter; | 86 GList *iter; |
| 66 for (iter = list; iter != NULL; iter = g_list_next(iter)) | 87 for (iter = list; iter != NULL; iter = g_list_next(iter)) |
| 67 org_atheme_audacious_add(proxy, iter->data, &error); | 88 org_atheme_audacious_playlist_add(proxy, iter->data, &error); |
| 68 g_clear_error(&error); | 89 g_clear_error(&error); |
| 69 } | 90 } |
| 70 | 91 |
| 71 /** | 92 /** |
| 72 * audacious_remote_playlist_delete: | 93 * audacious_remote_playlist_delete: |
| 74 * @pos: The playlist position to delete. | 95 * @pos: The playlist position to delete. |
| 75 * | 96 * |
| 76 * Deletes a playlist entry. | 97 * Deletes a playlist entry. |
| 77 **/ | 98 **/ |
| 78 void audacious_remote_playlist_delete(DBusGProxy *proxy, guint pos) { | 99 void audacious_remote_playlist_delete(DBusGProxy *proxy, guint pos) { |
| 79 //XXX | 100 org_atheme_audacious_delete(proxy, pos, &error); |
| 101 g_clear_error(&error); | |
| 80 } | 102 } |
| 81 | 103 |
| 82 /** | 104 /** |
| 83 * audacious_remote_play: | 105 * audacious_remote_play: |
| 84 * @proxy: DBus proxy for audacious | 106 * @proxy: DBus proxy for audacious |
| 338 * Queries Audacious about it's skin. | 360 * Queries Audacious about it's skin. |
| 339 * | 361 * |
| 340 * Return value: A path to the currently selected skin. | 362 * Return value: A path to the currently selected skin. |
| 341 **/ | 363 **/ |
| 342 gchar *audacious_remote_get_skin(DBusGProxy *proxy) { | 364 gchar *audacious_remote_get_skin(DBusGProxy *proxy) { |
| 343 //XXX | 365 gchar *skin = NULL; |
| 344 return NULL; | 366 org_atheme_audacious_get_skin (proxy, &skin, &error); // xxx |
| 367 g_clear_error(&error); | |
| 368 return skin; | |
| 345 } | 369 } |
| 346 | 370 |
| 347 /** | 371 /** |
| 348 * audacious_remote_set_skin: | 372 * audacious_remote_set_skin: |
| 349 * @proxy: DBus proxy for audacious | 373 * @proxy: DBus proxy for audacious |
| 350 * @skinfile: Path to a skinfile to use with Audacious. | 374 * @skinfile: Path to a skinfile to use with Audacious. |
| 351 * | 375 * |
| 352 * Tells audacious to start using the skinfile provided. | 376 * Tells audacious to start using the skinfile provided. |
| 353 **/ | 377 **/ |
| 354 void audacious_remote_set_skin(DBusGProxy *proxy, gchar *skinfile) { | 378 void audacious_remote_set_skin(DBusGProxy *proxy, gchar *skinfile) { |
| 355 //XXX | 379 org_atheme_audacious_set_skin(proxy, skinfile, &error); |
| 380 g_clear_error(&error); | |
| 356 } | 381 } |
| 357 | 382 |
| 358 /** | 383 /** |
| 359 * audacious_remote_get_playlist_file: | 384 * audacious_remote_get_playlist_file: |
| 360 * @proxy: DBus proxy for audacious | 385 * @proxy: DBus proxy for audacious |
| 504 * @proxy: DBus proxy for audacious | 529 * @proxy: DBus proxy for audacious |
| 505 * | 530 * |
| 506 * Tells audacious to show the preferences pane. | 531 * Tells audacious to show the preferences pane. |
| 507 **/ | 532 **/ |
| 508 void audacious_remote_show_prefs_box(DBusGProxy *proxy) { | 533 void audacious_remote_show_prefs_box(DBusGProxy *proxy) { |
| 509 //XXX | 534 org_atheme_audacious_show_prefs_box(proxy, &error); |
| 535 g_clear_error(&error); | |
| 536 } | |
| 537 | |
| 538 /** | |
| 539 * audacious_remote_show_about_box: | |
| 540 * @proxy: DBus proxy for audacious | |
| 541 * | |
| 542 * Tells audacious to show the about box. | |
| 543 **/ | |
| 544 void audacious_remote_show_about_box(DBusGProxy *proxy) { | |
| 545 org_atheme_audacious_show_about_box(proxy, &error); | |
| 546 g_clear_error(&error); | |
| 510 } | 547 } |
| 511 | 548 |
| 512 /** | 549 /** |
| 513 * audacious_remote_toggle_aot: | 550 * audacious_remote_toggle_aot: |
| 514 * @proxy: DBus proxy for audacious | 551 * @proxy: DBus proxy for audacious |
| 515 * @ontop: Whether or not Audacious should be always-on-top. | 552 * @ontop: Whether or not Audacious should be always-on-top. |
| 516 * | 553 * |
| 517 * Tells audacious to toggle the always-on-top feature. | 554 * Tells audacious to toggle the always-on-top feature. |
| 518 **/ | 555 **/ |
| 519 void audacious_remote_toggle_aot(DBusGProxy *proxy, gboolean ontop) { | 556 void audacious_remote_toggle_aot(DBusGProxy *proxy, gboolean ontop) { |
| 520 //XXX | 557 org_atheme_audacious_toggle_aot(proxy, ontop, &error); |
| 558 g_clear_error(&error); | |
| 521 } | 559 } |
| 522 | 560 |
| 523 /** | 561 /** |
| 524 * audacious_remote_eject: | 562 * audacious_remote_eject: |
| 525 * @proxy: DBus proxy for audacious | 563 * @proxy: DBus proxy for audacious |
| 731 * @proxy: DBus proxy for audacious | 769 * @proxy: DBus proxy for audacious |
| 732 * | 770 * |
| 733 * Tells audacious to either play or pause. | 771 * Tells audacious to either play or pause. |
| 734 **/ | 772 **/ |
| 735 void audacious_remote_play_pause(DBusGProxy *proxy) { | 773 void audacious_remote_play_pause(DBusGProxy *proxy) { |
| 736 //XXX | 774 org_atheme_audacious_play_pause(proxy, &error); |
| 737 } | 775 } |
| 738 | 776 |
| 739 /** | 777 /** |
| 740 * audacious_remote_playlist_ins_url_string: | 778 * audacious_remote_playlist_ins_url_string: |
| 741 * @proxy: DBus proxy for audacious | 779 * @proxy: DBus proxy for audacious |
| 744 * | 782 * |
| 745 * Tells audacious to add an URI to the playlist at a specific position. | 783 * Tells audacious to add an URI to the playlist at a specific position. |
| 746 **/ | 784 **/ |
| 747 void audacious_remote_playlist_ins_url_string(DBusGProxy *proxy, | 785 void audacious_remote_playlist_ins_url_string(DBusGProxy *proxy, |
| 748 gchar *string, guint pos) { | 786 gchar *string, guint pos) { |
| 749 //XXX | 787 org_atheme_audacious_playlist_ins_url_string (proxy, string, pos, &error); |
| 788 g_clear_error(&error); | |
| 750 } | 789 } |
| 751 | 790 |
| 752 /** | 791 /** |
| 753 * audacious_remote_playqueue_add: | 792 * audacious_remote_playqueue_add: |
| 754 * @proxy: DBus proxy for audacious | 793 * @proxy: DBus proxy for audacious |
| 755 * @pos: The playlist position to add to the queue. | 794 * @pos: The playlist position to add to the queue. |
| 756 * | 795 * |
| 757 * Tells audacious to add a playlist entry to the playqueue. | 796 * Tells audacious to add a playlist entry to the playqueue. |
| 758 **/ | 797 **/ |
| 759 void audacious_remote_playqueue_add(DBusGProxy *proxy, guint pos) { | 798 void audacious_remote_playqueue_add(DBusGProxy *proxy, guint pos) { |
| 760 //XXX | 799 org_atheme_audacious_playqueue_add (proxy, pos, &error); |
| 800 g_clear_error(&error); | |
| 761 } | 801 } |
| 762 | 802 |
| 763 /** | 803 /** |
| 764 * audacious_remote_playqueue_remove: | 804 * audacious_remote_playqueue_remove: |
| 765 * @proxy: DBus proxy for audacious | 805 * @proxy: DBus proxy for audacious |
| 766 * @pos: The playlist position to remove from the queue. | 806 * @pos: The playlist position to remove from the queue. |
| 767 * | 807 * |
| 768 * Tells audacious to remove a playlist entry from the playqueue. | 808 * Tells audacious to remove a playlist entry from the playqueue. |
| 769 **/ | 809 **/ |
| 770 void audacious_remote_playqueue_remove(DBusGProxy *proxy, guint pos) { | 810 void audacious_remote_playqueue_remove(DBusGProxy *proxy, guint pos) { |
| 771 //XXX | 811 org_atheme_audacious_playqueue_remove (proxy, pos, &error); |
| 812 g_clear_error(&error); | |
| 772 } | 813 } |
| 773 | 814 |
| 774 /** | 815 /** |
| 775 * audacious_remote_get_playqueue_length: | 816 * audacious_remote_get_playqueue_length: |
| 776 * @proxy: DBus proxy for audacious | 817 * @proxy: DBus proxy for audacious |
| 818 * @proxy: DBus proxy for audacious | 859 * @proxy: DBus proxy for audacious |
| 819 * | 860 * |
| 820 * Tells audacious to display the main window and become the selected window. | 861 * Tells audacious to display the main window and become the selected window. |
| 821 **/ | 862 **/ |
| 822 void audacious_remote_activate(DBusGProxy *proxy) { | 863 void audacious_remote_activate(DBusGProxy *proxy) { |
| 823 //XXX | 864 org_atheme_audacious_activate(proxy, &error); |
| 865 g_clear_error(&error); | |
| 824 } | 866 } |
| 825 | 867 |
| 826 /** | 868 /** |
| 827 * audacious_remote_show_jtf_box: | 869 * audacious_remote_show_jtf_box: |
| 828 * @proxy: DBus proxy for audacious | 870 * @proxy: DBus proxy for audacious |
| 829 * | 871 * |
| 830 * Tells audacious to show the Jump-to-File pane. | 872 * Tells audacious to show the Jump-to-File pane. |
| 831 **/ | 873 **/ |
| 832 void audacious_remote_show_jtf_box(DBusGProxy *proxy) { | 874 void audacious_remote_show_jtf_box(DBusGProxy *proxy) { |
| 833 //XXX | 875 org_atheme_audacious_show_jtf_box(proxy, &error); |
| 876 g_clear_error(&error); | |
| 834 } | 877 } |
| 835 | 878 |
| 836 /** | 879 /** |
| 837 * audacious_remote_playqueue_clear: | 880 * audacious_remote_playqueue_clear: |
| 838 * @proxy: DBus proxy for audacious | 881 * @proxy: DBus proxy for audacious |
| 839 * | 882 * |
| 840 * Tells audacious to clear the playqueue. | 883 * Tells audacious to clear the playqueue. |
| 841 **/ | 884 **/ |
| 842 void audacious_remote_playqueue_clear(DBusGProxy *proxy) { | 885 void audacious_remote_playqueue_clear(DBusGProxy *proxy) { |
| 843 //XXX | 886 org_atheme_audacious_playqueue_clear(proxy, &error); |
| 887 g_clear_error(&error); | |
| 844 } | 888 } |
| 845 | 889 |
| 846 /** | 890 /** |
| 847 * audacious_remote_playqueue_is_queued: | 891 * audacious_remote_playqueue_is_queued: |
| 848 * @proxy: DBus proxy for audacious | 892 * @proxy: DBus proxy for audacious |
| 851 * Queries audacious about whether or not a playlist entry is in the playqueue. | 895 * Queries audacious about whether or not a playlist entry is in the playqueue. |
| 852 * | 896 * |
| 853 * Return value: TRUE if yes, FALSE otherwise. | 897 * Return value: TRUE if yes, FALSE otherwise. |
| 854 **/ | 898 **/ |
| 855 gboolean audacious_remote_playqueue_is_queued(DBusGProxy *proxy, guint pos) { | 899 gboolean audacious_remote_playqueue_is_queued(DBusGProxy *proxy, guint pos) { |
| 856 //XXX | 900 gboolean is_queued; |
| 857 return FALSE; | 901 org_atheme_audacious_playqueue_is_queued (proxy, pos, &is_queued, &error); |
| 858 } | 902 g_clear_error(&error); |
| 859 | 903 return is_queued; |
| 860 /** | 904 } |
| 861 * audacious_remote_get_playqueue_position: | 905 |
| 906 /** | |
| 907 * audacious_remote_get_playqueue_queue_position: | |
| 862 * @proxy: DBus proxy for audacious | 908 * @proxy: DBus proxy for audacious |
| 863 * @pos: Position to check queue for. | 909 * @pos: Position to check queue for. |
| 864 * | 910 * |
| 865 * Queries audacious about what the playqueue position is for a playlist entry. | 911 * Queries audacious about what the playqueue position is for a playlist entry. |
| 866 * | 912 * |
| 867 * Return value: TRUE if yes, FALSE otherwise. | 913 * Return value: the playqueue position for a playlist entry |
| 868 **/ | 914 **/ |
| 869 gint audacious_remote_get_playqueue_position(DBusGProxy *proxy, guint pos) { | 915 gint audacious_remote_get_playqueue_queue_position(DBusGProxy *proxy, guint pos) { |
| 870 //XXX | 916 guint qpos = 0; |
| 871 return 0; | 917 org_atheme_audacious_queue_get_queue_pos (proxy, pos, &qpos, &error); |
| 872 } | 918 g_clear_error(&error); |
| 873 | 919 return qpos; |
| 874 /** | 920 } |
| 875 * audacious_remote_get_playqueue_queue_position: | 921 |
| 922 /** | |
| 923 * audacious_remote_get_playqueue_list_position: | |
| 876 * @proxy: DBus proxy for audacious | 924 * @proxy: DBus proxy for audacious |
| 877 * @pos: Position to check queue for. | 925 * @pos: Position to check queue for. |
| 878 * | 926 * |
| 879 * Queries audacious about what the playlist position is for a playqueue entry. | 927 * Queries audacious about what the playlist position is for a playqueue entry. |
| 880 * | 928 * |
| 881 * Return value: TRUE if yes, FALSE otherwise. | 929 * Return value: the playlist position for a playqueue entry |
| 882 **/ | 930 **/ |
| 883 gint audacious_remote_get_playqueue_queue_position(DBusGProxy *proxy, | 931 gint audacious_remote_get_playqueue_list_position(DBusGProxy *proxy, guint qpos) { |
| 884 guint pos) { | 932 guint pos = 0; |
| 885 //XXX | 933 org_atheme_audacious_queue_get_list_pos (proxy, qpos, &pos, &error); |
| 886 return 0; | 934 g_clear_error(&error); |
| 935 return pos; | |
| 887 } | 936 } |
| 888 | 937 |
| 889 /** | 938 /** |
| 890 * audacious_remote_playlist_enqueue_to_temp: | 939 * audacious_remote_playlist_enqueue_to_temp: |
| 891 * @proxy: DBus proxy for audacious | 940 * @proxy: DBus proxy for audacious |
| 893 * | 942 * |
| 894 * Tells audacious to add an URI to a temporary playlist. | 943 * Tells audacious to add an URI to a temporary playlist. |
| 895 **/ | 944 **/ |
| 896 void audacious_remote_playlist_enqueue_to_temp(DBusGProxy *proxy, | 945 void audacious_remote_playlist_enqueue_to_temp(DBusGProxy *proxy, |
| 897 gchar *string) { | 946 gchar *string) { |
| 898 //XXX | 947 org_atheme_audacious_playlist_enqueue_to_temp(proxy, string, &error); |
| 948 g_clear_error(&error); | |
| 899 } | 949 } |
| 900 | 950 |
| 901 /** | 951 /** |
| 902 * audacious_get_tuple_field_data: | 952 * audacious_get_tuple_field_data: |
| 903 * @proxy: DBus proxy for audacious | 953 * @proxy: DBus proxy for audacious |
| 909 * Return value: The requested field's data for the entry in the playlist at %pos position. | 959 * Return value: The requested field's data for the entry in the playlist at %pos position. |
| 910 **/ | 960 **/ |
| 911 gchar *audacious_get_tuple_field_data(DBusGProxy *proxy, gchar *field, | 961 gchar *audacious_get_tuple_field_data(DBusGProxy *proxy, gchar *field, |
| 912 guint pos) { | 962 guint pos) { |
| 913 //XXX | 963 //XXX |
| 964 g_clear_error(&error); | |
| 914 return NULL; | 965 return NULL; |
| 915 } | 966 } |
| 967 |
