[Nautilus-list] [PATCH] creating launchers with Nautilus



There are a couple of issues with this patch that I'm aware of:
1. It cannot create launchers in vFolders. But at least it handles the
error gracefully. I have some code that will partially handle this (as
discussed on another thread recently, but it is nowhere near being ready.

2. It creates another "New ...."-item to an already pretty swamped
context-menu. I don't know what to do with this.

3. It has no help yet.

Gaute

? src/file-manager/nautilus-launcher-dialog.c
? src/file-manager/nautilus-launcher-dialog.h
Index: src/file-manager/Makefile.am
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/Makefile.am,v
retrieving revision 1.67
diff -u -r1.67 Makefile.am
--- src/file-manager/Makefile.am	2002/02/14 23:21:59	1.67
+++ src/file-manager/Makefile.am	2002/03/05 13:55:30
@@ -26,6 +26,7 @@
 	fm-properties-window.c		\
 	fm-search-list-view.c		\
 	nautilus-indexing-info.c	\
+	nautilus-launcher-dialog.c	\
 	fm-desktop-icon-view.h 		\
 	fm-directory-view.h 		\
 	fm-error-reporting.h 		\
@@ -36,6 +37,7 @@
 	fm-properties-window.h 		\
 	fm-search-list-view.h 		\
 	nautilus-indexing-info.h 	\
+	nautilus-launcher-dialog.h	\
 	$(NULL)
 
 uidir = $(datadir)/gnome-2.0/ui
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.511
diff -u -r1.511 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	2002/03/02 00:30:55	1.511
+++ src/file-manager/fm-directory-view.c	2002/03/05 13:55:42
@@ -33,6 +33,7 @@
 #include "fm-desktop-icon-view.h"
 #include "fm-error-reporting.h"
 #include "fm-properties-window.h"
+#include "nautilus-launcher-dialog.h"
 #include <bonobo/bonobo-control.h>
 #include <bonobo/bonobo-window.h>
 #include <bonobo/bonobo-zoomable.h>
@@ -107,6 +108,7 @@
 #define FM_DIRECTORY_VIEW_COMMAND_OPEN_ALTERNATE        		"/commands/OpenAlternate"
 #define FM_DIRECTORY_VIEW_COMMAND_OPEN_WITH				"/commands/Open With"
 #define FM_DIRECTORY_VIEW_COMMAND_NEW_FOLDER				"/commands/New Folder"
+#define FM_DIRECTORY_VIEW_COMMAND_NEW_LAUNCHER				"/commands/New Launcher"
 #define FM_DIRECTORY_VIEW_COMMAND_DELETE                    		"/commands/Delete"
 #define FM_DIRECTORY_VIEW_COMMAND_SHOW_TRASH                    	"/commands/Show Trash"
 #define FM_DIRECTORY_VIEW_COMMAND_TRASH                    		"/commands/Trash"
@@ -929,6 +931,16 @@
 }
 
 static void
+new_launcher_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
+{
+	char * path;
+	g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
+	path = (char *) nautilus_directory_get_uri(FM_DIRECTORY_VIEW (callback_data)->details->model);
+	launcher_dialog (path, fm_directory_view_get_containing_window (FM_DIRECTORY_VIEW (callback_data)), NULL);
+	
+}
+
+static void
 open_properties_window_callback (BonoboUIComponent *component, gpointer callback_data, const char *verb)
 {
         FMDirectoryView *view;
@@ -4106,6 +4118,7 @@
 		BONOBO_UI_VERB ("Duplicate", duplicate_callback),
 		BONOBO_UI_VERB ("Empty Trash", bonobo_menu_empty_trash_callback),
 		BONOBO_UI_VERB ("New Folder", new_folder_callback),
+		BONOBO_UI_VERB ("New Launcher", new_launcher_callback),
 		BONOBO_UI_VERB ("Open Scripts Folder", open_scripts_folder_callback),
 		BONOBO_UI_VERB ("Open", open_callback),
 		BONOBO_UI_VERB ("OpenAlternate", open_alternate_callback),
@@ -4186,6 +4199,9 @@
 
 	nautilus_bonobo_set_sensitive (view->details->ui, 
 				       FM_DIRECTORY_VIEW_COMMAND_NEW_FOLDER,
+				       can_create_files);
+	nautilus_bonobo_set_sensitive (view->details->ui, 
+				       FM_DIRECTORY_VIEW_COMMAND_NEW_LAUNCHER,
 				       can_create_files);
 
 	nautilus_bonobo_set_sensitive (view->details->ui, 
Index: src/file-manager/nautilus-directory-view-ui.xml
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/nautilus-directory-view-ui.xml,v
retrieving revision 1.33
diff -u -r1.33 nautilus-directory-view-ui.xml
--- src/file-manager/nautilus-directory-view-ui.xml	2002/03/01 18:12:30	1.33
+++ src/file-manager/nautilus-directory-view-ui.xml	2002/03/05 13:55:43
@@ -15,6 +15,9 @@
 	<cmd name="New Folder"
          _label="New Folder"
 	 _tip="Create a new empty folder inside this folder"/>
+        <cmd name="New Launcher"
+	 _label="New Launcher"
+         _tip="Create a new launcher inside this folder"/>
 	<cmd name="Open"
          _label="Open"
 	 _tip="Open the selected item in this window"/>
@@ -76,6 +79,10 @@
 				  _label="_New Folder"
 			  	  accel="*Control*n"
 				  verb="New Folder"/>
+                        <menuitem name="New Launcher"
+				  _label="_New Launcher"
+				  verb="New Launcher"/>
+
 		</placeholder>
 		<placeholder name="Open Placeholder">
 			<menuitem name="Open"
@@ -183,6 +190,7 @@
 		<placeholder name="Before Zoom Items">
 			<placeholder name="New Items">
 				<menuitem name="New Folder" verb="New Folder"/>
+                                <menuitem name="New Launcher" verb="New Launcher"/>
 			</placeholder>
                         <submenu name="Scripts"
 				 _label="Scripts"


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