959aa6658de398da144446bbb6689ccbc80b275c
[geeqie.git] / src / view_file / view_file_common.c
1 /*
2  *  This file is a part of Geeqie project (http://www.geeqie.org/).
3  *  Copyright (C) 2008 - 2016 The Geeqie Team
4  *
5  *  This program is free software; you can redistribute it and/or modify it
6  *  under the terms of the GNU General Public License as published by the Free
7  *  Software Foundation; either version 2 of the License, or (at your option)
8  *  any later version.
9  *
10  *  This program is distributed in the hope that it will be useful, but WITHOUT
11  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  *  more details.
14  */
15
16 guint vfcommon_count(ViewFile *vf, gint64 *bytes)
17 {
18         if (bytes)
19                 {
20                 gint64 b = 0;
21                 GList *work;
22
23                 work = vf->list;
24                 while (work)
25                         {
26                         FileData *fd = work->data;
27                         work = work->next;
28
29                         b += fd->size;
30                         }
31
32                 *bytes = b;
33                 }
34
35         return g_list_length(vf->list);
36 }
37