Support for freezing/thawing the GtkCTree during potential

tree updates from the treestore.

This speeds up a lot the display, as the GtkCTree seems to be
particularly bad at handling changes to the tree and keeping
the display in sync.

Makefile fixes to support SHELL= during compilation.

Miguel.
This commit is contained in:
Miguel de Icaza 1999-02-09 22:06:56 +00:00
parent d1126049bb
commit 50de059b75
10 changed files with 85 additions and 5 deletions

View File

@ -1,6 +1,6 @@
VERSION = @VERSION@
SHELL = /bin/sh
SHELL = @SHELL@
# This variable makes it possible to move the installation root to another
# directory. This is useful when you're creating a binary distribution of mc.

View File

@ -1217,6 +1217,9 @@ AC_SUBST(PCENTRULE)
AC_SUBST(builddir)
builddir=`pwd`
SHELL=${SHELL-"/bin/sh"}
AC_SUBST(SHELL)
dnl
dnl Output configuration filesn
dnl

View File

@ -478,6 +478,21 @@ entry_added_callback (char *dirname, void *data)
g_free (dirname);
}
/*
* Callback routine invoked from the treestore to hint us
* about the progress of the freezing
*/
static void
tree_set_freeze (int state, void *data)
{
GtkDTree *dtree = GTK_DTREE (data);
if (state)
gtk_clist_freeze (GTK_CLIST (dtree));
else
gtk_clist_thaw (GTK_CLIST (dtree));
}
static void
gtk_dtree_destroy (GtkObject *object)
{
@ -485,6 +500,8 @@ gtk_dtree_destroy (GtkObject *object)
tree_store_remove_entry_remove_hook (entry_removed_callback);
tree_store_remove_entry_add_hook (entry_added_callback);
tree_store_remove_freeze_hook (tree_set_freeze);
gdk_pixmap_unref (dtree->pixmap_open);
gdk_pixmap_unref (dtree->pixmap_close);
gdk_bitmap_unref (dtree->bitmap_open);
@ -648,6 +665,7 @@ gtk_dtree_init (GtkDTree *dtree)
tree_store_add_entry_remove_hook (entry_removed_callback, dtree);
tree_store_add_entry_add_hook (entry_added_callback, dtree);
tree_store_add_freeze_hook (tree_set_freeze, dtree);
}
void

View File

@ -2,7 +2,7 @@
PACKAGE = mc
VERSION = @VERSION@
SHELL = /bin/sh
SHELL = @SHELL@
@SET_MAKE@
srcdir = @srcdir@

View File

@ -1,3 +1,9 @@
1999-02-09 Miguel de Icaza <miguel@nuclecu.unam.mx>
* treestore.c: Add a new hook system to hint a tree freeze/thaw.
* setup.c: In the GNOME version, we do not show the dot files by default.
1999-02-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* file.c (copy_file_file): Add support for the GNOME metadata here.

View File

@ -1,7 +1,7 @@
srcdir = @srcdir@
VPATH = @srcdir@
SHELL = /bin/sh
SHELL = @SHELL@
rootdir = $(srcdir)/..
@MCFG@@MCF@

View File

@ -32,8 +32,16 @@
/* "$Id$" */
/* If true show files starting with a dot */
/*
* If true show files starting with a dot.
*
* In GNOME we default to not showing them.
*/
#ifdef HAVE_GNOME
int show_dot_files = 0;
#else
int show_dot_files = 1;
#endif
/* If true show files ending in ~ */
int show_backups = 0;

View File

@ -166,7 +166,11 @@ static struct {
int *opt_addr;
} options [] = {
{ "show_backups", &show_backups },
#ifdef HAVE_GNOME
{ "gnome_show_dot_files", &show_dot_files },
#else
{ "show_dot_files", &show_dot_files },
#endif
{ "verbose", &verbose },
{ "mark_moves_down", &mark_moves_down },
{ "pause_after_run", &pause_after_run },

View File

@ -597,6 +597,8 @@ tree_store_start_check (char *path)
g_assert (ts.check_name == NULL);
ts.check_start = NULL;
tree_store_set_freeze (TRUE);
/* Search for the start of subdirectories */
current = tree_store_whereis (path);
if (!current){
@ -681,6 +683,8 @@ tree_store_end_check (void)
}
g_list_free (the_queue);
tree_store_set_freeze (FALSE);
}
tree_entry *
@ -722,6 +726,7 @@ tree_store_rescan (char *dir)
static Hook *remove_entry_hooks;
static Hook *add_entry_hooks;
static Hook *freeze_hooks;
void
tree_store_add_entry_remove_hook (tree_store_remove_fn callback, void *data)
@ -748,7 +753,6 @@ tree_store_notify_remove (tree_entry *entry)
p = p->next;
}
}
void
tree_store_add_entry_add_hook (tree_store_add_fn callback, void *data)
{
@ -774,6 +778,31 @@ tree_store_notify_add (char *directory)
}
}
void
tree_store_add_freeze_hook (tree_freeze_fn callback, void *data)
{
add_hook (&freeze_hooks, (void (*)(void *)) callback, data);
}
void
tree_store_remove_freeze_hook (tree_freeze_fn callback)
{
delete_hook (&freeze_hooks, (void (*)(void *))callback);
}
void
tree_store_set_freeze (int freeze)
{
Hook *p = freeze_hooks;
tree_freeze_fn f;
while (p) {
f = (tree_freeze_fn) p->hook_fn;
f (freeze, p->hook_data);
p = p->next;
}
}
tree_scan *
tree_store_opendir (char *path)
{

View File

@ -61,12 +61,24 @@ typedef void (*tree_store_add_fn)(char *name, void *data);
void tree_store_add_entry_add_hook (tree_store_add_fn callback, void *data);
void tree_store_remove_entry_add_hook (tree_store_add_fn callback);
/*
* Register/unregister freeze/unfreeze functions for the tree
*/
typedef void (*tree_freeze_fn)(int freeze, void *data);
void tree_store_add_freeze_hook (tree_freeze_fn callback, void *data);
void tree_store_remove_freeze_hook (tree_freeze_fn);
/*
* Changes in the tree_entry are notified with these
*/
void tree_store_notify_remove (tree_entry *entry);
void tree_store_notify_add (char *directory);
/*
* Freeze unfreeze notification
*/
void tree_store_set_freeze (int freeze);
tree_scan *tree_store_opendir (char *path);
tree_entry *tree_store_readdir (tree_scan *scanner);
void tree_store_closedir (tree_scan *scanner);