[Nautilus-list] [Patch] gmc desktop scripts support
- From: Frederic Crozat <fcrozat mandrakesoft com>
- To: nautilus-list eazel com
- Subject: [Nautilus-list] [Patch] gmc desktop scripts support
- Date: 26 Jul 2001 19:56:49 +0200
Hi all,
I'd like to version in CVS all patches which are currently in Mandrake
version of Nautilus..
The main patch is adding to Nautilus support for gmc desktop scripts..
Since there is no easy way to provide .desktop files for newly created
desktop (as in gmc), I've added support for the gmc desktop scripts..
When ~/.gnome-desktop doesn't exist, Nautilus creates this directory,
execute all scripts in /usr/lib/mc/desktop-scripts and load the
desktop..
This is not a perfect patch (almost all code is stolen from gmc) but
almost all Nautilus distributors need this patch or some feature like
this one..
--- nautilus-1.0.4/libnautilus-private/Makefile.am.gmc Fri May 4 12:17:51 2001
+++ nautilus-1.0.4/libnautilus-private/Makefile.am Fri Jul 6 14:19:02 2001
@@ -12,6 +12,7 @@
$(MEDUSA_CFLAGS) \
$(LIBRSVG_CFLAGS) \
-DDATADIR=\""$(datadir)"\" \
+ -DLIBDIR="\"$(libdir)"\" \
-DNAUTILUS_DATADIR=\""$(datadir)/nautilus"\" \
$(NULL)
--- nautilus-1.0.4/libnautilus-private/nautilus-file-utilities.c.gmc Wed May 9 02:22:33 2001
+++ nautilus-1.0.4/libnautilus-private/nautilus-file-utilities.c Fri Jul 6 14:24:32 2001
@@ -36,6 +36,9 @@
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-uri.h>
#include <libgnomevfs/gnome-vfs-utils.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
#define NAUTILUS_USER_DIRECTORY_NAME ".nautilus"
#define DEFAULT_NAUTILUS_DIRECTORY_MODE (0755)
@@ -144,6 +148,11 @@
} else {
desktop_directory = nautilus_get_gmc_desktop_directory ();
if (!g_file_exists (desktop_directory)) {
+ struct dirent *dirent;
+ DIR *dir;
+ char * gmc_scripts_dir;
+ struct stat st;
+
mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE);
/* FIXME bugzilla.eazel.com 1286:
* How should we handle the case where this mkdir fails?
@@ -152,6 +161,49 @@
* could be deleted after Nautilus was launched, and perhaps
* there is some bad side-effect of not handling that case.
*/
+ /* let's initialize nautilus desktop */
+
+ gmc_scripts_dir = g_strdup (LIBDIR "/mc/desktop-scripts");
+ dir = opendir (gmc_scripts_dir);
+ if (dir) {
+ while ((dirent = readdir (dir)) != NULL) {
+ int len = strlen (dirent->d_name);
+ int links_extlen = strlen(".links");
+ char *fname;
+
+ fname = g_concat_dir_and_file (gmc_scripts_dir, dirent->d_name);
+ if (stat (fname, &st) < 0) {
+ g_free (fname);
+ continue;
+ }
+ if (S_ISDIR (st.st_mode)) {
+ g_free (fname);
+ continue;
+ }
+ if ((S_IXUSR & st.st_mode) || (S_IXGRP & st.st_mode) || (S_IXOTH & st.st_mode)) {
+ /* let's try running it */
+ char *command;
+
+ command = g_strconcat ("/bin/sh -c \"", fname, " --desktop-dir='", desktop_directory,"'\"", NULL);
+
+ system (command);
+ g_free (command);
+ g_free (fname);
+ continue;
+ }
+
+ if (len < links_extlen){
+ g_free (fname);
+ continue;
+ }
+
+ if (strcmp (dirent->d_name + len - links_extlen, ".links")){
+ g_free (fname);
+ continue;
+ }
+ }
+ }
+ g_free(gmc_scripts_dir);
}
}
--
Frédéric Crozat
MandrakeSoft
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]