~ubuntu-branches/ubuntu/hardy/gnome-commander/hardy

« back to all changes in this revision

Viewing changes to src/libgviewer/fileops.h

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2006-06-13 15:39:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060613153948-gvrt3mb2ddk5u62o
Tags: 1.2.0-3
added --disable-scrollkeeper on build

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    LibGViewer - GTK+ File Viewer library 
 
3
    Copyright (C) 2006 Assaf Gordon
 
4
    
 
5
    Part of
 
6
        GNOME Commander - A GNOME based file manager
 
7
        Copyright (C) 2001-2006 Marcus Bjurman
 
8
 
 
9
    This program is free software; you can redistribute it and/or modify
 
10
    it under the terms of the GNU General Public License as published by
 
11
    the Free Software Foundation; either version 2 of the License, or
 
12
    (at your option) any later version.
 
13
 
 
14
    This program is distributed in the hope that it will be useful,
 
15
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
    GNU General Public License for more details.
 
18
 
 
19
    You should have received a copy of the GNU General Public License
 
20
    along with this program; if not, write to the Free Software
 
21
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
22
*/
 
23
 
 
24
#ifndef __LIBGVIEWER_FILEOPS_H__
 
25
#define __LIBGVIEWER_FILEOPS_H__
 
26
 
 
27
/*
 
28
        File Handling functions (based on Midnight Commander's view.c)
 
29
 
 
30
        'open' & 'close' : just open and close the file handle
 
31
        'load' & 'free' : allocate & free buffer memory, call mmap/munmap
 
32
 
 
33
        calling order should be: open->load->[use file with "get_byte"]->free (which calls close)
 
34
*/
 
35
 
 
36
 
 
37
typedef struct _ViewerFileOps ViewerFileOps;
 
38
 
 
39
ViewerFileOps* gv_fileops_new();
 
40
 
 
41
/*
 
42
        returns -1 on failure
 
43
*/
 
44
int     gv_file_open(ViewerFileOps *ops, const gchar* _file);
 
45
 
 
46
int     gv_file_open_fd(ViewerFileOps *ops, int filedesc);
 
47
 
 
48
 
 
49
/*
 
50
        returns: NULL on success
 
51
*/
 
52
char   *gv_file_load (ViewerFileOps *ops, int fd);
 
53
 
 
54
/*
 
55
        return values: NULL for success, else points to error message
 
56
*/
 
57
char   *gv_file_init_growing_view (ViewerFileOps *ops, const char *filename);
 
58
 
 
59
/*
 
60
        returns: -1 on failure
 
61
                0->255 value on success
 
62
*/
 
63
int     gv_file_get_byte (ViewerFileOps *ops, offset_type byte_index);
 
64
 
 
65
offset_type gv_file_get_max_offset(ViewerFileOps *ops);
 
66
 
 
67
void    gv_file_close (ViewerFileOps *ops);
 
68
 
 
69
void    gv_file_free (ViewerFileOps *ops);
 
70
 
 
71
#endif