changeset 3521:2f5ef443b231 trunk

tuple_formatter_expression_exists() now checks for empty fields, becoming the exact opposite of tuple_formatter_expression_empty().
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 12 Sep 2007 17:55:44 +0300
parents 46a0eb1426f6
children 23bf72b8c95c
files src/audacious/tuple_formatter.c
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/tuple_formatter.c	Wed Sep 12 05:32:56 2007 -0500
+++ b/src/audacious/tuple_formatter.c	Wed Sep 12 17:55:44 2007 +0300
@@ -379,13 +379,6 @@
     tuple_formatter_func_list = g_list_append(tuple_formatter_func_list, expr);
 }
 
-/* builtin-keyword: ${?arg}, returns TRUE if <arg> exists. */
-static gboolean
-tuple_formatter_expression_exists(Tuple *tuple, const gchar *expression)
-{
-    return (tuple_get_value_type(tuple, -1, expression) != TUPLE_UNKNOWN) ? TRUE : FALSE;
-}
-
 /* builtin-keyword: ${==arg1,arg2}, returns TRUE if <arg1> and <arg2> match.
    <arg1> and <arg2> can also be raw text, which should be enclosed in "double quotes". */
 static gboolean
@@ -461,7 +454,7 @@
     return tuple_formatter_expression_match(tuple, expression) ^ 1;
 }
 
-/* builtin-keyword: ${empty?}. returns TRUE if <arg> is empty. */
+/* builtin-keyword: ${(empty)?}. returns TRUE if <arg> is empty. */
 static gboolean
 tuple_formatter_expression_empty(Tuple *tuple, const gchar *expression)
 {
@@ -488,6 +481,13 @@
     return ret;
 }
 
+/* builtin-keyword: ${?arg}, returns TRUE if <arg> exists. */
+static gboolean
+tuple_formatter_expression_exists(Tuple *tuple, const gchar *expression)
+{
+    return !tuple_formatter_expression_empty(tuple, expression);
+}
+
 /* builtin function: %{audacious-version} */
 static gchar *
 tuple_formatter_function_version(Tuple *tuple, gchar **args)