3 * Copyright (C) 2003-2010 Jim Evins <evins@snaught.com>.
5 * This file is part of libglabels.
7 * libglabels is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * libglabels 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 Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with libglabels. If not, see <http://www.gnu.org/licenses/>.
23 #include "lgl-paper.h"
25 #include <glib/gi18n.h>
29 #include "libglabels-private.h"
31 /*===========================================*/
33 /*===========================================*/
36 /*===========================================*/
38 /*===========================================*/
41 /*===========================================*/
42 /* Local function prototypes */
43 /*===========================================*/
46 /*===========================================*/
48 /*===========================================*/
52 * @id: Id of paper definition. (E.g. US-Letter, A4, etc.) Should be
54 * @name: Localized name of paper.
55 * @width: Width of paper in points.
56 * @height: Height of paper in points.
57 * @pwg_size: PWG 5101.1-2002 size name.
59 * Allocates and constructs a new #lglPaper structure.
61 * Returns: a pointer to a newly allocated #lglPaper structure.
65 lgl_paper_new (gchar *id,
73 paper = g_new0 (lglPaper,1);
75 paper->id = g_strdup (id);
76 paper->name = g_strdup (name);
78 paper->height = height;
79 paper->pwg_size = g_strdup (pwg_size);
87 * @orig: #lglPaper structure to be duplicated.
89 * Duplicates an existing #lglPaper structure.
91 * Returns: a pointer to a newly allocated #lglPaper structure.
94 lglPaper *lgl_paper_dup (const lglPaper *orig)
98 g_return_val_if_fail (orig, NULL);
100 paper = g_new0 (lglPaper,1);
102 paper->id = g_strdup (orig->id);
103 paper->name = g_strdup (orig->name);
104 paper->width = orig->width;
105 paper->height = orig->height;
106 paper->pwg_size = g_strdup (orig->pwg_size);
114 * @paper: pointer to #lglPaper structure to be freed.
116 * Free all memory associated with an existing #lglPaper structure.
119 void lgl_paper_free (lglPaper *paper)
127 g_free (paper->name);
130 g_free (paper->pwg_size);
131 paper->pwg_size = NULL;
141 * Local Variables: -- emacs
143 * c-basic-offset: 8 -- emacs
144 * tab-width: 8 -- emacs
145 * indent-tabs-mode: nil -- emacs