public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] [PATCH] Fix bluez-gnome crash on input CreateDevice failure
Date: Sat, 22 Sep 2007 23:55:21 +0100	[thread overview]
Message-ID: <1190501721.7150.264.camel@pmac.infradead.org> (raw)

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

                 reply	other threads:[~2007-09-22 22:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1190501721.7150.264.camel@pmac.infradead.org \
    --to=dwmw2@infradead.org \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox