Re: [Nautilus-list] nautilus-1.0.4-gmc.patch



le mer 14-11-2001 à 21:24, Alex Larsson a écrit :
> On 14 Nov 2001, Frederic Crozat wrote:
> 
> > le lun 12-11-2001 à 19:55, Darin Adler a écrit :
> > > > Here is another suggestion which could be used by all distributions :
> > > > instead of copying start-here.desktop from $(datadir)/nautilus to
> > > > ~/.gnome-desktop,
> > > > 1- we create $(datadir)/nautilus/default-desktop and we put
> > > > start-here.desktop
> > > > 2- each distribution packager (and system administrator too) can add as
> > > > many .desktop as they want in $(datadir)/nautilus/default-desktop, with
> > > > a .nautilus-metafile.xml
> > > > 3- create_starthere_link_callback is renamed into something like
> > > > create_default_desktop_callback, and copy content of
> > > > $(datadir)/nautilus/default-desktop into ~/.gnome-desktop
> > > > 
> > > > Are you ok with this design ? If so, I'll do a patch and will ask for
> > > > review here..
> > > 
> > > Sounds good -- better than the gmc script thing.
> > 
> > I'm currently working on that and when I modified
> > create_starthere_link_callback, I had problem with two files :
> > start-here.desktop and start-here-link.desktop file. The
> > start-here-link.desktop is copied on ~/.gnome-desktop as
> > start-here.desktop so I don't see any use for start-here.desktop.. Is it
> > really needed ?
> 
> Of course it's needed. It is typically used to place start-here on the 
> panel. The start-here-link.desktop file is a link, and can't be 
> "launched", whereas the start-here.desktop is launched nautilus with 
> start-here as argument.

If start-here.desktop had been located in $datadir/gnome/apps, I would
had understood but I didn't understood since it was in
$datadir/nautilus...

> > I'd like to move start-here-link.desktop to
> > DATADIR/nautilus/default-desktop and rename it start-here.desktop
> > (therefore, a simple copy from DATADIR/nautilus/default-desktop to
> > ~/.gnome-desktop would work).
> > 
> > Comments ? (maybe Havoc or Alex ncould comment on the start-here problem
> > since originaly it was a redhat patch ..)
> 
> Sounds fine.

Ok, here is a patch to generalize the start-here mecanism. I've moved
start-here-link.desktop.in to data/default-desktop and renamed it to
start-here.desktop.in to simplify Makefile.am

I've also added a "Create Default Icons" in Desktop Background menu.

I'm waiting for your comments.. (the nautilus-metafile.xml copy is done
to provide some way to set locations of default icons)
-- 
Frédéric Crozat
MandrakeSoft
--- nautilus-1.0.6/data/Makefile.am.defaultdesktop	Sun Oct  7 18:36:03 2001
+++ nautilus-1.0.6/data/Makefile.am	Thu Nov 15 15:47:42 2001
@@ -9,7 +9,6 @@
 			sysconfig.desktop.in		\
 			preferences.desktop.in		\
 			serverconfig.desktop.in		\
-			starthere-link.desktop.in	\
 			$(NULL)
 
 DIRECTORY_IN_FILES=	serverconfig.directory.in	\
@@ -38,7 +37,6 @@
 	nautilus-extras.placeholder 	\
 	nautilus-suggested.placeholder 	\
 	starthere.desktop		\
-	starthere-link.desktop		\
 	$(NULL)
 
 EXTRA_DIST = $(nautilusdata_DATA) \
@@ -52,6 +50,7 @@
 	emblems \
 	linksets \
 	patterns \
+	default-desktop \
 	$(NULL)
 
 install-data-local: $(DIRECTORY_FILES)
--- nautilus-1.0.6/data/default-desktop/starthere.desktop.in.defaultdesktop	Thu Nov 15 15:47:42 2001
+++ nautilus-1.0.6/data/default-desktop/starthere.desktop.in	Thu Nov 15 15:47:42 2001
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Type=Link
+_Name=Start Here
+_Comment=Start Here
+URL=start-here:
+Icon=gnome-starthere.png
+X-Nautilus-Icon=gnome-starthere
+Terminal=0
--- nautilus-1.0.6/data/default-desktop/Makefile.am.defaultdesktop	Thu Nov 15 15:47:42 2001
+++ nautilus-1.0.6/data/default-desktop/Makefile.am	Thu Nov 15 15:47:42 2001
@@ -0,0 +1,22 @@
+NULL=
+
+ XML_I18N_MERGE_DESKTOP_RULE@
+ XML_I18N_MERGE_DIRECTORY_RULE@
+
+DESKTOP_IN_FILES= 	starthere.desktop.in	\
+			$(NULL)
+
+DESKTOP_FILES=$(DESKTOP_IN_FILES:.desktop.in=.desktop)
+
+DESKTOP_FILES=$(DESKTOP_IN_FILES:.in=)
+
+nautilusdesktopdatadir = $(datadir)/nautilus/default-desktop
+
+nautilusdesktopdata_DATA = \
+	starthere.desktop		\
+	$(NULL)
+
+EXTRA_DIST = 
+	$(DESKTOP_IN_FILES)			\
+	$(DESKTOP_FILES)			\
+	$(NULL)
--- nautilus-1.0.6/src/file-manager/nautilus-desktop-icon-view-ui.xml.defaultdesktop	Sat Mar 24 02:25:39 2001
+++ nautilus-1.0.6/src/file-manager/nautilus-desktop-icon-view-ui.xml	Thu Nov 15 15:47:42 2001
@@ -15,6 +15,9 @@
         <cmd name="Reset Background"
          _label="Reset Desktop Background"
          _tip="Remove any custom pattern or color from the desktop background"/>
