[network-manager-netbook/MplPanelClient] Fix system settings handling



commit e7986b46d4cbb259f14544a8a16be138a780f268
Author: Tambet Ingo <tambet gmail com>
Date:   Thu Nov 12 11:25:36 2009 +0200

    Fix system settings handling

 src/nmn-device-handler.c |   28 ++++++++++++++++++++--------
 src/nmn-nm-data.c        |    4 ++--
 2 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/src/nmn-device-handler.c b/src/nmn-device-handler.c
index 493aec8..4f56fa7 100644
--- a/src/nmn-device-handler.c
+++ b/src/nmn-device-handler.c
@@ -46,7 +46,8 @@ typedef struct {
     GSList *items;
     gboolean started;
     gulong device_state_changed_id;
-    gulong connection_added_id;
+    gulong user_connection_added_id;
+    gulong system_connection_added_id;
 
     gboolean disposed;
 } NmnDeviceHandlerPrivate;
@@ -117,12 +118,16 @@ nmn_device_handler_start (NmnDeviceHandler *self)
                                                       G_CALLBACK (device_state_changed), self);
 
     settings = nmn_nm_data_get_user_settings (priv->nm_data);
-    if (settings) {
-        priv->connection_added_id = g_signal_connect (settings,
-                                                      NM_SETTINGS_INTERFACE_NEW_CONNECTION,
-                                                      G_CALLBACK (connection_added),
-                                                      self);
-    }
+    if (settings)
+        priv->user_connection_added_id = g_signal_connect (settings,
+                                                           NM_SETTINGS_INTERFACE_NEW_CONNECTION,
+                                                           G_CALLBACK (connection_added),
+                                                           self);
+
+    settings = nmn_nm_data_get_system_settings (priv->nm_data);
+    if (settings)
+        priv->system_connection_added_id = g_signal_connect (settings, "new-connection",
+                                                             G_CALLBACK (connection_added), self);
 
     nmn_device_handler_add_items (self);
 }
@@ -190,6 +195,10 @@ nmn_device_handler_get_connections (NmnDeviceHandler *self)
     if (settings)
         list = nm_settings_interface_list_connections (settings);
 
+    settings = nmn_nm_data_get_system_settings (priv->nm_data);
+    if (settings)
+        list = g_slist_concat (list, nm_settings_interface_list_connections (settings));
+
     return list;
 }
 
@@ -313,7 +322,10 @@ dispose (GObject *object)
     g_signal_handler_disconnect (priv->device, priv->device_state_changed_id);
 
     settings = nmn_nm_data_get_user_settings (priv->nm_data);
-    g_signal_handler_disconnect (settings, priv->connection_added_id);
+    g_signal_handler_disconnect (settings, priv->user_connection_added_id);
+
+    settings = nmn_nm_data_get_system_settings (priv->nm_data);
+    g_signal_handler_disconnect (settings, priv->system_connection_added_id);
 
     g_slist_foreach (priv->items, (GFunc) g_object_unref, NULL);
     g_slist_free (priv->items);
diff --git a/src/nmn-nm-data.c b/src/nmn-nm-data.c
index ac02135..f0d0dd3 100644
--- a/src/nmn-nm-data.c
+++ b/src/nmn-nm-data.c
@@ -17,7 +17,7 @@
  * (C) Copyright 2009 Novell, Inc.
  */
 
-#include <nm-remote-settings.h>
+#include <nm-remote-settings-system.h>
 #include "nmn-nm-data.h"
 #include "nma-gconf-settings.h"
 
@@ -236,7 +236,7 @@ constructor (GType type,
 
     bus = nm_object_get_connection (NM_OBJECT (object));
     priv->user_settings = NM_SETTINGS_INTERFACE (nma_gconf_settings_new (bus));
-    priv->system_settings = NM_SETTINGS_INTERFACE (nm_remote_settings_new (bus, NM_CONNECTION_SCOPE_SYSTEM));
+    priv->system_settings = NM_SETTINGS_INTERFACE (nm_remote_settings_system_new (bus));
 
     g_signal_connect (object,
                       "notify::" NM_CLIENT_STATE,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]