Re: [Nautilus-list] Another question: nautilus and XALF



I tried a patch where I made the NautilusDesktopFile class public. It is better because the localized name of the command (the one that is IN the desktop file) appears in the xalf frontend. The patch should applied softly on gnome2 nautilus (without the ChangeLog part).
Havoc Pennington wrote:

Darin Adler <darin bentspoon com> writes:
Oh, that's new code that the Red Hat guys added after 1.0.

I have never looked at nautilus_desktop_file_launch -- it's quite
possible that it does something different.

Havoc, can you remember who did this part?

I don't remember. It appears to use
nautilus_launch_application_from_command and do some xalf stuff
though.

Havoc


_______________________________________________
nautilus-list mailing list
nautilus-list lists eazel com
http://lists.eazel.com/mailman/listinfo/nautilus-list


--
                                                         -o)
                  Remi Cohen-Scali                       /\\
<Remi Cohen-Scali com>          <rcoscali rcsnet net>    _\_v
                                                        ----


diff -u -r1.4797.2.9 nautilus/ChangeLog
--- nautilus/ChangeLog	2001/11/08 05:37:33	1.4797.2.9
+++ nautilus/ChangeLog	2002/01/26 12:11:30
@@ -1,3 +1,16 @@
+2002-01-26  Remi Cohen-Scali  <remi cohen-scali com>
+
+	* src/file-manager/fm-directory-view.c (activate_callback): 
+	Now use newly public NautilusDesktopFile class & nautilus_desktop_file_launch
+	to launch the corresponding command.
+
+	* libnautilus-private/nautilus-desktop-file-loader.c: 
+	* libnautilus-private/nautilus-desktop-file-loader.h: 
+	Made the NautilusDesktopFile class public. The struct has been moved
+	from the source to the header. The nautilus_desktop_file_new method
+	is not static any more.
+	
+
 2001-11-07  Darin Adler  <darin bentspoon com>
 
 	* configure.in: Update version to 1.0.6.

diff -u -r1.2 nautilus/libnautilus-private/nautilus-desktop-file-loader.c
--- nautilus/libnautilus-private/nautilus-desktop-file-loader.c	2001/09/26 16:37:15	1.2
+++ nautilus/libnautilus-private/nautilus-desktop-file-loader.c	2002/01/26 12:03:07
@@ -41,7 +41,6 @@
 #include <iconv.h>
 #include <langinfo.h>
 
-typedef struct NautilusDesktopFileSection NautilusDesktopFileSection;
 typedef struct NautilusDesktopFileAddition NautilusDesktopFileAddition;
 typedef struct NautilusDesktopFileForeachData NautilusDesktopFileForeachData;
 
@@ -50,18 +49,6 @@
 						 gpointer        data);
 
 
-struct NautilusDesktopFile {
-        char **lines;
-  
-        /* hash of section names, from pointer to start of name (just after
-         * bracket) to NautilusDesktopFileSection structs
-         */  
-        GHashTable *section_hash;
-	GList *addition_list;
-
-        NautilusDesktopFileSection *main_section;
-};
-
 struct NautilusDesktopFileSection {
         /* pointer into a line of df->lines for start of name */
         const char *name;
@@ -105,7 +92,6 @@
 								    NautilusDesktopFileForeachFunc   func,
 								    gpointer                         user_data);
 
-static NautilusDesktopFile *        nautilus_desktop_file_new             (void);
 static void                         hash_lines                            (NautilusDesktopFile             *df);
 static NautilusDesktopFileSection*  section_new                           (const char                      *name,
 									   char                           **start_line);
@@ -118,7 +104,7 @@
 static void                         addition_free                         (NautilusDesktopFileAddition     *addition);
 
 
