Patch for gnome-url.c



Hi Anders,
	here you can find a patch for gnome-url.c

Now it  uses "gnome-help" for ghelp: info: man: uris and use "mozilla"
as default handler. You can always set your default handlers using gconf
(or gnome-control-center).

Can I commit?

Ciao

Paolo



? libgnome_paolo_2.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnome/ChangeLog,v
retrieving revision 1.155
diff -u -r1.155 ChangeLog
--- ChangeLog	2002/03/05 17:39:33	1.155
+++ ChangeLog	2002/03/06 16:43:03
@@ -1,3 +1,11 @@
+2002-03-06  Paolo Maggi  <maggi athena polito it>
+
+	* libgnome/gnome-url.c (gnome_url_default_handler):
+	use gnome-help as handler for ghelp: info: man: uris
+	and mozilla as default url handler
+	(gnome_url_show): fix mem leak, use the rigth handler
+	also the first time it is run
+
 2002-03-05  Paolo Maggi  <maggi athena polito it>
 
 	* libgnome/gnome-program.c (gnome_program_locate_file):
Index: libgnome/gnome-url.c
===================================================================
RCS file: /cvs/gnome/libgnome/libgnome/gnome-url.c,v
retrieving revision 1.35
diff -u -r1.35 gnome-url.c
--- libgnome/gnome-url.c	2001/12/27 01:41:13	1.35
+++ libgnome/gnome-url.c	2002/03/06 16:43:04
@@ -44,10 +44,8 @@
 
 #include <popt.h>
 
-#define DEFAULT_HANDLER "mozilla \"%s\""
-#define INFO_HANDLER  "gnome-help-browser \"%s\""
-#define MAN_HANDLER   "gnome-help-browser \"%s\""
-#define GHELP_HANDLER "gnome-help-browser \"%s\""
+#define DEFAULT_HANDLER "mozilla"
+#define HELP_URIS_HANDLER "gnome-help"
 
 static gchar *
 gnome_url_default_handler (void)
@@ -70,15 +68,14 @@
 		} else {
 			/* It's the first time gnome_url_show is run, so up some useful defaults */
 
-			/* FIXME: Should we remove gnome-help-browser here? */
-			app = g_find_program_in_path ("nautilus");
+			app = g_find_program_in_path (HELP_URIS_HANDLER);
 			if (app) {
 				g_free (app);
-				app = "nautilus \"%s\"";
+				app = HELP_URIS_HANDLER " \"%s\"";
 			} else
-				app = "gnome-help-browser \"%s\"";
+				app = DEFAULT_HANDLER " \"%s\"";
 
-			default_handler = DEFAULT_HANDLER;
+			default_handler = DEFAULT_HANDLER " \"%s\"";
 			gconf_client_set_string (client, "/desktop/gnome/url-handlers/default-show",
 						 default_handler, NULL);
 
@@ -93,6 +90,8 @@
 			if (gconf_client_dir_exists (client, "/desktop/gnome/url-handlers/ghelp-show", NULL) == FALSE) {
 				gconf_client_set_string (client, "/desktop/gnome/url-handlers/ghelp-show", app, NULL);
 			}
+
+			gconf_client_suggest_sync (client, NULL);
 		}
 
 		g_object_unref (G_OBJECT (client));
@@ -160,9 +159,21 @@
 		template = gconf_client_get_string (client, path, NULL);
 
 		if (template == NULL) {
-			template = gnome_url_default_handler ();
-		}
+			gchar* template_temp;
+			
+			template_temp = gnome_url_default_handler ();
+						
+			/* Retry to get the right url handler */
+			template = gconf_client_get_string (client, path, NULL);
+
+			if (template == NULL) 
+				template = template_temp;
+			else
+				g_free (template_temp);
 
+		}
+		
+		g_free (path);
 		g_free (protocol);
 
 		g_object_unref (G_OBJECT (client));


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]