diff src/audacious/tuple_formatter.c @ 3490:602ec8c40d0d trunk

Fixed to comply with the Tuple API changes.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 01 Sep 2007 07:09:38 +0300
parents 86dafe2300f7
children 3a2ee00bc962
line wrap: on
line diff
--- a/src/audacious/tuple_formatter.c	Sat Sep 01 07:08:21 2007 +0300
+++ b/src/audacious/tuple_formatter.c	Sat Sep 01 07:09:38 2007 +0300
@@ -271,15 +271,15 @@
     /* ${artist} */
     if (expr == NULL && argument == NULL)
     {
-        TupleValueType type = tuple_get_value_type(tuple, expression);
+        TupleValueType type = tuple_get_value_type(tuple, -1, expression);
 
         switch(type)
         {
         case TUPLE_STRING:
-             return g_strdup(tuple_get_string(tuple, expression));
+             return g_strdup(tuple_get_string(tuple, -1, expression));
              break;
         case TUPLE_INT:
-             return g_strdup_printf("%d", tuple_get_int(tuple, expression));
+             return g_strdup_printf("%d", tuple_get_int(tuple, -1, expression));
              break;
         case TUPLE_UNKNOWN:
         default:
@@ -383,7 +383,7 @@
 static gboolean
 tuple_formatter_expression_exists(Tuple *tuple, const gchar *expression)
 {
-    return (tuple_get_value_type(tuple, expression) != TUPLE_UNKNOWN) ? TRUE : FALSE;
+    return (tuple_get_value_type(tuple, -1, expression) != TUPLE_UNKNOWN) ? TRUE : FALSE;
 }
 
 /* builtin-keyword: ${==arg1,arg2}, returns TRUE if <arg1> and <arg2> match.
@@ -406,7 +406,7 @@
         else /* bad formatted arg */
             return FALSE;
     }
-    else if (tuple_get_value_type(tuple, args[0]) == TUPLE_UNKNOWN)
+    else if (tuple_get_value_type(tuple, -1, args[0]) == TUPLE_UNKNOWN)
     {
         g_strfreev(args);
         return FALSE;
@@ -423,7 +423,7 @@
         else /* bad formatted arg */
             return FALSE;
     }
-    else if (tuple_get_value_type(tuple, args[1]) == TUPLE_UNKNOWN)
+    else if (tuple_get_value_type(tuple, -1, args[1]) == TUPLE_UNKNOWN)
     {
         g_strfreev(args);
         return FALSE;
@@ -431,18 +431,18 @@
 
     if (!arg1) /* if arg1 is not "raw text", get the tuple value */
     {
-        if (tuple_get_value_type(tuple, args[0]) == TUPLE_STRING)
-            arg1 = g_strdup(tuple_get_string(tuple, args[0]));
+        if (tuple_get_value_type(tuple, -1, args[0]) == TUPLE_STRING)
+            arg1 = g_strdup(tuple_get_string(tuple, -1, args[0]));
         else
-            arg1 = g_strdup_printf("%d", tuple_get_int(tuple, args[0]));
+            arg1 = g_strdup_printf("%d", tuple_get_int(tuple, -1, args[0]));
     }
 
     if (!arg2) /* if arg2 is not "raw text", get the tuple value */
     {
-        if (tuple_get_value_type(tuple, args[1]) == TUPLE_STRING)
-            arg2 = g_strdup(tuple_get_string(tuple, args[1]));
+        if (tuple_get_value_type(tuple, -1, args[1]) == TUPLE_STRING)
+            arg2 = g_strdup(tuple_get_string(tuple, -1, args[1]));
         else
-            arg2 = g_strdup_printf("%d", tuple_get_int(tuple, args[1]));
+            arg2 = g_strdup_printf("%d", tuple_get_int(tuple, -1, args[1]));
     }
 
     ret = g_ascii_strcasecmp(arg1, arg2);
@@ -467,15 +467,15 @@
 {
     gboolean ret = TRUE;
     const gchar *iter;
-    TupleValueType type = tuple_get_value_type(tuple, expression);
+    TupleValueType type = tuple_get_value_type(tuple, -1, expression);
 
     if (type == TUPLE_UNKNOWN)
         return TRUE;
 
-    if (type == TUPLE_INT && tuple_get_int(tuple, expression) != 0)
+    if (type == TUPLE_INT && tuple_get_int(tuple, -1, expression) != 0)
         return FALSE;
 
-    iter = tuple_get_string(tuple, expression);
+    iter = tuple_get_string(tuple, -1, expression);
 
     while (ret && *iter != '\0')
     {
@@ -529,7 +529,7 @@
 
     if(!rv || !strcmp(rv, "")) {
         g_free(rv);
-        rv = g_strdup(tuple_get_string(tuple, "file-name"));
+        rv = g_strdup(tuple_get_string(tuple, FIELD_FILE_NAME, NULL));
     }
 
     return rv;