[Galago-commits] r2435 - in trunk/notification-daemon: . themes/standard

galago-commits at freedesktop.org galago-commits at freedesktop.org
Thu Jan 19 01:37:43 PST 2006


Author: chipx86
Date: 2006-01-19 01:37:42 -0800 (Thu, 19 Jan 2006)
New Revision: 2435

Modified:
   trunk/notification-daemon/ChangeLog
   trunk/notification-daemon/themes/standard/theme.c
Log:
Add back support for hyperlinks in the standard engine.


Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog	2006-01-19 09:35:17 UTC (rev 2434)
+++ trunk/notification-daemon/ChangeLog	2006-01-19 09:37:42 UTC (rev 2435)
@@ -1,3 +1,8 @@
+Thu Jan 19 01:36:16 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* themes/standard/theme.c:
+	  - Add back support for hyperlinks in the standard engine.
+
 Sun Jan 15 17:51:27 PST 2006  Christian Hammond <chipx86 at chipx86.com>
 
 	* src/daemon.c:

Modified: trunk/notification-daemon/themes/standard/theme.c
===================================================================
--- trunk/notification-daemon/themes/standard/theme.c	2006-01-19 09:35:17 UTC (rev 2434)
+++ trunk/notification-daemon/themes/standard/theme.c	2006-01-19 09:37:42 UTC (rev 2435)
@@ -70,6 +70,49 @@
 	return FALSE;
 }
 
+static void
+url_activated_cb(GtkWidget *url_label, const gchar *url)
+{
+	char *escaped_url;
+	char *cmd = NULL;
+
+	escaped_url = g_shell_quote(url);
+
+	/*
+	 * We can't actually check for GNOME_DESKTOP_SESSION_ID, because it's
+	 * not in the environment for this program :(
+	 */
+	if (/*g_getenv("GNOME_DESKTOP_SESSION_ID") != NULL &&*/
+		g_find_program_in_path("gnome-open") != NULL)
+	{
+		cmd = g_strdup_printf("gnome-open %s", escaped_url);
+	}
+	else if (g_find_program_in_path("mozilla-firefox") != NULL)
+	{
+		cmd = g_strdup_printf("mozilla-firefox %s", escaped_url);
+	}
+	else if (g_find_program_in_path("firefox") != NULL)
+	{
+		cmd = g_strdup_printf("firefox %s", escaped_url);
+	}
+	else if (g_find_program_in_path("mozilla") != NULL)
+	{
+		cmd = g_strdup_printf("mozilla %s", escaped_url);
+	}
+	else
+	{
+		g_warning("Unable to find a browser.");
+	}
+
+	g_free(escaped_url);
+
+	if (cmd != NULL)
+	{
+		g_spawn_command_line_async(cmd, NULL);
+		g_free(cmd);
+	}
+}
+
 GtkWindow *
 create_notification(void)
 {
@@ -140,6 +183,8 @@
 	gtk_box_pack_start(GTK_BOX(vbox), windata->body_label, TRUE, TRUE, 0);
 	gtk_misc_set_alignment(GTK_MISC(windata->body_label), 0, 0);
 	gtk_label_set_line_wrap(GTK_LABEL(windata->body_label), TRUE);
+	g_signal_connect(G_OBJECT(windata->body_label), "url_activated",
+					 G_CALLBACK(url_activated_cb), NULL);
 
 	windata->actions_box = gtk_hbox_new(FALSE, 6);
 	gtk_widget_show(windata->actions_box);



More information about the galago-commits mailing list