diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-07-26 12:48:56 +0100 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-07-26 12:48:56 +0100 |
commit | bdfda68f33615dd7f24b35f425c44c9ef63a1675 (patch) | |
tree | 3a49c36c80317775cceed9bd53dcdbddd1ca961c /src | |
parent | 6dce39846999951353c2e866019a79d568c99dfa (diff) | |
download | ayatana-indicator-session-bdfda68f33615dd7f24b35f425c44c9ef63a1675.tar.gz ayatana-indicator-session-bdfda68f33615dd7f24b35f425c44c9ef63a1675.tar.bz2 ayatana-indicator-session-bdfda68f33615dd7f24b35f425c44c9ef63a1675.zip |
fixed gudev segfault
Diffstat (limited to 'src')
-rw-r--r-- | src/udev-mgr.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/udev-mgr.c b/src/udev-mgr.c index b5c1936..e100f16 100644 --- a/src/udev-mgr.c +++ b/src/udev-mgr.c @@ -26,6 +26,7 @@ static void udev_mgr_uevent_cb (GUdevClient *client, gchar *action, GUdevDevice *device, gpointer user_data); + struct _UdevMgr { GObject parent_instance; @@ -34,6 +35,8 @@ struct _UdevMgr GUdevClient* client; }; +const char *subsystems[1] = {"usb"}; +const gchar* usb_subsystem = "usb"; G_DEFINE_TYPE (UdevMgr, udev_mgr, G_TYPE_OBJECT); @@ -41,38 +44,20 @@ static void udev_mgr_init (UdevMgr* self) { self->client = NULL; - const gchar *subsystems[1] = {"usb"}; self->client = g_udev_client_new (subsystems); - const gchar* usb_subsystem = "usb"; GList* devices_available = g_udev_client_query_by_subsystem (self->client, usb_subsystem); - if (FALSE){ - g_list_foreach (devices_available, udevice_mgr_device_list_iterator, self); - } - //g_list_free (devices_available); - if (FALSE){ + g_list_foreach (devices_available, udevice_mgr_device_list_iterator, self); + g_list_free (devices_available); g_signal_connect (G_OBJECT (self->client), - "u-event", + "uevent", G_CALLBACK (udev_mgr_uevent_cb), self); - } } static void -udevice_mgr_device_list_iterator (gpointer data, gpointer userdata) -{ - g_return_if_fail (G_UDEV_IS_DEVICE (data)); - GUdevDevice* device = G_UDEV_DEVICE (data); - const gchar* name = g_udev_device_get_name (device); - - g_debug ("UDEV MGR - the name of the device = %s", name); - // for now tidy up here. - g_object_unref (device); -} - -static void udev_mgr_finalize (GObject *object) { G_OBJECT_CLASS (udev_mgr_parent_class)->finalize (object); @@ -85,6 +70,18 @@ udev_mgr_class_init (UdevMgrClass *klass) object_class->finalize = udev_mgr_finalize; } +static void +udevice_mgr_device_list_iterator (gpointer data, gpointer userdata) +{ + g_return_if_fail (G_UDEV_IS_DEVICE (data)); + GUdevDevice* device = G_UDEV_DEVICE (data); + const gchar* name = g_udev_device_get_name (device); + + g_debug ("UDEV MGR - the name of the device = %s", name); + // for now tidy up here. + g_object_unref (device); +} + static void udev_mgr_uevent_cb (GUdevClient *client, gchar *action, GUdevDevice *device, @@ -94,6 +91,7 @@ static void udev_mgr_uevent_cb (GUdevClient *client, g_return_if_fail (UDEV_IS_MGR (user_data)); } + UdevMgr* udev_mgr_new (DbusmenuMenuitem* scanner, DbusmenuMenuitem* webcam) { |