2 * ggv-utils.c: misc utility functions
4 * Copyright 2002 - 2005 The Free Software Foundation
6 * Author: Jaka Mocnik <jaka@gnu.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <glib/gi18n.h>
26 #include <libgnomevfs/gnome-vfs-utils.h>
30 GtkGSPaperSize ggv_paper_sizes[] = {
32 {N_("Letter"), 612, 792,},
33 {N_("Tabloid"), 792, 1224,},
34 {N_("Ledger"), 1224, 792,},
35 {N_("Legal"), 612, 1008,},
36 {N_("Statement"), 396, 612,},
37 {N_("Executive"), 540, 720,},
38 {N_("A0"), 2380, 3368,},
39 {N_("A1"), 1684, 2380,},
40 {N_("A2"), 1190, 1684,},
41 {N_("A3"), 842, 1190,},
42 {N_("A4"), 595, 842,},
43 {N_("A5"), 420, 595,},
44 {N_("B4"), 729, 1032,},
45 {N_("B5"), 516, 729,},
46 {N_("Folio"), 612, 936,},
47 {N_("Quarto"), 610, 780,},
48 {N_("10x14"), 720, 1008,},
52 const gchar *ggv_orientation_labels[] = {
60 gfloat ggv_zoom_levels[] = {
61 1.0 / 6.0, 1.0 / 5.0, 1.0 / 4.0, 1.0 / 3.0, 1.0 / 2.0, 3.0 / 4.0, 1.0,
62 3.0 / 2.0, 2.0, 3.0, 4.0, 5.0, 6.0
65 const gchar *ggv_zoom_level_names[] = {
66 "1:6", "1:5", "1:4", "1:3",
67 "1:2", "3:4", "1:1", "3:2",
68 "2:1", "3:1", "4:1", "5:1",
72 const gint ggv_max_zoom_levels = (sizeof(ggv_zoom_levels) / sizeof(gfloat)) - 1;
74 /* If file exists and is a regular file then return its length, else -1 */
76 ggv_file_length(const gchar * filename)
80 if(filename && (stat(filename, &stat_rec) == 0)
81 && S_ISREG(stat_rec.st_mode))
82 return stat_rec.st_size;
87 /* Test if file exists, is a regular file and its length is > 0 */
89 ggv_file_readable(const char *filename)
91 return (ggv_file_length(filename) > 0);