Also remember the filesystem type in the volume list

This commit is contained in:
Pierre Pronchery 2014-01-08 20:24:11 -06:00
parent dcb6a9aab8
commit a3d9ecd4c8

View File

@ -38,6 +38,7 @@ enum _VolumesColumn
{ {
DC_PIXBUF = 0, DC_PIXBUF = 0,
DC_NAME, DC_NAME,
DC_FILESYSTEM,
DC_MOUNTPOINT, DC_MOUNTPOINT,
DC_FREE, DC_FREE,
DC_FREE_DISPLAY, DC_FREE_DISPLAY,
@ -116,8 +117,8 @@ static Volumes * _volumes_init(BrowserPluginHelper * helper)
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(volumes->window), gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(volumes->window),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
volumes->store = gtk_list_store_new(DC_COUNT, GDK_TYPE_PIXBUF, volumes->store = gtk_list_store_new(DC_COUNT, GDK_TYPE_PIXBUF,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_BOOLEAN); G_TYPE_UINT, G_TYPE_STRING, G_TYPE_BOOLEAN);
volumes->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL( volumes->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(
volumes->store)); volumes->store));
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(volumes->view), FALSE); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(volumes->view), FALSE);
@ -170,8 +171,8 @@ static GtkWidget * _volumes_get_widget(Volumes * volumes)
/* volumes_refresh */ /* volumes_refresh */
static void _refresh_add(Volumes * volumes, char const * name, static void _refresh_add(Volumes * volumes, char const * name,
char const * device, char const * mountpoint, char const * device, char const * filesystem,
char const * filesystem, fsblkcnt_t free, fsblkcnt_t total); char const * mountpoint, fsblkcnt_t free, fsblkcnt_t total);
static void _refresh_get_iter(Volumes * volumes, GtkTreeIter * iter, static void _refresh_get_iter(Volumes * volumes, GtkTreeIter * iter,
char const * mountpoint); char const * mountpoint);
static void _refresh_purge(Volumes * volumes); static void _refresh_purge(Volumes * volumes);
@ -209,7 +210,7 @@ static void _volumes_refresh(Volumes * volumes, GList * selection)
_refresh_reset(volumes); _refresh_reset(volumes);
for(i = 0; i < res; i++) for(i = 0; i < res; i++)
_refresh_add(volumes, NULL, mnt[i].f_mntfromname, _refresh_add(volumes, NULL, mnt[i].f_mntfromname,
mnt[i].f_mntonname, mnt[i].f_fstypename, mnt[i].f_fstypename, mnt[i].f_mntonname,
mnt[i].f_bavail, mnt[i].f_blocks); mnt[i].f_bavail, mnt[i].f_blocks);
#elif defined(MNT_NOWAIT) #elif defined(MNT_NOWAIT)
if((res = getmntinfo(&mnt, MNT_NOWAIT)) <= 0) if((res = getmntinfo(&mnt, MNT_NOWAIT)) <= 0)
@ -217,18 +218,18 @@ static void _volumes_refresh(Volumes * volumes, GList * selection)
_refresh_reset(volumes); _refresh_reset(volumes);
for(i = 0; i < res; i++) for(i = 0; i < res; i++)
_refresh_add(volumes, NULL, mnt[i].f_mntfromname, _refresh_add(volumes, NULL, mnt[i].f_mntfromname,
mnt[i].f_mntonname, mnt[i].f_fstypename, mnt[i].f_fstypename, mnt[i].f_mntonname,
mnt[i].f_bavail, mnt[i].f_blocks); mnt[i].f_bavail, mnt[i].f_blocks);
#else #else
_refresh_reset(volumes); _refresh_reset(volumes);
_refresh_add(volumes, NULL, NULL, "/", NULL, 0, 0); _refresh_add(volumes, NULL, NULL, NULL, "/", 0, 0);
#endif #endif
_refresh_purge(volumes); _refresh_purge(volumes);
} }
static void _refresh_add(Volumes * volumes, char const * name, static void _refresh_add(Volumes * volumes, char const * name,
char const * device, char const * mountpoint, char const * device, char const * filesystem,
char const * filesystem, fsblkcnt_t free, fsblkcnt_t total) char const * mountpoint, fsblkcnt_t free, fsblkcnt_t total)
{ {
GtkTreeIter iter; GtkTreeIter iter;
VolumesPixbuf dp = DP_HARDDISK; VolumesPixbuf dp = DP_HARDDISK;
@ -277,8 +278,8 @@ static void _refresh_add(Volumes * volumes, char const * name,
_refresh_get_iter(volumes, &iter, mountpoint); _refresh_get_iter(volumes, &iter, mountpoint);
gtk_list_store_set(volumes->store, &iter, gtk_list_store_set(volumes->store, &iter,
DC_PIXBUF, volumes->icons[dp], DC_NAME, name, DC_PIXBUF, volumes->icons[dp], DC_NAME, name,
DC_MOUNTPOINT, mountpoint, DC_FREE, f, DC_FILESYSTEM, filesystem, DC_MOUNTPOINT, mountpoint,
DC_FREE_DISPLAY, buf, DC_UPDATED, TRUE, -1); DC_FREE, f, DC_FREE_DISPLAY, buf, DC_UPDATED, TRUE, -1);
} }
static void _refresh_get_iter(Volumes * volumes, GtkTreeIter * iter, static void _refresh_get_iter(Volumes * volumes, GtkTreeIter * iter,