GfConnection

GfConnection — GfConnection Object API

Synopsis




            GfConnection;
enum        GfConnectionState;
void        gf_connection_set_state         (GfConnection *connection,
                                             GfConnectionState state);
GfConnectionState gf_connection_get_state   (GfConnection *connection);
gboolean    gf_connection_disconnect        (GfConnection *connection,
                                             GError **error);
gboolean    gf_connection_is_connected      (const GfConnection *connection);
GfFeedPool* gf_connection_get_feed_pool     (const GfConnection *connection);
void        gf_connection_set_feed_pool     (GfConnection *connection,
                                             GfFeedPool *feed_pool);
GfPreferenceEngine* gf_connection_get_preference_engine
                                            (const GfConnection *connection);
void        gf_connection_set_preference_engine
                                            (GfConnection *connection,
                                             GfPreferenceEngine *engine);
#define     gf_connection_state_from_string (str)
#define     gf_connection_state_to_string   (state, i18n)
#define     GF_CONNECTION_IS_CONNECTED      (obj)

Object Hierarchy


  GObject
   +----GfObject
         +----GfNamedObject
               +----GfConnection
                     +----GfClientConnection
                     +----GfServerConnection

Properties


  "feed-pool"            GfFeedPool            : Read / Write / Construct
  "pref-engine"          GfPreferenceEngine    : Read / Write / Construct
  "state"                gint                  : Read / Write

Signal Prototypes


"connected" void        user_function      (GfConnection *gfconnection,
                                            gpointer user_data);
"connecting"
            void        user_function      (GfConnection *gfconnection,
                                            gpointer user_data);
"disconnected"
            void        user_function      (GfConnection *gfconnection,
                                            gpointer user_data);
"disconnecting"
            void        user_function      (GfConnection *gfconnection,
                                            gpointer user_data);
"feed-pool-set"
            void        user_function      (GfConnection *gfconnection,
                                            GfFeedPool *arg1,
                                            gpointer user_data);
"preference-engine-set"
            void        user_function      (GfConnection *gfconnection,
                                            GfFeedPool *arg1,
                                            gpointer user_data);

Description

GfConnection is the base class for all connections.

Details

GfConnection

typedef struct _GfConnection GfConnection;

GfConnection is an opaque structure that should not be used directly.


enum GfConnectionState

typedef enum _GfConnectionState {
	GF_CONNECTION_STATE_UNKNOWN = -1,
	GF_CONNECTION_STATE_DISCONNECTING = 0,
	GF_CONNECTION_STATE_DISCONNECTED,
	GF_CONNECTION_STATE_CONNECTING,
	GF_CONNECTION_STATE_CONNECTED,
	GF_CONNECTION_STATES
} GfConnectionState;

Valid connection states

GF_CONNECTION_STATE_UNKNOWN Unknown
GF_CONNECTION_STATE_DISCONNECTING Disconnecting
GF_CONNECTION_STATE_DISCONNECTED Disconnected
GF_CONNECTION_STATE_CONNECTING Connecting
GF_CONNECTION_STATE_CONNECTED Connected
GF_CONNECTION_STATES Total States

gf_connection_set_state ()

void        gf_connection_set_state         (GfConnection *connection,
                                             GfConnectionState state);

Note: This should _ONLY_ be used in connection implementations!

Sets the GfConnectionState for connection.

connection : The GfConnection instance.
state : The new GfConnectionState.

gf_connection_get_state ()

GfConnectionState gf_connection_get_state   (GfConnection *connection);

Gets the GfConnectionState for connection.

connection : The GfConnection instance.
Returns : The GfConnectionState for connection.

gf_connection_disconnect ()

gboolean    gf_connection_disconnect        (GfConnection *connection,
                                             GError **error);

Tries to disconnect connection.

connection : The GfConnection instance.
error : The return address for an error, if any.
Returns : TRUE if disconnecting was successful.

gf_connection_is_connected ()

gboolean    gf_connection_is_connected      (const GfConnection *connection);

Checks whether connection is connected or connecting.

connection : The GfConnection instance.
Returns : TRUE if connection is connected or connecting.

gf_connection_get_feed_pool ()

GfFeedPool* gf_connection_get_feed_pool     (const GfConnection *connection);

Gets the GfFeedPool for connection.

connection : The GfConnection instance.
Returns : The GfFeedPool for connection.

gf_connection_set_feed_pool ()

void        gf_connection_set_feed_pool     (GfConnection *connection,
                                             GfFeedPool *feed_pool);

Sets the GfFeedPool for connection.

Note: This should _ONLY_ be used by connection implementations.

connection : The GfConnection instance.
feed_pool : The GfFeedPool instance.

gf_connection_get_preference_engine ()

GfPreferenceEngine* gf_connection_get_preference_engine
                                            (const GfConnection *connection);

Gets the GfPreferenceEngine for connection.

connection : The GfConnection instance.
Returns : The GfPreferenceEngine for connection.

gf_connection_set_preference_engine ()

void        gf_connection_set_preference_engine
                                            (GfConnection *connection,
                                             GfPreferenceEngine *engine);

Sets the GfPreferenceEngine for connection.

Note: This should _ONLY_ be used by connection implementations.

connection : The GfConnection instance.
engine : The GfPreferenceEngine instance.

gf_connection_state_from_string()

#define     gf_connection_state_from_string(str)

Gets a GfConnectionState from a string.

Note: str MUST be the unstranslated string!

str : The string.
Returns : The GfConnectionState.

gf_connection_state_to_string()

#define     gf_connection_state_to_string(state, i18n)

Gets a string from a GfConnectionState.

state : The GfConnectionState.
i18n : TRUE for the translated version.
Returns : state as a string.

GF_CONNECTION_IS_CONNECTED()

#define GF_CONNECTION_IS_CONNECTED(obj)	(gf_connection_get_state((obj)) == GF_CONNECTION_STATE_CONNECTED)

Checks to see if a connection is connected.

obj : The connection.
Returns : TRUE if obj is connected.

Properties

The "feed-pool" property

  "feed-pool"            GfFeedPool            : Read / Write / Construct

The feed pool for this connection.


The "pref-engine" property

  "pref-engine"          GfPreferenceEngine    : Read / Write / Construct

The preference engine for the connection.


The "state" property

  "state"                gint                  : Read / Write

The state that the connection is in.

Allowed values: [-1,3]

Default value: -1

Signals

The "connected" signal

void        user_function                  (GfConnection *gfconnection,
                                            gpointer user_data);

gfconnection : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "connecting" signal

void        user_function                  (GfConnection *gfconnection,
                                            gpointer user_data);

gfconnection : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "disconnected" signal

void        user_function                  (GfConnection *gfconnection,
                                            gpointer user_data);

gfconnection : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "disconnecting" signal

void        user_function                  (GfConnection *gfconnection,
                                            gpointer user_data);

gfconnection : the object which received the signal.
user_data : user data set when the signal handler was connected.

The "feed-pool-set" signal

void        user_function                  (GfConnection *gfconnection,
                                            GfFeedPool *arg1,
                                            gpointer user_data);

gfconnection : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.

The "preference-engine-set" signal

void        user_function                  (GfConnection *gfconnection,
                                            GfFeedPool *arg1,
                                            gpointer user_data);

gfconnection : the object which received the signal.
arg1 :
user_data : user data set when the signal handler was connected.