3 * Copyright (C) 2006-2009 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/>.
25 #include <glib/gi18n.h>
29 #include "libglabels-private.h"
32 /*===========================================*/
34 /*===========================================*/
37 /*===========================================*/
39 /*===========================================*/
42 /*===========================================*/
43 /* Local function prototypes */
44 /*===========================================*/
47 /*===========================================*/
49 /*===========================================*/
53 * @id: Id of category definition. (E.g. label, card, etc.) Should be
55 * @name: Localized name of category.
57 * Allocates and constructs a new #lglCategory structure.
59 * Returns: a pointer to a newly allocated #lglCategory structure.
63 lgl_category_new (gchar *id,
66 lglCategory *category;
68 category = g_new0 (lglCategory,1);
69 category->id = g_strdup (id);
70 category->name = g_strdup (name);
78 * @orig: #lglCategory structure to be duplicated.
80 * Duplicates an existing #lglCategory structure.
82 * Returns: a pointer to a newly allocated #lglCategory structure.
85 lglCategory *lgl_category_dup (const lglCategory *orig)
87 lglCategory *category;
89 g_return_val_if_fail (orig, NULL);
91 category = g_new0 (lglCategory,1);
93 category->id = g_strdup (orig->id);
94 category->name = g_strdup (orig->name);
102 * @category: pointer to #lglCategory structure to be freed.
104 * Free all memory associated with an existing #lglCategory structure.
107 void lgl_category_free (lglCategory *category)
110 if ( category != NULL ) {
112 g_free (category->id);
115 g_free (category->name);
116 category->name = NULL;
126 * Local Variables: -- emacs
128 * c-basic-offset: 8 -- emacs
129 * tab-width: 8 -- emacs
130 * indent-tabs-mode: nil -- emacs