aboutsummaryrefslogtreecommitdiff
path: root/src/actions.h
blob: e0d0ec5d39225b36f6b520843254af5c9710d7d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Copyright 2013 Canonical Ltd.
 *
 * Authors:
 *   Charles Kerr <charles.kerr@canonical.com>
 *
 * This program is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 3, as published
 * by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 * MERCHANTABILITY, SATISFACTORY QUALITY, 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef __INDICATOR_SESSION_ACTIONS_H__
#define __INDICATOR_SESSION_ACTIONS_H__

#include <glib.h>
#include <glib-object.h>

G_BEGIN_DECLS

/* standard GObject macros */
#define INDICATOR_TYPE_SESSION_ACTIONS          (indicator_session_actions_get_type())
#define INDICATOR_SESSION_ACTIONS(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), INDICATOR_TYPE_SESSION_ACTIONS, IndicatorSessionActions))
#define INDICATOR_SESSION_ACTIONS_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), INDICATOR_TYPE_SESSION_ACTIONS, IndicatorSessionActionsClass))
#define INDICATOR_SESSION_ACTIONS_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST ((k), INDICATOR_TYPE_SESSION_ACTIONS, IndicatorSessionActionsClass))
#define INDICATOR_IS_SESSION_ACTIONS(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), INDICATOR_TYPE_SESSION_ACTIONS))

typedef struct _IndicatorSessionActions      IndicatorSessionActions;
typedef struct _IndicatorSessionActionsClass IndicatorSessionActionsClass;

/* property keys */
#define INDICATOR_SESSION_ACTIONS_PROP_CAN_LOCK "can-lock"
#define INDICATOR_SESSION_ACTIONS_PROP_CAN_LOGOUT "can-logout"
#define INDICATOR_SESSION_ACTIONS_PROP_CAN_SWITCH "can-switch"
#define INDICATOR_SESSION_ACTIONS_PROP_CAN_SUSPEND "can-suspend"
#define INDICATOR_SESSION_ACTIONS_PROP_CAN_HIBERNATE "can-hibernate"
#define INDICATOR_SESSION_ACTIONS_PROP_CAN_PROMPT "can-show-end-session-dialog"
#define INDICATOR_SESSION_ACTIONS_PROP_HAS_ONLINE_ACCOUNT_ERROR "has-online-account-error"

/**
 * A base class for invoking and getting state information on system actions.
 * Use backend.h's get_backend() to get an instance.
 */
struct _IndicatorSessionActions
{
  /*< private >*/
  GObject parent;
};

struct _IndicatorSessionActionsClass
{
  GObjectClass parent_class;

  /* pure virtual functions */

  gboolean (*can_lock)                 (IndicatorSessionActions * self);
  gboolean (*can_logout)               (IndicatorSessionActions * self);
  gboolean (*can_switch)               (IndicatorSessionActions * self);
  gboolean (*can_suspend)              (IndicatorSessionActions * self);
  gboolean (*can_hibernate)            (IndicatorSessionActions * self);
  gboolean (*can_prompt)               (IndicatorSessionActions * self);
  gboolean (*has_online_account_error) (IndicatorSessionActions * self);

  void  (*suspend)                     (IndicatorSessionActions * self);
  void  (*hibernate)                   (IndicatorSessionActions * self);
  void  (*logout)                      (IndicatorSessionActions * self);
  void  (*restart)                     (IndicatorSessionActions * self);
  void  (*shutdown)                    (IndicatorSessionActions * self);
  void  (*help)                        (IndicatorSessionActions * self);
  void  (*about)                       (IndicatorSessionActions * self);
  void  (*settings)                    (IndicatorSessionActions * self);

  void  (*switch_to_greeter)           (IndicatorSessionActions * self);
  void  (*switch_to_screensaver)       (IndicatorSessionActions * self);
  void  (*switch_to_guest)             (IndicatorSessionActions * self);
  void  (*switch_to_username)          (IndicatorSessionActions * self,
                                        const gchar             * username);
};

/***
****
***/

GType indicator_session_actions_get_type (void);

gboolean indicator_session_actions_can_lock                    (IndicatorSessionActions * self);
gboolean indicator_session_actions_can_logout                  (IndicatorSessionActions * self);
gboolean indicator_session_actions_can_switch                  (IndicatorSessionActions * self);
gboolean indicator_session_actions_can_suspend                 (IndicatorSessionActions * self);
gboolean indicator_session_actions_can_hibernate               (IndicatorSessionActions * self);
gboolean indicator_session_actions_can_prompt                  (IndicatorSessionActions * self);
gboolean indicator_session_actions_has_online_account_error    (IndicatorSessionActions * self);


void indicator_session_actions_notify_can_lock                 (IndicatorSessionActions * self);
void indicator_session_actions_notify_can_logout               (IndicatorSessionActions * self);
void indicator_session_actions_notify_can_switch               (IndicatorSessionActions * self);
void indicator_session_actions_notify_can_suspend              (IndicatorSessionActions * self);
void indicator_session_actions_notify_can_hibernate            (IndicatorSessionActions * self);
void indicator_session_actions_notify_can_prompt               (IndicatorSessionActions * self);
void indicator_session_actions_notify_has_online_account_error (IndicatorSessionActions * self);

void indicator_session_actions_lock                            (IndicatorSessionActions * self);
void indicator_session_actions_suspend                         (IndicatorSessionActions * self);
void indicator_session_actions_hibernate                       (IndicatorSessionActions * self);
void indicator_session_actions_logout                          (IndicatorSessionActions * self);
void indicator_session_actions_restart                         (IndicatorSessionActions * self);
void indicator_session_actions_shutdown                        (IndicatorSessionActions * self);

void indicator_session_actions_help                            (IndicatorSessionActions * self);
void indicator_session_actions_about                           (IndicatorSessionActions * self);
void indicator_session_actions_settings                        (IndicatorSessionActions * self);

void indicator_session_actions_switch_to_screensaver           (IndicatorSessionActions * self);
void indicator_session_actions_switch_to_greeter               (IndicatorSessionActions * self);
void indicator_session_actions_switch_to_guest                 (IndicatorSessionActions * self);
void indicator_session_actions_switch_to_username              (IndicatorSessionActions * self,
                                                               const gchar              * username);

G_END_DECLS

#endif /* __INDICATOR_SESSION_ACTIONS_H__ */