comparison src/audacious/dbus.c @ 4544:084dbc8d23da

removed variable "has_x11_connection" from main.c, needed to hookify some functions therefore
author mf0102 <0102@gmx.at>
date Mon, 12 May 2008 23:01:06 +0200
parents f2271d78e07e
children 744953f257fb
comparison
equal deleted inserted replaced
4543:ed94ac6182df 4544:084dbc8d23da
31 #include "dbus-service.h" 31 #include "dbus-service.h"
32 #include "dbus-server-bindings.h" 32 #include "dbus-server-bindings.h"
33 33
34 #include <math.h> 34 #include <math.h>
35 #include "main.h" 35 #include "main.h"
36 #include "ui_equalizer.h"
37 #include "ui_main.h"
38 #include "input.h" 36 #include "input.h"
39 #include "playback.h" 37 #include "playback.h"
40 #include "playlist.h" 38 #include "playlist.h"
41 #include "ui_playlist.h"
42 #include "ui_preferences.h"
43 #include "tuple.h" 39 #include "tuple.h"
44 #include "ui_jumptotrack.h"
45 #include "strings.h" 40 #include "strings.h"
46 #include "ui_credits.h" 41 #include "ui_equalizer.h"
47 #include "ui_skin.h" 42 #include "ui_skin.h"
48 #include "ui_fileopener.h"
49 43
50 static DBusGConnection *dbus_conn = NULL; 44 static DBusGConnection *dbus_conn = NULL;
51 static guint signals[LAST_SIG] = { 0 }; 45 static guint signals[LAST_SIG] = { 0 };
52 46
53 G_DEFINE_TYPE(RemoteObject, audacious_rc, G_TYPE_OBJECT); 47 G_DEFINE_TYPE(RemoteObject, audacious_rc, G_TYPE_OBJECT);
521 aud_quit(); 515 aud_quit();
522 return TRUE; 516 return TRUE;
523 } 517 }
524 518
525 gboolean audacious_rc_eject(RemoteObject *obj, GError **error) { 519 gboolean audacious_rc_eject(RemoteObject *obj, GError **error) {
526 if (has_x11_connection) 520 drct_eject();
527 mainwin_eject_pushed();
528 return TRUE; 521 return TRUE;
529 } 522 }
530 523
531 gboolean audacious_rc_main_win_visible(RemoteObject *obj, 524 gboolean audacious_rc_main_win_visible(RemoteObject *obj,
532 gboolean *is_main_win, GError **error) { 525 gboolean *is_main_win, GError **error) {
533 *is_main_win = cfg.player_visible; 526 *is_main_win = cfg.player_visible;
534 g_message("main win %s\n", (cfg.player_visible? "visible" : "hidden"));
535 return TRUE; 527 return TRUE;
536 } 528 }
537 529
538 gboolean audacious_rc_show_main_win(RemoteObject *obj, gboolean show, 530 gboolean audacious_rc_show_main_win(RemoteObject *obj, gboolean show,
539 GError **error) { 531 GError **error) {
540 g_message("%s main win\n", (show? "showing": "hiding")); 532 drct_main_win_toggle(show);
541 if (has_x11_connection)
542 mainwin_show(show);
543 return TRUE; 533 return TRUE;
544 } 534 }
545 535
546 gboolean audacious_rc_equalizer_visible(RemoteObject *obj, 536 gboolean audacious_rc_equalizer_visible(RemoteObject *obj,
547 gboolean *is_eq_win, GError **error) { 537 gboolean *is_eq_win, GError **error) {
549 return TRUE; 539 return TRUE;
550 } 540 }
551 541
552 gboolean audacious_rc_show_equalizer(RemoteObject *obj, gboolean show, 542 gboolean audacious_rc_show_equalizer(RemoteObject *obj, gboolean show,
553 GError **error) { 543 GError **error) {
554 if (has_x11_connection) 544 drct_eq_win_toggle(show);
555 equalizerwin_show(show);
556 return TRUE; 545 return TRUE;
557 } 546 }
558 547
559 gboolean audacious_rc_playlist_visible(RemoteObject *obj, gboolean *is_pl_win, 548 gboolean audacious_rc_playlist_visible(RemoteObject *obj, gboolean *is_pl_win,
560 GError **error) { 549 GError **error) {
562 return TRUE; 551 return TRUE;
563 } 552 }
564 553
565 gboolean audacious_rc_show_playlist(RemoteObject *obj, gboolean show, 554 gboolean audacious_rc_show_playlist(RemoteObject *obj, gboolean show,
566 GError **error) { 555 GError **error) {
567 if (has_x11_connection) { 556 drct_pl_win_toggle(show);
568 if (show)
569 playlistwin_show();
570 else
571 playlistwin_hide();
572 }
573 return TRUE; 557 return TRUE;
574 } 558 }
575 559
576 // Playback Information/Manipulation 560 // Playback Information/Manipulation
577 gboolean audacious_rc_play(RemoteObject *obj, GError **error) { 561 gboolean audacious_rc_play(RemoteObject *obj, GError **error) {
819 return TRUE; 803 return TRUE;
820 } 804 }
821 805
822 /* New on Oct 5 */ 806 /* New on Oct 5 */
823 gboolean audacious_rc_show_prefs_box(RemoteObject *obj, gboolean show, GError **error) { 807 gboolean audacious_rc_show_prefs_box(RemoteObject *obj, gboolean show, GError **error) {
824 if (has_x11_connection) { 808 hook_call("prefswin show", &show);
825 if (show) 809 return TRUE;
826 show_prefs_window(); 810 }
827 else 811
828 hide_prefs_window();
829 }
830 return TRUE;
831 }
832 gboolean audacious_rc_show_about_box(RemoteObject *obj, gboolean show, GError **error) { 812 gboolean audacious_rc_show_about_box(RemoteObject *obj, gboolean show, GError **error) {
833 if (has_x11_connection) { 813 hook_call("aboutwin show", &show);
834 if (show)
835 show_about_window();
836 else
837 hide_about_window();
838 }
839 return TRUE; 814 return TRUE;
840 } 815 }
841 816
842 gboolean audacious_rc_show_jtf_box(RemoteObject *obj, gboolean show, GError **error) { 817 gboolean audacious_rc_show_jtf_box(RemoteObject *obj, gboolean show, GError **error) {
843 if (has_x11_connection) { 818 hook_call("ui jump to track show", &show);
844 if (show)
845 ui_jump_to_track();
846 else
847 ui_jump_to_track_hide();
848 }
849 return TRUE; 819 return TRUE;
850 } 820 }
851 821
852 gboolean audacious_rc_show_filebrowser(RemoteObject *obj, gboolean show, GError **error) 822 gboolean audacious_rc_show_filebrowser(RemoteObject *obj, gboolean show, GError **error)
853 { 823 {
854 if (has_x11_connection) { 824 gboolean play_button = FALSE;
855 if (show) 825 if (show)
856 run_filebrowser(FALSE); 826 hook_call("filebrowser show", &play_button);
857 else 827 else
858 hide_filebrowser(); 828 hook_call("filebrowser hide", NULL);
859 }
860 return TRUE; 829 return TRUE;
861 } 830 }
862 831
863 gboolean audacious_rc_play_pause(RemoteObject *obj, GError **error) { 832 gboolean audacious_rc_play_pause(RemoteObject *obj, GError **error) {
864 if (playback_get_playing()) 833 if (playback_get_playing())
871 gboolean audacious_rc_activate(RemoteObject *obj, GError **error) { 840 gboolean audacious_rc_activate(RemoteObject *obj, GError **error) {
872 gtk_window_present(GTK_WINDOW(mainwin)); 841 gtk_window_present(GTK_WINDOW(mainwin));
873 return TRUE; 842 return TRUE;
874 } 843 }
875 844
845 /* TODO: these skin functions should be removed when skin functionality
846 * disappears --mf0102 */
876 gboolean audacious_rc_get_skin(RemoteObject *obj, gchar **skin, GError **error) { 847 gboolean audacious_rc_get_skin(RemoteObject *obj, gchar **skin, GError **error) {
877 *skin = g_strdup(aud_active_skin->path); 848 *skin = g_strdup(aud_active_skin->path);
878 return TRUE; 849 return TRUE;
879 } 850 }
880 851
881 gboolean audacious_rc_set_skin(RemoteObject *obj, gchar *skin, GError **error) { 852 gboolean audacious_rc_set_skin(RemoteObject *obj, gchar *skin, GError **error) {
882 if (has_x11_connection == TRUE) 853 aud_active_skin_load(skin);
883 aud_active_skin_load(skin);
884 return TRUE; 854 return TRUE;
885 } 855 }
886 856
887 gboolean audacious_rc_get_info(RemoteObject *obj, gint *rate, gint *freq, gint *nch, GError **error) { 857 gboolean audacious_rc_get_info(RemoteObject *obj, gint *rate, gint *freq, gint *nch, GError **error) {
888 playback_get_sample_params(rate, freq, nch); 858 playback_get_sample_params(rate, freq, nch);
889 return TRUE; 859 return TRUE;
890 } 860 }
891 861
892 gboolean audacious_rc_toggle_aot(RemoteObject *obj, gboolean ontop, GError **error) { 862 gboolean audacious_rc_toggle_aot(RemoteObject *obj, gboolean ontop, GError **error) {
893 if (has_x11_connection) { 863 hook_call("mainwin set always on top", &ontop);
894 mainwin_set_always_on_top(ontop);
895 }
896 return TRUE; 864 return TRUE;
897 } 865 }
898 866
899 /* New on Oct 9: Queue */ 867 /* New on Oct 9: Queue */
900 gboolean audacious_rc_playqueue_add(RemoteObject *obj, gint pos, GError **error) { 868 gboolean audacious_rc_playqueue_add(RemoteObject *obj, gint pos, GError **error) {