gdm-display.h 8.96 KB
Newer Older
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
 *
 * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 */


#ifndef __GDM_DISPLAY_H
#define __GDM_DISPLAY_H

#include <glib-object.h>
26
#include <gio/gio.h>
27 28 29 30 31 32 33 34 35 36 37 38 39

G_BEGIN_DECLS

#define GDM_TYPE_DISPLAY         (gdm_display_get_type ())
#define GDM_DISPLAY(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GDM_TYPE_DISPLAY, GdmDisplay))
#define GDM_DISPLAY_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), GDM_TYPE_DISPLAY, GdmDisplayClass))
#define GDM_IS_DISPLAY(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDM_TYPE_DISPLAY))
#define GDM_IS_DISPLAY_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GDM_TYPE_DISPLAY))
#define GDM_DISPLAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDM_TYPE_DISPLAY, GdmDisplayClass))

typedef struct GdmDisplayPrivate GdmDisplayPrivate;

typedef enum {
40
        GDM_DISPLAY_UNMANAGED = 0,
41
        GDM_DISPLAY_PREPARED,
42
        GDM_DISPLAY_MANAGED,
43 44
        GDM_DISPLAY_FINISHED,
        GDM_DISPLAY_FAILED,
45 46 47 48
} GdmDisplayStatus;

typedef struct
{
49
        GObject            parent;
50
        GdmDisplayPrivate *priv;
51 52 53 54
} GdmDisplay;

typedef struct
{
55 56 57 58 59 60 61 62 63 64 65
        GObjectClass   parent_class;

        /* methods */
        gboolean (*create_authority)          (GdmDisplay *display);
        gboolean (*add_user_authorization)    (GdmDisplay *display,
                                               const char *username,
                                               char      **filename,
                                               GError    **error);
        gboolean (*remove_user_authorization) (GdmDisplay *display,
                                               const char *username,
                                               GError    **error);
66 67 68
        gboolean (*set_slave_bus_name)        (GdmDisplay *display,
                                               const char *name,
                                               GError    **error);
69
        gboolean (*prepare)                   (GdmDisplay *display);
70 71 72
        gboolean (*manage)                    (GdmDisplay *display);
        gboolean (*finish)                    (GdmDisplay *display);
        gboolean (*unmanage)                  (GdmDisplay *display);
73 74 75 76
        void     (*get_timed_login_details)   (GdmDisplay *display,
                                               gboolean   *enabled,
                                               char      **username,
                                               int        *delay);
77 78 79 80
} GdmDisplayClass;

typedef enum
{
81
         GDM_DISPLAY_ERROR_GENERAL,
82 83
         GDM_DISPLAY_ERROR_GETTING_USER_INFO,
         GDM_DISPLAY_ERROR_GETTING_SESSION_INFO,
84 85 86 87
} GdmDisplayError;

#define GDM_DISPLAY_ERROR gdm_display_error_quark ()

88 89
GQuark              gdm_display_error_quark                    (void);
GType               gdm_display_get_type                       (void);
90 91 92

int                 gdm_display_get_status                     (GdmDisplay *display);
time_t              gdm_display_get_creation_time              (GdmDisplay *display);
93
char *              gdm_display_open_session_sync              (GdmDisplay    *display,
94 95
                                                                GPid           pid_of_caller,
                                                                uid_t          uid_of_caller,
96 97
                                                                GCancellable  *cancellable,
                                                                GError       **error);
98 99 100 101 102 103 104

char *              gdm_display_open_reauthentication_channel_sync        (GdmDisplay    *display,
                                                                           const char    *username,
                                                                           GPid           pid_of_caller,
                                                                           uid_t          uid_of_caller,
                                                                           GCancellable  *cancellable,
                                                                           GError       **error);
105
char *              gdm_display_get_session_id                 (GdmDisplay *display);
106
gboolean            gdm_display_create_authority               (GdmDisplay *display);
107
gboolean            gdm_display_prepare                        (GdmDisplay *display);
108
gboolean            gdm_display_manage                         (GdmDisplay *display);
109
gboolean            gdm_display_finish                         (GdmDisplay *display);
110 111
gboolean            gdm_display_unmanage                       (GdmDisplay *display);

112 113
GDBusConnection    *gdm_display_get_bus_connection             (GdmDisplay *display);
GDBusObjectSkeleton *gdm_display_get_object_skeleton           (GdmDisplay *display);
114 115 116

/* exported to bus */
gboolean            gdm_display_get_id                         (GdmDisplay *display,
117 118
                                                                char      **id,
                                                                GError    **error);
119
gboolean            gdm_display_get_remote_hostname            (GdmDisplay *display,
120 121
                                                                char      **hostname,
                                                                GError    **error);
122
gboolean            gdm_display_get_x11_display_number         (GdmDisplay *display,
123 124
                                                                int        *number,
                                                                GError    **error);
125
gboolean            gdm_display_get_x11_display_name           (GdmDisplay *display,
126 127
                                                                char      **x11_display,
                                                                GError    **error);
128 129 130
gboolean            gdm_display_get_seat_id                    (GdmDisplay *display,
                                                                char      **seat_id,
                                                                GError    **error);
131
gboolean            gdm_display_is_local                       (GdmDisplay *display,
132 133
                                                                gboolean   *local,
                                                                GError    **error);
134 135 136 137 138
gboolean            gdm_display_get_timed_login_details        (GdmDisplay *display,
                                                                gboolean   *enabled,
                                                                char      **username,
                                                                int        *delay,
                                                                GError    **error);
139 140 141
gboolean            gdm_display_is_initial                     (GdmDisplay  *display,
                                                                gboolean    *initial,
                                                                GError     **error);
142

143 144
/* exported but protected */
gboolean            gdm_display_get_x11_cookie                 (GdmDisplay *display,
145
                                                                GArray     **x11_cookie,
146
                                                                GError    **error);
147
gboolean            gdm_display_get_x11_authority_file         (GdmDisplay *display,
148 149
                                                                char      **filename,
                                                                GError    **error);
150
gboolean            gdm_display_add_user_authorization         (GdmDisplay *display,
151 152 153
                                                                const char *username,
                                                                char      **filename,
                                                                GError    **error);
154
gboolean            gdm_display_remove_user_authorization      (GdmDisplay *display,
155 156
                                                                const char *username,
                                                                GError    **error);
157 158 159
gboolean            gdm_display_set_slave_bus_name             (GdmDisplay *display,
                                                                const char *name,
                                                                GError    **error);
160

161 162 163
G_END_DECLS

#endif /* __GDM_DISPLAY_H */