public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] [PATCH] Fix bluez-gnome crash on input CreateDevice failure
@ 2007-09-22 22:55 David Woodhouse
  0 siblings, 0 replies; only message in thread
From: David Woodhouse @ 2007-09-22 22:55 UTC (permalink / raw)
  To: BlueZ development

When we try to add an input device which already exists, the
bluetooth-properties applet crashes with a dbus error.

This gives a slightly nicer failure mode...

diff --git a/properties/input.c b/properties/input.c
index 7a024ae..4142df5 100644
--- a/properties/input.c
+++ b/properties/input.c
@@ -56,10 +58,11 @@ static void proxy_callback(DBusGProxy *proxy,
 	const char *path, *busname;
 	const char *adapter = NULL, *address = NULL, *name = NULL;
 	gchar *text;
+	GError *error = NULL;
 
 	g_object_set_data(G_OBJECT(notebook), "call", NULL);
 
-	dbus_g_proxy_end_call(proxy, call, NULL,
+	dbus_g_proxy_end_call(proxy, call, &error,
 				G_TYPE_STRING, &path, G_TYPE_INVALID);
 
 	button = g_object_get_data(G_OBJECT(notebook), "cancel");
@@ -68,6 +71,15 @@ static void proxy_callback(DBusGProxy *proxy,
 	button = g_object_get_data(G_OBJECT(notebook), "close");
 	gtk_widget_set_sensitive(button, TRUE);
 
+	if (error) {
+		label = g_object_get_data(G_OBJECT(notebook), "label");
+		text = g_strdup_printf("<b>%s: %s</b>",
+				       _("Connection failed"), error->message);
+		gtk_label_set_markup(GTK_LABEL(label), text);
+		g_free(text);
+		return;
+	}
+
 	busname = dbus_g_proxy_get_bus_name(proxy);
 
 	client = dbus_g_proxy_new_for_name(connection, busname,


-- 
dwmw2


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-09-22 22:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-22 22:55 [Bluez-devel] [PATCH] Fix bluez-gnome crash on input CreateDevice failure David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox