comparison src/bluetooth/agent.c @ 2882:15754379dbd5

fixed the remove bonding bug and made it thread safe
author Paula Stanciu <paula.stanciu@gmail.com>
date Thu, 07 Aug 2008 20:00:52 +0300
parents 455e6e37feae
children 4128ae5633e4
comparison
equal deleted inserted replaced
2881:66f53425a5dd 2882:15754379dbd5
760 } 760 }
761 761
762 static void bonding_created(DBusGProxy *object, 762 static void bonding_created(DBusGProxy *object,
763 const char *address, gpointer user_data) 763 const char *address, gpointer user_data)
764 { 764 {
765 bonded_dev_mutex = g_mutex_new ();
766
765 const char *adapter = NULL, *name = NULL; 767 const char *adapter = NULL, *name = NULL;
766 gchar *device, *text; 768 gchar *device, *text;
767 769
768 dbus_g_proxy_call(object, "GetName", NULL, G_TYPE_INVALID, 770 dbus_g_proxy_call(object, "GetName", NULL, G_TYPE_INVALID,
769 G_TYPE_STRING, &adapter, G_TYPE_INVALID); 771 G_TYPE_STRING, &adapter, G_TYPE_INVALID);
777 device = g_strdup(name); 779 device = g_strdup(name);
778 else 780 else
779 device = g_strdup_printf("%s (%s)", name, address); 781 device = g_strdup_printf("%s (%s)", name, address);
780 } else 782 } else
781 device = g_strdup(address); 783 device = g_strdup(address);
784
785 g_mutex_lock(bonded_dev_mutex);
786 bonded_dev = g_strdup_printf(address);
787 g_mutex_unlock(bonded_dev_mutex);
782 788
783 text = g_strdup_printf(_("Created bonding with %s"), device); 789 text = g_strdup_printf(_("Created bonding with %s"), device);
784 bonding_finish = 1; 790 bonding_finish = 1;
785 g_free(device); 791 g_free(device);
786 792