From 43f86291262aeb29d81532bd6d11d91d152e5f36 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Mon, 29 Apr 2013 18:09:31 +0100 Subject: Hide IdleServerConnectionState --- src/idle-server-connection.c | 11 +++++++++-- src/idle-server-connection.h | 8 +------- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/idle-server-connection.c b/src/idle-server-connection.c index 82fffdf..f1c7ce1 100644 --- a/src/idle-server-connection.c +++ b/src/idle-server-connection.c @@ -52,6 +52,12 @@ enum { PROP_TLS_MANAGER }; +typedef enum { + SERVER_CONNECTION_STATE_NOT_CONNECTED, + SERVER_CONNECTION_STATE_CONNECTING, + SERVER_CONNECTION_STATE_CONNECTED +} IdleServerConnectionState; + struct _IdleServerConnectionPrivate { gchar *host; guint16 port; @@ -599,9 +605,10 @@ gboolean idle_server_connection_send_finish(IdleServerConnection *conn, GAsyncRe return !g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT(result), error); } -IdleServerConnectionState idle_server_connection_get_state(IdleServerConnection *conn) { +gboolean idle_server_connection_is_connected(IdleServerConnection *conn) { IdleServerConnectionPrivate *priv = IDLE_SERVER_CONNECTION_GET_PRIVATE(conn); - return priv->state; + + return priv->state == SERVER_CONNECTION_STATE_CONNECTED; } void idle_server_connection_set_tls(IdleServerConnection *conn, gboolean tls) { diff --git a/src/idle-server-connection.h b/src/idle-server-connection.h index 8ce36ca..1b595b7 100644 --- a/src/idle-server-connection.h +++ b/src/idle-server-connection.h @@ -30,12 +30,6 @@ G_BEGIN_DECLS typedef struct _IdleServerConnection IdleServerConnection; typedef struct _IdleServerConnectionClass IdleServerConnectionClass; -typedef enum { - SERVER_CONNECTION_STATE_NOT_CONNECTED, - SERVER_CONNECTION_STATE_CONNECTING, - SERVER_CONNECTION_STATE_CONNECTED -} IdleServerConnectionState; - typedef enum { SERVER_CONNECTION_STATE_REASON_ERROR, SERVER_CONNECTION_STATE_REASON_REQUESTED @@ -77,7 +71,7 @@ void idle_server_connection_force_disconnect(IdleServerConnection *conn); gboolean idle_server_connection_disconnect_finish(IdleServerConnection *conn, GAsyncResult *result, GError **error); void idle_server_connection_send_async(IdleServerConnection *conn, const gchar *cmd, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gboolean idle_server_connection_send_finish(IdleServerConnection *conn, GAsyncResult *result, GError **error); -IdleServerConnectionState idle_server_connection_get_state(IdleServerConnection *conn); +gboolean idle_server_connection_is_connected(IdleServerConnection *conn); void idle_server_connection_set_tls(IdleServerConnection *conn, gboolean tls); G_END_DECLS -- cgit v1.2.3