gdm-display.h 7.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
 *
 * 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
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 19 20 21 22 23 24 25
 *
 */


#ifndef __GDM_DISPLAY_H
#define __GDM_DISPLAY_H

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

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 {
41
        GDM_DISPLAY_UNMANAGED = 0,
42
        GDM_DISPLAY_PREPARED,
43
        GDM_DISPLAY_MANAGED,
44 45
        GDM_DISPLAY_FINISHED,
        GDM_DISPLAY_FAILED,
46 47 48 49
} GdmDisplayStatus;

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

typedef struct
{
56 57 58
        GObjectClass   parent_class;

        /* methods */
59
        gboolean (*prepare)                   (GdmDisplay *display);
60 61 62 63
} GdmDisplayClass;

typedef enum
{
64
         GDM_DISPLAY_ERROR_GENERAL,
65 66
         GDM_DISPLAY_ERROR_GETTING_USER_INFO,
         GDM_DISPLAY_ERROR_GETTING_SESSION_INFO,
67 68 69 70
} GdmDisplayError;

#define GDM_DISPLAY_ERROR gdm_display_error_quark ()

71 72
GQuark              gdm_display_error_quark                    (void);
GType               gdm_display_get_type                       (void);
73 74 75

int                 gdm_display_get_status                     (GdmDisplay *display);
time_t              gdm_display_get_creation_time              (GdmDisplay *display);
76
char *              gdm_display_open_session_sync              (GdmDisplay    *display,
77 78
                                                                GPid           pid_of_caller,
                                                                uid_t          uid_of_caller,
79 80
                                                                GCancellable  *cancellable,
                                                                GError       **error);
81 82 83 84 85 86 87

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);
88
const char *        gdm_display_get_session_id                 (GdmDisplay *display);
89
gboolean            gdm_display_create_authority               (GdmDisplay *display);
90
gboolean            gdm_display_prepare                        (GdmDisplay *display);
91
gboolean            gdm_display_manage                         (GdmDisplay *display);
92
gboolean            gdm_display_finish                         (GdmDisplay *display);
93 94
gboolean            gdm_display_unmanage                       (GdmDisplay *display);

95
GDBusObjectSkeleton *gdm_display_get_object_skeleton           (GdmDisplay *display);
96 97 98

/* exported to bus */
gboolean            gdm_display_get_id                         (GdmDisplay *display,
99 100
                                                                char      **id,
                                                                GError    **error);
101
gboolean            gdm_display_get_remote_hostname            (GdmDisplay *display,
102 103
                                                                char      **hostname,
                                                                GError    **error);
104
gboolean            gdm_display_get_x11_display_number         (GdmDisplay *display,
105 106
                                                                int        *number,
                                                                GError    **error);
107
gboolean            gdm_display_get_x11_display_name           (GdmDisplay *display,
108 109
                                                                char      **x11_display,
                                                                GError    **error);
110 111 112
gboolean            gdm_display_get_seat_id                    (GdmDisplay *display,
                                                                char      **seat_id,
                                                                GError    **error);
113
gboolean            gdm_display_is_local                       (GdmDisplay *display,
114 115
                                                                gboolean   *local,
                                                                GError    **error);
116
void                gdm_display_get_timed_login_details        (GdmDisplay *display,
117 118
                                                                gboolean   *enabled,
                                                                char      **username,
119
                                                                int        *delay);
120 121 122
gboolean            gdm_display_is_initial                     (GdmDisplay  *display,
                                                                gboolean    *initial,
                                                                GError     **error);
123

124 125 126 127
gboolean            gdm_display_get_x11_cookie                 (GdmDisplay  *display,
                                                                const char **x11_cookie,
                                                                gsize       *x11_cookie_size,
                                                                GError     **error);
128
gboolean            gdm_display_get_x11_authority_file         (GdmDisplay *display,
129 130
                                                                char      **filename,
                                                                GError    **error);
131
gboolean            gdm_display_add_user_authorization         (GdmDisplay *display,
132 133 134
                                                                const char *username,
                                                                char      **filename,
                                                                GError    **error);
135
gboolean            gdm_display_remove_user_authorization      (GdmDisplay *display,
136 137
                                                                const char *username,
                                                                GError    **error);
138 139 140 141 142 143

void                gdm_display_set_up_greeter_session         (GdmDisplay  *display,
                                                                char       **username);
void                gdm_display_start_greeter_session          (GdmDisplay  *display);
void                gdm_display_stop_greeter_session           (GdmDisplay  *display);
GdmSlave *          gdm_display_get_slave                      (GdmDisplay  *display);
144

145 146
gboolean            gdm_display_connect                        (GdmDisplay *self);

147 148 149
G_END_DECLS

#endif /* __GDM_DISPLAY_H */