mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 02:35:25 +00:00
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 git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3674 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
40a69f986c
commit
6c79f46f13
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
|||
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
|
||||
|
||||
2008-05-15 Tambet Ingo <tambet@gmail.com>
|
||||
|
||||
Move crypto functions from nm-applet to libnm-util.
|
||||
|
|
|
@ -19,7 +19,6 @@ nm_system_settings_SOURCES = \
|
|||
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 \
|
||||
|
|
|
@ -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 @@ typedef struct {
|
|||
|
||||
DBusGProxy *bus_proxy;
|
||||
NMSystemConfigHalManager *hal_mgr;
|
||||
gboolean started;
|
||||
|
||||
NMSysconfigSettings *settings;
|
||||
GMainLoop *loop;
|
||||
|
@ -62,8 +60,9 @@ typedef struct {
|
|||
} 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 @@ device_removed_cb (DBusGProxy *proxy, const char *udi, NMDeviceType devtype, gpo
|
|||
|
||||
/******************************************************************/
|
||||
|
||||
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 @@ dbus_cleanup (Application *app)
|
|||
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 @@ destroy_cb (DBusGProxy *proxy, gpointer user_data)
|
|||
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 @@ start_dbus_service (Application *app)
|
|||
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 @@ start_dbus_service (Application *app)
|
|||
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 @@ dbus_init (Application *app)
|
|||
"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 @@ main (int argc, char **argv)
|
|||
|
||||
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 ();
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2008 Dan Williams
|
||||
*
|
||||
* 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, 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., 59 Temple Place - Suite 330, Boston, MA
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* *** Not to be used by system settings service plugins *** */
|
||||
|
||||
#ifndef NM_SYSTEM_CONFIG_HAL_MANAGER_PRIVATE_H
|
||||
#define NM_SYSTEM_CONFIG_HAL_MANAGER_PRIVATE_H
|
||||
|
||||
#include "nm-system-config-hal-manager.h"
|
||||
|
||||
NMSystemConfigHalManager *nm_system_config_hal_manager_get (DBusGConnection *g_connection);
|
||||
|
||||
void nm_system_config_hal_manager_reinit_dbus (NMSystemConfigHalManager *manager,
|
||||
DBusGConnection *g_connection);
|
||||
|
||||
void nm_system_config_hal_manager_deinit_dbus (NMSystemConfigHalManager *manager);
|
||||
|
||||
#endif /* NM_SYSTEM_CONFIG_HAL_MANAGER_PRIVATE_H */
|
|
@ -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 @@ nm_system_config_hal_manager_class_init (NMSystemConfigHalManagerClass *manager_
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue