diff src/audacious/input.c @ 3133:25f92bfd50c4 trunk

Initialize tuple.mtime.
author William Pitcock <nenolod@atheme-project.org>
date Fri, 20 Jul 2007 20:59:15 -0500
parents dfe8f4eb3dba
children a2f1d831065f
line wrap: on
line diff
--- a/src/audacious/input.c	Fri Jul 20 20:17:57 2007 -0500
+++ b/src/audacious/input.c	Fri Jul 20 20:59:15 2007 -0500
@@ -293,6 +293,25 @@
         !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(object));
 }
 
+static time_t
+input_get_mtime(const gchar *filename)
+{
+    struct stat buf;
+    gint rv;
+    gchar *realfn = NULL;
+
+    /* stat() does not accept file:// --yaz */
+    realfn = g_filename_from_uri(filename, NULL, NULL);
+    rv = stat(realfn ? realfn : filename, &buf);
+    g_free(realfn); realfn = NULL;
+
+    if (rv == 0) {
+        return buf.st_mtime;
+    } else {
+        return 0; //error
+    }
+}
+
 /*
  * input_check_file()
  *
@@ -420,6 +439,7 @@
                 pr = g_new0(ProbeResult, 1);
                 pr->ip = ip;
                 pr->tuple = tuple;
+                pr->tuple->mtime = input_get_mtime(filename_proxy);
 
                 return pr;
             }