home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / include / gdict-1.0 / gdict / gdict-source.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-04-09  |  4.4 KB  |  116 lines

  1. /* gdict-source.h - Source configuration 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 Library General Public
  16.  * License along with this library; if not, write to the
  17.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18.  */
  19.  
  20. #ifndef __GDICT_SOURCE_H__
  21. #define __GDICT_SOURCE_H__
  22.  
  23. #include <stdarg.h>
  24. #include <glib-object.h>
  25. #include "gdict-context.h"
  26.  
  27. G_BEGIN_DECLS
  28.  
  29. #define GDICT_TYPE_SOURCE        (gdict_source_get_type ())
  30. #define GDICT_SOURCE(obj)        (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDICT_TYPE_SOURCE, GdictSource))
  31. #define GDICT_IS_SOURCE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDICT_TYPE_SOURCE))
  32. #define GDICT_SOURCE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_SOURCE, GdictSourceClass))
  33. #define GDICT_IS_SOURCE_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GDICT_TYPE_SOURCE))
  34. #define GDICT_SOURCE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_SOURCE, GdictSourceClass))
  35.  
  36.  
  37. typedef struct _GdictSource        GdictSource;
  38. typedef struct _GdictSourceClass   GdictSourceClass;
  39. typedef struct _GdictSourcePrivate GdictSourcePrivate;
  40.  
  41. typedef enum
  42. {
  43.   GDICT_SOURCE_TRANSPORT_DICTD,
  44.   
  45.   GDICT_SOURCE_TRANSPORT_INVALID /* only for debug */
  46. } GdictSourceTransport;
  47.  
  48. #define GDICT_SOURCE_ERROR    (gdict_source_error_quark ())
  49.  
  50. typedef enum
  51. {
  52.   GDICT_SOURCE_ERROR_PARSE,
  53.   GDICT_SOURCE_ERROR_INVALID_NAME,
  54.   GDICT_SOURCE_ERROR_INVALID_TRANSPORT,
  55.   GDICT_SOURCE_ERROR_INVALID_BAD_PARAMETER
  56. } GdictSourceError;
  57.  
  58. GQuark gdict_source_error_quark (void);
  59.  
  60. struct _GdictSource
  61. {
  62.   /*< private >*/
  63.   GObject parent_instance;
  64.   
  65.   GdictSourcePrivate *priv;
  66. };
  67.  
  68. struct _GdictSourceClass
  69. {
  70.   /*< private >*/
  71.   GObjectClass parent_class;
  72. };
  73.  
  74. GType gdict_source_get_type (void) G_GNUC_CONST;
  75.  
  76. GdictSource *         gdict_source_new             (void);
  77. gboolean              gdict_source_load_from_file  (GdictSource           *source,
  78.                             const gchar           *filename,
  79.                             GError               **error);
  80. gboolean              gdict_source_load_from_data  (GdictSource           *source,
  81.                             const gchar           *data,
  82.                             gsize                  length,
  83.                             GError               **error);
  84. gchar *               gdict_source_to_data         (GdictSource           *source,
  85.                             gsize                 *length,
  86.                             GError               **error) G_GNUC_MALLOC;
  87.                             
  88. void                  gdict_source_set_name        (GdictSource           *source,
  89.                             const gchar           *name);
  90. G_CONST_RETURN gchar *gdict_source_get_name        (GdictSource           *source);
  91. void                  gdict_source_set_description (GdictSource           *source,
  92.                             const gchar           *description);
  93. G_CONST_RETURN gchar *gdict_source_get_description (GdictSource           *source);
  94. void                  gdict_source_set_database    (GdictSource           *source,
  95.                             const gchar           *database);
  96. G_CONST_RETURN gchar *gdict_source_get_database    (GdictSource           *source);
  97. void                  gdict_source_set_strategy    (GdictSource           *source,
  98.                             const gchar           *strategy);
  99. G_CONST_RETURN gchar *gdict_source_get_strategy    (GdictSource           *source);
  100. void                  gdict_source_set_transport   (GdictSource           *source,
  101.                             GdictSourceTransport   transport,
  102.                             const gchar           *first_transport_property,
  103.                             ...);
  104. void                  gdict_source_set_transportv  (GdictSource           *source,
  105.                             GdictSourceTransport   transport,
  106.                             const gchar           *first_transport_property,
  107.                             va_list                var_args);
  108. GdictSourceTransport  gdict_source_get_transport   (GdictSource           *source);
  109.  
  110. GdictContext *        gdict_source_get_context     (GdictSource           *source);
  111. GdictContext *        gdict_source_peek_context    (GdictSource           *source);
  112.  
  113. G_END_DECLS
  114.  
  115. #endif /* __GDICT_SOURCE_H__ */
  116.