Back to index

lightdm  1.3.2
xdmcp-session.c
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2010-2011 Robert Ancell.
00003  * Author: Robert Ancell <robert.ancell@canonical.com>
00004  * 
00005  * This program is free software: you can redistribute it and/or modify it under
00006  * the terms of the GNU General Public License as published by the Free Software
00007  * Foundation, either version 3 of the License, or (at your option) any later
00008  * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
00009  * license.
00010  */
00011 
00012 #include "xdmcp-session.h"
00013 #include "xdmcp-session-private.h"
00014 
00015 G_DEFINE_TYPE (XDMCPSession, xdmcp_session, G_TYPE_OBJECT);
00016 
00017 XDMCPSession *
00018 xdmcp_session_new (guint16 id)
00019 {
00020     XDMCPSession *self = g_object_new (XDMCP_SESSION_TYPE, NULL);
00021 
00022     self->priv->id = id;
00023 
00024     return self;
00025 }
00026 
00027 guint16
00028 xdmcp_session_get_id (XDMCPSession *session)
00029 {
00030     g_return_val_if_fail (session != NULL, 0);
00031     return session->priv->id;
00032 }
00033 
00034 const gchar *
00035 xdmcp_session_get_manufacturer_display_id (XDMCPSession *session)
00036 {
00037     g_return_val_if_fail (session != NULL, NULL);
00038     return session->priv->manufacturer_display_id;
00039 }
00040 
00041 GInetAddress *
00042 xdmcp_session_get_address (XDMCPSession *session)
00043 {
00044     g_return_val_if_fail (session != NULL, NULL);
00045     return session->priv->address;
00046 }
00047 
00048 XAuthority *
00049 xdmcp_session_get_authority (XDMCPSession *session)
00050 {
00051     g_return_val_if_fail (session != NULL, NULL);
00052     return session->priv->authority;
00053 }
00054 
00055 guint16
00056 xdmcp_session_get_display_number (XDMCPSession *session)
00057 {
00058     g_return_val_if_fail (session != NULL, 0);
00059     return session->priv->display_number;
00060 }
00061 
00062 const gchar *
00063 xdmcp_session_get_display_class (XDMCPSession *session)
00064 {
00065     g_return_val_if_fail (session != NULL, NULL);
00066     return session->priv->display_class;
00067 }
00068 
00069 static void
00070 xdmcp_session_init (XDMCPSession *session)
00071 {
00072     session->priv = G_TYPE_INSTANCE_GET_PRIVATE (session, XDMCP_SESSION_TYPE, XDMCPSessionPrivate);
00073     session->priv->manufacturer_display_id = g_strdup ("");
00074     session->priv->display_class = g_strdup ("");
00075 }
00076 
00077 static void
00078 xdmcp_session_finalize (GObject *object)
00079 {
00080     XDMCPSession *self;
00081 
00082     self = XDMCP_SESSION (object);
00083   
00084     g_free (self->priv->manufacturer_display_id);
00085     if (self->priv->address)
00086         g_object_unref (self->priv->address);
00087     if (self->priv->authority)
00088         g_object_unref (self->priv->authority);
00089     g_free (self->priv->display_class);
00090 
00091     G_OBJECT_CLASS (xdmcp_session_parent_class)->finalize (object);
00092 }
00093 
00094 static void
00095 xdmcp_session_class_init (XDMCPSessionClass *klass)
00096 {
00097     GObjectClass *object_class = G_OBJECT_CLASS (klass);
00098 
00099     object_class->finalize = xdmcp_session_finalize;  
00100 
00101     g_type_class_add_private (klass, sizeof (XDMCPSessionPrivate));
00102 }