Package: firestarter / 1.0.3-11

13_browser_nonroot.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
From: <pandis@pandis-laptop>
Subject: Use generic open_browser(), not gnome_url_show()

diff -urNad firestarter-1.0.3~/src/menus.c firestarter-1.0.3/src/menus.c
--- firestarter-1.0.3~/src/menus.c	2005-01-29 14:32:08.000000000 +0200
+++ firestarter-1.0.3/src/menus.c	2006-08-12 04:17:35.000000000 +0300
@@ -23,6 +23,7 @@
 
 #include "xpm/firestarter-pixbufs.h"
 
+
 #define FIRESTARTER_STOCK_WIZARD "firestarter-wizard-icon"
 #define FIRESTARTER_STOCK_START_FIREWALL "firestarter-start-firewall-icon"
 #define FIRESTARTER_STOCK_STOP_FIREWALL "firestarter-stop-firewall-icon"
@@ -541,13 +542,13 @@
 static void
 open_homepage (void)
 {
-	gnome_url_show ("http://www.fs-security.com", NULL);
+	open_browser ("http://www.fs-security.com");
 }
 
 static void
 open_manual (void)
 {
-	gnome_url_show ("http://www.fs-security.com/docs/", NULL);
+	open_browser ("http://www.fs-security.com/docs/");
 }
 
 /* [ copy_selected ]
diff -urNad firestarter-1.0.3~/src/preferences.c firestarter-1.0.3/src/preferences.c
--- firestarter-1.0.3~/src/preferences.c	2005-01-29 14:32:08.000000000 +0200
+++ firestarter-1.0.3/src/preferences.c	2006-08-12 04:17:35.000000000 +0300
@@ -215,7 +215,7 @@
 static void
 preferences_show_help (void)
 {
-	gnome_url_show ("http://www.fs-security.com/docs/preferences.php", NULL);
+	open_browser ("http://www.fs-security.com/docs/preferences.php");
 }
 
 static GtkTreeModel*
diff -urNad firestarter-1.0.3~/src/util.c firestarter-1.0.3/src/util.c
--- firestarter-1.0.3~/src/util.c	2005-01-29 14:32:08.000000000 +0200
+++ firestarter-1.0.3/src/util.c	2006-08-12 04:17:35.000000000 +0300
@@ -18,6 +18,7 @@
 #include <arpa/inet.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
+#include <libgnomevfs/gnome-vfs-mime-handlers.h>
 
 #include "globals.h"
 #include "firestarter.h"
@@ -537,3 +538,24 @@
 	g_free (contents);
 	g_free (tail);
 }
+
+/* [ open_browser ]
+ * Open default browser without superuser privileges
+ */
+
+void
+open_browser (const gchar *str)
+{
+        const gchar *sudo_user;
+        GnomeVFSMimeApplication *app;
+        app=gnome_vfs_mime_get_default_application("text/html");
+        sudo_user=g_getenv("SUDO_USER");
+        if (sudo_user!=NULL)
+	{
+                g_spawn_command_line_async (g_strjoin(" ","sudo -u",sudo_user,app->command,str, NULL),NULL);
+		g_fprintf(stderr,"Doing :%s:\n",g_strjoin(" ","sudo -u",sudo_user,app->command,str, NULL));
+	}
+        else
+                g_spawn_command_line_async (g_strjoin(" ",app->command,str, NULL),NULL);
+}
+
diff -urNad firestarter-1.0.3~/src/util.h firestarter-1.0.3/src/util.h
--- firestarter-1.0.3~/src/util.h	2005-01-29 14:32:08.000000000 +0200
+++ firestarter-1.0.3/src/util.h	2006-08-12 04:17:35.000000000 +0300
@@ -45,5 +45,6 @@
 
 gboolean append_to_file (gchar *path, gchar *data, gboolean newline);
 void remove_line_from_file (gchar *path, gint position);
+void open_browser(const gchar *str);
 
 #endif