1999-02-04 Miguel de Icaza <miguel@nuclecu.unam.mx>

* widget.c (push_history): Only do check the history headings if
	the widget has a history entry bound to it.

1999-02-03  Miguel de Icaza  <miguel@nuclecu.unam.mx>

	* treestore.c (tree_store_start_check, tree_store_mark_checked,
	tree_store_end_check): Use a stack for check_name.  There are far
	too many instances that might call the end_check.
This commit is contained in:
Miguel de Icaza 1999-02-05 02:45:43 +00:00
parent 60e95cf7b5
commit eaa1ed0277
5 changed files with 55 additions and 23 deletions

View File

@ -1,3 +1,14 @@
1999-02-04 Miguel de Icaza <miguel@nuclecu.unam.mx>
* widget.c (push_history): Only do check the history headings if
the widget has a history entry bound to it.
1999-02-03 Miguel de Icaza <miguel@nuclecu.unam.mx>
* treestore.c (tree_store_start_check, tree_store_mark_checked,
tree_store_end_check): Use a stack for check_name. There are far
too many instances that might call the end_check.
Wed Feb 3 23:55:54 1999 Norbert Warmuth <nwarmuth@privat.circular.de>
* widget.c (history_put): set the access rights correctly when

View File

@ -425,7 +425,7 @@ static struct {
{ "name", 12, 1, J_LEFT_FIT, N_("Name"), 1, string_file_name, (sortfn *) sort_name },
{ "size", 7, 0, J_RIGHT, N_("Size"), 1, string_file_size, (sortfn *) sort_size },
{ "bsize", 7, 0, J_RIGHT, N_("Size"), 1, string_file_size_brief, (sortfn *) sort_size },
{ "type", GT, 0, J_LEFT, "", 1, string_file_type, (sortfn *) sort_type },
{ "type", GT, 0, J_LEFT, "", 2, string_file_type, (sortfn *) sort_type },
{ "mtime", 12, 0, J_RIGHT, N_("MTime"), 1, string_file_mtime, (sortfn *) sort_time },
{ "atime", 12, 0, J_RIGHT, N_("ATime"), 1, string_file_atime, (sortfn *) sort_atime },
{ "ctime", 12, 0, J_RIGHT, N_("CTime"), 1, string_file_ctime, (sortfn *) sort_ctime },

View File

@ -501,8 +501,10 @@ tree_store_remove_entry (char *name)
{
tree_entry *current, *base, *old;
int len, base_sublevel;
char *check_name;
g_return_if_fail (name != NULL);
g_return_if_fail (ts.check_name_list != NULL);
/* Miguel Ugly hack */
if (name [0] == PATH_SEP && name [1] == 0)
@ -512,7 +514,10 @@ tree_store_remove_entry (char *name)
base = tree_store_whereis (name);
if (!base)
return; /* Doesn't exist */
if (ts.check_name [0] == PATH_SEP && ts.check_name [1] == 0)
check_name = ts.check_name_list->data;
if (check_name [0] == PATH_SEP && check_name [1] == 0)
base_sublevel = base->sublevel;
else
base_sublevel = base->sublevel + 1;
@ -538,19 +543,24 @@ tree_store_mark_checked (const char *subname)
char *name;
tree_entry *current, *base;
int flag = 1, len;
char *check_name;
if (!ts.loaded)
return;
g_return_if_fail (ts.check_name != NULL);
if (ts.check_name_list == NULL)
return;
check_name = ts.check_name_list->data;
/* Calculate the full name of the subdirectory */
if (subname [0] == '.' &&
(subname [1] == 0 || (subname [1] == '.' && subname [2] == 0)))
return;
if (ts.check_name [0] == PATH_SEP && ts.check_name [1] == 0)
if (check_name [0] == PATH_SEP && check_name [1] == 0)
name = g_strconcat (PATH_SEP_STR, subname, NULL);
else
name = concat_dir_and_file (ts.check_name, subname);
name = concat_dir_and_file (check_name, subname);
/* Search for the subdirectory */
current = ts.check_start;
@ -585,6 +595,7 @@ tree_store_start_check (char *path)
{
tree_entry *current, *retval;
int len;
char *check_name;
if (!ts.loaded)
return NULL;
@ -603,22 +614,23 @@ tree_store_start_check (char *path)
return NULL;
current = tree_store_add_entry (path);
ts.check_name = g_strdup (path);
ts.check_name_list = g_list_prepend (ts.check_name_list, g_strdup (path));
return current;
}
ts.check_name = g_strdup (path);
ts.check_name_list = g_list_prepend (ts.check_name_list, g_strdup (path));
retval = current;
/* Mark old subdirectories for delete */
ts.check_start = current->next;
len = strlen (ts.check_name);
check_name = ts.check_name_list->data;
len = strlen (check_name);
current = ts.check_start;
while (current
&& strncmp (current->name, ts.check_name, len) == 0
&& strncmp (current->name, check_name, len) == 0
&& (current->name[len] == '\0' || current->name[len] == PATH_SEP || len == 1)){
current->mark = 1;
current = current->next;
@ -642,18 +654,21 @@ tree_store_end_check (void)
{
tree_entry *current, *old;
int len;
char *check_name;
GList *list_head;
if (!ts.loaded)
return;
g_return_if_fail (ts.check_name);
g_return_if_fail (ts.check_name_list);
/* Check delete marks and delete if found */
len = strlen (ts.check_name);
check_name = ts.check_name_list->data;
len = strlen (check_name);
current = ts.check_start;
while (current
&& strncmp (current->name, ts.check_name, len) == 0
&& strncmp (current->name, check_name, len) == 0
&& (current->name[len] == '\0' || current->name[len] == PATH_SEP || len == 1)){
old = current;
current = current->next;
@ -661,8 +676,10 @@ tree_store_end_check (void)
remove_entry (old);
}
g_free (ts.check_name);
ts.check_name = NULL;
g_free (ts.check_name_list->data);
list_head = ts.check_name_list;
ts.check_name_list = list_head->next;
g_list_free_1 (list_head);
}
tree_entry *

View File

@ -24,11 +24,13 @@ typedef struct {
tree_entry *tree_first; /* First entry in the list */
tree_entry *tree_last; /* Last entry in the list */
tree_entry *check_start; /* Start of checked subdirectories */
char *check_name; /* Directory which is been checked */
GList *check_name_list;
unsigned int loaded : 1;
unsigned int dirty : 1;
} TreeStore;
#define TREE_CHECK_NAME ts.check_name_list->data
extern void (*tree_store_dirty_notify)(int state);
TreeStore *tree_store_init (void);

View File

@ -1169,16 +1169,18 @@ push_history (WInput *in, char *text)
new->next = 0;
new->prev = in->history;
new->text = g_strdup (text);
if (in->history_name){
#ifdef HAVE_GNOME
if (strcmp (in->history_name + 4, _(" Link to a remote machine ")) == 0 ||
strcmp (in->history_name + 4, _(" FTP to machine ")) == 0)
if (strcmp (in->history_name + 4, _(" Link to a remote machine ")) == 0 ||
strcmp (in->history_name + 4, _(" FTP to machine ")) == 0)
#else
if (strcmp (in->history_name + 3, _(" Link to a remote machine ")) == 0 ||
strcmp (in->history_name + 3, _(" FTP to machine ")) == 0)
if (strcmp (in->history_name + 3, _(" Link to a remote machine ")) == 0 ||
strcmp (in->history_name + 3, _(" FTP to machine ")) == 0)
#endif
strip_password (new->text, 0);
else
strip_password (new->text, 1);
strip_password (new->text, 0);
else
strip_password (new->text, 1);
}
in->history = new;
return 2;
}