Hello community,

here is the log from the commit of package NetworkManager for openSUSE:Factory 
checked in at 2012-11-12 12:39:25
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/NetworkManager (Old)
 and      /work/SRC/openSUSE:Factory/.NetworkManager.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "NetworkManager", Maintainer is "[email protected]"

Changes:
--------
--- /work/SRC/openSUSE:Factory/NetworkManager/NetworkManager.changes    
2012-10-31 07:00:10.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.NetworkManager.new/NetworkManager.changes       
2012-11-12 12:39:26.000000000 +0100
@@ -1,0 +2,16 @@
+Thu Nov  8 18:59:31 UTC 2012 - [email protected]
+
+- Switch on systemd support: change with_systemd defines to 1.
+
+-------------------------------------------------------------------
+Tue Nov  6 21:28:24 UTC 2012 - [email protected]
+
+- Add NetworkManager-systemd-suspend.patch and
+  NetworkManager-upower-out.patch: Listen to systemd for
+  suspend/resume when built with systemd support. The upower
+  signals will never be emitted.
+- When building with systemd support, add gnome-common
+  BuildRequires and call to gnome-autogen.sh, as above patches
+  touch the build system.
+
+-------------------------------------------------------------------

New:
----
  NetworkManager-systemd-suspend.patch
  NetworkManager-upower-out.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ NetworkManager.spec ++++++
--- /var/tmp/diff_new_pack.HDjhCX/_old  2012-11-12 12:39:28.000000000 +0100
+++ /var/tmp/diff_new_pack.HDjhCX/_new  2012-11-12 12:39:28.000000000 +0100
@@ -18,7 +18,7 @@
 
 # We cannot enable systemd support right now, as it is exclusive and means we
 # lose ConsoleKit support (bad for sysvinit)
-%define with_systemd 0
+%define with_systemd 1
 %define with_wimax 0
 
 Name:           NetworkManager
@@ -41,7 +41,15 @@
 Patch3:         nm-don-t-consider-not-needed-secrets-for-has_system_secr.diff
 # PATCH-HACK-OPENSUSE 
nm-treat-not-saved-secrets-just-like-agent-owned-when-cl.diff [email protected] 
-- avoid polkit popups for 802.11x
 Patch4:         nm-treat-not-saved-secrets-just-like-agent-owned-when-cl.diff
+# PATCH-FIX-UPSTREAM NetworkManager-upower-out.patch bgo#677694 
[email protected] -- core: factor out the upower suspend/resume code
+Patch5:         NetworkManager-upower-out.patch
+# PATCH-FIX-UPSTREAM NetworkManager-systemd-suspend.patch bgo#677694 
[email protected] -- core: add a systemd suspend/resume monitor
+Patch6:         NetworkManager-systemd-suspend.patch
 BuildRequires:  fdupes
+%if %{with_systemd}
+# Needed by patch5 and patch6
+BuildRequires:  gnome-common
+%endif
 BuildRequires:  gobject-introspection-devel
 BuildRequires:  gtk-doc
 BuildRequires:  intltool
@@ -176,14 +184,24 @@
 %lang_package
 %prep
 %setup -n %{name}-%{version} -q
-translation-update-upstream
+#translation-update-upstream
 %patch0 -p1
 # Disabled due to issues, see bnc#768564
 #patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%if %{with_systemd}
+%patch5 -p1
+%patch6 -p1
+# Patch6 should rename the file.. but this somehow does not work... so 
manually rename
+mv src/nm-sleep-monitor.c src/nm-sleep-monitor-upower.c
+%endif
 
 %build
+%if %{with_systemd}
+# Needed by patch5 and patch6
+NOCONFIGURE=1 gnome-autogen.sh
+%endif
 pppddir=`ls -1d /usr/%_lib/pppd/2*`
 test -n "$pppddir" || exit 1
 export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"


