mirror of https://github.com/MidnightCommander/mc
1999-01-10 Ilya Zakharevich <ilya@math.ohio-state.edu>
* gtkedit/edit.c (edit_load_file): Off-by-one error disabled editing. 1999-01-11 Miguel de Icaza <miguel@nuclecu.unam.mx> * configure.in (REGEX_O): Always include regex.o as the code we are using in gmc is not using regcomp/regexec, but the internal Emacs API. * src/regex.c: Do not compile the POSIX compatibility code, as we do not use it. Tue Dec 29 15:49:45 1998 Norbert Warmuth <nwarmuth@privat.circular.de> * doc/mc.sgml, mc1.in (Color section): minor polishing (Layout section): documented Highlight...
This commit is contained in:
parent
4c6fef14d8
commit
0fa363d984
|
@ -1,7 +1,15 @@
|
|||
1999-01-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* glayout.c (run_cmd): Add run command. Add back FTP link
|
||||
command. Add Mkdir command. Use standard key definitions.
|
||||
|
||||
* gview.c: Use new standard keybindings
|
||||
|
||||
* gtkdtree.c: Now it uses the treestore code.
|
||||
|
||||
* treestore.c: New file format which includes the scan status of
|
||||
the directories.
|
||||
|
||||
* treestore.c: Provide _opendir, _readdir, _closedir operations
|
||||
for the tree cache.
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "main.h"
|
||||
#include "gmain.h"
|
||||
#include "cmd.h"
|
||||
#include "dialog.h"
|
||||
#include "boxes.h"
|
||||
#include "panelize.h"
|
||||
#include "gcmd.h"
|
||||
|
@ -260,13 +261,24 @@ save_panel_types (void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
run_cmd (void)
|
||||
{
|
||||
char *cmd;
|
||||
|
||||
cmd = input_dialog (_("Enter command to run"), _("Enter command to run"), "");
|
||||
if (cmd && *cmd){
|
||||
my_system (EXECUTE_AS_SHELL, shell, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
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 folder"), N_("Creates a folder"), mkdir_panel_cmd },
|
||||
GNOMEUIINFO_MENU_NEW_ITEM(N_("_New window"), N_("Opens a new window"), gnome_open_panel, NULL),
|
||||
GNOMEUIINFO_MENU_NEW_ITEM(N_("_New folder"),N_("Creates a folder"), mkdir_panel_cmd, NULL),
|
||||
/* We want to make a new menu entry here... */
|
||||
/* For example: */
|
||||
/* New-> */
|
||||
|
@ -275,25 +287,27 @@ GnomeUIInfo gnome_panel_file_menu [] = {
|
|||
/* Gnumeric Spreadsheet */
|
||||
/* Text Document */
|
||||
/* etc... */
|
||||
|
||||
{ GNOME_APP_UI_SEPARATOR },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Open"), N_("Open selected files"), NULL, NULL,
|
||||
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Run"), N_("Runs a command"), run_cmd, NULL,
|
||||
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_OPEN, GDK_F2, 0 },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Open"), N_("Opens the selected files"), NULL },
|
||||
{ GNOME_APP_UI_ITEM, N_("Open _FTP site"), N_("Opens an FTP site"), ftplink_cmd },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Copy..."), N_("Copy files"), copy_cmd, NULL},
|
||||
{ GNOME_APP_UI_ITEM, N_("_Delete..."), N_("Delete files from disk"), delete_cmd },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Move..."), N_("Rename or move files"), ren_cmd },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Make directory..."), N_("Creates a new directory"), mkdir_cmd },
|
||||
{ GNOME_APP_UI_SEPARATOR },
|
||||
{ GNOME_APP_UI_ITEM, N_("C_lose"), N_("Close this panel"), gnome_close_panel, NULL,
|
||||
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CLOSE },
|
||||
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CLOSE,
|
||||
GNOME_KEY_NAME_CLOSE, GNOME_KEY_MOD_CLOSE, NULL },
|
||||
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
||||
};
|
||||
|
||||
GnomeUIInfo gnome_panel_edit_menu [] = {
|
||||
{ GNOME_APP_UI_ITEM, N_("_Cut"), N_("Cuts the selected files into the cut buffer."), NULL, NULL,
|
||||
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_CUT },
|
||||
{ GNOME_APP_UI_ITEM, N_("C_opy"), N_("Copies the selected files into the cut buffer."), NULL, NULL,
|
||||
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_COPY },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Paste"), N_("Pastes files from the cut buffer into the current directory"), NULL, NULL,
|
||||
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PASTE },
|
||||
GNOMEUIINFO_MENU_CUT_ITEM(NULL, NULL),
|
||||
GNOMEUIINFO_MENU_COPY_ITEM(NULL, NULL),
|
||||
GNOMEUIINFO_MENU_PASTE_ITEM(NULL, NULL),
|
||||
{ GNOME_APP_UI_SEPARATOR },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Select All"), N_("Select all files in the current Panel"), gnome_select_all_cmd },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Select Files..."), N_("Select a group of files"), select_cmd },
|
||||
|
@ -301,8 +315,7 @@ GnomeUIInfo gnome_panel_edit_menu [] = {
|
|||
{ GNOME_APP_UI_SEPARATOR },
|
||||
{ GNOME_APP_UI_ITEM, N_("_Rescan Directory"), N_("Rescan the directory contents"), reread_cmd },
|
||||
{ GNOME_APP_UI_SEPARATOR },
|
||||
{ GNOME_APP_UI_ITEM, N_("Preferences..."), N_("Configure the GNOME Midnight Commander"), gnome_configure_box, NULL,
|
||||
NULL, GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_PROP},
|
||||
GNOMEUIINFO_MENU_PREFERENCES_ITEM(gnome_configure_box, NULL),
|
||||
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
||||
};
|
||||
|
||||
|
@ -456,7 +469,7 @@ create_container (Dlg_head *h, char *name, char *geometry)
|
|||
|
||||
panel = panel_new (name);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_set_border_width (vbox, 0);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox), 0);
|
||||
gnome_app_set_contents (GNOME_APP (app), vbox);
|
||||
gnome_app_create_menus_with_data (GNOME_APP (app), gnome_panel_menu, panel);
|
||||
|
||||
|
|
|
@ -115,11 +115,7 @@ gtk_dtree_load_path (GtkDTree *dtree, char *path, GtkCTreeNode *parent, int leve
|
|||
|
||||
for (; (dirent = tree_store_readdir (dir)) != NULL; ){
|
||||
GtkCTreeNode *sibling;
|
||||
struct stat s;
|
||||
char *text [1];
|
||||
int res;
|
||||
|
||||
res = mc_stat (dirent->name, &s);
|
||||
|
||||
text [0] = x_basename (dirent->name);
|
||||
|
||||
|
@ -485,6 +481,10 @@ gtk_dtree_save_tree (void)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback routine invoked by the treestore code when the state
|
||||
* of the treestore has been modified.
|
||||
*/
|
||||
static void
|
||||
gtk_dtree_dirty_notify (int state)
|
||||
{
|
||||
|
@ -498,7 +498,7 @@ gtk_dtree_dirty_notify (int state)
|
|||
}
|
||||
|
||||
if (state)
|
||||
dirty_tag = gtk_timeout_add (1000, (GtkFunction) gtk_dtree_save_tree, NULL);
|
||||
dirty_tag = gtk_timeout_add (10 * 1000, (GtkFunction) gtk_dtree_save_tree, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -286,49 +286,43 @@ gnome_monitor (GtkWidget *widget, WView *view)
|
|||
}
|
||||
|
||||
GnomeUIInfo gview_file_menu [] = {
|
||||
GNOMEUIINFO_ITEM_STOCK (N_("Goto line"),
|
||||
GNOMEUIINFO_ITEM_STOCK (N_("_Goto line"),
|
||||
N_("Jump to a specified line number"),
|
||||
&gnome_goto_line, GNOME_STOCK_PIXMAP_JUMP_TO),
|
||||
GNOMEUIINFO_ITEM (N_("Monitor file"), N_("Monitor file growing"), &gnome_monitor, NULL),
|
||||
GNOMEUIINFO_ITEM_STOCK (N_("Close"),
|
||||
N_("Close the viewer"),
|
||||
&gview_quit, GNOME_STOCK_PIXMAP_QUIT),
|
||||
GNOMEUIINFO_ITEM (N_("_Monitor file"), N_("Monitor file growing"), &gnome_monitor, NULL),
|
||||
GNOMEUIINFO_MENU_CLOSE_ITEM(gview_quit, NULL),
|
||||
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
||||
};
|
||||
|
||||
GnomeUIInfo gview_search_menu [] = {
|
||||
GNOMEUIINFO_ITEM_STOCK (N_("Search"),
|
||||
N_("String search"),
|
||||
gnome_normal_search_cmd, GNOME_STOCK_MENU_SEARCH),
|
||||
GNOMEUIINFO_MENU_FIND_ITEM(gnome_normal_search_cmd, NULL),
|
||||
GNOMEUIINFO_ITEM_STOCK (N_("Regexp search"),
|
||||
N_("Regular expression search"),
|
||||
gnome_regexp_search_cmd, GNOME_STOCK_MENU_SEARCH),
|
||||
GNOMEUIINFO_SEPARATOR,
|
||||
GNOMEUIINFO_ITEM_STOCK (N_("Search again..."),
|
||||
N_("Continue searching"),
|
||||
gnome_continue_search, GNOME_STOCK_MENU_SRCHRPL),
|
||||
GNOMEUIINFO_MENU_FIND_AGAIN_ITEM(gnome_continue_search, NULL),
|
||||
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
||||
};
|
||||
|
||||
GnomeUIInfo gview_mode_menu [] = {
|
||||
#define WRAP_POS 0
|
||||
GNOMEUIINFO_TOGGLEITEM (N_("Wrap"), N_("Wrap the text"), gnome_toggle_wrap, NULL),
|
||||
GNOMEUIINFO_TOGGLEITEM (N_("_Wrap"), N_("Wrap the text"), gnome_toggle_wrap, NULL),
|
||||
#if 0
|
||||
/* Can not use this one yet, as it destroys the viewer, need to fix that */
|
||||
GNOMEUIINFO_TOGGLEITEM ("Parsed view", NULL, gnome_toggle_parse, NULL),
|
||||
GNOMEUIINFO_TOGGLEITEM ("_Parsed view", NULL, gnome_toggle_parse, NULL),
|
||||
#endif
|
||||
#define FORMAT_POS 1
|
||||
GNOMEUIINFO_TOGGLEITEM (N_("Formatted"), NULL, gnome_toggle_format, NULL),
|
||||
GNOMEUIINFO_TOGGLEITEM (N_("_Formatted"), NULL, gnome_toggle_format, NULL),
|
||||
#define HEX_POS 2
|
||||
GNOMEUIINFO_TOGGLEITEM (N_("Hex"), NULL, gnome_toggle_hex, NULL),
|
||||
GNOMEUIINFO_TOGGLEITEM (N_("_Hex"), NULL, gnome_toggle_hex, NULL),
|
||||
|
||||
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
||||
};
|
||||
|
||||
GnomeUIInfo gview_top_menu [] = {
|
||||
{ GNOME_APP_UI_SUBTREE, N_("File"), NULL, &gview_file_menu },
|
||||
{ GNOME_APP_UI_SUBTREE, N_("Search"), NULL, &gview_search_menu },
|
||||
{ GNOME_APP_UI_SUBTREE, N_("Mode"), NULL, &gview_mode_menu },
|
||||
{ GNOME_APP_UI_SUBTREE, N_("_File"), NULL, &gview_file_menu },
|
||||
{ GNOME_APP_UI_SUBTREE, N_("_Search"), NULL, &gview_search_menu },
|
||||
{ GNOME_APP_UI_SUBTREE, N_("_Mode"), NULL, &gview_mode_menu },
|
||||
{ GNOME_APP_UI_ENDOFINFO, 0, 0 }
|
||||
};
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
1999-01-12 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* treestore.c (tree_store_save): Add signature for version 2.0 of
|
||||
the file format.
|
||||
|
||||
1999-01-11 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* util.c: Provide workarounds for Linux kernel bug.
|
||||
|
|
|
@ -2834,6 +2834,10 @@ mc_tree_store_save ()
|
|||
|
||||
int main (int argc, char *argv [])
|
||||
{
|
||||
#ifdef HAVE_GNOME
|
||||
/* Just to time things */
|
||||
printf ("GNU Midnight Commander " VERSION "\n");
|
||||
#endif
|
||||
/* We had LC_CTYPE before, LC_ALL includs LC_TYPE as well */
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain ("mc", LOCALEDIR);
|
||||
|
|
|
@ -53,9 +53,9 @@ WTree *tree_new (int is_panel, int y, int x, int lines, int cols);
|
|||
extern WTree *the_tree;
|
||||
|
||||
#ifdef OS2_NT
|
||||
# define MC_TREE "mc.tre"
|
||||
# define MC_TREE "mcn.tre"
|
||||
#else
|
||||
# define MC_TREE ".mc/tree"
|
||||
# define MC_TREE ".mc/Tree"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -45,12 +45,15 @@
|
|||
#include <string.h>
|
||||
#include <glib.h>
|
||||
#include "fs.h"
|
||||
#include "../vfs/vfs.h"
|
||||
#include "util.h"
|
||||
#include "treestore.h"
|
||||
#ifdef OS2_NT
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
#define TREE_SIGNATURE "Midnight Commander TreeStore v 2.0"
|
||||
|
||||
static TreeStore ts;
|
||||
|
||||
void (*tree_store_dirty_notify)(int state) = NULL;
|
||||
|
@ -197,9 +200,10 @@ int
|
|||
tree_store_load (char *name)
|
||||
{
|
||||
FILE *file;
|
||||
char buffer [MC_MAXPATHLEN], oldname[MC_MAXPATHLEN];
|
||||
char buffer [MC_MAXPATHLEN + 20], oldname[MC_MAXPATHLEN];
|
||||
char *different;
|
||||
int len, common;
|
||||
int do_load;
|
||||
|
||||
g_return_if_fail (name != NULL);
|
||||
|
||||
|
@ -207,13 +211,38 @@ tree_store_load (char *name)
|
|||
return TRUE;
|
||||
|
||||
file = fopen (name, "r");
|
||||
|
||||
if (file){
|
||||
fgets (buffer, sizeof (buffer), file);
|
||||
|
||||
if (strncmp (buffer, TREE_SIGNATURE, strlen (TREE_SIGNATURE)) != 0){
|
||||
fclose (file);
|
||||
do_load = FALSE;
|
||||
} else
|
||||
do_load = TRUE;
|
||||
} else
|
||||
do_load = FALSE;
|
||||
|
||||
if (do_load){
|
||||
ts.loaded = TRUE;
|
||||
|
||||
/* File open -> read contents */
|
||||
oldname [0] = 0;
|
||||
while (fgets (buffer, MC_MAXPATHLEN, file)){
|
||||
char *name = decode (buffer);
|
||||
tree_entry *e;
|
||||
int scanned;
|
||||
char *name;
|
||||
|
||||
/* Skip invalid records */
|
||||
if ((buffer [0] != '0' && buffer [0] != '1'))
|
||||
continue;
|
||||
|
||||
if (buffer [1] != ':')
|
||||
continue;
|
||||
|
||||
scanned = buffer [0] == '1';
|
||||
|
||||
name = decode (buffer+2);
|
||||
|
||||
len = strlen (name);
|
||||
#ifdef OS2_NT
|
||||
|
@ -236,11 +265,13 @@ tree_store_load (char *name)
|
|||
different = strtok (NULL, "");
|
||||
if (different){
|
||||
strcpy (oldname + common, different);
|
||||
tree_store_add_entry (oldname);
|
||||
e = tree_store_add_entry (oldname);
|
||||
e->scanned = scanned;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tree_store_add_entry (name);
|
||||
e = tree_store_add_entry (name);
|
||||
e->scanned = scanned;
|
||||
strcpy (oldname, name);
|
||||
}
|
||||
}
|
||||
|
@ -302,6 +333,8 @@ tree_store_save (char *name)
|
|||
if (!file)
|
||||
return errno;
|
||||
|
||||
fprintf (file, "%s\n", TREE_SIGNATURE);
|
||||
|
||||
current = ts.tree_first;
|
||||
while (current){
|
||||
int i, common;
|
||||
|
@ -310,12 +343,12 @@ tree_store_save (char *name)
|
|||
if (current->prev && (common = str_common (current->prev->name, current->name)) > 2){
|
||||
char *encoded = encode (current->name + common);
|
||||
|
||||
i = fprintf (file, "%d %s\n", common, encoded);
|
||||
i = fprintf (file, "%d:%d %s\n", current->scanned, common, encoded);
|
||||
free (encoded);
|
||||
} else {
|
||||
char *encoded = encode (current->name);
|
||||
|
||||
i = fprintf (file, "%s\n", encoded);
|
||||
i = fprintf (file, "%d:%s\n", current->scanned, encoded);
|
||||
free (encoded);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue