Commit a5d937a6 authored by Ray Strode's avatar Ray Strode
Browse files

2005-03-07 Ray Strode <rstrode@redhat.com>

	* info-daemon/NetworkManagerInfoDbus.c:
	* libnm_glib/libnm_glib.c:
	* panel-applet/NMWirelessAppletDbus.c:
	* src/NetworkManager.c:
	* src/NetworkManagerDbus.c:
	* src/NetworkManagerDevice.c:
	* src/NetworkManagerUtils.c:
	* src/nm-dbus-device.c:
	* src/nm-dbus-dhcp.c:
	* src/nm-dbus-net.c:
	* src/nm-dbus-nm.c:
	* test/nminfotest.c:
	First (unfinished, unworking) cut at porting to dbus 0.30 api.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@493 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
parent bd14854d
2005-03-07 Ray Strode <rstrode@redhat.com>
* info-daemon/NetworkManagerInfoDbus.c:
* libnm_glib/libnm_glib.c:
* panel-applet/NMWirelessAppletDbus.c:
* src/NetworkManager.c:
* src/NetworkManagerDbus.c:
* src/NetworkManagerDevice.c:
* src/NetworkManagerUtils.c:
* src/nm-dbus-device.c:
* src/nm-dbus-dhcp.c:
* src/nm-dbus-net.c:
* src/nm-dbus-nm.c:
* test/nminfotest.c:
First (unfinished, unworking) cut at porting to dbus 0.30 api.
2005-03-04 Dan Williams <dcbw@redhat.com>
* configure.in
......
......@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <errno.h>
#include "NetworkManagerInfo.h"
#include "NetworkManagerInfoDbus.h"
......@@ -117,9 +118,6 @@ static void nmi_dbus_get_key_for_network (NMIAppInfo *info, DBusMessage *message
DBUS_TYPE_INVALID))
{
nmi_passphrase_dialog_show (device, network, info);
dbus_free (device);
dbus_free (network);
}
}
......@@ -145,12 +143,9 @@ static void nmi_dbus_get_vpn_userpass (NMIAppInfo *info, DBusMessage *message)
DBUS_TYPE_INVALID))
{
if (username[0] == '\0') {
dbus_free (username);
username = NULL;
}
nmi_vpn_request_password (info, message, vpn, username, retry);
dbus_free (vpn);
dbus_free (username);
}
}
......@@ -178,10 +173,10 @@ void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
}
/* Add network name and passphrase */
if (dbus_message_append_args (message, DBUS_TYPE_STRING, device,
DBUS_TYPE_STRING, network,
DBUS_TYPE_STRING, passphrase,
DBUS_TYPE_INT32, key_type,
if (dbus_message_append_args (message, DBUS_TYPE_STRING, &device,
DBUS_TYPE_STRING, &network,
DBUS_TYPE_STRING, &passphrase,
DBUS_TYPE_INT32, &key_type,
DBUS_TYPE_INVALID))
{
if (!dbus_connection_send (connection, message, NULL))
......@@ -213,7 +208,7 @@ void nmi_dbus_return_vpn_password (DBusConnection *connection, DBusMessage *mess
{
reply = dbus_message_new_method_return (message);
dbus_message_append_args (reply,
DBUS_TYPE_STRING, password,
DBUS_TYPE_STRING, &password,
DBUS_TYPE_INVALID);
}
dbus_connection_send (connection, reply, NULL);
......@@ -245,7 +240,7 @@ void nmi_dbus_signal_update_network (DBusConnection *connection, const char *net
return;
}
dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INVALID);
dbus_message_append_args (message, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID);
if (!dbus_connection_send (connection, message, NULL))
syslog (LOG_WARNING, "nmi_dbus_signal_update_network(): Could not raise the 'WirelessNetworkUpdate' signal!");
......@@ -294,8 +289,8 @@ static DBusMessage *nmi_dbus_get_networks (NMIAppInfo *info, DBusMessage *messag
gboolean value_added = FALSE;
reply_message = dbus_message_new_method_return (message);
dbus_message_iter_init (reply_message, &iter);
dbus_message_iter_append_array (&iter, &iter_array, DBUS_TYPE_STRING);
dbus_message_iter_init_append (reply_message, &iter);
dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &iter_array);
/* Append the essid of every allowed or ignored access point we know of
* to a string array in the dbus message.
......@@ -309,7 +304,9 @@ static DBusMessage *nmi_dbus_get_networks (NMIAppInfo *info, DBusMessage *messag
value = gconf_client_get (info->gconf_client, key, NULL);
if (value && gconf_value_get_string (value))
{
dbus_message_iter_append_string (&iter_array, gconf_value_get_string (value));
const gchar *essid;
essid = gconf_value_get_string (value);
dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_STRING, &essid);
value_added = TRUE;
gconf_value_free (value);
}
......@@ -319,6 +316,8 @@ static DBusMessage *nmi_dbus_get_networks (NMIAppInfo *info, DBusMessage *messag
}
g_slist_free (dir_list);
dbus_message_iter_close_container (&iter, &iter_array);
if (!value_added)
{
dbus_message_unref (reply_message);
......@@ -450,8 +449,20 @@ static DBusMessage *nmi_dbus_get_network_properties (NMIAppInfo *info, DBusMessa
}
else
{
char **array = NULL;
int num_items = 0;
DBusMessageIter iter, array_iter;
reply = dbus_message_new_method_return (message);
dbus_message_iter_init_append (reply, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &essid);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &timestamp);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &key);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &key_type);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &auth_method);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &trusted);
dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING_AS_STRING, &array_iter);
/* Add a string array of access point MAC addresses if the array is valid */
if ( ap_addrs_value
......@@ -460,31 +471,16 @@ static DBusMessage *nmi_dbus_get_network_properties (NMIAppInfo *info, DBusMessa
{
GSList *list = gconf_value_get_list (ap_addrs_value);
GSList *elt;
int i;
num_items = g_slist_length (list);
if (num_items > 0)
array = g_malloc0 (sizeof (char *) * num_items);
for (elt = list, i = 0; elt; elt = g_slist_next (elt), i++)
for (elt = list; elt; elt = g_slist_next (elt))
{
const char *string;
if ((string = gconf_value_get_string ((GConfValue *)elt->data)))
array[i] = g_strdup (string);
dbus_message_iter_append_basic (&array_iter, DBUS_TYPE_STRING, &string);
}
}
reply = dbus_message_new_method_return (message);
/* Add general properties to dbus reply */
dbus_message_append_args (reply, DBUS_TYPE_STRING, essid,
DBUS_TYPE_INT32, timestamp,
DBUS_TYPE_STRING, key,
DBUS_TYPE_INT32, key_type,
DBUS_TYPE_INT32, auth_method,
DBUS_TYPE_BOOLEAN, trusted,
DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, array, num_items,
DBUS_TYPE_INVALID);
dbus_message_iter_close_container (&iter, &array_iter);
}
gconf_value_free (ap_addrs_value);
......@@ -492,7 +488,6 @@ static DBusMessage *nmi_dbus_get_network_properties (NMIAppInfo *info, DBusMessa
g_free (key);
g_free (escaped_network);
dbus_free (network);
return (reply);
}
......@@ -633,7 +628,6 @@ static DBusMessage *nmi_dbus_add_network_address (NMIAppInfo *info, DBusMessage
g_slist_foreach (new_mac_list, (GFunc)g_free, NULL);
g_slist_free (new_mac_list);
dbus_free (addr);
g_free (key);
return (NULL);
......@@ -776,8 +770,6 @@ static DBusHandlerResult nmi_dbus_filter (DBusConnection *connection, DBusMessag
else if (dev)
nmi_show_warning_dialog (TRUE, "Connection to the wired network failed.\n");
dbus_free (dev);
dbus_free (net);
}
return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
......@@ -797,7 +789,7 @@ static gboolean nmi_dbus_nm_is_running (DBusConnection *connection)
g_return_val_if_fail (connection != NULL, FALSE);
dbus_error_init (&error);
exists = dbus_bus_service_exists (connection, NM_DBUS_SERVICE, &error);
exists = dbus_bus_name_has_owner (connection, NM_DBUS_SERVICE, &error);
if (dbus_error_is_set (&error))
dbus_error_free (&error);
return (exists);
......@@ -817,8 +809,8 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
int acquisition;
dbus_error_init (&dbus_error);
acquisition = dbus_bus_acquire_service (dbus_connection, NMI_DBUS_SERVICE,
DBUS_SERVICE_FLAG_PROHIBIT_REPLACEMENT,
acquisition = dbus_bus_request_name (dbus_connection, NMI_DBUS_SERVICE,
DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT,
&dbus_error);
if (dbus_error_is_set (&dbus_error))
{
......@@ -826,7 +818,7 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
dbus_error_free (&dbus_error);
return (-1);
}
if (acquisition & DBUS_SERVICE_REPLY_SERVICE_EXISTS) {
if (acquisition == DBUS_REQUEST_NAME_REPLY_EXISTS) {
exit (0);
}
......@@ -858,8 +850,8 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
dbus_bus_add_match(dbus_connection,
"type='signal',"
"interface='" DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS "',"
"sender='" DBUS_SERVICE_ORG_FREEDESKTOP_DBUS "'",
"interface='" DBUS_INTERFACE_DBUS "',"
"sender='" DBUS_SERVICE_DBUS "'",
&dbus_error);
if (dbus_error_is_set (&dbus_error))
{
......@@ -869,3 +861,108 @@ int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
return (0);
}
gchar *nm_dbus_escape_object_path (const gchar *utf8_string)
{
const gchar *p;
gchar *object_path;
GString *string;
g_return_val_if_fail (utf8_string != NULL, NULL);
g_return_val_if_fail (g_utf8_validate (utf8_string, -1, NULL), NULL);
string = g_string_sized_new ((strlen (utf8_string) + 1) * 6);
for (p = utf8_string; *p != '\0'; p = g_utf8_next_char (p))
{
gunichar character;
character = g_utf8_get_char (p);
if (((character >= ((gunichar) 'a')) &&
(character <= ((gunichar) 'z'))) ||
((character >= ((gunichar) 'A')) &&
(character <= ((gunichar) 'Z'))) ||
((character >= ((gunichar) '0')) &&
(character <= ((gunichar) '9'))) ||
(character == ((gunichar) '/')))
{
g_string_append_c (string, (gchar) character);
continue;
}
g_string_append_printf (string, "_%x_", character);
}
object_path = string->str;
g_string_free (string, FALSE);
return object_path;
}
gchar *nm_dbus_unescape_object_path (const gchar *object_path)
{
const gchar *p;
gchar *utf8_string;
GString *string;
g_return_val_if_fail (object_path != NULL, NULL);
string = g_string_sized_new (strlen (object_path) + 1);
for (p = object_path; *p != '\0'; p++)
{
const gchar *q;
gchar *hex_digits, *end, utf8_character[6] = { '\0' };
gint utf8_character_size;
gunichar character;
gulong hex_value;
if (*p != '_')
{
g_string_append_c (string, *p);
continue;
}
q = strchr (p + 1, '_');
if ((q == NULL) || (q == p + 1))
{
g_string_free (string, TRUE);
return NULL;
}
hex_digits = g_strndup (p + 1, (q - 1) - p);
hex_value = strtoul (hex_digits, &end, 16);
character = (gunichar) hex_value;
if (((hex_value == G_MAXLONG) && (errno == ERANGE)) ||
(hex_value > G_MAXUINT32) ||
(*end != '\0') ||
(!g_unichar_validate (character)))
{
g_free (hex_digits);
g_string_free (string, TRUE);
return NULL;
}
utf8_character_size =
g_unichar_to_utf8 (character, utf8_character);
g_assert (utf8_character_size > 0);
g_string_append_len (string, utf8_character,
utf8_character_size);
p = q;
}
utf8_string = string->str;
g_string_free (string, FALSE);
return utf8_string;
}
......@@ -189,7 +189,7 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
dbus_error_init (&error);
if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL, "Disconnected"))
if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected"))
{
/* Try to reactivate our connection to dbus on the next pass through the event loop */
ctx->nm_status = LIBNM_NO_DBUS;
......@@ -197,7 +197,7 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu
libnm_glib_schedule_dbus_watcher (ctx);
}
#if (DBUS_VERSION_MAJOR == 0 && DBUS_VERSION_MINOR == 22)
else if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceCreated"))
else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "ServiceCreated"))
{
char *service;
......@@ -209,7 +209,7 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu
g_free (status_string);
}
}
else if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceDeleted"))
else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "ServiceDeleted"))
{
char *service;
......@@ -220,7 +220,7 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu
}
}
#elif (DBUS_VERSION_MAJOR == 0 && DBUS_VERSION_MINOR == 23)
else if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceOwnerChanged"))
else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "ServiceOwnerChanged"))
{
/* New signal for dbus 0.23... */
char *service;
......@@ -249,6 +249,37 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu
}
}
}
#elif ((DBUS_VERSION_MAJOR == 0) && ((DBUS_VERSION_MINOR == 30) || (DBUS_VERSION_MINOR == 31)))
else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
{
/* New signal for dbus 0.23... */
char *service;
char *old_owner;
char *new_owner;
if ( dbus_message_get_args (message, &error,
DBUS_TYPE_STRING, &service,
DBUS_TYPE_STRING, &old_owner,
DBUS_TYPE_STRING, &new_owner,
DBUS_TYPE_INVALID))
{
if (strcmp (service, NM_DBUS_SERVICE) == 0)
{
gboolean old_owner_good = (old_owner && (strlen (old_owner) > 0));
gboolean new_owner_good = (new_owner && (strlen (new_owner) > 0));
if (!old_owner_good && new_owner_good) /* Equivalent to old ServiceCreated signal */
{
char *status_string = libnm_glib_get_nm_status (ctx->dbus_con);
libnm_glib_update_status (ctx, status_string);
g_free (status_string);
}
else if (old_owner_good && !new_owner_good) /* Equivalent to old ServiceDeleted signal */
ctx->nm_status = LIBNM_NO_NETWORKMANAGER;
}
}
}
#else
#error "Unrecognized version of DBUS."
#endif
......@@ -312,8 +343,8 @@ static DBusConnection * libnm_glib_dbus_init (gpointer *user_data, GMainContext
dbus_error_init (&error);
dbus_bus_add_match(connection,
"type='signal',"
"interface='" DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS "',"
"sender='" DBUS_SERVICE_ORG_FREEDESKTOP_DBUS "'",
"interface='" DBUS_INTERFACE_DBUS "',"
"sender='" DBUS_SERVICE_DBUS "'",
&error);
if (dbus_error_is_set (&error))
dbus_error_free (&error);
......
......@@ -33,10 +33,8 @@
#define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist"
/* dbus doesn't define a DBUS_TYPE_STRING_ARRAY so we fake one here for consistency */
#define DBUS_TYPE_STRING_ARRAY ((int) '$')
/*
* nmwa_dbus_call_nm_method
*
......@@ -150,6 +148,7 @@ static int nmwa_dbus_call_nm_method (DBusConnection *con, const char *path, cons
case DBUS_TYPE_STRING_ARRAY:
*((char ***)(arg)) = g_strdupv (dbus_string_array);
*item_count = num_items;
g_strfreev (dbus_string_array);
break;
case DBUS_TYPE_INT32:
case DBUS_TYPE_UINT32:
......@@ -546,7 +545,7 @@ static char *nmwa_dbus_get_hal_device_string_property (DBusConnection *connectio
return (NULL);
dbus_error_init (&error);
dbus_message_append_args (message, DBUS_TYPE_STRING, property_name, DBUS_TYPE_INVALID);
dbus_message_append_args (message, DBUS_TYPE_STRING, &property_name, DBUS_TYPE_INVALID);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
dbus_message_unref (message);
if (dbus_error_is_set (&error))
......@@ -590,6 +589,7 @@ static char *nmwa_dbus_get_hal_device_info (DBusConnection *connection, const ch
DBusMessage *reply;
gboolean exists = FALSE;
char *info = NULL;
const char *product;
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (udi != NULL, NULL);
......@@ -599,7 +599,8 @@ static char *nmwa_dbus_get_hal_device_info (DBusConnection *connection, const ch
return (NULL);
dbus_error_init (&error);
dbus_message_append_args (message, DBUS_TYPE_STRING, "info.product", DBUS_TYPE_INVALID);
product = "info.product";
dbus_message_append_args (message, DBUS_TYPE_STRING, &product, DBUS_TYPE_INVALID);
reply = dbus_connection_send_with_reply_and_block (connection, message, -1, &error);
dbus_message_unref (message);
if (dbus_error_is_set (&error))
......@@ -652,16 +653,20 @@ void nmwa_dbus_set_device (DBusConnection *connection, const NetworkDevice *dev,
if ((dev->type == DEVICE_TYPE_WIRELESS_ETHERNET) && network && network->essid)
{
fprintf (stderr, "Forcing device '%s' and network '%s' %s passphrase\n", dev->nm_device, network->essid, passphrase ? "with" : "without");
dbus_message_append_args (message, DBUS_TYPE_STRING, dev->nm_device,
DBUS_TYPE_STRING, network->essid,
DBUS_TYPE_STRING, (passphrase ? passphrase : ""),
DBUS_TYPE_INT32, key_type,
if (passphrase == NULL)
passphrase = "";
dbus_message_append_args (message, DBUS_TYPE_STRING, &dev->nm_device,
DBUS_TYPE_STRING, &network->essid,
DBUS_TYPE_STRING, &passphrase,
DBUS_TYPE_INT32, &key_type,
DBUS_TYPE_INVALID);
}
else
{
fprintf (stderr, "Forcing device '%s'\n", dev->nm_device);
dbus_message_append_args (message, DBUS_TYPE_STRING, dev->nm_device, DBUS_TYPE_INVALID);
dbus_message_append_args (message, DBUS_TYPE_STRING, &dev->nm_device, DBUS_TYPE_INVALID);
}
dbus_connection_send (connection, message, NULL);
}
......@@ -690,10 +695,12 @@ void nmwa_dbus_create_network (DBusConnection *connection, const NetworkDevice *
if (network && network->essid)
{
fprintf (stderr, "Creating network '%s' %s passphrase on device '%s'.\n", network->essid, passphrase ? "with" : "without", dev->nm_device);
dbus_message_append_args (message, DBUS_TYPE_STRING, dev->nm_device,
DBUS_TYPE_STRING, network->essid,
DBUS_TYPE_STRING, (passphrase ? passphrase : ""),
DBUS_TYPE_INT32, key_type,
if (passphrase == NULL)
passphrase = "";
dbus_message_append_args (message, DBUS_TYPE_STRING, &dev->nm_device,
DBUS_TYPE_STRING, &network->essid,
DBUS_TYPE_STRING, &passphrase,
DBUS_TYPE_INT32, &key_type,
DBUS_TYPE_INVALID);
}
dbus_connection_send (connection, message, NULL);
......@@ -718,7 +725,7 @@ void nmwa_dbus_enable_scanning (NMWirelessApplet *applet, gboolean enabled)
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "setScanningEnabled")))
{
dbus_message_append_args (message, DBUS_TYPE_BOOLEAN, enabled, DBUS_TYPE_INVALID);
dbus_message_append_args (message, DBUS_TYPE_BOOLEAN, &enabled, DBUS_TYPE_INVALID);
dbus_connection_send (applet->connection, message, NULL);
applet->scanning_enabled = nmwa_dbus_get_scanning_enabled (applet);
}
......@@ -740,7 +747,7 @@ void nmwa_dbus_enable_wireless (NMWirelessApplet *applet, gboolean enabled)
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "setWirelessEnabled")))
{
dbus_message_append_args (message, DBUS_TYPE_BOOLEAN, enabled, DBUS_TYPE_INVALID);
dbus_message_append_args (message, DBUS_TYPE_BOOLEAN, &enabled, DBUS_TYPE_INVALID);
dbus_connection_send (applet->connection, message, NULL);
applet->wireless_enabled = nmwa_dbus_get_wireless_enabled (applet);
}
......@@ -1475,33 +1482,9 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
dbus_error_init (&error);
#if (DBUS_VERSION_MAJOR == 0 && DBUS_VERSION_MINOR == 22)
/* Old signal names for dbus <= 0.22 */
if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceCreated"))
{
char *service;
if ( dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &service, DBUS_TYPE_INVALID)
&& (strcmp (service, NM_DBUS_SERVICE) == 0) && (applet->applet_state == APPLET_STATE_NO_NM))
applet->applet_state = APPLET_STATE_NO_CONNECTION;
}
else if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceDeleted"))
if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
{
char *service;
if (dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &service, DBUS_TYPE_INVALID))
{
if (strcmp (service, NM_DBUS_SERVICE) == 0)
applet->applet_state = APPLET_STATE_NO_NM;
else if (strcmp (service, NMI_DBUS_SERVICE) == 0)
gtk_main_quit (); /* Just die if NetworkManagerInfo dies */
}
}
#elif (DBUS_VERSION_MAJOR == 0 && DBUS_VERSION_MINOR == 23)
if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceOwnerChanged"))
{
/* New signal for dbus 0.23... */
char *service;
char *old_owner;
char *new_owner;
......@@ -1530,9 +1513,6 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
}
}
}
#else
#error "Unrecognized version of DBUS."
#endif
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "WirelessNetworkUpdate"))
nmwa_dbus_device_update_one_network (applet, message);
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive")
......@@ -1567,7 +1547,7 @@ static gboolean nmwa_dbus_nm_is_running (DBusConnection *connection)
g_return_val_if_fail (connection != NULL, FALSE);
dbus_error_init (&error);
exists = dbus_bus_service_exists (connection, NM_DBUS_SERVICE, &error);
exists = dbus_bus_name_has_owner (connection, NM_DBUS_SERVICE, &error);
if (dbus_error_is_set (&error))
dbus_error_free (&error);
return (exists);
......@@ -1605,8 +1585,8 @@ static DBusConnection * nmwa_dbus_init (NMWirelessApplet *applet, GMainContext *
dbus_bus_add_match(connection,
"type='signal',"
"interface='" DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS "',"
"sender='" DBUS_SERVICE_ORG_FREEDESKTOP_DBUS "'",
"interface='" DBUS_INTERFACE_DBUS "',"
"sender='" DBUS_SERVICE_DBUS "'",
&error);
if (dbus_error_is_set (&error))
dbus_error_free (&error);
......
......@@ -66,19 +66,19 @@ static char *nm_get_device_interface_from_hal (LibHalContext *ctx, const char *u
{
char *iface = NULL;
if (hal_device_property_exists (ctx, udi, "net.interface"))
if (libhal_device_property_exists (ctx, udi, "net.interface", NULL))
{
/* Only use Ethernet and Wireless devices at the moment */
if (hal_device_property_exists (ctx, udi, "info.category"))
if (libhal_device_property_exists (ctx, udi, "info.category", NULL))
{
char *category = hal_device_get_property_string (ctx, udi, "info.category");
char *category = libhal_device_get_property_string (ctx, udi, "info.category", NULL);
if (category && (!strcmp (category, "net.80203") || !strcmp (category, "net.80211")))
{
char *temp = hal_device_get_property_string (ctx, udi, "net.interface");
char *temp = libhal_device_get_property_string (ctx, udi, "net.interface", NULL);
iface = g_strdup (temp);
hal_free_string (temp);
libhal_free_string (temp);
}
hal_free_string (category);