NetworkManager r3674 - in trunk: . system-settings/src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3674 - in trunk: . system-settings/src
- Date: Mon, 19 May 2008 16:13:32 +0000 (UTC)
Author: dcbw
Date: Mon May 19 16:13:31 2008
New Revision: 3674
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3674&view=rev
Log:
2008-05-19 Dan Williams <dcbw redhat com>
Make the system settings service exit when the bus goes away. Since it's
a bus-activated service, it's lifetime is limited to the bus that activated
it (rh #444976).
* system-settings/src/Makefile.am
system-settings/src/nm-system-config-hal-manager-private.h
- Remove nm-system-config-hal-manager-private.h
* system-settings/src/nm-system-config-hal-manager.c
- (nm_system_config_hal_manager_reinit_dbus,
nm_system_config_hal_manager_deinit_dbus): remove
* system-settings/src/main.c
- (dbus_reconnect): remove
- (dbus_cleanup): don't tell the HAL manager to deinit dbus
- (destroy_cb): just quit when the bus goes away
- (start_dbus_service, dbus_init): simplify
- (main): destroy the wired devices hash table after destroying
the HAL manager so we don't have to disconnect signals from the
HAL manager
Removed:
trunk/system-settings/src/nm-system-config-hal-manager-private.h
Modified:
trunk/ChangeLog
trunk/system-settings/src/Makefile.am
trunk/system-settings/src/main.c
trunk/system-settings/src/nm-system-config-hal-manager.c
Modified: trunk/system-settings/src/Makefile.am
==============================================================================
--- trunk/system-settings/src/Makefile.am (original)
+++ trunk/system-settings/src/Makefile.am Mon May 19 16:13:31 2008
@@ -19,7 +19,6 @@
nm-system-config-interface.h \
nm-system-config-hal-manager.c \
nm-system-config-hal-manager.h \
- nm-system-config-hal-manager-private.h \
nm-sysconfig-connection.c \
nm-sysconfig-connection.h \
sha1.c \
Modified: trunk/system-settings/src/main.c
==============================================================================
--- trunk/system-settings/src/main.c (original)
+++ trunk/system-settings/src/main.c Mon May 19 16:13:31 2008
@@ -44,7 +44,6 @@
#include "dbus-settings.h"
#include "nm-system-config-hal-manager.h"
-#include "nm-system-config-hal-manager-private.h"
#include "nm-system-config-interface.h"
typedef struct {
@@ -53,7 +52,6 @@
DBusGProxy *bus_proxy;
NMSystemConfigHalManager *hal_mgr;
- gboolean started;
NMSysconfigSettings *settings;
GMainLoop *loop;
@@ -62,8 +60,9 @@
} Application;
+NMSystemConfigHalManager *nm_system_config_hal_manager_get (DBusGConnection *g_connection);
+
static gboolean dbus_init (Application *app);
-static void dbus_cleanup (Application *app);
static gboolean start_dbus_service (Application *app);
static void destroy_cb (DBusGProxy *proxy, gpointer user_data);
static void device_added_cb (DBusGProxy *proxy, const char *udi, NMDeviceType devtype, gpointer user_data);
@@ -400,23 +399,6 @@
/******************************************************************/
-static gboolean
-dbus_reconnect (gpointer user_data)
-{
- Application *app = (Application *) user_data;
-
- if (dbus_init (app)) {
- if (start_dbus_service (app)) {
- g_message ("reconnected to the system bus.");
- nm_system_config_hal_manager_reinit_dbus (app->hal_mgr, app->g_connection);
- return TRUE;
- }
- }
-
- dbus_cleanup (app);
- return FALSE;
-}
-
static void
dbus_cleanup (Application *app)
{
@@ -431,10 +413,6 @@
g_object_unref (app->bus_proxy);
app->bus_proxy = NULL;
}
-
- nm_system_config_hal_manager_deinit_dbus (app->hal_mgr);
-
- app->started = FALSE;
}
static void
@@ -443,10 +421,8 @@
Application *app = (Application *) user_data;
/* Clean up existing connection */
- g_warning ("disconnected by the system bus.");
- dbus_cleanup (app);
-
- g_timeout_add (3000, dbus_reconnect, app);
+ g_warning ("disconnected from the system bus, exiting.");
+ g_main_loop_quit (app->loop);
}
static gboolean
@@ -455,11 +431,6 @@
int request_name_result;
GError *err = NULL;
- if (app->started) {
- g_warning ("Service has already started.");
- return FALSE;
- }
-
if (!dbus_g_proxy_call (app->bus_proxy, "RequestName", &err,
G_TYPE_STRING, NM_DBUS_SERVICE_SYSTEM_SETTINGS,
G_TYPE_UINT, DBUS_NAME_FLAG_DO_NOT_QUEUE,
@@ -469,23 +440,17 @@
g_warning ("Could not acquire the NetworkManagerSystemSettings service.\n"
" Message: '%s'", err->message);
g_error_free (err);
- goto out;
+ return FALSE;
}
if (request_name_result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
g_warning ("Could not acquire the NetworkManagerSystemSettings service "
"as it is already taken. Return: %d",
request_name_result);
- goto out;
+ return FALSE;
}
- app->started = TRUE;
-
-out:
- if (!app->started)
- dbus_cleanup (app);
-
- return app->started;
+ return TRUE;
}
static gboolean
@@ -513,16 +478,12 @@
"org.freedesktop.DBus");
if (!app->bus_proxy) {
g_warning ("Could not get the DBus object!");
- goto error;
+ return FALSE;
}
g_signal_connect (app->bus_proxy, "destroy", G_CALLBACK (destroy_cb), app);
return TRUE;
-
-error:
- dbus_cleanup (app);
- return FALSE;
}
static gboolean
@@ -682,11 +643,13 @@
g_main_loop_run (app->loop);
- g_hash_table_destroy (app->wired_devices);
-
g_object_unref (app->settings);
g_object_unref (app->hal_mgr);
+ g_hash_table_destroy (app->wired_devices);
+
+ dbus_cleanup (app);
+
if (!debug)
logging_shutdown ();
Modified: trunk/system-settings/src/nm-system-config-hal-manager.c
==============================================================================
--- trunk/system-settings/src/nm-system-config-hal-manager.c (original)
+++ trunk/system-settings/src/nm-system-config-hal-manager.c Mon May 19 16:13:31 2008
@@ -26,7 +26,8 @@
#include "nm-marshal.h"
#include "nm-dbus-glib-types.h"
#include "nm-system-config-hal-manager.h"
-#include "nm-system-config-hal-manager-private.h"
+
+NMSystemConfigHalManager *nm_system_config_hal_manager_get (DBusGConnection *g_connection);
#define NUM_DEVICE_TYPES DEVICE_TYPE_CDMA
@@ -320,19 +321,6 @@
G_TYPE_UINT);
}
-void
-nm_system_config_hal_manager_reinit_dbus (NMSystemConfigHalManager *manager,
- DBusGConnection *g_connection)
-{
- init_dbus (manager, g_connection);
-}
-
-void
-nm_system_config_hal_manager_deinit_dbus (NMSystemConfigHalManager *manager)
-{
- cleanup_dbus (manager);
-}
-
typedef struct {
NMDeviceType devtype;
GSList **list;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]