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/>.
36 LGL_DB_REG_BAD_PAPER_ID = -1,
37 LGL_DB_REG_BRAND_PART_EXISTS = -2,
38 LGL_DB_REG_FILE_WRITE_ERROR = -3
44 LGL_DB_DELETE_DOES_NOT_EXIST = -1,
45 LGL_DB_DELETE_NOT_USER_DEFINED = -2,
46 LGL_DB_DELETE_FILE_ERROR = -3
50 typedef void (*lglDbNotifyFunc) (gpointer user_data);
56 * Module initialization
58 void lgl_db_init (void);
65 gulong lgl_db_notify_add (lglDbNotifyFunc func,
68 void lgl_db_notify_remove (gulong id);
75 GList *lgl_db_get_paper_id_list (void);
77 void lgl_db_free_paper_id_list (GList *ids);
79 GList *lgl_db_get_paper_name_list (void);
81 void lgl_db_free_paper_name_list (GList *names);
83 lglPaper *lgl_db_lookup_paper_from_name (const gchar *name);
85 lglPaper *lgl_db_lookup_paper_from_id (const gchar *id);
87 gchar *lgl_db_lookup_paper_id_from_name (const gchar *name);
89 gchar *lgl_db_lookup_paper_name_from_id (const gchar *id);
91 gboolean lgl_db_is_paper_id_known (const gchar *id);
93 gboolean lgl_db_is_paper_id_other (const gchar *id);
100 GList *lgl_db_get_category_id_list (void);
102 void lgl_db_free_category_id_list (GList *ids);
104 GList *lgl_db_get_category_name_list (void);
106 void lgl_db_free_category_name_list (GList *names);
108 lglCategory *lgl_db_lookup_category_from_name (const gchar *name);
110 lglCategory *lgl_db_lookup_category_from_id (const gchar *id);
112 gchar *lgl_db_lookup_category_id_from_name (const gchar *name);
114 gchar *lgl_db_lookup_category_name_from_id (const gchar *id);
116 gboolean lgl_db_is_category_id_known (const gchar *id);
122 GList *lgl_db_get_vendor_name_list (void);
124 void lgl_db_free_vendor_name_list (GList *names);
126 lglVendor *lgl_db_lookup_vendor_from_name (const gchar *name);
128 gboolean lgl_db_is_vendor_name_known (const gchar *name);
134 GList *lgl_db_get_brand_list (const gchar *paper_id,
135 const gchar *category_id);
137 void lgl_db_free_brand_list (GList *brands);
143 lglDbRegStatus lgl_db_register_template (const lglTemplate *template);
145 lglDbDeleteStatus lgl_db_delete_template_by_name (const gchar *name);
147 gboolean lgl_db_does_template_exist (const gchar *brand,
150 gboolean lgl_db_does_template_name_exist (const gchar *name);
152 GList *lgl_db_get_template_name_list_unique (const gchar *brand,
153 const gchar *paper_id,
154 const gchar *category_id);
156 GList *lgl_db_get_template_name_list_all (const gchar *brand,
157 const gchar *paper_id,
158 const gchar *category_id);
160 GList *lgl_db_get_similar_template_name_list (const gchar *name);
162 void lgl_db_free_template_name_list (GList *names);
164 lglTemplate *lgl_db_lookup_template_from_name (const gchar *name);
166 lglTemplate *lgl_db_lookup_template_from_brand_part(const gchar *brand,
171 * Debugging functions
173 void lgl_db_print_known_papers (void);
175 void lgl_db_print_known_categories (void);
177 void lgl_db_print_known_templates (void);
179 void lgl_db_print_aliases (const lglTemplate *template);
181 void lgl_db_print_known_vendors (void);
187 #endif /* __LGL_DB_H__ */
192 * Local Variables: -- emacs
194 * c-basic-offset: 8 -- emacs
195 * tab-width: 8 -- emacs
196 * indent-tabs-mode: nil -- emacs