public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jaap A. Haitsma" <jaap@haitsma.org>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [PATCH] Make links in about dialog launch browser/email client
Date: Sat, 22 Dec 2007 11:55:33 +0100	[thread overview]
Message-ID: <8a8adccc0712220255q60347c54v36f510baf63b673e@mail.gmail.com> (raw)
In-Reply-To: <1198282576.8050.296.camel@aeonflux>

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

On Dec 22, 2007 1:16 AM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Jaap,
>
> > Attached patch does this. It now uses the screen of the about dialog
>
> can't we have a generic do_open function and then call it from both
> hooks. From a code perspective it makes it simpler.
>
> Also what is the deal with gnome-open and xdg-open. Wouldn't it be
> enough to use only xdg-open. It should be present on all major distros
> by now.
>
> Coding style wise, please don't put a space between the function name
> and the "(". I know it is unusual for GNOME stuff, but this one follows
> the kernel coding style like all bluez-* packages. Also please respect
> the 80 characters width rule. Meaning break long functions calls to
> multiple lines.
>
Marcel,

Thanks for the review. Updated patch attached

Jaap

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bluez-gnome-clickable2.patch --]
[-- Type: text/x-patch; name=bluez-gnome-clickable2.patch, Size: 2837 bytes --]

Index: analyzer/dialog.c
===================================================================
RCS file: /cvsroot/bluez/gnome/analyzer/dialog.c,v
retrieving revision 1.21
diff -u -r1.21 dialog.c
--- analyzer/dialog.c	22 Dec 2007 00:09:15 -0000	1.21
+++ analyzer/dialog.c	22 Dec 2007 10:53:52 -0000
@@ -49,14 +49,45 @@
 	gtk_widget_destroy(dialog);
 }
 
+static void open_url(const char *url, GdkScreen *screen)
+{
+	GError *error = NULL;
+	gboolean ret;
+	char *cmdline;
+	GtkWidget *error_dialog;
+
+	cmdline = g_strconcat("xdg-open ", url, NULL);
+	ret = gdk_spawn_command_line_on_screen(screen, cmdline, &error);
+	g_free (cmdline);
+
+	if (ret == FALSE) {
+		error_dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, 
+				GTK_MESSAGE_INFO, GTK_BUTTONS_OK, 
+				"Failed to show url %s", error->message); 
+		gtk_dialog_run(GTK_DIALOG (error_dialog));
+		g_error_free(error);
+	}
+}
+
 static void about_url_hook(GtkAboutDialog *dialog,
 					const gchar *url, gpointer data)
 {
+	GdkScreen *gscreen;
+
+	gscreen = gtk_window_get_screen(GTK_WINDOW(dialog));
+	open_url(url, gscreen);
 }
 
 static void about_email_hook(GtkAboutDialog *dialog,
 					const gchar *email, gpointer data)
 {
+	char *url;
+	GdkScreen *gscreen;
+
+	gscreen = gtk_window_get_screen(GTK_WINDOW(dialog));
+	url = g_strconcat ("mailto:", email, NULL);
+	open_url(url, gscreen);
+	g_free (url);
 }
 
 void show_about_dialog(void)
Index: applet/main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.95
diff -u -r1.95 main.c
--- applet/main.c	22 Dec 2007 00:09:15 -0000	1.95
+++ applet/main.c	22 Dec 2007 10:53:52 -0000
@@ -1501,14 +1501,45 @@
 	gtk_widget_destroy(dialog);
 }
 
+static void open_url(const char *url, GdkScreen *screen)
+{
+	GError *error = NULL;
+	gboolean ret;
+	char *cmdline;
+	GtkWidget *error_dialog;
+
+	cmdline = g_strconcat("xdg-open ", url, NULL);
+	ret = gdk_spawn_command_line_on_screen(screen, cmdline, &error);
+	g_free (cmdline);
+
+	if (ret == FALSE) {
+		error_dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, 
+				GTK_MESSAGE_INFO, GTK_BUTTONS_OK, 
+				"Failed to show url %s", error->message); 
+		gtk_dialog_run(GTK_DIALOG (error_dialog));
+		g_error_free(error);
+	}
+}
+
 static void about_url_hook(GtkAboutDialog *dialog,
 					const gchar *url, gpointer data)
 {
+	GdkScreen *gscreen;
+
+	gscreen = gtk_window_get_screen(GTK_WINDOW(dialog));
+	open_url(url, gscreen);
 }
 
 static void about_email_hook(GtkAboutDialog *dialog,
 					const gchar *email, gpointer data)
 {
+	char *url;
+	GdkScreen *gscreen;
+
+	gscreen = gtk_window_get_screen(GTK_WINDOW(dialog));
+	url = g_strconcat ("mailto:", email, NULL);
+	open_url(url, gscreen);
+	g_free (url);
 }
 
 static void about_callback(GtkWidget *item, gpointer user_data)

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
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/

[-- Attachment #4: 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-22 10:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-21 22:17 [Bluez-devel] [PATCH] Make links in about dialog launch browser/email client Jaap A. Haitsma
2007-12-22  0:16 ` Marcel Holtmann
2007-12-22 10:55   ` Jaap A. Haitsma [this message]

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=8a8adccc0712220255q60347c54v36f510baf63b673e@mail.gmail.com \
    --to=jaap@haitsma.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