1999-02-09 Federico Mena Quintero <federico@nuclecu.unam.mx>

* gtkdtree.c (gtk_dtree_class_init): Added two new signals,
	scan_begin and scan_end.
	(gtk_dtree_expand): Call scan_begin() and scan_end().
	(gtk_dtree_select_row): Call scan_begin() and scan_end().
	(gtk_dtree_expand): Use gtk_ctree_select(), not gtk_dtree_select_row().
	(gtk_dtree_collapse): Select the node when it is collapsed.

	* gscreen.c (panel_create_tree_view): Added handlers for the
	scan_begin and scan_end signals of the tree -- these will set the
	cursor to a watch while the tree is being scanned.
This commit is contained in:
Miguel de Icaza 1999-02-09 20:10:10 +00:00
parent 9036590857
commit 1dfa5305cf
5 changed files with 163 additions and 38 deletions

View File

@ -1,3 +1,16 @@
1999-02-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtkdtree.c (gtk_dtree_class_init): Added two new signals,
scan_begin and scan_end.
(gtk_dtree_expand): Call scan_begin() and scan_end().
(gtk_dtree_select_row): Call scan_begin() and scan_end().
(gtk_dtree_expand): Use gtk_ctree_select(), not gtk_dtree_select_row().
(gtk_dtree_collapse): Select the node when it is collapsed.
* gscreen.c (panel_create_tree_view): Added handlers for the
scan_begin and scan_end signals of the tree -- these will set the
cursor to a watch while the tree is being scanned.
1999-02-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gdesktop.c (desktop_icon_info_destroy): Delete the metadata

View File

@ -265,9 +265,10 @@ get_active_index (GtkMenu *menu)
* It can take either a WPanel or a GnomeDesktopEntry. One of them should
* be set to NULL.
*/
#define REMOVE(x,f) if (x&f)x-=f
#define REMOVE(x,f) x &= ~f
int gpopup_do_popup2 (GdkEventButton *event,
int
gpopup_do_popup2 (GdkEventButton *event,
WPanel *panel, GList *file_list,
gboolean on_selected)
{
@ -354,44 +355,54 @@ panel_action_open_with (GtkWidget *widget, WPanel *panel)
char *command;
command = input_expand_dialog (_(" Open with..."),
_("Enter extra arguments:"), panel->dir.list [panel->selected].fname);
_("Enter extra arguments:"),
panel->dir.list [panel->selected].fname);
if (!command)
return;
execute (command);
g_free (command);
}
static void
popup_handle_open (GtkWidget *widget, WPanel *panel)
{
if (do_enter (panel))
return;
panel_action_open_with (widget, panel);
}
static void
popup_handle_view (GtkWidget *widget, WPanel *panel)
{
view_cmd (panel);
}
static void
popup_handle_view_unfiltered (GtkWidget *widget, WPanel *panel)
{
view_simple_cmd (panel);
}
static void
popup_handle_edit (GtkWidget *widget, WPanel *panel)
{
edit_cmd (panel);
}
static void
popup_handle_copy (GtkWidget *widget, WPanel *panel)
{
copy_cmd ();
}
static void
popup_handle_delete (GtkWidget *widget, WPanel *panel)
{
delete_cmd ();
}
static void
popup_handle_move (GtkWidget *widget, WPanel *panel)
{
@ -399,7 +410,8 @@ popup_handle_move (GtkWidget *widget, WPanel *panel)
}
/* F_SINGLE file commands */
static void popup_handle_properties (GtkWidget *widget, WPanel *panel)
static void
popup_handle_properties (GtkWidget *widget, WPanel *panel)
{
gint retval;
file_entry *fe = &panel->dir.list [panel->selected];
@ -409,7 +421,9 @@ static void popup_handle_properties (GtkWidget *widget, WPanel *panel)
/* if (item_properties (GTK_WIDGET (CLIST_FROM_SW (panel->list)), full_name, NULL) != 0)
reread_cmd ();*/
dlg = gnome_file_property_dialog_new (full_name, we_can_afford_the_speed);
gnome_dialog_set_parent (GNOME_DIALOG (dlg), GTK_WINDOW (gtk_widget_get_toplevel (panel->ministatus)));
gnome_dialog_set_parent (GNOME_DIALOG (dlg),
GTK_WINDOW (gtk_widget_get_toplevel (panel->ministatus)));
if (gnome_dialog_run (GNOME_DIALOG (dlg)) == 0)
retval = gnome_file_property_dialog_make_changes (GNOME_FILE_PROPERTY_DIALOG (dlg));
@ -418,43 +432,65 @@ static void popup_handle_properties (GtkWidget *widget, WPanel *panel)
if (retval)
reread_cmd ();
}
static void popup_handle_open_with (GtkWidget *widget, WPanel *panel)
static void
popup_handle_open_with (GtkWidget *widget, WPanel *panel)
{
char *command;
command = input_expand_dialog (_(" Open with..."),
_("Enter extra arguments:"), panel->dir.list [panel->selected].fname);
_("Enter extra arguments:"),
panel->dir.list [panel->selected].fname);
if (!command)
return;
execute (command);
g_free (command);
}
static void popup_handle_hard_link (GtkWidget *widget, WPanel *panel)
static void
popup_handle_hard_link (GtkWidget *widget, WPanel *panel)
{
/* yeah right d: -jrb */
link_cmd ();
}
static void popup_handle_symlink (GtkWidget *widget, WPanel *panel)
static void
popup_handle_symlink (GtkWidget *widget, WPanel *panel)
{
symlink_cmd ();
}
static void popup_handle_edit_symlink (GtkWidget *widget, WPanel *panel)
static void
popup_handle_edit_symlink (GtkWidget *widget, WPanel *panel)
{
edit_symlink_cmd ();
}
static void popup_handle_display_properties (GtkWidget *widget, WPanel *panel)
{
}
static void popup_handle_refresh (GtkWidget *widget, WPanel *panel)
static void
popup_handle_display_properties (GtkWidget *widget, WPanel *panel)
{
/* FIXME */
g_warning ("FIXME: implement popup_handle_display_properties()");
}
static void popup_handle_arrange_icons (GtkWidget *widget, WPanel *panel)
static void
popup_handle_refresh (GtkWidget *widget, WPanel *panel)
{
/* FIXME */
g_warning ("FIXME: implement popup_handle_refresh()");
}
static void popup_handle_logout (GtkWidget *widget, WPanel *panel)
static void
popup_handle_arrange_icons (GtkWidget *widget, WPanel *panel)
{
/* FIXME */
g_warning ("FIXME: implement popup_handle_arrange_icons()");
}
static void
popup_handle_logout (GtkWidget *widget, WPanel *panel)
{
/* FIXME */
g_warning ("FIXME: implement popup_handle_logout()");
}

