[gnio] Use real enum GType for socket type property



commit 2db479073d9e589e759e72f7d362fe7c780bf8db
Author: Alexander Larsson <alexl redhat com>
Date:   Fri May 15 10:24:16 2009 +0200

    Use real enum GType for socket type property
---
 gio/gsocketclient.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c
index 4d1fabb..2ee1fea 100644
--- a/gio/gsocketclient.c
+++ b/gio/gsocketclient.c
@@ -142,7 +142,7 @@ g_socket_client_get_property (GObject    *object,
         break;
 
       case PROP_TYPE:
-        g_value_set_int (value, client->priv->type);
+        g_value_set_enum (value, client->priv->type);
         break;
 
       case PROP_PROTOCOL:
@@ -173,7 +173,7 @@ g_socket_client_set_property (GObject      *object,
         break;
 
       case PROP_TYPE:
-        client->priv->type = g_value_get_int (value);
+        client->priv->type = g_value_get_enum (value);
         break;
 
       case PROP_PROTOCOL:
@@ -208,18 +208,13 @@ g_socket_client_class_init (GSocketClientClass *class)
                                                       G_SOCKET_FAMILY_INVALID,
                                                       G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
-  /* TODO: Make real enum gtype for GSocketType */
   g_object_class_install_property (gobject_class, PROP_TYPE,
-                                   g_param_spec_int ("type",
-						     P_("Socket type"),
-						     P_("The sockets type to use for socket construction"),
-#if 1 /* not enum */
-						     0, G_MAXINT,
-#else
-						     //G_TYPE_SOCKET_TYPE,
-#endif
-						     G_SOCKET_TYPE_STREAM,
-						     G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+                                   g_param_spec_enum ("type",
+						      P_("Socket type"),
+						      P_("The sockets type to use for socket construction"),
+						      G_TYPE_SOCKET_TYPE,
+						      G_SOCKET_TYPE_STREAM,
+						      G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (gobject_class, PROP_PROTOCOL,
                                    g_param_spec_string ("protocol",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]