-static NautilusDesktopFile*
+NautilusDesktopFile*
 nautilus_desktop_file_new (void)
 {
         NautilusDesktopFile *df;
@@ -1160,8 +1146,7 @@
 	char *url;
 	char *exec;
 	char *subst;
-		
-		
+	char *name;
 
 	if (!nautilus_desktop_file_get_string (df, NULL, "Type", &type)) {
 		return;
@@ -1187,11 +1172,13 @@
 
 			in_terminal = FALSE;
 			nautilus_desktop_file_get_boolean (df, NULL, "Terminal", &in_terminal);
+			nautilus_desktop_file_get_locale_string (df, NULL, "Name", &name);
 
-			nautilus_launch_application_from_command ("",
+			nautilus_launch_application_from_command (name,
 								  subst,
 								  NULL,
 								  in_terminal);
+			g_free (name);
 			g_free (subst);
 		}
 

diff -u -r1.2 nautilus/libnautilus-private/nautilus-desktop-file-loader.h
--- nautilus/libnautilus-private/nautilus-desktop-file-loader.h	2001/09/26 16:37:15	1.2
+++ nautilus/libnautilus-private/nautilus-desktop-file-loader.h	2002/01/26 12:03:07
@@ -30,6 +30,21 @@
 #include <glib.h>
 #include <libgnomevfs/gnome-vfs-result.h>
 
+struct NautilusDesktopFileSection;
+typedef struct NautilusDesktopFileSection NautilusDesktopFileSection;
+
+struct NautilusDesktopFile {
+        char **lines;
+  
+        /* hash of section names, from pointer to start of name (just after
+         * bracket) to NautilusDesktopFileSection structs
+         */  
+        GHashTable *section_hash;
+	GList *addition_list;
+
+        NautilusDesktopFileSection *main_section;
+};
+
 typedef struct NautilusDesktopFile NautilusDesktopFile;
 
 /* This is a quick-hack to read and modify .desktop files.
@@ -40,6 +55,7 @@
  * and put it in another library for use by the panel, nautilus etc.
  */
 
+NautilusDesktopFile *nautilus_desktop_file_new             (void);
 GnomeVFSResult       nautilus_desktop_file_load            (const char                      *uri,
 							    NautilusDesktopFile            **desktop_file);
 NautilusDesktopFile *nautilus_desktop_file_from_string     (const char                      *data);

diff -u -r1.473.2.3 nautilus/src/file-manager/fm-directory-view.c
--- nautilus/src/file-manager/fm-directory-view.c	2001/10/26 01:06:47	1.473.2.3
+++ nautilus/src/file-manager/fm-directory-view.c	2002/01/26 12:05:09
@@ -75,6 +75,7 @@
 #include <libnautilus-private/nautilus-trash-directory.h>
 #include <libnautilus-private/nautilus-trash-monitor.h>
 #include <libnautilus-private/nautilus-view-identifier.h>
+#include <libnautilus-private/nautilus-desktop-file-loader.h>
 #include <libnautilus/nautilus-bonobo-ui.h>
 #include <math.h>
 
@@ -4594,8 +4595,10 @@
 	ActivateParameters *parameters;
 	FMDirectoryView *view;
 	char *uri, *command, *executable_path, *quoted_path, *name;
+	char *dfpath; 
 	GnomeVFSMimeApplication *application;
 	ActivationAction action;
+	NautilusDesktopFile *df; 
 	
 	parameters = callback_data;
 
@@ -4632,8 +4635,14 @@
 			 * enforced by using a call that uses
 			 * fork/execlp instead of system.
 			 */
-			command = uri + strlen (NAUTILUS_COMMAND_SPECIFIER);
-			eel_gnome_shell_execute (command);
+			name = nautilus_file_get_name(file); 
+			df = nautilus_desktop_file_new ();
+			dfpath = g_strdup_printf ("%s/%s",
+						  nautilus_get_desktop_directory (),
+						  name); 
+			g_free (name); 
+			nautilus_desktop_file_load (dfpath, &df);
+			nautilus_desktop_file_launch(df); 
 			action = ACTIVATION_ACTION_DO_NOTHING;
 		}
 	}



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