2
* Copyright 2013 Canonical Ltd.
5
* Charles Kerr <charles.kerr@canonical.com>
7
* This program is free software: you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License version 3, as published
9
* by the Free Software Foundation.
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranties of
13
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
14
* PURPOSE. See the GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License along
17
* with this program. If not, see <http://www.gnu.org/licenses/>.
20
#include "mock-display-manager-seat.h"
21
#include "mock-login1-seat.h"
25
const char * const DISPLAY_MANAGER_NAME = "org.freedesktop.DisplayManager";
30
static int id = 12; // arbitrary; doesn't matter
35
tmp = g_strdup_printf ("/org/freedesktop/DisplayManager/Seat%d", id++);
47
MockDisplayManagerSeat :: switch_to_greeter ()
49
my_last_action = GREETER;
53
MockDisplayManagerSeat :: handle_switch_to_greeter (DisplayManagerSeat * o,
54
GDBusMethodInvocation * inv,
57
static_cast<MockDisplayManagerSeat*>(gself)->switch_to_greeter ();
58
display_manager_seat_complete_switch_to_greeter (o, inv);
63
MockDisplayManagerSeat :: set_guest_allowed (bool b)
65
display_manager_seat_set_has_guest_account (my_skeleton, b);
69
MockDisplayManagerSeat :: handle_switch_to_guest (DisplayManagerSeat * o,
70
GDBusMethodInvocation * inv,
71
const gchar * session_name G_GNUC_UNUSED,
74
static_cast<MockDisplayManagerSeat*>(gself)->switch_to_guest ();
75
display_manager_seat_complete_switch_to_guest (o, inv);
80
MockDisplayManagerSeat :: switch_to_guest ()
82
g_assert (my_login1_seat != 0);
84
my_last_action = GUEST;
85
my_login1_seat->switch_to_guest ();
89
MockDisplayManagerSeat :: handle_switch_to_user (DisplayManagerSeat * o,
90
GDBusMethodInvocation * inv,
91
const gchar * username,
92
const gchar * session_name G_GNUC_UNUSED,
95
static_cast<MockDisplayManagerSeat*>(gself)->switch_to_user (username);
96
display_manager_seat_complete_switch_to_user (o, inv);
101
MockDisplayManagerSeat :: switch_to_user (const char * username)
103
g_assert (my_login1_seat != 0);
105
my_last_action = USER;
106
my_login1_seat->switch_to_user (username);
110
MockDisplayManagerSeat :: set_login1_seat (MockLogin1Seat * seat)
112
my_login1_seat = seat;
119
MockDisplayManagerSeat :: MockDisplayManagerSeat (GMainLoop * loop,
120
GDBusConnection * connection):
121
MockObject (loop, connection, DISPLAY_MANAGER_NAME, next_unique_path()),
122
my_skeleton (display_manager_seat_skeleton_new ()),
123
my_last_action (NONE)
125
g_signal_connect (my_skeleton, "handle-switch-to-guest",
126
G_CALLBACK(handle_switch_to_guest), this);
127
g_signal_connect (my_skeleton, "handle-switch-to-user",
128
G_CALLBACK(handle_switch_to_user), this);
129
g_signal_connect (my_skeleton, "handle-switch-to-greeter",
130
G_CALLBACK(handle_switch_to_greeter), this);
132
set_skeleton (G_DBUS_INTERFACE_SKELETON(my_skeleton));
135
MockDisplayManagerSeat :: ~MockDisplayManagerSeat ()
137
//g_signal_handlers_disconnect_by_data (my_skeleton, this);
138
g_clear_object (&my_skeleton);