1 /* gdict-utils.h - Utility functions for Gdict
2  *
3  * Copyright (C) 2005  Emmanuele Bassi <ebassi@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef __GDICT_UTILS_H__
20 #define __GDICT_UTILS_H__
21 
22 #include <glib-object.h>
23 #include <gtk/gtk.h>
24 
25 G_BEGIN_DECLS
26 
27 #define GDICT_DEFAULT_DATABASE	"*"
28 #define GDICT_DEFAULT_STRATEGY	"."
29 
30 #define GDICT_DEFAULT_FONT_NAME "Sans 10"
31 
32 /* properties shared between GdictContext implementations */
33 typedef enum {
34   GDICT_CONTEXT_PROP_FIRST      = 0x1000,
35   GDICT_CONTEXT_PROP_LOCAL_ONLY = GDICT_CONTEXT_PROP_FIRST,
36   GDICT_CONTEXT_PROP_LAST
37 } GdictContextProp;
38 
39 /* Status codes as defined by RFC 2229 */
40 typedef enum {
41   GDICT_STATUS_INVALID                   = 0,
42 
43   GDICT_STATUS_N_DATABASES_PRESENT       = 110,
44   GDICT_STATUS_N_STRATEGIES_PRESENT      = 111,
45   GDICT_STATUS_DATABASE_INFO             = 112,
46   GDICT_STATUS_HELP_TEXT                 = 113,
47   GDICT_STATUS_SERVER_INFO               = 114,
48   GDICT_STATUS_CHALLENGE                 = 130,
49   GDICT_STATUS_N_DEFINITIONS_RETRIEVED   = 150,
50   GDICT_STATUS_WORD_DB_NAME              = 151,
51   GDICT_STATUS_N_MATCHES_FOUND           = 152,
52   GDICT_STATUS_CONNECT                   = 220,
53   GDICT_STATUS_QUIT                      = 221,
54   GDICT_STATUS_AUTH_OK                   = 230,
55   GDICT_STATUS_OK                        = 250,
56   GDICT_STATUS_SEND_RESPONSE             = 330,
57   /* Connect response codes */
58   GDICT_STATUS_SERVER_DOWN               = 420,
59   GDICT_STATUS_SHUTDOWN                  = 421,
60   /* Error codes */
61   GDICT_STATUS_BAD_COMMAND               = 500,
62   GDICT_STATUS_BAD_PARAMETERS            = 501,
63   GDICT_STATUS_COMMAND_NOT_IMPLEMENTED   = 502,
64   GDICT_STATUS_PARAMETER_NOT_IMPLEMENTED = 503,
65   GDICT_STATUS_NO_ACCESS                 = 530,
66   GDICT_STATUS_USE_SHOW_INFO             = 531,
67   GDICT_STATUS_UNKNOWN_MECHANISM         = 532,
68   GDICT_STATUS_BAD_DATABASE              = 550,
69   GDICT_STATUS_BAD_STRATEGY              = 551,
70   GDICT_STATUS_NO_MATCH                  = 552,
71   GDICT_STATUS_NO_DATABASES_PRESENT      = 554,
72   GDICT_STATUS_NO_STRATEGIES_PRESENT     = 555
73 } GdictStatusCode;
74 
75 #define GDICT_IS_VALID_STATUS_CODE(x)	(((x) > GDICT_STATUS_INVALID) && \
76                                          ((x) <= GDICT_STATUS_NO_STRATEGIES_PRESENT))
77 
78 GOptionGroup *gdict_get_option_group (void);
79 void          gdict_init             (gint    *argc,
80                                       gchar ***argv);
81 void          gdict_debug_init       (gint    *argc,
82                                       gchar ***argv);
83 
84 gboolean      gdict_check_version    (guint    major,
85                                       guint    minor,
86                                       guint    micro);
87 
88 G_END_DECLS
89 
90 #endif /* __GDICT_UTILS_H__ */
91