Commit 1ecd3ef9 authored by John Palmieri's avatar John Palmieri Committed by John Palmieri
Browse files

2004-10-26 John (J5) Palmieri <johnp@redhat.com>

        * info-daemon/NetworkManagerInfoDbus.c
                - (nmi_dbus_is_running): New function for determining if nmi is already running
                - (nmi_dbus_service_init): exit if another instance of nmi is already running


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@273 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent 9c509ddd
2004-10-26 John (J5) Palmieri <johnp@redhat.com>
* info-daemon/NetworkManagerInfoDbus.c
- (nmi_dbus_is_running): New function for determining if nmi is already running
- (nmi_dbus_service_init): exit if another instance of nmi is already running
2004-10-23 Dan Williams <dcbw@redhat.com> 2004-10-23 Dan Williams <dcbw@redhat.com>
* info-daemon/NetworkManagerInfoDbus.c * info-daemon/NetworkManagerInfoDbus.c
......
...@@ -706,9 +706,28 @@ static DBusHandlerResult nmi_dbus_filter (DBusConnection *connection, DBusMessag ...@@ -706,9 +706,28 @@ static DBusHandlerResult nmi_dbus_filter (DBusConnection *connection, DBusMessag
return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED); return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
} }
/*
* nmi_dbus_is_running
*
* Ask dbus whether or not another instance of NetworkManagerInfo is running
*
*/
static gboolean nmi_dbus_is_running (DBusConnection *connection)
{
DBusError error;
gboolean exists;
g_return_val_if_fail (connection != NULL, FALSE);
dbus_error_init (&error);
exists = dbus_bus_service_exists (connection, NMI_DBUS_SERVICE, &error);
if (dbus_error_is_set (&error))
dbus_error_free (&error);
return (exists);
}
/* /*
* nmwa_dbus_nm_is_running * nmi_dbus_nm_is_running
* *
* Ask dbus whether or not NetworkManager is running * Ask dbus whether or not NetworkManager is running
* *
...@@ -738,6 +757,10 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info) ...@@ -738,6 +757,10 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
DBusError dbus_error; DBusError dbus_error;
DBusObjectPathVTable nmi_vtable = { &nmi_dbus_nmi_unregister_handler, &nmi_dbus_nmi_message_handler, NULL, NULL, NULL, NULL }; DBusObjectPathVTable nmi_vtable = { &nmi_dbus_nmi_unregister_handler, &nmi_dbus_nmi_message_handler, NULL, NULL, NULL, NULL };
/*return if we are already running in another instance*/
if (nmi_dbus_is_running (dbus_connection))
return (-1);
dbus_error_init (&dbus_error); dbus_error_init (&dbus_error);
dbus_bus_acquire_service (dbus_connection, NMI_DBUS_SERVICE, 0, &dbus_error); dbus_bus_acquire_service (dbus_connection, NMI_DBUS_SERVICE, 0, &dbus_error);
if (dbus_error_is_set (&dbus_error)) if (dbus_error_is_set (&dbus_error))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment