mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
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:
parent
9036590857
commit
1dfa5305cf
@ -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>
|
1999-02-08 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||||
|
|
||||||
* gdesktop.c (desktop_icon_info_destroy): Delete the metadata
|
* gdesktop.c (desktop_icon_info_destroy): Delete the metadata
|
||||||
|
@ -265,11 +265,12 @@ get_active_index (GtkMenu *menu)
|
|||||||
* It can take either a WPanel or a GnomeDesktopEntry. One of them should
|
* It can take either a WPanel or a GnomeDesktopEntry. One of them should
|
||||||
* be set to NULL.
|
* 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
|
||||||
WPanel *panel, GList *file_list,
|
gpopup_do_popup2 (GdkEventButton *event,
|
||||||
gboolean on_selected)
|
WPanel *panel, GList *file_list,
|
||||||
|
gboolean on_selected)
|
||||||
{
|
{
|
||||||
GtkWidget *menu;
|
GtkWidget *menu;
|
||||||
GList *list;
|
GList *list;
|
||||||
@ -354,44 +355,54 @@ panel_action_open_with (GtkWidget *widget, WPanel *panel)
|
|||||||
char *command;
|
char *command;
|
||||||
|
|
||||||
command = input_expand_dialog (_(" Open with..."),
|
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)
|
if (!command)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
execute (command);
|
execute (command);
|
||||||
g_free (command);
|
g_free (command);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popup_handle_open (GtkWidget *widget, WPanel *panel)
|
popup_handle_open (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
if (do_enter (panel))
|
if (do_enter (panel))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
panel_action_open_with (widget, panel);
|
panel_action_open_with (widget, panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popup_handle_view (GtkWidget *widget, WPanel *panel)
|
popup_handle_view (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
view_cmd (panel);
|
view_cmd (panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popup_handle_view_unfiltered (GtkWidget *widget, WPanel *panel)
|
popup_handle_view_unfiltered (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
view_simple_cmd (panel);
|
view_simple_cmd (panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popup_handle_edit (GtkWidget *widget, WPanel *panel)
|
popup_handle_edit (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
edit_cmd (panel);
|
edit_cmd (panel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popup_handle_copy (GtkWidget *widget, WPanel *panel)
|
popup_handle_copy (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
copy_cmd ();
|
copy_cmd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popup_handle_delete (GtkWidget *widget, WPanel *panel)
|
popup_handle_delete (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
delete_cmd ();
|
delete_cmd ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
popup_handle_move (GtkWidget *widget, WPanel *panel)
|
popup_handle_move (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
@ -399,7 +410,8 @@ popup_handle_move (GtkWidget *widget, WPanel *panel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* F_SINGLE file commands */
|
/* F_SINGLE file commands */
|
||||||
static void popup_handle_properties (GtkWidget *widget, WPanel *panel)
|
static void
|
||||||
|
popup_handle_properties (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
gint retval;
|
gint retval;
|
||||||
file_entry *fe = &panel->dir.list [panel->selected];
|
file_entry *fe = &panel->dir.list [panel->selected];
|
||||||
@ -409,52 +421,76 @@ static void popup_handle_properties (GtkWidget *widget, WPanel *panel)
|
|||||||
/* if (item_properties (GTK_WIDGET (CLIST_FROM_SW (panel->list)), full_name, NULL) != 0)
|
/* if (item_properties (GTK_WIDGET (CLIST_FROM_SW (panel->list)), full_name, NULL) != 0)
|
||||||
reread_cmd ();*/
|
reread_cmd ();*/
|
||||||
dlg = gnome_file_property_dialog_new (full_name, we_can_afford_the_speed);
|
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)
|
if (gnome_dialog_run (GNOME_DIALOG (dlg)) == 0)
|
||||||
retval = gnome_file_property_dialog_make_changes (GNOME_FILE_PROPERTY_DIALOG (dlg));
|
retval = gnome_file_property_dialog_make_changes (GNOME_FILE_PROPERTY_DIALOG (dlg));
|
||||||
|
|
||||||
gtk_widget_destroy (dlg);
|
gtk_widget_destroy (dlg);
|
||||||
g_free (full_name);
|
g_free (full_name);
|
||||||
if (retval)
|
if (retval)
|
||||||
reread_cmd ();
|
reread_cmd ();
|
||||||
}
|
}
|
||||||
static void popup_handle_open_with (GtkWidget *widget, WPanel *panel)
|
|
||||||
|
static void
|
||||||
|
popup_handle_open_with (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
char *command;
|
char *command;
|
||||||
|
|
||||||
command = input_expand_dialog (_(" Open with..."),
|
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)
|
if (!command)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
execute (command);
|
execute (command);
|
||||||
g_free (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 */
|
/* yeah right d: -jrb */
|
||||||
link_cmd ();
|
link_cmd ();
|
||||||
}
|
}
|
||||||
static void popup_handle_symlink (GtkWidget *widget, WPanel *panel)
|
|
||||||
|
static void
|
||||||
|
popup_handle_symlink (GtkWidget *widget, WPanel *panel)
|
||||||
{
|
{
|
||||||
symlink_cmd ();
|
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 ();
|
edit_symlink_cmd ();
|
||||||
}
|
}
|
||||||
static void popup_handle_display_properties (GtkWidget *widget, WPanel *panel)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
static void
|
||||||
static void popup_handle_refresh (GtkWidget *widget, WPanel *panel)
|
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()");
|
||||||
}
|
}
|
||||||
|
@ -1842,6 +1842,28 @@ panel_chdir (GtkDTree *dtree, char *path, WPanel *panel)
|
|||||||
do_panel_cd (panel, path, cd_exact);
|
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:
|
* tree_drag_open_directory:
|
||||||
*
|
*
|
||||||
@ -2125,7 +2147,11 @@ panel_create_tree_view (WPanel *panel)
|
|||||||
gtk_ctree_set_indent (GTK_CTREE (tree), 10);
|
gtk_ctree_set_indent (GTK_CTREE (tree), 10);
|
||||||
|
|
||||||
gtk_signal_connect (GTK_OBJECT (tree), "directory_changed",
|
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,
|
gtk_drag_dest_set (GTK_WIDGET (tree), GTK_DEST_DEFAULT_ALL,
|
||||||
drop_types, ELEMENTS (drop_types),
|
drop_types, ELEMENTS (drop_types),
|
||||||
|
@ -32,6 +32,8 @@ static GtkCTreeClass *parent_class = NULL;
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
DIRECTORY_CHANGED,
|
DIRECTORY_CHANGED,
|
||||||
|
SCAN_BEGIN,
|
||||||
|
SCAN_END,
|
||||||
LAST_SIGNAL
|
LAST_SIGNAL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -157,6 +159,26 @@ gtk_dtree_load_path (GtkDTree *dtree, char *path, GtkCTreeNode *parent, int leve
|
|||||||
return TRUE;
|
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
|
static void
|
||||||
gtk_dtree_select_row (GtkCTree *ctree, GtkCTreeNode *row, gint column)
|
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->loading_dir++;
|
||||||
dtree->last_node = row;
|
dtree->last_node = row;
|
||||||
|
|
||||||
gtk_clist_freeze (GTK_CLIST (ctree));
|
scan_begin (dtree);
|
||||||
path = gtk_dtree_get_row_path (GTK_DTREE (ctree), row, 0);
|
path = gtk_dtree_get_row_path (GTK_DTREE (ctree), row, 0);
|
||||||
|
|
||||||
if (dtree->current_path)
|
if (dtree->current_path)
|
||||||
@ -202,7 +224,7 @@ gtk_dtree_select_row (GtkCTree *ctree, GtkCTreeNode *row, gint column)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
dtree->loading_dir--;
|
dtree->loading_dir--;
|
||||||
gtk_clist_thaw (GTK_CLIST (ctree));
|
scan_end (dtree);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkCTreeNode *
|
static GtkCTreeNode *
|
||||||
@ -367,8 +389,19 @@ gtk_dtree_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
|
|||||||
static void
|
static void
|
||||||
gtk_dtree_expand (GtkCTree *ctree, GtkCTreeNode *node)
|
gtk_dtree_expand (GtkCTree *ctree, GtkCTreeNode *node)
|
||||||
{
|
{
|
||||||
|
scan_begin (GTK_DTREE (ctree));
|
||||||
|
|
||||||
parent_class->tree_expand (ctree, node);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -469,15 +502,28 @@ gtk_dtree_class_init (GtkDTreeClass *klass)
|
|||||||
|
|
||||||
parent_class = gtk_type_class (GTK_TYPE_CTREE);
|
parent_class = gtk_type_class (GTK_TYPE_CTREE);
|
||||||
|
|
||||||
gtk_dtree_signals [DIRECTORY_CHANGED] =
|
gtk_dtree_signals[DIRECTORY_CHANGED] =
|
||||||
gtk_signal_new (
|
gtk_signal_new ("directory_changed",
|
||||||
"directory_changed",
|
GTK_RUN_FIRST, object_class->type,
|
||||||
GTK_RUN_FIRST, object_class->type,
|
GTK_SIGNAL_OFFSET (GtkDTreeClass, directory_changed),
|
||||||
GTK_SIGNAL_OFFSET (GtkDTreeClass, directory_changed),
|
gtk_marshal_NONE__POINTER,
|
||||||
gtk_marshal_NONE__POINTER,
|
GTK_TYPE_NONE,
|
||||||
GTK_TYPE_NONE,
|
1,
|
||||||
1,
|
GTK_TYPE_POINTER);
|
||||||
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);
|
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_select_row = gtk_dtree_select_row;
|
||||||
ctree_class->tree_expand = gtk_dtree_expand;
|
ctree_class->tree_expand = gtk_dtree_expand;
|
||||||
|
ctree_class->tree_collapse = gtk_dtree_collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -16,6 +16,7 @@ typedef struct {
|
|||||||
char *requested_path;
|
char *requested_path;
|
||||||
|
|
||||||
int visible;
|
int visible;
|
||||||
|
int scan_level;
|
||||||
|
|
||||||
char *drag_dir;
|
char *drag_dir;
|
||||||
GList *auto_expanded_nodes;
|
GList *auto_expanded_nodes;
|
||||||
@ -41,6 +42,8 @@ typedef struct {
|
|||||||
GtkCTreeClass parent_class;
|
GtkCTreeClass parent_class;
|
||||||
|
|
||||||
void (* directory_changed) (GtkDTree *dtree, char *directory);
|
void (* directory_changed) (GtkDTree *dtree, char *directory);
|
||||||
|
void (* scan_begin) (GtkDTree *dtree);
|
||||||
|
void (* scan_end) (GtkDTree *dtree);
|
||||||
} GtkDTreeClass;
|
} GtkDTreeClass;
|
||||||
|
|
||||||
guint gtk_dtree_get_type (void);
|
guint gtk_dtree_get_type (void);
|
||||||
|
Loading…
Reference in New Issue
Block a user