Mercurial > audlegacy
annotate src/audtool/audtool_handlers_general.c @ 2929:b0ca7bddaec9 trunk
Split out playqueue functions.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 29 Jun 2007 08:17:02 -0500 |
parents | ede9a8b8deff |
children | fe27b67d8c37 |
rev | line source |
---|---|
2737 | 1 /* |
2 * Audtool2 | |
3 * Copyright (c) 2007 Audacious development team | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions are | |
7 * met: | |
8 * | |
9 * 1. Redistributions of source code must retain the above copyright notice, | |
10 * this list of conditions and the following disclaimer. | |
11 * | |
12 * 2. Redistributions in binary form must reproduce the above copyright | |
13 * notice, this list of conditions and the following disclaimer in the | |
14 * documentation and/or other materials provided with the distribution. | |
15 * | |
16 * 3. The name of the author may not be used to endorse or promote products | |
17 * derived from this software without specific prior written permission. | |
18 * | |
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 * POSSIBILITY OF SUCH DAMAGE. | |
30 */ | |
31 | |
32 #include <stdlib.h> | |
33 #include <string.h> | |
34 #include <glib.h> | |
35 #include <mowgli.h> | |
36 #include <locale.h> | |
37 #include "libaudclient/audctrl.h" | |
38 #include "audtool.h" | |
39 | |
40 void get_volume(gint argc, gchar **argv) | |
41 { | |
42 gint i; | |
43 | |
44 i = audacious_remote_get_main_volume(dbus_proxy); | |
45 | |
46 g_print("%d\n", i); | |
47 } | |
48 | |
49 void set_volume(gint argc, gchar **argv) | |
50 { | |
51 gint i, current_volume; | |
52 | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
53 if (argc < 2) |
2737 | 54 { |
55 g_print("%s: invalid parameters for set-volume.\n", argv[0]); | |
56 g_print("%s: syntax: %s set-volume <level>\n", argv[0], argv[0]); | |
57 return; | |
58 } | |
59 | |
60 current_volume = audacious_remote_get_main_volume(dbus_proxy); | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
61 switch (argv[1][0]) |
2737 | 62 { |
63 case '+': | |
64 case '-': | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
65 i = current_volume + atoi(argv[1]); |
2737 | 66 break; |
67 default: | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
68 i = atoi(argv[1]); |
2737 | 69 break; |
70 } | |
71 | |
72 audacious_remote_set_main_volume(dbus_proxy, i); | |
73 } | |
74 | |
75 void mainwin_show(gint argc, gchar **argv) | |
76 { | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
77 if (argc > 1) |
2737 | 78 { |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
79 if (!strncmp(argv[1],"on",2)) { |
2737 | 80 audacious_remote_main_win_toggle(dbus_proxy, TRUE); |
81 return; | |
82 } | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
83 else if (!strncmp(argv[1],"off",3)) { |
2737 | 84 audacious_remote_main_win_toggle(dbus_proxy, FALSE); |
85 return; | |
86 } | |
87 } | |
88 g_print("%s: invalid parameter for mainwin-show.\n",argv[0]); | |
89 g_print("%s: syntax: %s mainwin-show <on/off>\n",argv[0],argv[0]); | |
90 } | |
91 | |
92 void playlist_show(gint argc, gchar **argv) | |
93 { | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
94 if (argc > 1) |
2737 | 95 { |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
96 if (!strncmp(argv[1],"on",2)) { |
2737 | 97 audacious_remote_pl_win_toggle(dbus_proxy, TRUE); |
98 return; | |
99 } | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
100 else if (!strncmp(argv[1],"off",3)) { |
2737 | 101 audacious_remote_pl_win_toggle(dbus_proxy, FALSE); |
102 return; | |
103 } | |
104 } | |
105 g_print("%s: invalid parameter for playlist-show.\n",argv[0]); | |
106 g_print("%s: syntax: %s playlist-show <on/off>\n",argv[0],argv[0]); | |
107 } | |
108 | |
109 void equalizer_show(gint argc, gchar **argv) | |
110 { | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
111 if (argc > 1) |
2737 | 112 { |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
113 if (!strncmp(argv[1],"on",2)) { |
2737 | 114 audacious_remote_eq_win_toggle(dbus_proxy, TRUE); |
115 return; | |
116 } | |
2925
90ca95b7277d
Convert code where necessary to work with the new data passed to it.
William Pitcock <nenolod@atheme.org>
parents:
2922
diff
changeset
|
117 else if (!strncmp(argv[1],"off",3)) { |
2737 | 118 audacious_remote_eq_win_toggle(dbus_proxy, FALSE); |
119 return; | |
120 } | |
121 } | |
122 g_print("%s: invalid parameter for equalizer-show.\n",argv[0]); | |
123 g_print("%s: syntax: %s equalizer-show <on/off>\n",argv[0],argv[0]); | |
124 } | |
125 | |
126 void show_preferences_window(gint argc, gchar **argv) | |
127 { | |
128 audacious_remote_show_prefs_box(dbus_proxy); | |
129 } | |
130 | |
131 void show_jtf_window(gint argc, gchar **argv) | |
132 { | |
133 audacious_remote_show_jtf_box(dbus_proxy); | |
134 } | |
135 | |
136 void shutdown_audacious_server(gint argc, gchar **argv) | |
137 { | |
138 audacious_remote_quit(dbus_proxy); | |
139 } | |
140 | |
141 void get_handlers_list(gint argc, gchar **argv) | |
142 { | |
143 gint i; | |
144 | |
145 for (i = 0; handlers[i].name != NULL; i++) | |
146 { | |
147 if (!g_strcasecmp("<sep>", handlers[i].name)) | |
148 g_print("%s%s:\n", i == 0 ? "" : "\n", handlers[i].desc); | |
149 else | |
150 g_print(" %-34s - %s\n", handlers[i].name, handlers[i].desc); | |
151 } | |
152 | |
153 g_print("\nHandlers may be prefixed with `--' (GNU-style long-options) or not, your choice.\n"); | |
154 g_print("Report bugs to http://bugs-meta.atheme.org/\n"); | |
155 } |