annotate src/audtool/report.c @ 4739:4d15507f568c

remove reduntant call
author Tomasz Mon <desowin@gmail.com>
date Sat, 19 Jul 2008 16:57:45 +0200
parents 3ce92d3cd0e1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2930
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 /*
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2 * Audtool2
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 * Copyright (c) 2007 Audacious development team
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 *
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 * Redistribution and use in source and binary forms, with or without
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 * modification, are permitted provided that the following conditions are
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 * met:
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8 *
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright notice,
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 * this list of conditions and the following disclaimer.
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11 *
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 * 2. Redistributions in binary form must reproduce the above copyright
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 * notice, this list of conditions and the following disclaimer in the
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 * documentation and/or other materials provided with the distribution.
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15 *
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 * 3. The name of the author may not be used to endorse or promote products
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 * derived from this software without specific prior written permission.
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18 *
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 * POSSIBILITY OF SUCH DAMAGE.
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 */
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 #include <stdlib.h>
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33 #include <string.h>
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34 #include <glib.h>
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35 #include <mowgli.h>
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36 #include <locale.h>
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 #include "libaudclient/audctrl.h"
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38 #include "audtool.h"
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 void audtool_report(const gchar *str, ...)
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41 {
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42 gchar *buf;
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43 va_list va;
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 va_start(va, str);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 buf = g_strdup_vprintf(str, va);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47 va_end(va);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
48
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49 g_print("%s\n", buf);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50 g_free(buf);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51 }
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53 void audtool_whine(const gchar *str, ...)
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 {
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55 gchar *buf;
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56 va_list va;
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58 va_start(va, str);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
59 buf = g_strdup_vprintf(str, va);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
60 va_end(va);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
61
4611
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
62 g_printerr("audtool: %s", buf);
2930
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
63 g_free(buf);
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
64 }
d1198fb765c6 Add audtool_report() and audtool_whine() for message handling.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
65
4611
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
66 void audtool_whine_args(const gchar *name, const gchar *fmt, ...)
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
67 {
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
68 gchar *buf;
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
69 va_list va;
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
70
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
71 va_start(va, fmt);
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
72 buf = g_strdup_vprintf(fmt, va);
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
73 va_end(va);
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
74
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
75 g_printerr("audtool: Invalid parameters for %s\n", name);
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
76 g_printerr(" syntax: %s %s\n", name, buf);
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
77 g_free(buf);
895297e46ee3 Cure some 'repetitive code syndromes' from audtool.
Matti Hamalainen <ccr@tnsp.org>
parents: 2930
diff changeset
78 }
4615
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
79
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
80 void audtool_whine_tuple_fields(void)
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
81 {
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
82 gint nfields, i;
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
83 gchar **fields = audacious_remote_get_tuple_fields(dbus_proxy),
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
84 **tmp = fields;
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
85
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
86 audtool_whine("Field names include, but are not limited to:\n");
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
87
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
88 for (nfields = 0; tmp && *tmp; nfields++, tmp++);
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
89
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
90 tmp = fields;
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
91 i = 0;
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
92 g_printerr(" ");
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
93 while (tmp && *tmp) {
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
94 i += g_utf8_strlen(*tmp, -1);
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
95 if (i > 45) {
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
96 g_printerr("\n ");
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
97 i = 0;
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
98 }
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
99 g_printerr("%s", *tmp);
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
100 if (--nfields > 0)
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
101 g_printerr(", ");
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
102
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
103 g_free(*tmp);
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
104 tmp++;
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
105 }
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
106
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
107 g_printerr("\n");
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
108
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
109 g_free(fields);
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
110 }
3ce92d3cd0e1 Use audacious_remote_get_tuple_fields() to get available standard tuple
Matti Hamalainen <ccr@tnsp.org>
parents: 4612
diff changeset
111