Re: Templates creation & copying contents of symlinks
Bernard Jungen <[email protected]>
| Newsgroups | gmane.comp.desktop.rox.devel |
|---|---|
| Message-ID | <[email protected]> |
OK, it was easier than I thought. Here's a ROX patch that: - makes the symlink box remember the "relative" setting between invocations; - makes creating a new file from a template work when the template is a symlink (copying the target contents). However, if the template target is a directory containing symlinks, those are copied as they are. Cheers, Bernard. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ rox-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rox-devel
rox_symlink
(text/plain, 3 KB)
diff -rc src.old/menu.c src/menu.c
*** src.old/menu.c 2008-05-14 19:19:21.000000000 +0200
--- src/menu.c 2008-05-31 20:08:04.000000000 +0200
***************
*** 1069,1074 ****
--- 1069,1076 ----
destroy_glist(&paths);
}
+ static gboolean last_symlink_check_relative = TRUE;
+
/* This creates a new savebox widget, and allows the user to pick a new path
* for the file.
* Once the new path has been picked, the callback will be called with
***************
*** 1092,1098 ****
check_relative = gtk_check_button_new_with_mnemonic(
_("_Relative link"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_relative),
! TRUE);
GTK_WIDGET_UNSET_FLAGS(check_relative, GTK_CAN_FOCUS);
gtk_tooltips_set_tip(tooltips, check_relative,
--- 1094,1100 ----
check_relative = gtk_check_button_new_with_mnemonic(
_("_Relative link"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check_relative),
! last_symlink_check_relative);
GTK_WIDGET_UNSET_FLAGS(check_relative, GTK_CAN_FOCUS);
gtk_tooltips_set_tip(tooltips, check_relative,
***************
*** 1220,1226 ****
check_relative = g_object_get_data(savebox, "check_relative");
! if (gtk_toggle_button_get_active(check_relative))
link_path = get_relative_path(path, initial);
else
link_path = g_strdup(initial);
--- 1222,1230 ----
check_relative = g_object_get_data(savebox, "check_relative");
! last_symlink_check_relative = gtk_toggle_button_get_active(check_relative);
!
! if (last_symlink_check_relative)
link_path = get_relative_path(path, initial);
else
link_path = g_strdup(initial);
***************
*** 1409,1415 ****
const gchar *initial, const gchar *path)
{
const gchar *oleaf, *leaf;
! gchar *templ, *templ_dname, *dest;
GList *paths;
/* We can work out the template path from the initial name */
--- 1413,1419 ----
const gchar *initial, const gchar *path)
{
const gchar *oleaf, *leaf;
! gchar *templ, *rtempl, *templ_dname, *dest;
GList *paths;
/* We can work out the template path from the initial name */
***************
*** 1425,1440 ****
templ = g_strconcat(templ_dname, "/", oleaf, NULL);
g_free(templ_dname);
dest = g_path_get_dirname(path);
leaf = g_basename(path);
! paths = g_list_append(NULL, templ);
action_copy(paths, dest, leaf, TRUE);
g_list_free(paths);
g_free(dest);
! g_free(templ);
if (filer_exists(window_with_focus))
display_set_autoselect(window_with_focus, leaf);
--- 1429,1446 ----
templ = g_strconcat(templ_dname, "/", oleaf, NULL);
g_free(templ_dname);
+ rtempl = pathdup(templ);
+ g_free(templ);
dest = g_path_get_dirname(path);
leaf = g_basename(path);
! paths = g_list_append(NULL, rtempl);
action_copy(paths, dest, leaf, TRUE);
g_list_free(paths);
g_free(dest);
! g_free(rtempl);
if (filer_exists(window_with_focus))
display_set_autoselect(window_with_focus, leaf);