changeset 3133:25f92bfd50c4 trunk

Initialize tuple.mtime.
author William Pitcock <nenolod@atheme-project.org>
date Fri, 20 Jul 2007 20:59:15 -0500
parents c5568d294a8a
children 10c42e059460 3eca96f6a73f
files src/audacious/input.c
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
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;
             }