Darin Adler wrote:
The patch you included in this message still makes the struct public.
My fault.
I now use the uri directly from NautilusFile. It was the simplest ... but I choosed the weird :-)This code assumes that all .desktop files are in the desktop directory. I'm pretty sure that's wrong and it can be done correctly, but I have to hurry right now so I can't look at it myself right away.
The formatting of your patch is wrong, you didn't do spaces before ( in the function calls.
fixed
Your patch frees the desktop file object with g_free. I think you need to use something like nautilus_desktop_file_free.
also fixed
This second patch also doesn't follow the nautilus style guilde. You have an if statement without braces.
fixed
-- Darin _______________________________________________ nautilus-list mailing list nautilus-list lists eazel com http://lists.eazel.com/mailman/listinfo/nautilus-list
Regards all
--
-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.
+
+
2002-01-22 Darin Adler <darin bentspoon com>
* libnautilus-private/nautilus-icon-container.c:
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
@@ -105,7 +105,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 +117,7 @@
static void addition_free (NautilusDesktopFileAddition *addition);
-static NautilusDesktopFile*
+NautilusDesktopFile*
nautilus_desktop_file_new (void)
{
NautilusDesktopFile *df;
@@ -1160,6 +1159,7 @@
char *url;
char *exec;
char *subst;
+ char *name;
@@ -1187,11 +1187,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
@@ -40,6 +40,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>
@@ -4600,6 +4601,7 @@
char *uri, *command, *executable_path, *quoted_path, *name;
GnomeVFSMimeApplication *application;
ActivationAction action;
+ NautilusDesktopFile *df;
parameters = callback_data;
@@ -4636,8 +4638,12 @@
* 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_uri (file);
+ df = nautilus_desktop_file_new ();
+ nautilus_desktop_file_load (name, &df);
+ g_free (name);
+ nautilus_desktop_file_launch (df);
+ nautilus_desktop_file_free (df);
action = ACTIVATION_ACTION_DO_NOTHING;
}
}
diff -u nautilus/ChangeLog.prev nautilus/ChangeLog
--- nautilus/ChangeLog.prev Sat Jan 26 19:37:08 2002
+++ nautilus/ChangeLog Sat Jan 26 19:12:13 2002
@@ -1,5 +1,9 @@
2002-01-26 Remi Cohen-Scali <remi cohen-scali com>
+ * libnautilus-private/nautilus-program-choosing.c
+ (nautilus_launch_application_from_command): Changed the system(3) call to
+ launch application from command. Instead use eel_gnome_shell_execute.
+
* src/file-manager/fm-directory-view.c (activate_callback):
Now use newly public NautilusDesktopFile class & nautilus_desktop_file_launch
to launch the corresponding command.
diff -u -r1.46 nautilus/libnautilus-private/nautilus-program-choosing.c
--- nautilus/libnautilus-private/nautilus-program-choosing.c 2001/10/04 10:05:57 1.46
+++ nautilus/libnautilus-private/nautilus-program-choosing.c 2002/01/26 18:10:15
@@ -678,16 +678,16 @@
}
xalf_prefix = get_xalf_prefix (name);
+ final_command = g_strconcat (xalf_prefix, full_command, NULL);
+ g_free (full_command);
+ g_free (xalf_prefix);
+
if (use_terminal) {
- final_command = g_strconcat (xalf_prefix, full_command, NULL);
eel_gnome_open_terminal (final_command);
} else {
- final_command = g_strconcat (xalf_prefix, full_command, " &", NULL);
- system (final_command);
+ eel_gnome_shell_execute (final_command);
}
g_free (final_command);
- g_free (full_command);
- g_free (xalf_prefix);
}
--- nautilus/ChangeLog 2001/11/08 05:37:33
+++ 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.
+
+
2002-01-25 Michael Meeks <michael ximian com>
* libnautilus-private/nautilus-bookmark.c
diff -u nautilus-orig/libnautilus-private/nautilus-desktop-file-loader.c nautilus/libnautilus-private/nautilus-desktop-file-loader.c
--- nautilus-orig/libnautilus-private/nautilus-desktop-file-loader.c 2001/09/26 16:37:15
+++ nautilus/libnautilus-private/nautilus-desktop-file-loader.c 2002/01/26 12:03:07
@@ -102,7 +102,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);
@@ -115,7 +114,7 @@
static void addition_free (NautilusDesktopFileAddition *addition);
-static NautilusDesktopFile*
+NautilusDesktopFile*
nautilus_desktop_file_new (void)
{
NautilusDesktopFile *df;
@@ -1099,8 +1098,7 @@
char *url;
char *exec;
char *subst;
-
-
+ char *name;
if (!nautilus_desktop_file_get_string (df, NULL, "Type", &type)) {
return;
@@ -1126,11 +1124,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 nautilus-orig/libnautilus-private/nautilus-desktop-file-loader.h nautilus/libnautilus-private/nautilus-desktop-file-loader.h
--- nautilus-orig/libnautilus-private/nautilus-desktop-file-loader.h 2001/09/26 16:37:15
+++ nautilus/libnautilus-private/nautilus-desktop-file-loader.h 2002/01/26 12:03:07
@@ -40,6 +40,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
@@ -74,6 +74,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>
#include <unistd.h>
@@ -4627,6 +4628,7 @@
char *uri, *command, *executable_path, *quoted_path, *name;
GnomeVFSMimeApplication *application;
ActivationAction action;
+ NautilusDesktopFile *df;
parameters = callback_data;
@@ -4663,8 +4665,12 @@
* 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_uri (file);
+ df = nautilus_desktop_file_new ();
+ nautilus_desktop_file_load (name, &df);
+ g_free (name);
+ nautilus_desktop_file_launch (df);
+ nautilus_desktop_file_free (df);
action = ACTIVATION_ACTION_DO_NOTHING;
}
}
diff -u nautilus/ChangeLog.prev nautilus/ChangeLog
--- nautilus/ChangeLog.prev Sat Jan 26 19:37:08 2002
+++ nautilus/ChangeLog Sat Jan 26 19:12:13 2002
@@ -1,5 +1,9 @@
2002-01-26 Remi Cohen-Scali <remi cohen-scali com>
+ * libnautilus-private/nautilus-program-choosing.c
+ (nautilus_launch_application_from_command): Changed the system(3) call to
+ launch application from command. Instead use eel_gnome_shell_execute.
+
* src/file-manager/fm-directory-view.c (activate_callback):
Now use newly public NautilusDesktopFile class & nautilus_desktop_file_launch
to launch the corresponding command.
--- nautilus-orig/libnautilus-private/nautilus-program-choosing.c 2001/10/04 10:05:57
+++ nautilus/libnautilus-private/nautilus-program-choosing.c 2002/01/26 18:10:15
@@ -674,16 +674,16 @@
}
xalf_prefix = get_xalf_prefix (name);
+ final_command = g_strconcat (xalf_prefix, full_command, NULL);
+ g_free (full_command);
+ g_free (xalf_prefix);
+
if (use_terminal) {
- final_command = g_strconcat (xalf_prefix, full_command, NULL);
eel_gnome_open_terminal (final_command);
} else {
- final_command = g_strconcat (xalf_prefix, full_command, " &", NULL);
- system (final_command);
+ eel_gnome_shell_execute (final_command);
}
g_free (final_command);
- g_free (full_command);
- g_free (xalf_prefix);
}
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature