1 /* -*- Mode: C; tab-width: 3; indent-tabs-mode: nil; c-basic-offset: 3 -*- */
2 
3 /*
4  * GImageView
5  * Copyright (C) 2001 Takuro Ashie
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  *
21  * $Id: fileload.h,v 1.12 2004/04/11 14:03:36 makeinu Exp $
22  */
23 
24 #ifndef __FILE_H__
25 #define __FILE_H__
26 
27 #include "gimageview.h"
28 #include "fr-archive.h"
29 
30 typedef enum
31 {
32    LOAD_CACHE,
33    CREATE_THUMB
34 } ThumbLoadType;
35 
36 
37 typedef enum
38 {
39    SCAN_SUB_DIR_NONE,
40    SCAN_SUB_DIR,
41    SCAN_SUB_DIR_ONE_TAB
42 } ScanSubDirType;
43 
44 
45 typedef enum
46 {
47    NO_OPEN_FILE,
48    END,
49    GETTING_FILELIST,
50    IMAGE_LOADING,
51    IMAGE_LOAD_DONE,
52    THUMB_LOADING,
53    THUMB_LOAD_DONE,
54    CANCEL              = 30,
55    STOP                = 31,
56    CONTAINER_DESTROYED = -1,
57    WINDOW_DESTROYED    = -2
58 } LoadStatus;
59 
60 
61 struct FilesLoader_Tag
62 {
63    GList        *filelist;
64    GList        *dirlist;
65    const gchar  *dirname;
66    FRArchive    *archive;
67 
68    GtkWidget    *window;      /* window which containes progress bar */
69    GtkWidget    *progressbar;
70 
71    /* for thumbnail */
72    ThumbLoadType thumb_load_type;
73 
74    /* cancel */
75    LoadStatus    status;
76 
77    /* progress infomation */
78    const gchar  *now_file;
79    gint          pos;
80    gint          num;
81 };
82 
83 
84 FilesLoader *files_loader_new                     (void);
85 gboolean     files_loader_query_loading           (void);
86 void         files_loader_delete                  (FilesLoader   *files);
87 void         files_loader_stop                    (void);
88 void         files_loader_create_progress_window  (FilesLoader   *files);
89 void         files_loader_destroy_progress_window (FilesLoader   *files);
90 void         files_loader_progress_update         (FilesLoader   *files,
91                                                    gfloat         progress,
92                                                    const gchar   *text);
93 
94 gint         open_image_files_in_image_view     (FilesLoader     *files);
95 gint         open_image_files_in_thumbnail_view (FilesLoader     *files,
96                                                  GimvThumbWin    *tw,
97                                                  GimvThumbView   *tv);
98 gint         open_image_files                   (FilesLoader     *files);
99 gint         open_dir_images                    (const gchar     *dirname,
100                                                  GimvThumbWin    *tw,
101                                                  GimvThumbView   *tv,
102                                                  ThumbLoadType    type,
103                                                  ScanSubDirType   scan_subdir);
104 gint         open_archive_images                (const gchar     *filename,
105                                                  GimvThumbWin    *tw,
106                                                  GimvThumbView   *tv,
107                                                  ThumbLoadType    type);
108 gint         open_dirs                          (FilesLoader     *files,
109                                                  GimvThumbWin    *tw,
110                                                  ThumbLoadType    type,
111                                                  gboolean         scan_subdir);
112 gint         open_images_dirs                   (GList           *list,
113                                                  GimvThumbWin    *tw,
114                                                  ThumbLoadType    type,
115                                                  gboolean         scan_subdir);
116 
117 GtkWidget   *create_filebrowser                 (gpointer         parent);
118 
119 #ifdef GIMV_DEBUG
120 void file_disp_loading_status (FilesLoader *files);
121 #endif /* GIMV_DEBUG */
122 
123 #endif /* __FILE_H__ */
124