Re: Using libnm-glib issues after dbus and dbus-glib update



On Thu, 2008-12-11 at 00:30 +1100, James . wrote:
> I have a small program which I use to detect device state changes,
> that uses libnm-glib. A couple of days ago i updated dbus to 1.2.6 and
> dbus-glib to 0.78 (this is a slackware base), and now the
> "device-changed" signal among others no longer works, however, other
> applications that use NM seems to work fine such as nm-applet. Here is
> the code I am using, with irrelevant sections cut out:
> 
> #include <stdio.h>
> #include <gtk/gtk.h>
> #include <glib.h>
> #include <NetworkManager.h>
> #include <nm-client.h>
> #include <nm-device.h>
> 
> static void device_state_changed_cb(NMDevice *device, NMDeviceState
> new_state, NMDeviceState old_state, NMDeviceStateReason reason,
> gpointer user_data){
> 	printf("device state changed\n");
> 	//handle_device(device, new_state);
> }
> 
> static void device_update_cb(NMClient *client, NMDevice *device,
> gpointer user_data){
> 	g_signal_connect(G_OBJECT(device), "state-changed",
> G_CALLBACK(device_state_changed_cb), NULL);
> }
> 
> static void init_devices(NMDevice* device, gpointer user_data){
> 	g_signal_connect(G_OBJECT(device), "state-changed",
> G_CALLBACK(device_state_changed_cb), NULL);
> 	printf("device added %s\n", nm_device_get_iface(device));
> 	//handle_device(device, nm_device_get_state(device));
> }
> 
> int main(){
> 	NMClient* nm_client;
> 	const GPtrArray* devices = NULL;
> 	
> 	gtk_init (NULL, NULL);
> 	
> 	nm_client = nm_client_new();
> 	
> 	g_signal_connect(G_OBJECT(nm_client), "device-added",
> G_CALLBACK(device_update_cb), NULL);
> 	
> 	devices = nm_client_get_devices(nm_client);
> 	if(devices) g_ptr_array_foreach((GPtrArray*)devices,
> (GFunc)init_devices, NULL);
> 	
> 	gtk_main();
> 	return 0;
> }
> 
> Before, I could unplug my ethernet and replug it, and it would spam
> "device state changed" all over the screen. Now, nothing happens on
> the "state-changed" signal despite getting a valid connection handler.
> 
> Would anyone like to shed light on this strange issue?

The changes to dbus involved the default security policy, including what
messages could be sent to what processes.  The fallout from that is
still ongoing.  Does slackware use pam_console and the at_console D-Bus
context, or are D-Bus permissions on Slackware normally user-based?
It's probably an issue between
the /etc/dbus-1/system.d/NetworkManager.conf dbus permissions file (can
you attach yours to a reply?) and the new dbus update.

Dan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]