2 * Copyright (C) 2004-2007 Qball Cow <qball@sarine.nl>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
25 #include "bacon-message-connection.h"
28 int main ( int argc
, char **argv
)
30 BaconMessageConnection
*bacon_connection
= NULL
;
32 gtk_init(&argc
, &argv
);
37 bacon_connection
= bacon_message_connection_new("gmpc");
38 if(bacon_connection
!= NULL
)
40 if (!bacon_message_connection_get_is_server (bacon_connection
))
43 GOptionContext
*context
;
55 GOptionEntry entries
[] = {
57 "version", 0, 0, G_OPTION_ARG_NONE
, &version
,
58 "Print the version number and exit", NULL
61 "quit", 'q', 0, G_OPTION_ARG_NONE
, &quit
,
62 "Quit the running gmpc", NULL
65 "play", 'c', 0, G_OPTION_ARG_NONE
, &play
,
66 "Give the running gmpc the play command", NULL
69 "pause", 'v', 0, G_OPTION_ARG_NONE
, &pause
,
70 "Give the running gmpc the pause command", NULL
73 "next", 'b', 0, G_OPTION_ARG_NONE
, &next
,
74 "Give the running gmpc the next command", NULL
77 "prev", 'z', 0, G_OPTION_ARG_NONE
, &prev
,
78 "Give the running gmpc the prev command", NULL
81 "stop", 'x', 0, G_OPTION_ARG_NONE
, &stop
,
82 "Give the running gmpc the stop command", NULL
91 /*Create the commandline option parser */
92 context
= g_option_context_new("GMPC remote program");
93 g_option_context_add_main_entries(context
, entries
, NULL
);
95 /*Time to parse the options */
96 g_option_context_parse(context
, &argc
, &argv
, &error
);
97 g_option_context_free(context
);
101 printf("send quit\n");
102 bacon_message_connection_send(bacon_connection
, "QUIT");
106 printf("send play\n");
107 bacon_message_connection_send(bacon_connection
, "PLAY");
111 printf("send prev\n");
112 bacon_message_connection_send(bacon_connection
, "PREV");
116 printf("send next\n");
117 bacon_message_connection_send(bacon_connection
, "NEXT");
121 printf("send stop\n");
122 bacon_message_connection_send(bacon_connection
, "STOP");
128 printf("GMPC is not running\n");
129 bacon_message_connection_free (bacon_connection
);