diff options
author | Thomas Haller <thaller@redhat.com> | 2016-09-29 13:49:01 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-10-04 09:50:56 +0200 |
commit | 4d37f7a1e94f469fb1e3eacde4d2424ebf6ccf0b (patch) | |
tree | 304dd68a6f6bab8fb3ba9cb63d76faf69a530650 /src/nm-session-monitor.c | |
parent | 92e9822e1be23b0a1964b8b16a1cd2c0c51ee59b (diff) | |
download | NetworkManager-4d37f7a1e94f469fb1e3eacde4d2424ebf6ccf0b.tar.gz |
core: refactor private data in "src"
- use _NM_GET_PRIVATE() and _NM_GET_PRIVATE_PTR() everywhere.
- reorder statements, to have GObject related functions (init, dispose,
constructed) at the bottom of each file and in a consistent order w.r.t.
each other.
- unify whitespaces in signal and properties declarations.
- use NM_GOBJECT_PROPERTIES_DEFINE() and _notify()
- drop unused signal slots in class structures
- drop unused header files for device factories
Diffstat (limited to 'src/nm-session-monitor.c')
-rw-r--r-- | src/nm-session-monitor.c | 55 |
1 files changed, 22 insertions, 33 deletions
diff --git a/src/nm-session-monitor.c b/src/nm-session-monitor.c index 19d4688bb4..8f2955daa0 100644 --- a/src/nm-session-monitor.c +++ b/src/nm-session-monitor.c @@ -21,29 +21,30 @@ */ #include "nm-default.h" +#include "nm-session-monitor.h" + #include <pwd.h> #include <errno.h> #include <string.h> #include <sys/stat.h> -#include "nm-session-monitor.h" -#include "NetworkManagerUtils.h" - #ifdef SESSION_TRACKING_SYSTEMD #include <systemd/sd-login.h> #endif +#include "NetworkManagerUtils.h" + /*****************************************************************************/ -/* <internal> - * SECTION:nm-session-monitor - * @title: NMSessionMonitor - * @short_description: Monitor sessions - * - * The #NMSessionMonitor class is a utility class to track and monitor sessions. - */ +enum { + CHANGED, + LAST_SIGNAL, +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + struct _NMSessionMonitor { - GObject parent_instance; + GObject parent; #ifdef SESSION_TRACKING_SYSTEMD struct { @@ -62,20 +63,11 @@ struct _NMSessionMonitor { }; struct _NMSessionMonitorClass { - GObjectClass parent_class; - - void (*changed) (NMSessionMonitor *monitor); + GObjectClass parent; }; G_DEFINE_TYPE (NMSessionMonitor, nm_session_monitor, G_TYPE_OBJECT); -enum { - CHANGED, - LAST_SIGNAL, -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - /*****************************************************************************/ #ifdef SESSION_TRACKING_SYSTEMD @@ -371,7 +363,7 @@ nm_session_monitor_init (NMSessionMonitor *monitor) } static void -nm_session_monitor_finalize (GObject *object) +finalize (GObject *object) { #ifdef SESSION_TRACKING_SYSTEMD st_sd_finalize (NM_SESSION_MONITOR (object)); @@ -381,8 +373,7 @@ nm_session_monitor_finalize (GObject *object) ck_finalize (NM_SESSION_MONITOR (object)); #endif - if (G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize != NULL) - G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize (object); + G_OBJECT_CLASS (nm_session_monitor_parent_class)->finalize (object); } static void @@ -390,7 +381,7 @@ nm_session_monitor_class_init (NMSessionMonitorClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = nm_session_monitor_finalize; + gobject_class->finalize = finalize; /** * NMSessionMonitor::changed: @@ -399,12 +390,10 @@ nm_session_monitor_class_init (NMSessionMonitorClass *klass) * Emitted when something changes. */ signals[CHANGED] = g_signal_new (NM_SESSION_MONITOR_CHANGED, - NM_TYPE_SESSION_MONITOR, - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (NMSessionMonitorClass, changed), - NULL, /* accumulator */ - NULL, /* accumulator data */ - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, - 0); + NM_TYPE_SESSION_MONITOR, + G_SIGNAL_RUN_LAST, + 0, NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); } |