++++++ NetworkManager-systemd-suspend.patch ++++++
>From ea0c3a3e0fcbe400a704692d3b436d4733d348a1 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <[email protected]>
Date: Tue, 09 Oct 2012 04:39:03 +0000
Subject: core: add a systemd suspend/resume monitor (bgo #677694)

This implementation uses a delay inhibitor to get systemd to
emit PrepareForSleep, and then emits ::Sleeping and ::Resuming
when receiving the before/after PrepareForSleep emissions.
---
Index: NetworkManager-0.9.6.4/configure.ac
===================================================================
--- NetworkManager-0.9.6.4.orig/configure.ac
+++ NetworkManager-0.9.6.4/configure.ac
@@ -327,7 +327,7 @@ PKG_CHECK_MODULES(GUDEV, gudev-1.0 >= 14
 AC_SUBST(GUDEV_CFLAGS)
 AC_SUBST(GUDEV_LIBS)
 
-PKG_CHECK_MODULES(GIO, gio-2.0)
+PKG_CHECK_MODULES(GIO, gio-unix-2.0)
 AC_SUBST(GIO_CFLAGS)
 AC_SUBST(GIO_LIBS)
 
Index: NetworkManager-0.9.6.4/src/Makefile.am
===================================================================
--- NetworkManager-0.9.6.4.orig/src/Makefile.am
+++ NetworkManager-0.9.6.4/src/Makefile.am
@@ -193,7 +193,6 @@ NetworkManager_SOURCES = \
                nm-session-utils.c \
                nm-session-utils.h \
                nm-sleep-monitor.h \
-               nm-sleep-monitor.c \
                nm-connection-provider.h \
                nm-connection-provider.c
 
@@ -202,13 +201,18 @@ NetworkManager_SOURCES += nm-connectivit
 endif
 
 if SESSION_TRACKING_SYSTEMD
-NetworkManager_SOURCES += nm-session-monitor-systemd.c
+NetworkManager_SOURCES += \
+               nm-session-monitor-systemd.c \
+               nm-sleep-monitor-systemd.c
 else
 if SESSION_TRACKING_CK
 NetworkManager_SOURCES += nm-session-monitor-ck.c
 else
 NetworkManager_SOURCES += nm-session-monitor-null.c
 endif
+
+# UPower suspend/resume used whenever systemd is not enabled
+NetworkManager_SOURCES += nm-sleep-monitor-upower.c
 endif
 
 nm-access-point-glue.h: $(top_srcdir)/introspection/nm-access-point.xml
@@ -284,6 +288,7 @@ BUILT_SOURCES = \
 NetworkManager_CPPFLAGS = \
        $(DBUS_CFLAGS) \
        $(GLIB_CFLAGS) \
+       $(GIO_CFLAGS) \
        $(GUDEV_CFLAGS) \
        $(LIBNL_CFLAGS) \
        $(GMODULE_CFLAGS) \
Index: NetworkManager-0.9.6.4/src/nm-sleep-monitor-systemd.c
===================================================================
--- /dev/null
+++ NetworkManager-0.9.6.4/src/nm-sleep-monitor-systemd.c
@@ -0,0 +1,217 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* 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 2012 Red Hat, Inc.
+ * Author: Matthias Clasen <[email protected]>
+ */
+
+#include "config.h"
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib.h>
+#include <gio/gio.h>
+#include <gio/gunixfdlist.h>
+
+#include "nm-logging.h"
+#include "nm-dbus-manager.h"
+
+#include "nm-sleep-monitor.h"
+
+#define SD_NAME              "org.freedesktop.login1"
+#define SD_PATH              "/org/freedesktop/login1"
+#define SD_INTERFACE         "org.freedesktop.login1.Manager"
+
+
+struct _NMSleepMonitor {
+       GObject parent_instance;
+
+       GDBusProxy *sd_proxy;
+       gint inhibit_fd;
+};
+
+struct _NMSleepMonitorClass {
+       GObjectClass parent_class;
+
+       void (*sleeping) (NMSleepMonitor *monitor);
+       void (*resuming) (NMSleepMonitor *monitor);
+};
+
+
+enum {
+       SLEEPING,
+       RESUMING,
+       LAST_SIGNAL,
+};
+static guint signals[LAST_SIGNAL] = {0};
+
+G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT);
+
+/********************************************************************/
+
+static void
+inhibit_done (GObject      *source,
+              GAsyncResult *result,
+              gpointer      user_data)
+{
+       GDBusProxy *sd_proxy = G_DBUS_PROXY (source);
+       NMSleepMonitor *self = user_data;
+       GError *error = NULL;
+       GVariant *res;
+       GUnixFDList *fd_list;
+
+       res = g_dbus_proxy_call_with_unix_fd_list_finish (sd_proxy, &fd_list, 
result, &error);
+       if (!res) {
+               nm_log_warn (LOGD_SUSPEND, "Inhibit failed: %s", 
error->message);
+               g_error_free (error);
+       } else {
+               if (!fd_list || g_unix_fd_list_get_length (fd_list) != 1)
+                       nm_log_warn (LOGD_SUSPEND, "Didn't get a single fd 
back");
+
+               self->inhibit_fd = g_unix_fd_list_get (fd_list, 0, NULL);
+
+               nm_log_dbg (LOGD_SUSPEND, "Inhibitor fd is %d", 
self->inhibit_fd);
+               g_object_unref (fd_list);
+               g_variant_unref (res);
+       }
+}
+
+static void
+take_inhibitor (NMSleepMonitor *self)
+{
+       g_assert (self->inhibit_fd == -1);
+
+       nm_log_dbg (LOGD_SUSPEND, "Taking systemd sleep inhibitor");
+       g_dbus_proxy_call_with_unix_fd_list (self->sd_proxy,
+                                            "Inhibit",
+                                            g_variant_new ("(ssss)",
+                                                           "sleep",
+                                                           g_get_user_name (),
+                                                           "inhibited",
+                                                           "delay"),
+                                            0,
+                                            G_MAXINT,
+                                            NULL,
+                                            NULL,
+                                            inhibit_done,
+                                            self);
+}
+
+static gboolean
+drop_inhibitor (NMSleepMonitor *self)
+{
+       if (self->inhibit_fd >= 0) {
+               nm_log_dbg (LOGD_SUSPEND, "Dropping systemd sleep inhibitor");
+               close (self->inhibit_fd);
+               self->inhibit_fd = -1;
+               return TRUE;
+       }
+       return FALSE;
+}
+
+static void
+signal_cb (GDBusProxy  *proxy,
+           const gchar *sendername,
+           const gchar *signalname,
+           GVariant    *args,
+           gpointer     data)
+{
+       NMSleepMonitor *self = data;
+       gboolean is_about_to_suspend;
+
+       if (strcmp (signalname, "PrepareForSleep") != 0)
+               return;
+
+       g_variant_get (args, "(b)", &is_about_to_suspend);
+       nm_log_dbg (LOGD_SUSPEND, "Received PrepareForSleep signal: %d", 
is_about_to_suspend);
+
+       if (is_about_to_suspend) {
+               g_signal_emit (self, signals[SLEEPING], 0);
+               drop_inhibitor (self);
+       } else {
+               take_inhibitor (self);
+               g_signal_emit (self, signals[RESUMING], 0);
+       }
+}
+
+static void
+nm_sleep_monitor_init (NMSleepMonitor *self)
+{
+       GDBusConnection *bus;
+
+       self->inhibit_fd = -1;
+       bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
+       self->sd_proxy = g_dbus_proxy_new_sync (bus, 0, NULL,
+                                               SD_NAME, SD_PATH, SD_INTERFACE,
+                                               NULL, NULL);
+       g_object_unref (bus);
+       g_signal_connect (self->sd_proxy, "g-signal", G_CALLBACK (signal_cb), 
self);
+       take_inhibitor (self);
+}
+
+static void
+finalize (GObject *object)
+{
+       NMSleepMonitor *self = NM_SLEEP_MONITOR (object);
+
+       drop_inhibitor (self);
+       if (self->sd_proxy)
+               g_object_unref (self->sd_proxy);
+
+       if (G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize != NULL)
+               G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize 
(object);
+}
+
+static void
+nm_sleep_monitor_class_init (NMSleepMonitorClass *klass)
+{
+       GObjectClass *gobject_class;
+
+       gobject_class = G_OBJECT_CLASS (klass);
+
+       gobject_class->finalize = finalize;
+
+       signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING,
+                                         NM_TYPE_SLEEP_MONITOR,
+                                         G_SIGNAL_RUN_LAST,
+                                         G_STRUCT_OFFSET (NMSleepMonitorClass, 
sleeping),
+                                         NULL,                   /* 
accumulator      */
+                                         NULL,                   /* 
accumulator data */
+                                         g_cclosure_marshal_VOID__VOID,
+                                         G_TYPE_NONE, 0);
+       signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING,
+                                         NM_TYPE_SLEEP_MONITOR,
+                                         G_SIGNAL_RUN_LAST,
+                                         G_STRUCT_OFFSET (NMSleepMonitorClass, 
resuming),
+                                         NULL,                   /* 
accumulator      */
+                                         NULL,                   /* 
accumulator data */
+                                         g_cclosure_marshal_VOID__VOID,
+                                         G_TYPE_NONE, 0);
+}
+
+NMSleepMonitor *
+nm_sleep_monitor_get (void)
+{
+       static NMSleepMonitor *singleton = NULL;
+
+       if (singleton)
+               return g_object_ref (singleton);
+
+       singleton = NM_SLEEP_MONITOR (g_object_new (NM_TYPE_SLEEP_MONITOR, 
NULL));
+       return singleton;
+}
+
+/* 
----------------------------------------------------------------------------------------------------
 */
