1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2  *
3  * Copyright (C) 2010 Red Hat, Inc.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, see <http://www.gnu.org/licenses/>.
17  *
18  * Authors:
19  *    Ray Strode <rstrode@redhat.com>
20  */
21 
22 #ifndef __GSM_SHELL_H__
23 #define __GSM_SHELL_H__
24 
25 #include <glib.h>
26 #include <glib-object.h>
27 
28 #include "gsm-store.h"
29 
30 G_BEGIN_DECLS
31 
32 #define GSM_TYPE_SHELL             (gsm_shell_get_type ())
33 #define GSM_SHELL(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSM_TYPE_SHELL, GsmShell))
34 #define GSM_SHELL_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), GSM_TYPE_SHELL, GsmShellClass))
35 #define GSM_IS_SHELL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSM_TYPE_SHELL))
36 #define GSM_IS_SHELL_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), GSM_TYPE_SHELL))
37 #define GSM_SHELL_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), GSM_TYPE_SHELL, GsmShellClass))
38 #define GSM_SHELL_ERROR            (gsm_shell_error_quark ())
39 
40 typedef struct _GsmShell        GsmShell;
41 typedef struct _GsmShellClass   GsmShellClass;
42 typedef struct _GsmShellPrivate GsmShellPrivate;
43 
44 typedef enum
45 {
46     GSM_SHELL_END_SESSION_DIALOG_TYPE_LOGOUT = 0,
47     GSM_SHELL_END_SESSION_DIALOG_TYPE_SHUTDOWN,
48     GSM_SHELL_END_SESSION_DIALOG_TYPE_RESTART,
49 } GsmShellEndSessionDialogType;
50 
51 struct _GsmShell
52 {
53         GObject               parent;
54 
55         GsmShellPrivate *priv;
56 };
57 
58 struct _GsmShellClass
59 {
60         GObjectClass parent_class;
61 
62         void (* end_session_dialog_opened)        (GsmShell *shell);
63         void (* end_session_dialog_open_failed)   (GsmShell *shell);
64         void (* end_session_dialog_closed)        (GsmShell *shell);
65         void (* end_session_dialog_canceled)      (GsmShell *shell);
66 
67         void (* end_session_dialog_confirmed_logout)   (GsmShell *shell);
68         void (* end_session_dialog_confirmed_shutdown) (GsmShell *shell);
69         void (* end_session_dialog_confirmed_reboot)   (GsmShell *shell);
70 
71 };
72 
73 GType            gsm_shell_get_type           (void);
74 
75 GsmShell        *gsm_shell_new                (void);
76 
77 GsmShell        *gsm_get_shell                (void);
78 gboolean         gsm_shell_is_running         (GsmShell *shell);
79 
80 gboolean         gsm_shell_open_end_session_dialog (GsmShell *shell,
81                                                     GsmShellEndSessionDialogType type,
82                                                     GsmStore *inhibitors);
83 void             gsm_shell_close_end_session_dialog (GsmShell *shell);
84 
85 G_END_DECLS
86 
87 #endif /* __GSM_SHELL_H__ */
88