1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
4 * (GLABELS) Label and Business Card Creation program for GNOME
6 * prefs.c: Application preferences module
8 * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include <glib/gi18n.h>
32 glPrefsModel *gl_prefs = NULL;
34 /*========================================================*/
35 /* Private macros and constants. */
36 /*========================================================*/
39 /*========================================================*/
41 /*========================================================*/
44 /*========================================================*/
45 /* Private globals. */
46 /*========================================================*/
49 /*========================================================*/
50 /* Private function prototypes. */
51 /*========================================================*/
55 /*****************************************************************************/
56 /* Initialize preferences module. */
57 /*****************************************************************************/
61 gl_debug (DEBUG_PREFS, "START");
63 gl_prefs = gl_prefs_model_new ();
65 gl_prefs_model_load_settings (gl_prefs);
67 gl_debug (DEBUG_PREFS, "END");
71 /****************************************************************************/
72 /* Get string representing desired units. */
73 /****************************************************************************/
75 gl_prefs_get_page_size (void)
77 return (gl_prefs->default_page_size);
80 /****************************************************************************/
81 /* Get desired units. */
82 /****************************************************************************/
84 gl_prefs_get_units (void)
86 return gl_prefs->units;
89 /****************************************************************************/
90 /* Get desired units per point. */
91 /****************************************************************************/
93 gl_prefs_get_units_per_point (void)
96 switch (gl_prefs->units) {
98 return 1.0; /* points */
100 return 1.0 / 72.0; /* inches */
102 return 0.35277778; /* mm */
104 g_message ("Illegal units"); /* Should not happen */
109 /****************************************************************************/
110 /* Get precision for desired units. */
111 /****************************************************************************/
113 gl_prefs_get_units_precision (void)
116 switch (gl_prefs->units) {
118 return 1; /* points */
120 return 3; /* inches */
124 g_message ("Illegal units"); /* Should not happen */
129 /****************************************************************************/
130 /* Get step size for desired units. */
131 /****************************************************************************/
133 gl_prefs_get_units_step_size (void)
136 switch (gl_prefs->units) {
138 return 0.1; /* points */
140 return 0.001; /* inches */
144 g_message ("Illegal units"); /* Should not happen */
149 /****************************************************************************/
150 /* Get string representing desired units. */
151 /****************************************************************************/
153 gl_prefs_get_units_string (void)
156 switch (gl_prefs->units) {
164 g_message ("Illegal units"); /* Should not happen */