diff --git a/src/nm-sleep-monitor.c b/src/nm-sleep-monitor-upower.c
index 488200e..488200e 100644
--- a/src/nm-sleep-monitor.c
+++ b/src/nm-sleep-monitor-upower.c
--
cgit v0.9.0.2-2-gbeb
++++++ NetworkManager-upower-out.patch ++++++
>From 64fd8eea7706038e5d38c8463a1c765ed9331db2 Mon Sep 17 00:00:00 2001
From: Matthias Clasen <[email protected]>
Date: Tue, 09 Oct 2012 04:36:35 +0000
Subject: core: factor out the upower suspend/resume code (bgo #677694)

Factor the code that listens for upower sleeping and resuming
signals out into a class code NMSleepMonitor.
---
Index: NetworkManager-0.9.6.4/src/Makefile.am
===================================================================
--- NetworkManager-0.9.6.4.orig/src/Makefile.am
+++ NetworkManager-0.9.6.4/src/Makefile.am
@@ -192,6 +192,8 @@ NetworkManager_SOURCES = \
                nm-session-monitor.h \
                nm-session-utils.c \
                nm-session-utils.h \
+               nm-sleep-monitor.h \
+               nm-sleep-monitor.c \
                nm-connection-provider.h \
                nm-connection-provider.c
 
Index: NetworkManager-0.9.6.4/src/nm-manager.c
===================================================================
--- NetworkManager-0.9.6.4.orig/src/nm-manager.c
+++ NetworkManager-0.9.6.4/src/nm-manager.c
@@ -69,6 +69,7 @@
 #include "nm-device-factory.h"
 #include "wifi-utils.h"
 #include "nm-enum-types.h"
+#include "nm-sleep-monitor.h"
 
 #if WITH_CONCHECK
 #include "nm-connectivity.h"
@@ -78,8 +79,6 @@
 #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd"
 #define NM_AUTOIP_DBUS_IFACE   "org.freedesktop.nm_avahi_autoipd"
 
-#define UPOWER_DBUS_SERVICE "org.freedesktop.UPower"
-
 static gboolean impl_manager_get_devices (NMManager *manager,
                                           GPtrArray **devices,
                                           GError **err);
@@ -227,7 +226,7 @@ typedef struct {
        guint modem_removed_id;
 
        DBusGProxy *aipd_proxy;
-       DBusGProxy *upower_proxy;
+       NMSleepMonitor *sleep_monitor;
 
        GSList *auth_chains;
 
@@ -3275,16 +3274,16 @@ impl_manager_sleep (NMManager *self,
 }
 
 static void
-upower_sleeping_cb (DBusGProxy *proxy, gpointer user_data)
+sleeping_cb (DBusGProxy *proxy, gpointer user_data)
 {
-       nm_log_dbg (LOGD_SUSPEND, "Received UPower sleeping signal");
+       nm_log_dbg (LOGD_SUSPEND, "Received sleeping signal");
        _internal_sleep (NM_MANAGER (user_data), TRUE);
 }
 
 static void
-upower_resuming_cb (DBusGProxy *proxy, gpointer user_data)
+resuming_cb (DBusGProxy *proxy, gpointer user_data)
 {
-       nm_log_dbg (LOGD_SUSPEND, "Received UPower resuming signal");
+       nm_log_dbg (LOGD_SUSPEND, "Received resuming signal");
        _internal_sleep (NM_MANAGER (user_data), FALSE);
 }
 
@@ -4036,8 +4035,8 @@ dispose (GObject *object)
        if (priv->aipd_proxy)
                g_object_unref (priv->aipd_proxy);
 
-       if (priv->upower_proxy)
-               g_object_unref (priv->upower_proxy);
+       if (priv->sleep_monitor)
+               g_object_unref (priv->sleep_monitor);
 
        if (priv->fw_monitor) {
                if (priv->fw_monitor_id)
@@ -4359,23 +4358,12 @@ nm_manager_init (NMManager *manager)
        } else
                nm_log_warn (LOGD_AUTOIP4, "could not initialize avahi-autoipd 
D-Bus proxy");
 
-       /* upower sleep/wake handling */
-       priv->upower_proxy = dbus_g_proxy_new_for_name (g_connection,
-                                                       UPOWER_DBUS_SERVICE,
-                                                       
"/org/freedesktop/UPower",
-                                                       
"org.freedesktop.UPower");
-       if (priv->upower_proxy) {
-               dbus_g_proxy_add_signal (priv->upower_proxy, "Sleeping", 
G_TYPE_INVALID);
-               dbus_g_proxy_connect_signal (priv->upower_proxy, "Sleeping",
-                                            G_CALLBACK (upower_sleeping_cb),
-                                            manager, NULL);
-
-               dbus_g_proxy_add_signal (priv->upower_proxy, "Resuming", 
G_TYPE_INVALID);
-               dbus_g_proxy_connect_signal (priv->upower_proxy, "Resuming",
-                                            G_CALLBACK (upower_resuming_cb),
-                                            manager, NULL);
-       } else
-               nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus 
proxy");
+       /* sleep/wake handling */
+       priv->sleep_monitor = nm_sleep_monitor_get ();
+        g_signal_connect (priv->sleep_monitor, "Sleeping",
+                          G_CALLBACK (sleeping_cb), manager);
+        g_signal_connect (priv->sleep_monitor, "Resuming",
+                          G_CALLBACK (resuming_cb), manager);
 
        /* Listen for authorization changes */
        nm_auth_changed_func_register (authority_changed_cb, manager);
Index: NetworkManager-0.9.6.4/src/nm-sleep-monitor.c
===================================================================
--- /dev/null
+++ NetworkManager-0.9.6.4/src/nm-sleep-monitor.c
@@ -0,0 +1,152 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* 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 2012 Red Hat, Inc.
+ * Author: Matthias Clasen <[email protected]>
+ */
+
+#include "config.h"
+#include <errno.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib.h>
+#include <gio/gio.h>
+#include "nm-logging.h"
+#include "nm-dbus-manager.h"
+
+#include "nm-sleep-monitor.h"
+
+#define UPOWER_DBUS_SERVICE "org.freedesktop.UPower"
+
+struct _NMSleepMonitor {
+        GObject parent_instance;
+
+        DBusGProxy *upower_proxy;
+};
+
+struct _NMSleepMonitorClass {
+        GObjectClass parent_class;
+
+        void (*sleeping) (NMSleepMonitor *monitor);
+        void (*resuming) (NMSleepMonitor *monitor);
+};
+
+
+enum {
+        SLEEPING,
+        RESUMING,
+        LAST_SIGNAL,
+};
+static guint signals[LAST_SIGNAL] = {0};
+
+G_DEFINE_TYPE (NMSleepMonitor, nm_sleep_monitor, G_TYPE_OBJECT);
+
+/********************************************************************/
+
+static void
+upower_sleeping_cb (DBusGProxy *proxy, gpointer user_data)
+{
+        nm_log_dbg (LOGD_SUSPEND, "Received UPower sleeping signal");
+        g_signal_emit (user_data, signals[SLEEPING], 0);
+}
+
+static void
+upower_resuming_cb (DBusGProxy *proxy, gpointer user_data)
+{
+        nm_log_dbg (LOGD_SUSPEND, "Received UPower resuming signal");
+        g_signal_emit (user_data, signals[RESUMING], 0);
+}
+
+static void
+nm_sleep_monitor_init (NMSleepMonitor *self)
+{
+        NMDBusManager *dbus_mgr;
+        DBusGConnection *bus;
+
+        dbus_mgr = nm_dbus_manager_get ();
+        bus = nm_dbus_manager_get_connection (dbus_mgr);
+        self->upower_proxy = dbus_g_proxy_new_for_name (bus,
+                                                        UPOWER_DBUS_SERVICE,
+                                                        
"/org/freedesktop/UPower",
+                                                        
"org.freedesktop.UPower");
+        if (self->upower_proxy) {
+                dbus_g_proxy_add_signal (self->upower_proxy, "Sleeping", 
G_TYPE_INVALID);
+                dbus_g_proxy_connect_signal (self->upower_proxy, "Sleeping",
+                                             G_CALLBACK (upower_sleeping_cb),
+                                             self, NULL);
+
+                dbus_g_proxy_add_signal (self->upower_proxy, "Resuming", 
G_TYPE_INVALID);
+                dbus_g_proxy_connect_signal (self->upower_proxy, "Resuming",
+                                             G_CALLBACK (upower_resuming_cb),
+                                             self, NULL);
+        } else
+                nm_log_warn (LOGD_SUSPEND, "could not initialize UPower D-Bus 
proxy");
+        g_object_unref (bus);
+        g_object_unref (dbus_mgr);
+}
+
+static void
+finalize (GObject *object)
+{
+        NMSleepMonitor *self = NM_SLEEP_MONITOR (object);
+
+        if (self->upower_proxy)
+                g_object_unref (self->upower_proxy);
+
+        if (G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize != NULL)
+                G_OBJECT_CLASS (nm_sleep_monitor_parent_class)->finalize 
(object);
+}
+
+static void
+nm_sleep_monitor_class_init (NMSleepMonitorClass *klass)
+{
+        GObjectClass *gobject_class;
+
+        gobject_class = G_OBJECT_CLASS (klass);
+
+        gobject_class->finalize = finalize;
+
+        signals[SLEEPING] = g_signal_new (NM_SLEEP_MONITOR_SLEEPING,
+                                          NM_TYPE_SLEEP_MONITOR,
+                                          G_SIGNAL_RUN_LAST,
+                                          G_STRUCT_OFFSET 
(NMSleepMonitorClass, sleeping),
+                                          NULL,                   /* 
accumulator      */
+                                          NULL,                   /* 
accumulator data */
+                                          g_cclosure_marshal_VOID__VOID,
+                                          G_TYPE_NONE, 0);
+        signals[RESUMING] = g_signal_new (NM_SLEEP_MONITOR_RESUMING,
+                                          NM_TYPE_SLEEP_MONITOR,
+                                          G_SIGNAL_RUN_LAST,
+                                          G_STRUCT_OFFSET 
(NMSleepMonitorClass, resuming),
+                                          NULL,                   /* 
accumulator      */
+                                          NULL,                   /* 
accumulator data */
+                                          g_cclosure_marshal_VOID__VOID,
+                                          G_TYPE_NONE, 0);
+}
+
+NMSleepMonitor *
+nm_sleep_monitor_get (void)
+{
+        static NMSleepMonitor *singleton = NULL;
+
+        if (singleton)
+                return g_object_ref (singleton);
+
+        singleton = NM_SLEEP_MONITOR (g_object_new (NM_TYPE_SLEEP_MONITOR, 
NULL));
+        return singleton;
+}
+
+/* 
----------------------------------------------------------------------------------------------------
 */
Index: NetworkManager-0.9.6.4/src/nm-sleep-monitor.h
===================================================================
--- /dev/null
+++ NetworkManager-0.9.6.4/src/nm-sleep-monitor.h
@@ -0,0 +1,46 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* 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 2012 Red Hat, Inc.
+ * Author: Matthias Clasen <[email protected]>
+ */
+
+#ifndef NM_SLEEP_MONITOR_H
+#define NM_SLEEP_MONITOR_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NM_TYPE_SLEEP_MONITOR         (nm_sleep_monitor_get_type ())
+#define NM_SLEEP_MONITOR(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), 
NM_TYPE_SLEEP_MONITOR, NMSleepMonitor))
+#define NM_SLEEP_MONITOR_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), 
NM_TYPE_SLEEP_MONITOR, NMSleepMonitorClass))
+#define NM_SLEEP_MONITOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), 
NM_TYPE_SLEEP_MONITOR, NMSleepMonitorClass))
+#define NM_IS_SLEEP_MONITOR(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), 
NM_TYPE_SLEEP_MONITOR))
+#define NM_IS_SLEEP_MONITOR_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), 
NM_TYPE_SLEEP_MONITOR))
+
+#define NM_SLEEP_MONITOR_SLEEPING "sleeping"
+#define NM_SLEEP_MONITOR_RESUMING "resuming"
+
+typedef struct _NMSleepMonitor         NMSleepMonitor;
+typedef struct _NMSleepMonitorClass    NMSleepMonitorClass;
+
+GType           nm_sleep_monitor_get_type     (void) G_GNUC_CONST;
+NMSleepMonitor *nm_sleep_monitor_get          (void);
+
+G_END_DECLS
+
+#endif /* NM_SLEEP_MONITOR_H */
+
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to