1999-04-01 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtkdtree.c (scan_subtree): Moved the functionality to scan a subtree to this function. Also, do not emit the DIRECTORY_CHANGED signal here. (gtk_dtree_select_row): Call scan_subtree() and emit the DIRECTORY_CHANGED signal here. (gtk_dtree_expand): Do not select the just-expanded node. Call scan_subtree(). (gtk_dtree_collapse): Only select the node if it is an ancestor of the currently-selected node. This should really go in the GtkCTree sources. (gtk_dtree_init): Bad hack: unset the GTK_CAN_FOCUS flag to avoid the broken focusing behavior of GtkCTree.
Этот коммит содержится в:
родитель
584cac757f
Коммит
5c38a4b03b
@ -1,3 +1,18 @@
|
||||
1999-04-01 Federico Mena Quintero <federico@nuclecu.unam.mx>
|
||||
|
||||
* gtkdtree.c (scan_subtree): Moved the functionality to scan a
|
||||
subtree to this function. Also, do not emit the DIRECTORY_CHANGED
|
||||
signal here.
|
||||
(gtk_dtree_select_row): Call scan_subtree() and emit the
|
||||
DIRECTORY_CHANGED signal here.
|
||||
(gtk_dtree_expand): Do not select the just-expanded node. Call
|
||||
scan_subtree().
|
||||
(gtk_dtree_collapse): Only select the node if it is an ancestor of
|
||||
the currently-selected node. This should really go in the
|
||||
GtkCTree sources.
|
||||
(gtk_dtree_init): Bad hack: unset the GTK_CAN_FOCUS flag to avoid
|
||||
the broken focusing behavior of GtkCTree.
|
||||
|
||||
1999-04-01 Miguel de Icaza <miguel@nuclecu.unam.mx>
|
||||
|
||||
* gcmd.c (gnome_about_cmd): Internationalize about box. And put
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "gsession.h"
|
||||
#include "command.h"
|
||||
#include "cmd.h"
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
GdkColorContext *mc_cc;
|
||||
|
||||
@ -106,7 +107,6 @@ int
|
||||
xtoolkit_init (int *argc, char *argv [])
|
||||
{
|
||||
gmc_color_init ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,6 @@ gtk_dtree_load_path (GtkDTree *dtree, char *path, GtkCTreeNode *parent, int leve
|
||||
|
||||
dtree->loading_dir++;
|
||||
|
||||
|
||||
phantom = gtk_dtree_contains (dtree, parent, "PHANTOM");
|
||||
if (!level) {
|
||||
dirent = tree_store_whereis (path);
|
||||
@ -205,44 +204,36 @@ scan_end (GtkDTree *dtree)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dtree_select_row (GtkCTree *ctree, GtkCTreeNode *row, gint column)
|
||||
/* Scans a subdirectory in the tree. Returns whether it is worth it to reload
|
||||
* the directory or not.
|
||||
*/
|
||||
static int
|
||||
scan_subtree (GtkDTree *dtree, GtkCTreeNode *row)
|
||||
{
|
||||
GtkDTree *dtree = GTK_DTREE (ctree);
|
||||
char *path;
|
||||
|
||||
if (dtree->removing_rows)
|
||||
return;
|
||||
|
||||
parent_class->tree_select_row (ctree, row, column);
|
||||
|
||||
if (row == dtree->last_node) {
|
||||
return;
|
||||
}
|
||||
if (row == dtree->last_node)
|
||||
return FALSE;
|
||||
|
||||
dtree->loading_dir++;
|
||||
dtree->last_node = row;
|
||||
|
||||
scan_begin (dtree);
|
||||
path = gtk_dtree_get_row_path (GTK_DTREE (ctree), row, 0);
|
||||
path = gtk_dtree_get_row_path (dtree, row, 0);
|
||||
|
||||
if (dtree->current_path)
|
||||
g_free (dtree->current_path);
|
||||
|
||||
dtree->current_path = path;
|
||||
|
||||
if (!dtree->internal)
|
||||
gtk_signal_emit (GTK_OBJECT (ctree), gtk_dtree_signals [DIRECTORY_CHANGED], path);
|
||||
|
||||
gtk_dtree_load_path (dtree, path, row, 1);
|
||||
#if 0
|
||||
last_node = GTK_CTREE_ROW (row)->children;
|
||||
for (; last_node; last_node = GTK_CTREE_ROW (last_node)->sibling){
|
||||
char *np, *text;
|
||||
|
||||
gtk_ctree_node_get_pixtext (
|
||||
ctree, last_node, column, &text,
|
||||
NULL, NULL, NULL);
|
||||
gtk_ctree_node_get_pixtext (GTK_CTREE (dtree), last_node, column,
|
||||
&text, NULL, NULL, NULL);
|
||||
|
||||
np = g_concat_dir_and_file (path, text);
|
||||
gtk_dtree_load_path (dtree, np, last_node, 0);
|
||||
@ -252,6 +243,31 @@ gtk_dtree_select_row (GtkCTree *ctree, GtkCTreeNode *row, gint column)
|
||||
|
||||
dtree->loading_dir--;
|
||||
scan_end (dtree);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_dtree_select_row (GtkCTree *ctree, GtkCTreeNode *row, gint column)
|
||||
{
|
||||
GtkDTree *dtree;
|
||||
int do_change;
|
||||
|
||||
dtree = GTK_DTREE (ctree);
|
||||
|
||||
if (dtree->removing_rows)
|
||||
return;
|
||||
|
||||
scan_begin (dtree);
|
||||
|
||||
(* parent_class->tree_select_row) (ctree, row, column);
|
||||
do_change = scan_subtree (dtree, row);
|
||||
|
||||
if (do_change && !dtree->internal)
|
||||
gtk_signal_emit (GTK_OBJECT (dtree), gtk_dtree_signals [DIRECTORY_CHANGED],
|
||||
dtree->current_path);
|
||||
|
||||
scan_end (dtree);
|
||||
}
|
||||
|
||||
static GtkCTreeNode *
|
||||
@ -292,7 +308,6 @@ gtk_dtree_do_select_dir (GtkDTree *dtree, char *path)
|
||||
g_return_val_if_fail (GTK_IS_DTREE (dtree), FALSE);
|
||||
g_return_val_if_fail (path != NULL, FALSE);
|
||||
|
||||
|
||||
if (dtree->current_path && (strcmp (path, dtree->current_path) == 0))
|
||||
return TRUE;
|
||||
|
||||
@ -413,22 +428,49 @@ gtk_dtree_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
|
||||
g_free (request);
|
||||
}
|
||||
|
||||
/* Our handler for the tree_expand signal */
|
||||
static void
|
||||
gtk_dtree_expand (GtkCTree *ctree, GtkCTreeNode *node)
|
||||
{
|
||||
scan_begin (GTK_DTREE (ctree));
|
||||
GtkDTree *dtree;
|
||||
|
||||
parent_class->tree_expand (ctree, node);
|
||||
gtk_ctree_select (ctree, node);
|
||||
dtree = GTK_DTREE (ctree);
|
||||
|
||||
scan_end (GTK_DTREE (ctree));
|
||||
scan_begin (dtree);
|
||||
(* parent_class->tree_expand) (ctree, node);
|
||||
scan_subtree (dtree, node);
|
||||
scan_end (dtree);
|
||||
}
|
||||
|
||||
/* Our handler for the tree_collapse signal */
|
||||
static void
|
||||
gtk_dtree_collapse (GtkCTree *ctree, GtkCTreeNode *node)
|
||||
{
|
||||
parent_class->tree_collapse (ctree, node);
|
||||
GList *sel;
|
||||
int do_select;
|
||||
|
||||
/* Select the node only if it is an ancestor of the currently-selected
|
||||
* node.
|
||||
*/
|
||||
|
||||
do_select = FALSE;
|
||||
|
||||
sel = GTK_CLIST (ctree)->selection;
|
||||
if (!sel)
|
||||
do_select = TRUE;
|
||||
else {
|
||||
if (gtk_ctree_is_ancestor (ctree, node, sel->data))
|
||||
do_select = TRUE;
|
||||
}
|
||||
|
||||
gtk_clist_freeze (GTK_CLIST (ctree));
|
||||
|
||||
(* parent_class->tree_collapse) (ctree, node);
|
||||
|
||||
if (do_select)
|
||||
gtk_ctree_select (ctree, node);
|
||||
|
||||
gtk_clist_thaw (GTK_CLIST (ctree));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -630,7 +672,6 @@ gtk_dtree_load_pixmap (char *pix [], GdkPixmap **pixmap, GdkBitmap **bitmap)
|
||||
gdk_imlib_render (image, image->rgb_width, image->rgb_height);
|
||||
*pixmap = gdk_imlib_move_image (image);
|
||||
*bitmap = gdk_imlib_move_mask (image);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -685,6 +726,9 @@ gtk_dtree_dirty_notify (int state)
|
||||
static void
|
||||
gtk_dtree_init (GtkDTree *dtree)
|
||||
{
|
||||
/* HACK: This is to avoid GtkCTree's broken focusing behavior */
|
||||
GTK_WIDGET_UNSET_FLAGS (dtree, GTK_CAN_FOCUS);
|
||||
|
||||
dtree->current_path = NULL;
|
||||
dtree->auto_expanded_nodes = NULL;
|
||||
|
||||
@ -712,7 +756,6 @@ gtk_dtree_construct (GtkDTree *dtree)
|
||||
gtk_clist_set_selection_mode(clist, GTK_SELECTION_BROWSE);
|
||||
gtk_clist_set_auto_sort (clist, TRUE);
|
||||
gtk_clist_set_sort_type (clist, GTK_SORT_ASCENDING);
|
||||
gtk_clist_set_selection_mode (clist, GTK_SELECTION_BROWSE);
|
||||
gtk_clist_set_column_auto_resize (clist, 0, TRUE);
|
||||
gtk_clist_columns_autosize (clist);
|
||||
|
||||
@ -759,4 +802,3 @@ gtk_dtree_get_type (void)
|
||||
|
||||
return dtree_type;
|
||||
}
|
||||
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user