View File

@ -1842,6 +1842,28 @@ panel_chdir (GtkDTree *dtree, char *path, WPanel *panel)
do_panel_cd (panel, path, cd_exact);
}
static void
set_cursor (WPanel *panel, GdkCursorType type)
{
GdkCursor *cursor;
cursor = gdk_cursor_new (type);
gdk_window_set_cursor (GTK_WIDGET (panel->xwindow)->window, cursor);
gdk_cursor_destroy (cursor);
}
static void
panel_tree_scan_begin (GtkWidget *widget, gpointer data)
{
set_cursor (data, GDK_WATCH);
}
static void
panel_tree_scan_end (GtkWidget *widget, gpointer data)
{
set_cursor (data, GDK_TOP_LEFT_ARROW);
}
/**
* tree_drag_open_directory:
*
@ -2125,7 +2147,11 @@ panel_create_tree_view (WPanel *panel)
gtk_ctree_set_indent (GTK_CTREE (tree), 10);
gtk_signal_connect (GTK_OBJECT (tree), "directory_changed",
GTK_SIGNAL_FUNC (panel_chdir), panel);
(GtkSignalFunc) panel_chdir, panel);
gtk_signal_connect (GTK_OBJECT (tree), "scan_begin",
(GtkSignalFunc) panel_tree_scan_begin, panel);
gtk_signal_connect (GTK_OBJECT (tree), "scan_end",
(GtkSignalFunc) panel_tree_scan_end, panel);
gtk_drag_dest_set (GTK_WIDGET (tree), GTK_DEST_DEFAULT_ALL,
drop_types, ELEMENTS (drop_types),

View File

@ -32,6 +32,8 @@ static GtkCTreeClass *parent_class = NULL;
enum {
DIRECTORY_CHANGED,
SCAN_BEGIN,
SCAN_END,
LAST_SIGNAL
};
@ -157,6 +159,26 @@ gtk_dtree_load_path (GtkDTree *dtree, char *path, GtkCTreeNode *parent, int leve
return TRUE;
}
static void
scan_begin (GtkDTree *dtree)
{
if (++dtree->scan_level == 1) {
gtk_clist_freeze (GTK_CLIST (dtree));
gtk_signal_emit (GTK_OBJECT (dtree), gtk_dtree_signals[SCAN_BEGIN]);
}
}
static void
scan_end (GtkDTree *dtree)
{
g_assert (dtree->scan_level > 0);
if (--dtree->scan_level == 0) {
gtk_signal_emit (GTK_OBJECT (dtree), gtk_dtree_signals[SCAN_END]);
gtk_clist_thaw (GTK_CLIST (dtree));
}
}
static void
gtk_dtree_select_row (GtkCTree *ctree, GtkCTreeNode *row, gint column)
{
@ -174,7 +196,7 @@ gtk_dtree_select_row (GtkCTree *ctree, GtkCTreeNode *row, gint column)
dtree->loading_dir++;
dtree->last_node = row;
gtk_clist_freeze (GTK_CLIST (ctree));
scan_begin (dtree);
path = gtk_dtree_get_row_path (GTK_DTREE (ctree), row, 0);
if (dtree->current_path)
@ -202,7 +224,7 @@ gtk_dtree_select_row (GtkCTree *ctree, GtkCTreeNode *row, gint column)
#endif
dtree->loading_dir--;
gtk_clist_thaw (GTK_CLIST (ctree));
scan_end (dtree);
}
static GtkCTreeNode *
@ -367,8 +389,19 @@ gtk_dtree_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
static void
gtk_dtree_expand (GtkCTree *ctree, GtkCTreeNode *node)
{
scan_begin (GTK_DTREE (ctree));
parent_class->tree_expand (ctree, node);
gtk_dtree_select_row (ctree, node, 0);
gtk_ctree_select (ctree, node);
scan_end (GTK_DTREE (ctree));
}
static void
gtk_dtree_collapse (GtkCTree *ctree, GtkCTreeNode *node)
{
parent_class->tree_collapse (ctree, node);
gtk_ctree_select (ctree, node);
}
/*
@ -470,14 +503,27 @@ gtk_dtree_class_init (GtkDTreeClass *klass)
parent_class = gtk_type_class (GTK_TYPE_CTREE);
gtk_dtree_signals[DIRECTORY_CHANGED] =
gtk_signal_new (
"directory_changed",
gtk_signal_new ("directory_changed",
GTK_RUN_FIRST, object_class->type,
GTK_SIGNAL_OFFSET (GtkDTreeClass, directory_changed),
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE,
1,
GTK_TYPE_POINTER);
gtk_dtree_signals[SCAN_BEGIN] =
gtk_signal_new ("scan_begin",
GTK_RUN_FIRST, object_class->type,
GTK_SIGNAL_OFFSET (GtkDTreeClass, scan_begin),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE,
0);
gtk_dtree_signals[SCAN_END] =
gtk_signal_new ("scan_end",
GTK_RUN_FIRST, object_class->type,
GTK_SIGNAL_OFFSET (GtkDTreeClass, scan_end),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE,
0);
gtk_object_class_add_signals (object_class, gtk_dtree_signals, LAST_SIGNAL);
@ -487,6 +533,7 @@ gtk_dtree_class_init (GtkDTreeClass *klass)
ctree_class->tree_select_row = gtk_dtree_select_row;
ctree_class->tree_expand = gtk_dtree_expand;
ctree_class->tree_collapse = gtk_dtree_collapse;
}
static void

View File

@ -16,6 +16,7 @@ typedef struct {
char *requested_path;
int visible;
int scan_level;
char *drag_dir;
GList *auto_expanded_nodes;
@ -41,6 +42,8 @@ typedef struct {
GtkCTreeClass parent_class;
void (* directory_changed) (GtkDTree *dtree, char *directory);
void (* scan_begin) (GtkDTree *dtree);
void (* scan_end) (GtkDTree *dtree);
} GtkDTreeClass;
guint gtk_dtree_get_type (void);