~ubuntu-branches/ubuntu/precise/network-manager/precise

« back to all changes in this revision

Viewing changes to src/nm-session-monitor-null.c

  • Committer: Package Import Robot
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2012-02-09 16:45:41 UTC
  • mfrom: (1.1.53)
  • Revision ID: package-import@ubuntu.com-20120209164541-4h90zknlsfdb7x35
Tags: 0.9.2.0+git201202091925.c721477-0ubuntu1
* upstream snapshot 2012-02-09 19:25:59 (GMT)
  + c721477d11d4fe144111d6d2eec8f93f2e9186c9
* debian/patches/avoid-periodic-disk-wakeups.patch: refreshed.
* debian/patches/nl3-default-ip6-route.patch: refreshed.
* debian/libnm-glib4.symbols: add symbols:
  + nm_active_connection_get_master@Base
  + nm_client_new_async@Base
  + nm_client_new_finish@Base
  + nm_remote_settings_new_async@Base
  + nm_remote_settings_new_finish@Base
  + nm_device_get_state_reason@Base
* debian/libnm-util2.symbols: add symbols:
  + nm_setting_802_1x_get_pac_file@Base
  + nm_setting_infiniband_get_transport_mode@Base

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 
2
/* This program is free software; you can redistribute it and/or modify
 
3
 * it under the terms of the GNU General Public License as published by
 
4
 * the Free Software Foundation; either version 2 of the License, or
 
5
 * (at your option) any later version.
 
6
 *
 
7
 * This program is distributed in the hope that it will be useful,
 
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
 * GNU General Public License for more details.
 
11
 *
 
12
 * You should have received a copy of the GNU General Public License along
 
13
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
14
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
15
 *
 
16
 * (C) Copyright 2008 - 2010 Red Hat, Inc.
 
17
 * Author: David Zeuthen <davidz@redhat.com>
 
18
 * Author: Dan Williams <dcbw@redhat.com>
 
19
 */
 
20
 
 
21
#include "config.h"
 
22
#include <string.h>
 
23
#include "nm-logging.h"
 
24
 
 
25
#include "nm-session-utils.h"
 
26
#include "nm-session-monitor.h"
 
27
 
 
28
/* <internal>
 
29
 * SECTION:nm-session-monitor
 
30
 * @title: NMSessionMonitor
 
31
 * @short_description: Monitor sessions
 
32
 *
 
33
 * The #NMSessionMonitor class is a utility class to track and monitor sessions.
 
34
 */
 
35
 
 
36
struct _NMSessionMonitor {
 
37
        GObject parent_instance;
 
38
};
 
39
 
 
40
struct _NMSessionMonitorClass {
 
41
        GObjectClass parent_class;
 
42
 
 
43
        void (*changed) (NMSessionMonitor *monitor);
 
44
};
 
45
 
 
46
 
 
47
enum {
 
48
        CHANGED,
 
49
        LAST_SIGNAL,
 
50
};
 
51
static guint signals[LAST_SIGNAL] = {0};
 
52
 
 
53
G_DEFINE_TYPE (NMSessionMonitor, nm_session_monitor, G_TYPE_OBJECT);
 
54
 
 
55
/********************************************************************/
 
56
 
 
57
static void
 
58
nm_session_monitor_init (NMSessionMonitor *self)
 
59
{
 
60
}
 
61
 
 
62
static void
 
63
nm_session_monitor_class_init (NMSessionMonitorClass *klass)
 
64
{
 
65
        /**
 
66
         * NMSessionMonitor::changed:
 
67
         * @monitor: A #NMSessionMonitor
 
68
         *
 
69
         * Emitted when something changes.
 
70
         */
 
71
        signals[CHANGED] = g_signal_new (NM_SESSION_MONITOR_CHANGED,
 
72
                                         NM_TYPE_SESSION_MONITOR,
 
73
                                         G_SIGNAL_RUN_LAST,
 
74
                                         0, NULL, NULL,
 
75
                                         g_cclosure_marshal_VOID__VOID,
 
76
                                         G_TYPE_NONE, 0);
 
77
}
 
78
 
 
79
NMSessionMonitor *
 
80
nm_session_monitor_get (void)
 
81
{
 
82
        static NMSessionMonitor *singleton = NULL;
 
83
 
 
84
        if (singleton)
 
85
                return g_object_ref (singleton);
 
86
 
 
87
        singleton = NM_SESSION_MONITOR (g_object_new (NM_TYPE_SESSION_MONITOR, NULL));
 
88
        g_assert (singleton);
 
89
        return singleton;
 
90
}
 
91
 
 
92
/* ---------------------------------------------------------------------------------------------------- */
 
93
 
 
94
/**
 
95
 * nm_session_monitor_user_has_session:
 
96
 * @monitor: A #NMSessionMonitor.
 
97
 * @username: A username.
 
98
 * @error: Return location for error.
 
99
 *
 
100
 * Checks whether the given @username is logged into a session or not.
 
101
 *
 
102
 * Returns: %FALSE if @error is set otherwise %TRUE if the given @username is
 
103
 * currently logged into a session.
 
104
 */
 
105
gboolean
 
106
nm_session_monitor_user_has_session (NMSessionMonitor *monitor,
 
107
                                     const char *username,
 
108
                                     uid_t *out_uid,
 
109
                                     GError **error)
 
110
{
 
111
        return nm_session_user_to_uid (username, out_uid, error);
 
112
}
 
113
 
 
114
/**
 
115
 * nm_session_monitor_uid_has_session:
 
116
 * @monitor: A #NMSessionMonitor.
 
117
 * @uid: A user ID.
 
118
 * @error: Return location for error.
 
119
 *
 
120
 * Checks whether the given @uid is logged into a session or not.
 
121
 *
 
122
 * Returns: %FALSE if @error is set otherwise %TRUE if the given @uid is
 
123
 * currently logged into a session.
 
124
 */
 
125
gboolean
 
126
nm_session_monitor_uid_has_session (NMSessionMonitor *monitor,
 
127
                                    uid_t uid,
 
128
                                    const char **out_user,
 
129
                                    GError **error)
 
130
{
 
131
        return nm_session_uid_to_user (uid, out_user, error);
 
132
}
 
133
 
 
134
/**
 
135
 * nm_session_monitor_user_active:
 
136
 * @monitor: A #NMSessionMonitor.
 
137
 * @username: A username.
 
138
 * @error: Return location for error.
 
139
 *
 
140
 * Checks whether the given @username is logged into a active session or not.
 
141
 *
 
142
 * Returns: %FALSE if @error is set otherwise %TRUE if the given @username is
 
143
 * logged into an active session.
 
144
 */
 
145
gboolean
 
146
nm_session_monitor_user_active (NMSessionMonitor *monitor,
 
147
                                const char *username,
 
148
                                GError **error)
 
149
{
 
150
        return TRUE;
 
151
}
 
152
 
 
153
/**
 
154
 * nm_session_monitor_uid_active:
 
155
 * @monitor: A #NMSessionMonitor.
 
156
 * @uid: A user ID.
 
157
 * @error: Return location for error.
 
158
 *
 
159
 * Checks whether the given @uid is logged into a active session or not.
 
160
 *
 
161
 * Returns: %FALSE if @error is set otherwise %TRUE if the given @uid is
 
162
 * logged into an active session.
 
163
 */
 
164
gboolean
 
165
nm_session_monitor_uid_active (NMSessionMonitor *monitor,
 
166
                               uid_t uid,
 
167
                               GError **error)
 
168
{
 
169
        return TRUE;
 
170
}
 
171