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-client-context.h next >
Encoding:
C/C++ Source or Header  |  2007-04-09  |  3.4 KB  |  87 lines

  1. /* gdict-server-context.h - Implementation of a dictionary protocol client context
  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_CLIENT_CONTEXT_H__
  21. #define __GDICT_CLIENT_CONTEXT_H__
  22.  
  23. #include <glib-object.h>
  24.  
  25. #define GDICT_TYPE_CLIENT_CONTEXT        (gdict_client_context_get_type ())
  26. #define GDICT_CLIENT_CONTEXT(obj)        (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDICT_TYPE_CLIENT_CONTEXT, GdictClientContext))
  27. #define GDICT_IS_CLIENT_CONTEXT(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDICT_TYPE_CLIENT_CONTEXT))
  28. #define GDICT_CLIENT_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GDICT_TYPE_CLIENT_CONTEXT, GdictClientContextClass))
  29. #define GDICT_CLIENT_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GDICT_TYPE_CLIENT_CONTEXT, GdictClientContextClass))
  30.  
  31. typedef struct _GdictClientContext        GdictClientContext;
  32. typedef struct _GdictClientContextClass   GdictClientContextClass;
  33. typedef struct _GdictClientContextPrivate GdictClientContextPrivate;
  34.  
  35. #define GDICT_CLIENT_CONTEXT_ERROR    (gdict_client_context_error_quark ())
  36.  
  37. typedef enum {
  38.   GDICT_CLIENT_CONTEXT_ERROR_SOCKET,
  39.   GDICT_CLIENT_CONTEXT_ERROR_LOOKUP,
  40.   GDICT_CLIENT_CONTEXT_ERROR_NO_CONNECTION,
  41.   GDICT_CLIENT_CONTEXT_ERROR_SERVER_DOWN
  42. } GdictClientContextError;
  43.  
  44. GQuark gdict_client_context_error_quark (void);
  45.  
  46. struct _GdictClientContext
  47. {
  48.   /*< private >*/
  49.   GObject parent_instance;
  50.   
  51.   GdictClientContextPrivate *priv;
  52. };
  53.  
  54. struct _GdictClientContextClass
  55. {
  56.   GObjectClass parent_class;
  57.   
  58.   /* signals monitoring the lifetime of the connection with
  59.    * the dictionary server
  60.    */
  61.   void (*connected)    (GdictClientContext *context);
  62.   void (*disconnected) (GdictClientContext *context);
  63.   
  64.   /* padding for future expansion */
  65.   void (*_gdict_client_1) (void);
  66.   void (*_gdict_client_2) (void);
  67.   void (*_gdict_client_3) (void);
  68.   void (*_gdict_client_4) (void);
  69. };
  70.  
  71. GType                 gdict_client_context_get_type     (void) G_GNUC_CONST;
  72.  
  73. GdictContext *        gdict_client_context_new          (const gchar        *hostname,
  74.                              gint                port);
  75.  
  76. void                  gdict_client_context_set_hostname (GdictClientContext *context,
  77.                                  const gchar        *hostname);
  78. G_CONST_RETURN gchar *gdict_client_context_get_hostname (GdictClientContext *context);
  79. void                  gdict_client_context_set_port     (GdictClientContext *context,
  80.                              gint                port);
  81. guint                 gdict_client_context_get_port     (GdictClientContext *context);
  82. void                  gdict_client_context_set_client   (GdictClientContext *context,
  83.                              const gchar        *client);
  84. G_CONST_RETURN gchar *gdict_client_context_get_client   (GdictClientContext *context);
  85.  
  86. #endif /* __GDICT_CLIENT_CONTEXT_H__ */
  87.