diff --git a/ChangeLog b/ChangeLog index b766f29e60..04fc9d615f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2004-08-06 Seth Nickell + + * panel-applet/NMWirelessApplet.c: (nmwa_new): + + Check the error code when getting a connection. + + * panel-applet/NMWirelessAppletDbus.c: (nmwa_dbus_init): + + Check if the NM service exists when initializing (rather than + assuming it does not). + + * src/NetworkManagerDbus.c: (nm_dbus_init): + + Don't acquire the well-known service name until we have + registered object/path handlers and can actually receive + calls. + 2004-08-06 Dan Williams * panel-applet/* diff --git a/panel-applet/NMWirelessApplet.c b/panel-applet/NMWirelessApplet.c index 582c0aa359..064048c95a 100644 --- a/panel-applet/NMWirelessApplet.c +++ b/panel-applet/NMWirelessApplet.c @@ -489,7 +489,7 @@ static GtkWidget * nmwa_new (NMWirelessApplet *applet) applet->connection = nmwa_dbus_init(applet); applet->have_active_device = FALSE; - applet->nm_active = FALSE; + applet->nm_active = nmwa_dbus_nm_is_running(applet->connection); nmwa_load_theme (applet); nmwa_setup_widgets (applet); diff --git a/panel-applet/NMWirelessAppletDbus.c b/panel-applet/NMWirelessAppletDbus.c index 53e3952d80..b33d3173f1 100644 --- a/panel-applet/NMWirelessAppletDbus.c +++ b/panel-applet/NMWirelessAppletDbus.c @@ -424,8 +424,14 @@ DBusConnection * nmwa_dbus_init (gpointer user_data) dbus_error_init (&error); connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error); - if (!connection) + + if (dbus_error_is_set (&error)) + { + fprintf (stderr, "%s raised:\n %s\n\n", error.name, error.message); return (NULL); + } + + g_assert(connection); if (!dbus_connection_add_filter (connection, nmwa_dbus_filter, user_data, NULL)) return (NULL); diff --git a/src/NetworkManagerDbus.c b/src/NetworkManagerDbus.c index cada341fff..e6698fa5e1 100644 --- a/src/NetworkManagerDbus.c +++ b/src/NetworkManagerDbus.c @@ -1268,12 +1268,6 @@ DBusConnection *nm_dbus_init (NMData *data) dbus_connection_set_exit_on_disconnect (connection, FALSE); dbus_connection_setup_with_g_main (connection, NULL); - dbus_bus_acquire_service (connection, NM_DBUS_SERVICE, 0, &dbus_error); - if (dbus_error_is_set (&dbus_error)) - { - NM_DEBUG_PRINT_1 ("nm_dbus_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'\n", dbus_error.message); - return (NULL); - } success = dbus_connection_register_object_path (connection, NM_DBUS_PATH, &nm_vtable, data); if (!success) @@ -1305,5 +1299,12 @@ DBusConnection *nm_dbus_init (NMData *data) "sender='" DBUS_SERVICE_ORG_FREEDESKTOP_DBUS "'", &dbus_error); + dbus_bus_acquire_service (connection, NM_DBUS_SERVICE, 0, &dbus_error); + if (dbus_error_is_set (&dbus_error)) + { + NM_DEBUG_PRINT_1 ("nm_dbus_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'\n", dbus_error.message); + return (NULL); + } + return (connection); }