From 0a024abfb55198241e4fca6b413a6626f79c4b19 Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Wed, 14 Oct 1998 06:26:05 +0000 Subject: [PATCH] In-line icon renames actually rename the file. WEEEEEEEEEE! --- gnome/ChangeLog | 4 ++++ gnome/glayout.c | 64 ++++++++++++++++++++++++------------------------- gnome/gscreen.c | 19 ++++++++++++++- 3 files changed, 54 insertions(+), 33 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 576a87bdc..aea5ffc1a 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,7 @@ +1998-10-14 Miguel de Icaza + + * gscreen.c (panel_icon_renamed): Add support for renaming files. + 1998-10-13 Miguel de Icaza * gscreen.c: Use the new icon list. diff --git a/gnome/glayout.c b/gnome/glayout.c index 880cfcfac..f079f7a19 100644 --- a/gnome/glayout.c +++ b/gnome/glayout.c @@ -265,77 +265,77 @@ void configure_box (void); GtkCheckMenuItem *gnome_toggle_snap (void); GnomeUIInfo gnome_panel_file_menu [] = { - { GNOME_APP_UI_ITEM, N_("New window"), N_("Opens a new window"), gnome_open_panel }, - { GNOME_APP_UI_ITEM, N_("New Terminal"), N_("Opens a terminal"), gnome_open_terminal }, + { GNOME_APP_UI_ITEM, N_("_New window"), N_("Opens a new window"), gnome_open_panel }, + { GNOME_APP_UI_ITEM, N_("New _Terminal"), N_("Opens a terminal"), gnome_open_terminal }, { GNOME_APP_UI_SEPARATOR }, - { GNOME_APP_UI_ITEM, N_("Copy..."), N_("Copy files"), copy_cmd }, - { GNOME_APP_UI_ITEM, N_("Rename/Move..."), N_("Rename or move files"), ren_cmd }, - { GNOME_APP_UI_ITEM, N_("New directory..."), N_("Creates a new folder"), mkdir_cmd }, - { GNOME_APP_UI_ITEM, N_("Delete..."), N_("Delete files from disk"), delete_cmd }, + { GNOME_APP_UI_ITEM, N_("_Copy..."), N_("Copy files"), copy_cmd }, + { GNOME_APP_UI_ITEM, N_("Rename/_Move..."), N_("Rename or move files"), ren_cmd }, + { GNOME_APP_UI_ITEM, N_("New di_rectory..."), N_("Creates a new folder"), mkdir_cmd }, + { GNOME_APP_UI_ITEM, N_("_Delete..."), N_("Delete files from disk"), delete_cmd }, { GNOME_APP_UI_SEPARATOR }, - { GNOME_APP_UI_ITEM, N_("View"), N_("View file"), panel_action_view }, - { GNOME_APP_UI_ITEM, N_("View raw"), N_("View the file without further processing"),panel_action_view_unfiltered}, + { GNOME_APP_UI_ITEM, N_("_View"), N_("View file"), panel_action_view }, + { GNOME_APP_UI_ITEM, N_("View r_aw"), N_("View the file without further processing"),panel_action_view_unfiltered}, { GNOME_APP_UI_SEPARATOR }, - { GNOME_APP_UI_ITEM, N_("Select group by pattern..."), N_("Select a group of files"), select_cmd }, - { GNOME_APP_UI_ITEM, N_("Unselect group by pattern..."), N_("Un-selects a group of marked files"), unselect_cmd }, - { GNOME_APP_UI_ITEM, N_("Reverse selection"), N_("Reverses the list of tagged files"), reverse_selection_cmd }, + { GNOME_APP_UI_ITEM, N_("_Select group by pattern..."), N_("Select a group of files"), select_cmd }, + { GNOME_APP_UI_ITEM, N_("_Unselect group by pattern..."), N_("Un-selects a group of marked files"), unselect_cmd }, + { GNOME_APP_UI_ITEM, N_("R_everse selection"), N_("Reverses the list of tagged files"), reverse_selection_cmd }, { GNOME_APP_UI_SEPARATOR }, - { GNOME_APP_UI_ITEM, N_("Close"), N_("Close this panel"), gnome_close_panel }, - { GNOME_APP_UI_ITEM, N_("Exit"), N_("Exit program"), gnome_quit_cmd, NULL, NULL, + { GNOME_APP_UI_ITEM, N_("C_lose"), N_("Close this panel"), gnome_close_panel }, + { GNOME_APP_UI_ITEM, N_("E_xit"), N_("Exit program"), gnome_quit_cmd, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_EXIT }, { GNOME_APP_UI_ENDOFINFO, 0, 0 } }; GnomeUIInfo gnome_panel_panel_menu [] = { - { GNOME_APP_UI_ITEM, N_("Display mode..."), N_("Set the display mode for the panel"), gnome_listing_cmd }, - { GNOME_APP_UI_ITEM, N_("Sort order..."), N_("Changes the sort order of the files"), sort_cmd }, - { GNOME_APP_UI_ITEM, N_("Filter..."), N_("Set a filter for the files"), filter_cmd }, - { GNOME_APP_UI_ITEM, N_("Rescan"), N_("Rescan the directory contents"), reread_cmd }, + { GNOME_APP_UI_ITEM, N_("_Display mode..."), N_("Set the display mode for the panel"), gnome_listing_cmd }, + { GNOME_APP_UI_ITEM, N_("_Sort order..."), N_("Changes the sort order of the files"), sort_cmd }, + { GNOME_APP_UI_ITEM, N_("_Filter..."), N_("Set a filter for the files"), filter_cmd }, + { GNOME_APP_UI_ITEM, N_("_Rescan"), N_("Rescan the directory contents"), reread_cmd }, { GNOME_APP_UI_SEPARATOR }, #ifdef USE_NETCODE - { GNOME_APP_UI_ITEM, N_("Network link..."), N_("Connect to a remote machine"), netlink_cmd }, - { GNOME_APP_UI_ITEM, N_("FTP link..."), N_("Connect to a remote machine with FTP"), ftplink_cmd }, + { GNOME_APP_UI_ITEM, N_("_Network link..."), N_("Connect to a remote machine"), netlink_cmd }, + { GNOME_APP_UI_ITEM, N_("FT_P link..."), N_("Connect to a remote machine with FTP"), ftplink_cmd }, #endif { GNOME_APP_UI_ENDOFINFO, 0, 0 } }; GnomeUIInfo gnome_panel_options_menu [] = { - { GNOME_APP_UI_ITEM, N_("Confirmation..."), N_("Confirmation settings"), confirm_box }, - { GNOME_APP_UI_ITEM, N_("Options..."), N_("Global option settings"), configure_box, NULL, NULL, + { GNOME_APP_UI_ITEM, N_("_Confirmation..."), N_("Confirmation settings"), confirm_box }, + { GNOME_APP_UI_ITEM, N_("_Options..."), N_("Global option settings"), configure_box, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP }, #ifdef USE_VFS - { GNOME_APP_UI_ITEM, N_("Virtual FS..."), N_("Virtual File System settings"), configure_vfs }, + { GNOME_APP_UI_ITEM, N_("_Virtual FS..."), N_("Virtual File System settings"), configure_vfs }, #endif { GNOME_APP_UI_SEPARATOR }, - { GNOME_APP_UI_ITEM, N_("Save setup"), NULL, save_setup_cmd }, + { GNOME_APP_UI_ITEM, N_("_Save setup"), NULL, save_setup_cmd }, { GNOME_APP_UI_ENDOFINFO, 0, 0 } }; GnomeUIInfo gnome_panel_commands_menu [] = { - { GNOME_APP_UI_ITEM, N_("Find..."), N_("Locate files on disk"), find_cmd }, - { GNOME_APP_UI_ITEM, N_("Hotlist..."), N_("List of favorite sites"), quick_chdir_cmd }, - { GNOME_APP_UI_ITEM, N_("Compare panels..."), N_("Compare panel contents"), gnome_compare_panels }, - { GNOME_APP_UI_ITEM, N_("External panelize..."), NULL, external_panelize }, + { GNOME_APP_UI_ITEM, N_("_Find..."), N_("Locate files on disk"), find_cmd }, + { GNOME_APP_UI_ITEM, N_("_Hotlist..."), N_("List of favorite sites"), quick_chdir_cmd }, + { GNOME_APP_UI_ITEM, N_("_Compare panels..."), N_("Compare panel contents"), gnome_compare_panels }, + { GNOME_APP_UI_ITEM, N_("_External panelize..."), NULL, external_panelize }, #ifdef USE_VFS - { GNOME_APP_UI_ITEM, N_("Active VFS list..."), N_("List of active virtual file systems"), reselect_vfs }, + { GNOME_APP_UI_ITEM, N_("_Active VFS list..."), N_("List of active virtual file systems"), reselect_vfs }, #endif #ifdef USE_EXT2FSLIB - { GNOME_APP_UI_ITEM, N_("Undelete files (ext2fs only)..."), N_("Recover deleted files"), undelete_cmd }, + { GNOME_APP_UI_ITEM, N_("_Undelete files (ext2fs only)..."), N_("Recover deleted files"), undelete_cmd }, #endif #ifdef WITH_BACKGROUND - { GNOME_APP_UI_ITEM, N_("Background jobs..."), N_("List of background operations"), jobs_cmd }, + { GNOME_APP_UI_ITEM, N_("_Background jobs..."), N_("List of background operations"), jobs_cmd }, #endif { GNOME_APP_UI_ENDOFINFO, 0, 0 } }; GnomeUIInfo gnome_panel_desktop_menu [] = { - { GNOME_APP_UI_ITEM, N_("Arrange icons"), N_("Arranges the icons on the desktop"), gnome_arrange_icons }, + { GNOME_APP_UI_ITEM, N_("_Arrange icons"), N_("Arranges the icons on the desktop"), gnome_arrange_icons }, /* { GNOME_APP_UI_TOGGLEITEM, N_("Desktop grid"), N_("Use a grid for laying out icons"), gnome_toggle_snap }, */ { GNOME_APP_UI_ENDOFINFO, 0, 0 } }; GnomeUIInfo gnome_panel_about_menu [] = { - { GNOME_APP_UI_ITEM, N_("About"), N_("Information on this program"), gnome_about_cmd, NULL, NULL, + { GNOME_APP_UI_ITEM, N_("_About"), N_("Information on this program"), gnome_about_cmd, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT }, GNOMEUIINFO_HELP ("midnight-commander"), GNOMEUIINFO_END diff --git a/gnome/gscreen.c b/gnome/gscreen.c index 64733b21e..f79bc972d 100644 --- a/gnome/gscreen.c +++ b/gnome/gscreen.c @@ -1270,6 +1270,20 @@ panel_icon_list_unselect_icon (GtkWidget *widget, int index, GdkEvent *event, WP panel->selected = 0; } +static int +panel_icon_renamed (GtkWidget *widget, int index, char *dest, WPanel *panel) +{ + char *source; + + source = panel->dir.list [index].fname; + if (mc_rename (source, dest) == 0){ + free (panel->dir.list [index].fname); + panel->dir.list [index].fname = strdup (dest); + return TRUE; + } else + return FALSE; +} + static GdkImlibImage * load_image_icon_view (char *base) { @@ -1409,7 +1423,10 @@ panel_create_icon_display (WPanel *panel) gtk_signal_connect ( GTK_OBJECT (icon_field), "unselect_icon", GTK_SIGNAL_FUNC (panel_icon_list_unselect_icon), panel); - + gtk_signal_connect ( + GTK_OBJECT (icon_field), "text_changed", + GTK_SIGNAL_FUNC (panel_icon_renamed), panel); + gtk_signal_connect ( GTK_OBJECT (icon_field), "realize", GTK_SIGNAL_FUNC (panel_icon_list_realized), panel);