Le 11/05/2011 05:08 PM, PCMan a écrit :
> Yet another TODO item for 1.0 release.
> 1. Implement an easy way to add new desktop entry to desktop.
> 2. May optionally integrate lxshorcut?
Maybe it will be covered by the nautilus-actions specs ?
Or, there is a preliminary patch for this support (see attached). It
could also be improved by launching the same UI than when you launch
"Open with ...".
Regards,
Julien Lavergne
Index: pcmanfm-0.9.10/src/desktop-ui.c
===================================================================
--- pcmanfm-0.9.10.orig/src/desktop-ui.c 2011-10-24 22:21:16.000000000 +0200
+++ pcmanfm-0.9.10/src/desktop-ui.c 2011-11-06 18:57:20.000000000 +0100
@@ -26,6 +26,7 @@
"<menu action='CreateNew'>"
"<menuitem action='NewFolder'/>"
"<menuitem action='NewBlank'/>"
+ "<menuitem action='NewShortcut'/>"
"</menu>"
"<separator/>"
"<menuitem action='Paste'/>"
@@ -55,6 +56,7 @@
{"CreateNew", NULL, N_("Create _New..."), "", NULL, NULL},
{"NewFolder", "folder", N_("Folder"), "<Ctrl><Shift>N", NULL, G_CALLBACK(on_create_new)},
{"NewBlank", "text-x-generic", N_("Blank File"), NULL, NULL, G_CALLBACK(on_create_new)},
+ {"NewShortcut", "system-run", N_("Shortcut"), NULL, NULL, G_CALLBACK(on_create_new)},
{"Prop", GTK_STOCK_PROPERTIES, N_("Desktop Preferences"), "<Alt>Return", NULL, G_CALLBACK(fm_desktop_preference)}
};
Index: pcmanfm-0.9.10/src/desktop.c
===================================================================
--- pcmanfm-0.9.10.orig/src/desktop.c 2011-10-24 22:21:16.000000000 +0200
+++ pcmanfm-0.9.10/src/desktop.c 2011-11-06 18:57:20.000000000 +0100
@@ -2024,6 +2024,8 @@
name = TEMPL_NAME_FOLDER;
else if( strcmp(name, "NewBlank") == 0 )
name = TEMPL_NAME_BLANK;
+ else if( strcmp(name, "NewShortcut") == 0)
+ name = TEMPL_NAME_SHORTCUT;
pcmanfm_create_new(NULL, fm_path_get_desktop(), name);
}
Index: pcmanfm-0.9.10/src/main-win-ui.c
===================================================================
--- pcmanfm-0.9.10.orig/src/main-win-ui.c 2011-10-24 22:21:16.000000000 +0200
+++ pcmanfm-0.9.10/src/main-win-ui.c 2011-11-06 18:57:20.000000000 +0100
@@ -114,6 +114,7 @@
"<menu action='CreateNew'>"
"<menuitem action='NewFolder'/>"
"<menuitem action='NewBlank'/>"
+ "<menuitem action='NewShortcut'/>"
"</menu>"
"<separator/>"
"<menuitem action='Paste'/>"
@@ -189,6 +190,7 @@
{"CreateNew", NULL, N_("Create _New..."), "", NULL, NULL},
{"NewFolder", "folder", N_("Folder"), "<Ctrl><Shift>N", NULL, G_CALLBACK(on_create_new)},
{"NewBlank", "text-x-generic", N_("Blank File"), NULL, NULL, G_CALLBACK(on_create_new)},
+ {"NewShortcut", "system-run", N_("Shortcut"), NULL, NULL, G_CALLBACK(on_create_new)},
{"Prop", GTK_STOCK_PROPERTIES, NULL, NULL, NULL, G_CALLBACK(on_prop)}
};
Index: pcmanfm-0.9.10/src/main-win.c
===================================================================
--- pcmanfm-0.9.10.orig/src/main-win.c 2011-11-06 18:56:30.000000000 +0100
+++ pcmanfm-0.9.10/src/main-win.c 2011-11-06 18:57:20.000000000 +0100
@@ -1227,6 +1227,8 @@
name = TEMPL_NAME_FOLDER;
else if( strcmp(name, "NewBlank") == 0 )
name = TEMPL_NAME_BLANK;
+ else if( strcmp(name, "NewShortcut") == 0 )
+ name = TEMPL_NAME_SHORTCUT;
pcmanfm_create_new(GTK_WINDOW(win), fm_folder_view_get_cwd(fv), name);
}
Index: pcmanfm-0.9.10/src/pcmanfm.h
===================================================================
--- pcmanfm-0.9.10.orig/src/pcmanfm.h 2011-10-24 22:21:16.000000000 +0200
+++ pcmanfm-0.9.10/src/pcmanfm.h 2011-11-06 18:57:20.000000000 +0100
@@ -44,6 +44,7 @@
#define TEMPL_NAME_FOLDER NULL
#define TEMPL_NAME_BLANK (const char*)-1
+#define TEMPL_NAME_SHORTCUT (const char*)-2
void pcmanfm_create_new(GtkWindow* parent, FmPath* cwd, const char* templ);
G_END_DECLS
Index: pcmanfm-0.9.10/src/pcmanfm.c
===================================================================
--- pcmanfm-0.9.10.orig/src/pcmanfm.c 2011-11-06 18:56:30.000000000 +0100
+++ pcmanfm-0.9.10/src/pcmanfm.c 2011-11-06 18:57:20.000000000 +0100
@@ -576,6 +576,15 @@
}
g_object_unref(gf);
}
+ else if ( templ == TEMPL_NAME_SHORTCUT )
+ {
+ char buf[256];
+ GFile* gf = fm_path_to_gfile(dest);
+ printf("Creating Shortcut..."); // Debug message
+ sprintf(buf, "/usr/bin/lxshortcut -i %s",g_file_get_path(gf));
+ system(buf);
+ g_object_unref(gf);
+ }
else /* templates in ~/Templates */
{
FmPath* dir = fm_path_new_for_str(g_get_user_special_dir(G_USER_DIRECTORY_TEMPLATES));
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Lxde-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxde-list