2006-10-13 Dan Williams <dcbw@redhat.com>

* Huge DBus refactor:
		- Create a "DBus Manager" object which manages the connection and
		sends signals on NameOwnerChanged and connection/disconnection events,
		handles reconnection to the bus if NM gets kicked off, and abstracts
		signal handling
		- Remove DBusConnection members from places where they are no
		longer needed due to the refactor, like the dbus-connection
		property of the named manager, and from NMData
		- Reformats a bunch of the code to gnome style
		(8-space tabs, braces on same line as statement, 80-col width).
		Consider it open season to reformat any bits to gnome style.
		style that aren't already.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2061 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2006-10-13 19:41:47 +00:00
parent 129d0ca46d
commit 84678fc9fe
38 changed files with 4569 additions and 2771 deletions

View File

@@ -27,6 +27,7 @@
#include "nm-device.h"
#include "NetworkManagerDbus.h"
#include "nm-dhcp-manager.h"
#include "nm-dbus-manager.h"
#include "nm-utils.h"
@@ -170,7 +171,9 @@ NMActStage nm_act_request_get_stage (NMActRequest *req)
void nm_act_request_set_stage (NMActRequest *req, NMActStage stage)
{
DBusMessage * message;
char * dev_path;
char * dev_path = NULL;
NMDBusManager * dbus_mgr = NULL;
DBusConnection *dbus_connection;
g_return_if_fail (req != NULL);
@@ -179,23 +182,34 @@ void nm_act_request_set_stage (NMActRequest *req, NMActStage stage)
g_return_if_fail (req->data);
g_return_if_fail (req->dev);
if (!(dev_path = nm_dbus_get_object_path_for_device (req->dev)))
return;
if (!(message = dbus_message_new_signal (NM_DBUS_PATH, NM_DBUS_INTERFACE, "DeviceActivationStage")))
{
nm_warning ("nm_act_request_set_stage(): Not enough memory for new dbus message!");
g_free (dev_path);
return;
dbus_mgr = nm_dbus_manager_get (NULL);
dbus_connection = nm_dbus_manager_get_dbus_connection (dbus_mgr);
if (!dbus_connection) {
nm_warning ("couldn't get the dbus connection.");
goto out;
}
dbus_message_append_args (message, DBUS_TYPE_OBJECT_PATH, &dev_path, DBUS_TYPE_UINT32, &stage, DBUS_TYPE_INVALID);
g_free (dev_path);
if (!(dev_path = nm_dbus_get_object_path_for_device (req->dev)))
goto out;
if (!dbus_connection_send (req->data->dbus_connection, message, NULL))
nm_warning ("nm_act_request_set_stage(): Could not raise the signal!");
message = dbus_message_new_signal (NM_DBUS_PATH,
NM_DBUS_INTERFACE,
"DeviceActivationStage");
if (!message) {
nm_warning ("couldn't allocate the dbus message.");
goto out;
}
dbus_message_append_args (message,
DBUS_TYPE_OBJECT_PATH, &dev_path,
DBUS_TYPE_UINT32, &stage,
DBUS_TYPE_INVALID);
dbus_connection_send (dbus_connection, message, NULL);
dbus_message_unref (message);
out:
g_free (dev_path);
g_object_unref (dbus_mgr);
}
DBusPendingCall * nm_act_request_get_user_key_pending_call (NMActRequest *req)