Commit d2d48676 authored by Dan Williams's avatar Dan Williams

settings: remove older session monitor code

parent 925d69c6
......@@ -25,11 +25,7 @@ libsystem_settings_la_SOURCES = \
nm-sysconfig-connection.c \
nm-sysconfig-connection.h \
nm-default-wired-connection.c \
nm-default-wired-connection.h \
nm-session-info.c \
nm-session-info.h \
nm-session-manager.c \
nm-session-manager.h
nm-default-wired-connection.h
libsystem_settings_la_CPPFLAGS = \
$(DBUS_CFLAGS) \
......
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager user session tracker -- per-session data
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 Daniel Gnoutcheff <daniel@gnoutcheff.name>
*/
#include "nm-session-info.h"
#include "nm-dbus-glib-types.h"
#include "nm-utils.h"
G_DEFINE_TYPE (NMSessionInfo, nm_session_info, G_TYPE_OBJECT);
typedef struct {
char *id;
char *user;
gboolean is_default;
} NMSessionInfoPrivate;
#define NM_SESSION_INFO_GET_PRIVATE(self) (G_TYPE_INSTANCE_GET_PRIVATE (self, NM_TYPE_SESSION_INFO, NMSessionInfoPrivate))
enum {
PROP_0,
PROP_ID,
PROP_USER,
PROP_IS_DEFAULT
};
char *
nm_session_info_get_id (NMSessionInfo *self)
{
g_return_val_if_fail (NM_IS_SESSION_INFO (self), NULL);
return NM_SESSION_INFO_GET_PRIVATE (self)->id;
}
char *
nm_session_info_get_unix_user (NMSessionInfo *self)
{
g_return_val_if_fail (NM_IS_SESSION_INFO (self), NULL);
return NM_SESSION_INFO_GET_PRIVATE (self)->user;
}
gboolean
nm_session_info_is_default_session (NMSessionInfo *self)
{
g_return_val_if_fail (NM_IS_SESSION_INFO (self), FALSE);
return NM_SESSION_INFO_GET_PRIVATE (self)->is_default;
}
static void
set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
NMSessionInfoPrivate *priv = NM_SESSION_INFO_GET_PRIVATE (object);
switch (property_id) {
case PROP_ID:
g_free (priv->id);
priv->id = g_value_dup_string (value);
break;
case PROP_USER:
g_free (priv->user);
priv->user = g_value_dup_string (value);
break;
case PROP_IS_DEFAULT:
priv->is_default = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
NMSessionInfoPrivate *priv = NM_SESSION_INFO_GET_PRIVATE (object);
switch (property_id) {
case PROP_ID:
g_value_set_string (value, priv->id);
break;
case PROP_USER:
g_value_set_string (value, priv->user);
break;
case PROP_IS_DEFAULT:
g_value_set_boolean (value, priv->is_default);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
nm_session_info_init (NMSessionInfo *self) {
}
static void
dispose (GObject *object)
{
NMSessionInfoPrivate *priv = NM_SESSION_INFO_GET_PRIVATE (object);
if (priv->id) {
g_free (priv->id);
priv->id = NULL;
}
if (priv->user) {
g_free (priv->user);
priv->user = NULL;
}
G_OBJECT_CLASS (nm_session_info_parent_class)->dispose (object);
}
static void
nm_session_info_class_init (NMSessionInfoClass *info_class) {
GObjectClass *g_class = G_OBJECT_CLASS (info_class);
g_type_class_add_private (g_class, sizeof(NMSessionInfoPrivate));
g_class->set_property = set_property;
g_class->get_property = get_property;
g_class->dispose = dispose;
g_object_class_install_property
(g_class, PROP_ID,
g_param_spec_string (
NM_SESSION_INFO_ID,
"ConsoleKitSID",
"ConsoleKit session ID, or \"[none]\" if this is the \"default\" "
"session.",
NM_SESSION_INFO_DEFAULT_ID,
G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
(g_class, PROP_USER,
g_param_spec_string (
NM_SESSION_INFO_UNIX_USER,
"UnixUser",
"String name of the unix user who owns this session, or NULL if "
"this is the default session.",
NULL,
G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property
(g_class, PROP_IS_DEFAULT,
g_param_spec_boolean (
NM_SESSION_INFO_IS_DEFAULT,
"IsDefaultSession",
"Indicates if this NMSessionInfo instance represents the "
"\"default\" session, the session containing all processes that "
"do not belong to a ConsoleKit-recognized session.",
TRUE,
G_PARAM_READABLE | G_PARAM_CONSTRUCT_ONLY));
g_signal_new (
NM_SESSION_INFO_REMOVED,
NM_TYPE_SESSION_INFO,
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
}
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager user session tracker -- per-session data
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 Daniel Gnoutcheff <daniel@gnoutcheff.name>
*/
#ifndef NM_SESSION_INFO_H
#define NM_SESSION_INFO_H
#include <glib-object.h>
G_BEGIN_DECLS
#define NM_TYPE_SESSION_INFO (nm_session_info_get_type ())
#define NM_SESSION_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SESSION_INFO, NMSessionInfo))
#define NM_SESSION_INFO_CLASS(class_struct) (G_TYPE_CHECK_CLASS_CAST ((class_struct), NM_TYPE_SESSION_INFO, NMSessionInfoClass))
#define NM_IS_SESSION_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SESSION_INFO))
#define NM_IS_SESSION_INFO_CLASS(class_struct) (G_TYPE_CHECK_CLASS_TYPE ((class_struct), NM_TYPE_SESSION_INFO))
#define NM_SESSION_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SESSION_INFO, NMSessionInfoClass))
#define NM_SESSION_INFO_ID "session-id"
#define NM_SESSION_INFO_UNIX_USER "unix-user"
#define NM_SESSION_INFO_IS_DEFAULT "is-default"
#define NM_SESSION_INFO_REMOVED "removed"
#define NM_SESSION_INFO_DEFAULT_ID "[none]"
typedef struct {
GObject parent;
} NMSessionInfo;
typedef struct {
GObjectClass parent_class;
} NMSessionInfoClass;
GType nm_session_info_get_type (void);
char * nm_session_info_get_id (NMSessionInfo *self);
char * nm_session_info_get_unix_user (NMSessionInfo *self);
gboolean nm_session_info_is_default_session (NMSessionInfo *self);
G_END_DECLS
#endif
This diff is collapsed.
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/* NetworkManager user session tracker
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* (C) Copyright 2010 Daniel Gnoutcheff <daniel@gnoutcheff.name>
*/
#ifndef NM_SESSION_MANAGER_H
#define NM_SESSION_MANAGER_H
#include <glib-object.h>
#include <dbus/dbus-glib.h>
#include "nm-session-info.h"
G_BEGIN_DECLS
#define NM_SESSION_MANAGER_ERROR (nm_session_manager_error_quark())
enum {
NM_SESSION_MANAGER_ERROR_NOT_FOUND,
NM_SESSION_MANAGER_ERROR_INFO_GATHERING_FAILED,
NM_SESSION_MANAGER_ERROR_DISPOSED
} NMSessionManagerError;
#define NM_TYPE_SESSION_MANAGER (nm_session_manager_get_type ())
#define NM_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SESSION_MANAGER, NMSessionManager))
#define NM_SESSION_MANAGER_CLASS(class_struct) (G_TYPE_CHECK_CLASS_CAST ((class_struct), NM_TYPE_SESSION_MANAGER, NMSessionManagerClass))
#define NM_IS_SESSION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SESSION_MANAGER))
#define NM_IS_SESSION_MANAGER_CLASS(class_struct) (G_TYPE_CHECK_CLASS_TYPE ((class_struct), NM_TYPE_SESSION_MANAGER))
#define NM_SESSION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SESSION_MANAGER, NMSessionManagerClass))
#define NM_SESSION_MANAGER_SESSION_ADDED "session-added"
#define NM_SESSION_MANAGER_INIT_DONE "init-done"
typedef struct {
GObject parent;
} NMSessionManager;
typedef struct {
GObjectClass parent_class;
} NMSessionManagerClass;
typedef void (*NMSessionFunc) (NMSessionInfo *session,
GError *error,
gpointer user_data);
NMSessionManager * nm_session_manager_get (void);
gboolean nm_session_manager_is_initialized (NMSessionManager *manager);
GSList * nm_session_manager_get_sessions (NMSessionManager *manager);
void nm_session_manager_get_session (NMSessionManager *manager,
char *session_id,
NMSessionFunc callback,
gpointer user_data);
void nm_session_manager_get_session_of_caller (NMSessionManager *manager,
DBusGMethodInvocation *method_call,
NMSessionFunc callback,
gpointer user_data);
GType nm_session_manager_get_type (void);
GQuark nm_session_manager_error_quark (void);
G_END_DECLS
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment