2 * ggvutils.h: 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
23 #ifndef __GGV_UTILS_H__
24 #define __GGV_UTILS_H__
31 #define GGV_CLEAR_ALL "ggv-clear-all"
32 #define GGV_TOGGLE_ALL "ggv-toggle-all"
33 #define GGV_TOGGLE_EVEN "ggv-toggle-even"
34 #define GGV_TOGGLE_ODD "ggv-toggle-odd"
35 #define GGV_FIT_WIDTH "ggv-fit-width"
36 #define GGV_ZOOM "ggv-zoom"
38 extern GtkGSPaperSize ggv_paper_sizes[];
39 extern const gchar *ggv_orientation_labels[];
40 extern const gint ggv_max_orientation_labels;
41 extern const gfloat ggv_unit_factors[];
42 extern const gchar *ggv_unit_labels[];
43 extern const gint ggv_max_unit_labels;
44 extern gfloat ggv_zoom_levels[];
45 extern const gchar *ggv_zoom_level_names[];
46 extern const gint ggv_max_zoom_levels;
47 extern const gchar *ggv_auto_fit_modes[];
48 extern const gint ggv_max_auto_fit_modes;
50 /* zoom level index <-> zoom factor */
51 gint ggv_zoom_index_from_float(gfloat zoom_level);
52 gfloat ggv_zoom_level_from_index(gint index);
54 /* Split delimited string into a list of strings. */
55 GSList *ggv_split_string(const gchar * string, const gchar * delimiter);
57 /* Get index of a string from a list of them. */
58 gint ggv_get_index_of_string(gchar * string, gchar ** strings);
60 /* Quote filename for system call */
61 gchar *ggv_quote_filename(const gchar * str);
63 /* escape filename to conform to URI specification */
64 gchar *ggv_filename_to_uri(const gchar * fname);
66 /* If file exists and is a regular file then return its length, else -1 */
67 gint ggv_file_length(const gchar * filename);
69 /* Test if file exists, is a regular file and its length is > 0 */
70 gboolean ggv_file_readable(const char *filename);
72 /* Set a tooltip for a widget */
73 void ggv_set_tooltip(GtkWidget * w, const gchar * tip);
75 /* zoom <-> magstep (currently not used...) */
76 gfloat ggv_compute_zoom(gint zoom_spec);
77 gint ggv_compute_spec(gfloat zoom);
79 void ggv_raise_and_focus_widget(GtkWidget * widget);
81 void ggv_get_window_size(GtkWidget * widget, gint * width, gint * height);
83 void ggv_init_stock_icons(void);
85 #endif /* __GGV_UTILS_H__ */