+	<cmd name="Create Default Icons"
+         _label="Create Default Icons"
+	 _tip="Create default icons on your desktop"/>
 </commands>
 <menu>
 	<!-- By re-labelling these submenus to names without underscores, we
@@ -47,6 +50,7 @@
                         <placeholder name="Background Items">
                                 <menuitem name="Reset Background" verb="Reset Background"/>
                                 <menuitem name="Change Background" verb="Change Background"/>
+				<menuitem name="Create Default Icons" verb="Create Default Icons"/>
                         </placeholder>
                 </placeholder>
         </popup>
@@ -60,4 +64,4 @@
                 </placeholder>
         </popup>
 </popups>
-</Root>
\ No newline at end of file
+</Root>
--- nautilus-1.0.6/src/file-manager/fm-desktop-icon-view.c.defaultdesktop	Thu Oct  4 18:30:56 2001
+++ nautilus-1.0.6/src/file-manager/fm-desktop-icon-view.c	Thu Nov 15 15:47:42 2001
@@ -696,6 +696,15 @@
 }
 
 static void
+create_default_icons_callback (BonoboUIComponent *component,
+			       gpointer data,
+			       const char *verb)
+{
+	nautilus_application_create_default_desktop_links ();
+}
+
+
+static void
 unmount_volume_callback (BonoboUIComponent *component, gpointer data, const char *verb)
 {
         FMDirectoryView *view;
@@ -1248,6 +1257,7 @@
 		BONOBO_UI_VERB ("New Terminal", new_terminal_callback),
 		BONOBO_UI_VERB ("Reset Background", reset_background_callback),
 		BONOBO_UI_VERB ("Unmount Volume Conditional", unmount_volume_callback),
+		BONOBO_UI_VERB ("Create Default Icons", create_default_icons_callback),
 		BONOBO_UI_VERB_END
 	};
 
--- nautilus-1.0.6/src/nautilus-application.c.defaultdesktop	Sat Sep 15 21:23:04 2001
+++ nautilus-1.0.6/src/nautilus-application.c	Thu Nov 15 16:41:22 2001
@@ -60,6 +60,7 @@
 #include <libnautilus-private/nautilus-global-preferences.h>
 #include <libnautilus-private/nautilus-icon-factory.h>
 #include <libnautilus-private/nautilus-metafile-factory.h>
+#include <libnautilus-private/nautilus-metafile.h>
 #include <libnautilus-private/nautilus-sound.h>
 #include <libnautilus-private/nautilus-undo-manager.h>
 #include <libnautilus-private/nautilus-volume-monitor.h>
@@ -415,21 +416,26 @@
 }
 
 static gint
-create_starthere_link_callback (gpointer data)
+create_default_desktop_links_callback (gpointer data)
 {
 	char *desktop_path;
-	char *desktop_link_file;
+	char *metafile;
 	char *cmd;
 	
 	/* Create default services icon on the desktop */
 	desktop_path = nautilus_get_desktop_directory ();
-	desktop_link_file = nautilus_make_path (desktop_path,
-						"starthere.desktop");
 
-	cmd = g_strconcat ("/bin/cp ",
-			   NAUTILUS_DATADIR,
-			   "/starthere-link.desktop ",
-			   desktop_link_file,
+	if (g_file_exists (nautilus_make_path ( NAUTILUS_DATADIR "/default-desktop/", NAUTILUS_METAFILE_NAME_SUFFIX))) {
+		metafile = NAUTILUS_DATADIR "/default-desktop/" NAUTILUS_METAFILE_NAME_SUFFIX " " ;
+	} else {
+		metafile = " ";
+	}
+		
+
+	cmd = g_strconcat ("/bin/cp -u ",
+			   NAUTILUS_DATADIR "/default-desktop/* ",
+			   metafile,
+			   desktop_path,
 			   NULL);
 
 	if (system (cmd) != 0) {
@@ -437,12 +443,17 @@
 	}
 	
 	g_free (desktop_path);
-	g_free (desktop_link_file);
 	g_free (cmd);
 	
 	return FALSE;
 }
 
+void
+nautilus_application_create_default_desktop_links ()
+{
+	create_default_desktop_links_callback (NULL);
+}
+
 static void
 finish_startup (NautilusApplication *application)
 {
@@ -498,7 +509,7 @@
 		 * itself. Otherwise we may spawn a second nautilus
 		 * process when looking for a metadata factory..
 		 */
-		g_idle_add (create_starthere_link_callback, NULL);
+		g_idle_add (create_default_desktop_links_callback, NULL);
 		nautilus_set_first_time_file_flag ();
 	}
 
--- nautilus-1.0.6/src/nautilus-application.h.defaultdesktop	Fri May  4 05:14:38 2001
+++ nautilus-1.0.6/src/nautilus-application.h	Thu Nov 15 15:47:42 2001
@@ -67,5 +67,6 @@
 void                 nautilus_application_close_all_windows (void);
 void                 nautilus_application_open_desktop      (NautilusApplication *application);
 void                 nautilus_application_close_desktop     (void);
+void                 nautilus_application_create_default_desktop_links (void);
 
 #endif /* NAUTILUS_APPLICATION_H */
--- nautilus-1.0.6/configure.in.defaultdesktop	Thu Nov  8 02:52:37 2001
+++ nautilus-1.0.6/configure.in	Thu Nov 15 15:47:42 2001
@@ -760,6 +760,7 @@
 data/patterns/Makefile
 data/emblems/Makefile
 data/linksets/Makefile
+data/default-desktop/Makefile
 cut-n-paste-code/Makefile
 cut-n-paste-code/widgets/Makefile
 cut-n-paste-code/widgets/e-paned/Makefile


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