From: "Jaap A. Haitsma" <jaap@haitsma.org>
To: "BlueZ development" <bluez-devel@lists.sourceforge.net>
Subject: [Bluez-devel] [PATCH] Make links in about dialog launch browser/email client
Date: Fri, 21 Dec 2007 23:17:03 +0100 [thread overview]
Message-ID: <8a8adccc0712211417o3d2c8467m543e113eee1839c6@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 80 bytes --]
Hi,
Attached patch does this. It now uses the screen of the about dialog
Jaap
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bluez-gnome-clickable.patch --]
[-- Type: text/x-patch; name=bluez-gnome-clickable.patch, Size: 4217 bytes --]
Index: analyzer/dialog.c
===================================================================
RCS file: /cvsroot/bluez/gnome/analyzer/dialog.c,v
retrieving revision 1.20
diff -u -r1.20 dialog.c
--- analyzer/dialog.c 17 Dec 2007 01:41:19 -0000 1.20
+++ analyzer/dialog.c 21 Dec 2007 22:10:38 -0000
@@ -54,11 +54,65 @@
static void about_url_hook(GtkAboutDialog *dialog,
const gchar *url, gpointer data)
{
+ GError *error = NULL;
+ gboolean ret;
+ char *cmdline;
+ GdkScreen *gscreen;
+ GtkWidget *error_dialog;
+
+ gscreen = gtk_window_get_screen (GTK_WINDOW(dialog));
+
+ cmdline = g_strconcat ("gnome-open ", url, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
+
+ if (ret == TRUE)
+ return;
+
+ g_error_free (error);
+ error = NULL;
+
+ cmdline = g_strconcat ("xdg-open ", url, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, 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_email_hook(GtkAboutDialog *dialog,
const gchar *email, gpointer data)
{
+ GError *error = NULL;
+ gboolean ret;
+ char *cmdline;
+ GdkScreen *gscreen;
+ GtkWidget *error_dialog;
+
+ gscreen = gtk_window_get_screen (GTK_WINDOW(dialog));
+
+ cmdline = g_strconcat ("gnome-open mailto:", email, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
+
+ if (ret == TRUE)
+ return;
+
+ g_error_free (error);
+ error = NULL;
+
+ cmdline = g_strconcat ("xdg-open mailto:", email, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, 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);
+ }
}
void show_about_dialog(void)
Index: applet/main.c
===================================================================
RCS file: /cvsroot/bluez/gnome/applet/main.c,v
retrieving revision 1.94
diff -u -r1.94 main.c
--- applet/main.c 19 Dec 2007 01:06:05 -0000 1.94
+++ applet/main.c 21 Dec 2007 22:10:38 -0000
@@ -1510,11 +1510,65 @@
static void about_url_hook(GtkAboutDialog *dialog,
const gchar *url, gpointer data)
{
+ GError *error = NULL;
+ gboolean ret;
+ char *cmdline;
+ GdkScreen *gscreen;
+ GtkWidget *error_dialog;
+
+ gscreen = gtk_window_get_screen (GTK_WINDOW(dialog));
+
+ cmdline = g_strconcat ("gnome-open ", url, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
+
+ if (ret == TRUE)
+ return;
+
+ g_error_free (error);
+ error = NULL;
+
+ cmdline = g_strconcat ("xdg-open ", url, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, 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_email_hook(GtkAboutDialog *dialog,
const gchar *email, gpointer data)
{
+ GError *error = NULL;
+ gboolean ret;
+ char *cmdline;
+ GdkScreen *gscreen;
+ GtkWidget *error_dialog;
+
+ gscreen = gtk_window_get_screen (GTK_WINDOW(dialog));
+
+ cmdline = g_strconcat ("gnome-open mailto:", email, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, cmdline, &error);
+ g_free (cmdline);
+
+ if (ret == TRUE)
+ return;
+
+ g_error_free (error);
+ error = NULL;
+
+ cmdline = g_strconcat ("xdg-open mailto:", email, NULL);
+ ret = gdk_spawn_command_line_on_screen (gscreen, 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_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
next reply other threads:[~2007-12-21 22:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-21 22:17 Jaap A. Haitsma [this message]
2007-12-22 0:16 ` [Bluez-devel] [PATCH] Make links in about dialog launch browser/email client Marcel Holtmann
2007-12-22 10:55 ` Jaap A. Haitsma
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=8a8adccc0712211417o3d2c8467m543e113eee1839c6@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