summaryrefslogtreecommitdiffstats
path: root/src/itdb_itunesdb.c
diff options
context:
space:
mode:
authorChristophe Fergeau <teuf@gnome.org>2008-07-06 14:04:46 +0000
committerChristophe Fergeau <teuf@gnome.org>2008-07-06 14:04:46 +0000
commitfce629575441fbc5ec5bb13f5b01aa011f7beefa (patch)
tree020cc9b46576e4188f7c0b479c385bf1df519ec1 /src/itdb_itunesdb.c
parentc41ab5991769d2c19202e470084ed5727a7ee294 (diff)
downloadlibgpod-tmz-fce629575441fbc5ec5bb13f5b01aa011f7beefa.tar.gz
libgpod-tmz-fce629575441fbc5ec5bb13f5b01aa011f7beefa.tar.xz
libgpod-tmz-fce629575441fbc5ec5bb13f5b01aa011f7beefa.zip
Pick itdb_device_get_storage_info from songbird
git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@2041 f01d2545-417e-4e96-918e-98f8d0dbbcb6
Diffstat (limited to 'src/itdb_itunesdb.c')
-rw-r--r--src/itdb_itunesdb.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c
index 6bbba84..e8d7e9b 100644
--- a/src/itdb_itunesdb.c
+++ b/src/itdb_itunesdb.c
@@ -119,7 +119,6 @@
#include <glib/gstdio.h>
#include <stdio.h>
#include <string.h>
-#include <sys/statvfs.h>
#include <sys/types.h>
#include <time.h>
#ifdef HAVE_UNISTD_H
@@ -6911,17 +6910,14 @@ static gboolean itdb_create_directories (Itdb_Device *device, GError **error)
/* Build the directories that hold the music files */
dirnum = info->musicdirs;
if (dirnum == 0)
- { /* do a guess */
- struct statvfs stat;
- if (statvfs (mp, &stat) != 0)
- { /* why should this fail !? */
- dirnum = 20;
- }
- else
- {
- gdouble size = ((gdouble)stat.f_blocks * stat.f_frsize) / 1073741824;
+ {
+ guint64 capacity, free_space;
+ if (itdb_device_get_storage_info(device, &capacity, &free_space)) {
+ gdouble size = ((gdouble)capacity) / 1073741824;
if (size < 20) dirnum = 20;
else dirnum = 50;
+ } else {
+ dirnum = 20;
}
}