linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bastien Nocera <hadess@hadess.net>
To: BlueZ Hackers <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] [patch] Use buttons in notification popups
Date: Mon, 03 Dec 2007 10:24:30 +0000	[thread overview]
Message-ID: <1196677470.3227.192.camel@cookie.hadess.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

Heya,

As reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=407551

notification-daemon kind of sucks and doesn't allow for long messages
(it will clip the messages, see those screenshots:
https://bugzilla.redhat.com/attachment.cgi?id=274901
https://bugzilla.redhat.com/attachment.cgi?id=274911
)

Attached patch removes the extra lines, and adds a button to the popup
instead. It looks better, and still pops up the dialogues as expected.

Cheers

[-- Attachment #2: bluez-gnome-use-notify-button.patch --]
[-- Type: text/x-patch, Size: 4164 bytes --]

Index: main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.87
diff -u -p -r1.87 main.c
--- main.c	29 Aug 2007 20:42:18 -0000	1.87
+++ main.c	3 Dec 2007 10:20:18 -0000
@@ -653,7 +653,7 @@ static void notify_action(NotifyNotifica
 #endif
 
 static void show_notification(const gchar *summary, const gchar *message,
-					gint timeout, GCallback handler)
+			      const gchar *action, gint timeout, GCallback handler)
 {
 #ifdef HAVE_LIBNOTIFY
 	NotifyActionCallback callback;
@@ -685,6 +685,9 @@ static void show_notification(const gcha
 
 	notify_notification_add_action(notify, "default", "action",
 						callback, NULL, NULL);
+	if (action != NULL)
+		notify_notification_add_action(notify, "button", _(action),
+					       callback, NULL, NULL);
 
 	notify_notification_show(notify, NULL);
 #endif
@@ -761,7 +764,7 @@ static gboolean passkey_agent_request(Pa
 {
 	DBusGProxy *object;
 	const char *adapter = NULL, *name = NULL;
-	gchar *device, *text, *line;
+	gchar *device, *line;
 
 	object = dbus_g_proxy_new_for_name(conn, "org.bluez",
 						path, "org.bluez.Adapter");
@@ -786,15 +789,12 @@ static gboolean passkey_agent_request(Pa
 	/* translators: this is a popup telling you a particular device
 	 * has asked for pairing */
 	line = g_strdup_printf(_("Pairing request for '%s'"), device);
-	text = g_strconcat(line, "\n\n",
-			_("Click to open passkey entry dialog"), NULL);
-	g_free(line);
 	g_free(device);
 
 	show_notification(adapter ? adapter : _("Bluetooth device"),
-				text, 0, G_CALLBACK(notification_closed));
+				line, N_("Enter passkey"), 0, G_CALLBACK(notification_closed));
 
-	g_free(text);
+	g_free(line);
 
 	return TRUE;
 }
@@ -805,7 +805,7 @@ static gboolean passkey_agent_confirm(Pa
 {
 	DBusGProxy *object;
 	const char *adapter = NULL, *name = NULL;
-	gchar *device, *text, *line;
+	gchar *device, *line;
 
 	object = dbus_g_proxy_new_for_name(conn, "org.bluez",
 						path, "org.bluez.Adapter");
@@ -828,15 +828,12 @@ static gboolean passkey_agent_confirm(Pa
 	confirm_dialog(path, address, value, device, context);
 
 	line = g_strdup_printf(_("Pairing request for '%s'"), device);
-	text = g_strconcat(line, "\n\n",
-			_("Click to open confirmation dialog"), NULL);
-	g_free(line);
 	g_free(device);
 
 	show_notification(adapter ? adapter : _("Bluetooth device"),
-				text, 0, G_CALLBACK(notification_closed));
+				line, N_("Confirm pairing"), 0, G_CALLBACK(notification_closed));
 
-	g_free(text);
+	g_free (line);
 
 	return TRUE;
 }
@@ -940,7 +937,7 @@ static gboolean auth_agent_authorize(Pas
 {
 	DBusGProxy *object;
 	const char *adapter = NULL, *name = NULL;
-	gchar *device, *profile, *text, *line;
+	gchar *device, *profile, *line;
 
 	if (auto_authorize == TRUE) {
 		dbus_g_method_return(context);
@@ -974,15 +971,12 @@ static gboolean auth_agent_authorize(Pas
 	auth_dialog(path, address, service, uuid, device, profile, context);
 
 	line = g_strdup_printf(_("Authorization request for %s"), device);
-	text = g_strconcat(line, "\n\n",
-			_("Click to open authorization dialog"), NULL);
-	g_free(line);
 	g_free(device);
 
 	show_notification(adapter ? adapter : _("Bluetooth device"),
-				text, 0, G_CALLBACK(notification_closed));
+				line, _("Check authorization"), 0, G_CALLBACK(notification_closed));
 
-	g_free(text);
+	g_free(line);
 
 	return TRUE;
 }
@@ -1105,7 +1099,7 @@ static void bonding_created(DBusGProxy *
 	g_free(device);
 
 	show_notification(adapter ? adapter : _("Bluetooth device"),
-							text, 6000, NULL);
+							text, NULL, 6000, NULL);
 
 	g_free(text);
 }
@@ -1136,7 +1130,7 @@ static void bonding_removed(DBusGProxy *
 	g_free(device);
 
 	show_notification(adapter ? adapter : _("Bluetooth device"),
-							text, 6000, NULL);
+							text, NULL, 6000, NULL);
 
 	g_free(text);
 }
@@ -1199,7 +1193,7 @@ static void mode_changed(DBusGProxy *obj
 				G_TYPE_STRING, &adapter_name, G_TYPE_INVALID);
 
 	show_notification(adapter_name ? adapter_name : _("Bluetooth device"),
-							_(text), 3000, NULL);
+							_(text), NULL, 3000, NULL);
 
 	set_new_mode(adapter, mode);
 }

[-- Attachment #3: pairing-notification.png --]
[-- Type: image/png, Size: 15388 bytes --]

[-- Attachment #4: Type: text/plain, Size: 309 bytes --]

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

[-- Attachment #5: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

             reply	other threads:[~2007-12-03 10:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-03 10:24 Bastien Nocera [this message]
2007-12-03 16:26 ` [Bluez-devel] [patch] Use buttons in notification popups Marcel Holtmann
2007-12-03 16:32   ` Bastien Nocera
2007-12-03 17:04     ` Marcel Holtmann
2007-12-04 14:03       ` Bastien Nocera
2007-12-04 15:31         ` Marcel Holtmann

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=1196677470.3227.192.camel@cookie.hadess.net \
    --to=hadess@hadess.net \
    --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;
as well as URLs for NNTP newsgroup(s).