~larsu/indicator-session/glib-deadlock-workaround

« back to all changes in this revision

Viewing changes to src/users-service-dbus.h

  • Committer: Charles Kerr
  • Date: 2013-03-22 21:34:34 UTC
  • mto: (384.2.29 ng)
  • mto: This revision was merged to the branch mainline in revision 399.
  • Revision ID: charles.kerr@canonical.com-20130322213434-a85qbob8bi4fvfx2
port indicator-session to GMenu/cmake. Code coverage increased from 0% to 95.4%.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2009 Canonical Ltd.
3
 
 *
4
 
 * Authors:
5
 
 *     Cody Russell <crussell@canonical.com>
6
 
 *     Charles Kerr <charles.kerr@canonical.com>
7
 
 *
8
 
 * This program is free software: you can redistribute it and/or modify it
9
 
 * under the terms of the GNU General Public License version 3, as published
10
 
 * by the Free Software Foundation.
11
 
 *
12
 
 * This program is distributed in the hope that it will be useful, but
13
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
14
 
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
15
 
 * PURPOSE.  See the GNU General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU General Public License along
18
 
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
19
 
 */
20
 
 
21
 
#ifndef __USERS_SERVICE_DBUS_H__
22
 
#define __USERS_SERVICE_DBUS_H__
23
 
 
24
 
#include <glib.h>
25
 
#include <glib-object.h>
26
 
 
27
 
#include "dbus-user.h" /* for AccountsUser */
28
 
 
29
 
G_BEGIN_DECLS
30
 
 
31
 
#define USERS_SERVICE_DBUS_TYPE  (users_service_dbus_get_type ())
32
 
#define USERS_SERVICE_DBUS(o)    (G_TYPE_CHECK_INSTANCE_CAST ((o), USERS_SERVICE_DBUS_TYPE, UsersServiceDbus))
33
 
#define IS_USERS_SERVICE_DBUS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), USERS_SERVICE_DBUS_TYPE))
34
 
 
35
 
typedef struct _UsersServiceDbus        UsersServiceDbus;
36
 
typedef struct _UsersServiceDbusClass   UsersServiceDbusClass;
37
 
typedef struct _UsersServiceDbusPrivate UsersServiceDbusPrivate;
38
 
 
39
 
/**
40
 
 * A facade class which interacts with multiple DBus services to
41
 
 * track info which is useful to the interactor's user menu:
42
 
 *
43
 
 *  1. A list of users to add to the user menu.
44
 
 *
45
 
 *     Each user is an AccountsUser object, which is a GDBusProxy
46
 
 *     to an org.freedesktop.Accounts.User object.
47
 
 *
48
 
 *     We initially build this list by calling org.freedesktop.Accounts'
49
 
 *     GetCachedUsers method. We also monitor o.f.Accounts' UserAdded
50
 
 *     and UserDeleted and update the list accordingly.
51
 
 *
52
 
 *  2. Track which users currently have X sessions.
53
 
 *     This is used for the menuitems' USER_ITEM_PROP_LOGGED_IN property.
54
 
 *
55
 
 *     We initially build this list by calling org.freedesktop.ConsoleKit.Seat's
56
 
 *     GetDevices method. We also monitor the seat for SessionAdded and
57
 
 *     SessionRemoved and update the list accordingly.
58
 
 *
59
 
 *  3. Provide an API for user switching and guest sessions.
60
 
 *     These are typically pass-through functions to GDBusProxies.
61
 
 *
62
 
 */
63
 
struct _UsersServiceDbus
64
 
{
65
 
  /*< private >*/
66
 
  GObject parent;
67
 
  UsersServiceDbusPrivate * priv;
68
 
};
69
 
 
70
 
struct _UsersServiceDbusClass
71
 
{
72
 
  GObjectClass parent_class;
73
 
 
74
 
  /* Signals */
75
 
  void (* user_list_changed)       (UsersServiceDbus*, gpointer);
76
 
  void (* user_logged_in_changed)  (UsersServiceDbus*, AccountsUser*, gpointer);
77
 
  void (* guest_logged_in_changed) (UsersServiceDbus*, gpointer);
78
 
};
79
 
 
80
 
GType     users_service_dbus_get_type               (void) G_GNUC_CONST;
81
 
 
82
 
GList   * users_service_dbus_get_user_list          (UsersServiceDbus * self);
83
 
 
84
 
gboolean  users_service_dbus_is_guest_logged_in     (UsersServiceDbus * self);
85
 
gboolean  users_service_dbus_is_user_logged_in      (UsersServiceDbus * self,
86
 
                                                     AccountsUser     * user);
87
 
 
88
 
void      users_service_dbus_show_greeter           (UsersServiceDbus * self);
89
 
gboolean  users_service_dbus_guest_session_enabled  (UsersServiceDbus * self);
90
 
gboolean  users_service_dbus_can_activate_session   (UsersServiceDbus * self);
91
 
void      users_service_dbus_activate_guest_session (UsersServiceDbus * self);
92
 
void      users_service_dbus_activate_user_session  (UsersServiceDbus * self,
93
 
                                                     AccountsUser     * user);
94
 
 
95
 
G_END_DECLS
96
 
 
97
 
#endif