diff --git a/ChangeLog b/ChangeLog index 30631f728d..31827b91d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-01-25 Dan Williams + + * panel-applet/NMWirelessAppletDbus.c + - (nmwa_dbus_filter): Fix dbus 0.23 ServiceOwnerChanged checks + so we check for NM_DBUS_SERVICE rather than not for it + + * libnm_glib/libnm_glib.c + - (libnm_glib_dbus_filter): Fix for dbus 0.23, trapping + ServiceOwnerChanged signal + 2005-01-25 Dan Williams * configure.in diff --git a/libnm_glib/libnm_glib.c b/libnm_glib/libnm_glib.c index 60b27a45d6..31b1802dee 100644 --- a/libnm_glib/libnm_glib.c +++ b/libnm_glib/libnm_glib.c @@ -195,7 +195,8 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu dbus_connection_disconnect (ctx->dbus_con); libnm_glib_schedule_dbus_watcher (ctx); } - if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceCreated")) +#if (DBUS_VERSION_MAJOR == 0 && DBUS_VERSION_MINOR == 22) + else if (dbus_message_is_signal (message, DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS, "ServiceCreated")) { char *service; @@ -217,6 +218,39 @@ static DBusHandlerResult libnm_glib_dbus_filter (DBusConnection *connection, DBu ctx->nm_status = LIBNM_NO_NETWORKMANAGER; } } +#elif (DBUS_VERSION_MAJOR == 0 && DBUS_VERSION_MINOR == 23) + else 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; + + 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 else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive") || dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive") || dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating") diff --git a/panel-applet/NMWirelessAppletDbus.c b/panel-applet/NMWirelessAppletDbus.c index 5116367106..c1a3c404d9 100644 --- a/panel-applet/NMWirelessAppletDbus.c +++ b/panel-applet/NMWirelessAppletDbus.c @@ -1104,7 +1104,7 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa gboolean old_owner_good = (old_owner && (strlen (old_owner) > 0)); gboolean new_owner_good = (new_owner && (strlen (new_owner) > 0)); - if ( (strcmp (service, NM_DBUS_SERVICE)) + if ( (strcmp (service, NM_DBUS_SERVICE) == 0) && (!old_owner_good && new_owner_good) /* Equivalent to old ServiceCreated signal */ && (applet->applet_state == APPLET_STATE_NO_NM)) {