Fix up warnings, #58928.

Sun Aug 19 03:22:59 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtkliststore.c: Fix up warnings, #58928.

	* gtk/gtktreeselection.h: Change signal prototype, #58647

	* gtk/gtktreeview.c (_gdk_tree_view_find_node): Make more robust,
	#59221.

	* gtk/gtkstyle.c: Actually prelight arrow, #50981
This commit is contained in:
Jonathan Blandford 2001-08-19 23:46:59 +00:00 committed by Jonathan Blandford
parent 9b71c44a75
commit 9b14c04682
12 changed files with 191 additions and 38 deletions

View File

@ -1,3 +1,14 @@
Sun Aug 19 03:22:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Fix up warnings, #58928.
* gtk/gtktreeselection.h: Change signal prototype, #58647
* gtk/gtktreeview.c (_gdk_tree_view_find_node): Make more robust,
#59221.
* gtk/gtkstyle.c: Actually prelight arrow, #50981
2001-08-18 Hans Breuer <hans@breuer.org> 2001-08-18 Hans Breuer <hans@breuer.org>
* gdk/gdk.def : updated externals * gdk/gdk.def : updated externals

View File

@ -1,3 +1,14 @@
Sun Aug 19 03:22:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Fix up warnings, #58928.
* gtk/gtktreeselection.h: Change signal prototype, #58647
* gtk/gtktreeview.c (_gdk_tree_view_find_node): Make more robust,
#59221.
* gtk/gtkstyle.c: Actually prelight arrow, #50981
2001-08-18 Hans Breuer <hans@breuer.org> 2001-08-18 Hans Breuer <hans@breuer.org>
* gdk/gdk.def : updated externals * gdk/gdk.def : updated externals

View File

@ -1,3 +1,14 @@
Sun Aug 19 03:22:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Fix up warnings, #58928.
* gtk/gtktreeselection.h: Change signal prototype, #58647
* gtk/gtktreeview.c (_gdk_tree_view_find_node): Make more robust,
#59221.
* gtk/gtkstyle.c: Actually prelight arrow, #50981
2001-08-18 Hans Breuer <hans@breuer.org> 2001-08-18 Hans Breuer <hans@breuer.org>
* gdk/gdk.def : updated externals * gdk/gdk.def : updated externals

View File

@ -1,3 +1,14 @@
Sun Aug 19 03:22:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Fix up warnings, #58928.
* gtk/gtktreeselection.h: Change signal prototype, #58647
* gtk/gtktreeview.c (_gdk_tree_view_find_node): Make more robust,
#59221.
* gtk/gtkstyle.c: Actually prelight arrow, #50981
2001-08-18 Hans Breuer <hans@breuer.org> 2001-08-18 Hans Breuer <hans@breuer.org>
* gdk/gdk.def : updated externals * gdk/gdk.def : updated externals

View File

@ -1,3 +1,14 @@
Sun Aug 19 03:22:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Fix up warnings, #58928.
* gtk/gtktreeselection.h: Change signal prototype, #58647
* gtk/gtktreeview.c (_gdk_tree_view_find_node): Make more robust,
#59221.
* gtk/gtkstyle.c: Actually prelight arrow, #50981
2001-08-18 Hans Breuer <hans@breuer.org> 2001-08-18 Hans Breuer <hans@breuer.org>
* gdk/gdk.def : updated externals * gdk/gdk.def : updated externals

View File

@ -1,3 +1,14 @@
Sun Aug 19 03:22:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Fix up warnings, #58928.
* gtk/gtktreeselection.h: Change signal prototype, #58647
* gtk/gtktreeview.c (_gdk_tree_view_find_node): Make more robust,
#59221.
* gtk/gtkstyle.c: Actually prelight arrow, #50981
2001-08-18 Hans Breuer <hans@breuer.org> 2001-08-18 Hans Breuer <hans@breuer.org>
* gdk/gdk.def : updated externals * gdk/gdk.def : updated externals

View File

@ -1,3 +1,14 @@
Sun Aug 19 03:22:59 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtkliststore.c: Fix up warnings, #58928.
* gtk/gtktreeselection.h: Change signal prototype, #58647
* gtk/gtktreeview.c (_gdk_tree_view_find_node): Make more robust,
#59221.
* gtk/gtkstyle.c: Actually prelight arrow, #50981
2001-08-18 Hans Breuer <hans@breuer.org> 2001-08-18 Hans Breuer <hans@breuer.org>
* gdk/gdk.def : updated externals * gdk/gdk.def : updated externals

View File

@ -273,7 +273,7 @@ gtk_list_store_new (gint n_columns,
GType type = va_arg (args, GType); GType type = va_arg (args, GType);
if (! _gtk_tree_data_list_check_type (type)) if (! _gtk_tree_data_list_check_type (type))
{ {
g_warning ("%s: Invalid type %s passed to gtk_list_store_new_with_types\n", G_STRLOC, g_type_name (type)); g_warning ("%s: Invalid type %s passed to gtk_list_store_new\n", G_STRLOC, g_type_name (type));
g_object_unref (G_OBJECT (retval)); g_object_unref (G_OBJECT (retval));
return NULL; return NULL;
} }
@ -312,7 +312,7 @@ gtk_list_store_newv (gint n_columns,
{ {
if (! _gtk_tree_data_list_check_type (types[i])) if (! _gtk_tree_data_list_check_type (types[i]))
{ {
g_warning ("%s: Invalid type %s passed to gtk_list_store_new_with_types\n", G_STRLOC, g_type_name (types[i])); g_warning ("%s: Invalid type %s passed to gtk_list_store_newv\n", G_STRLOC, g_type_name (types[i]));
g_object_unref (G_OBJECT (retval)); g_object_unref (G_OBJECT (retval));
return NULL; return NULL;
} }
@ -365,7 +365,7 @@ gtk_list_store_set_column_type (GtkListStore *list_store,
g_return_if_fail (column >=0 && column < list_store->n_columns); g_return_if_fail (column >=0 && column < list_store->n_columns);
if (!_gtk_tree_data_list_check_type (type)) if (!_gtk_tree_data_list_check_type (type))
{ {
g_warning ("%s: Invalid type %s passed to gtk_list_store_new_with_types\n", G_STRLOC, g_type_name (type)); g_warning ("%s: Invalid type %s passed to gtk_list_store_set_column_type\n", G_STRLOC, g_type_name (type));
return; return;
} }

View File

@ -4086,11 +4086,25 @@ gtk_default_draw_expander (GtkStyle *style,
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
apply_affine_on_point (affine, &points[i]); apply_affine_on_point (affine, &points[i]);
if (state_type == GTK_STATE_PRELIGHT)
{
gdk_draw_polygon (window, style->base_gc[GTK_STATE_NORMAL], gdk_draw_polygon (window, style->base_gc[GTK_STATE_NORMAL],
TRUE, points, 3); TRUE, points, 3);
gdk_draw_polygon (window, style->fg_gc[GTK_STATE_NORMAL], gdk_draw_polygon (window, style->fg_gc[GTK_STATE_NORMAL],
FALSE, points, 3); FALSE, points, 3);
}
else if (state_type == GTK_STATE_ACTIVE)
{
gdk_draw_polygon (window, style->light_gc[GTK_STATE_ACTIVE],
TRUE, points, 3);
gdk_draw_polygon (window, style->fg_gc[GTK_STATE_NORMAL],
FALSE, points, 3);
}
else
{
gdk_draw_polygon (window, style->fg_gc[GTK_STATE_NORMAL],
TRUE, points, 3);
}
if (area) if (area)
{ {
gdk_gc_set_clip_rectangle (style->fg_gc[GTK_STATE_NORMAL], NULL); gdk_gc_set_clip_rectangle (style->fg_gc[GTK_STATE_NORMAL], NULL);

View File

@ -84,7 +84,7 @@ gtk_tree_selection_class_init (GtkTreeSelectionClass *class)
GTK_RUN_FIRST, GTK_RUN_FIRST,
GTK_CLASS_TYPE (object_class), GTK_CLASS_TYPE (object_class),
GTK_SIGNAL_OFFSET (GtkTreeSelectionClass, changed), GTK_SIGNAL_OFFSET (GtkTreeSelectionClass, changed),
gtk_marshal_VOID__VOID, gtk_marshal_VOID__OBJECT,
GTK_TYPE_NONE, 0); GTK_TYPE_NONE, 0);
} }

View File

@ -66,7 +66,7 @@ struct _GtkTreeSelectionClass
{ {
GObjectClass parent_class; GObjectClass parent_class;
void (* changed) (GtkTreeView *tree_view); void (* changed) (GtkTreeSelection *selection);
}; };

View File

@ -2306,6 +2306,7 @@ gtk_tree_view_motion_bin_window (GtkWidget *widget,
gint new_y; gint new_y;
GtkRBTree *old_prelight_tree; GtkRBTree *old_prelight_tree;
GtkRBNode *old_prelight_node; GtkRBNode *old_prelight_node;
gboolean old_arrow_prelit;
tree_view = (GtkTreeView *) widget; tree_view = (GtkTreeView *) widget;
@ -2316,7 +2317,7 @@ gtk_tree_view_motion_bin_window (GtkWidget *widget,
old_prelight_tree = tree_view->priv->prelight_tree; old_prelight_tree = tree_view->priv->prelight_tree;
old_prelight_node = tree_view->priv->prelight_node; old_prelight_node = tree_view->priv->prelight_node;
old_arrow_prelit = GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_ARROW_PRELIT);
do_unprelight (tree_view, event->x, event->y); do_unprelight (tree_view, event->x, event->y);
new_y = ((gint)event->y<TREE_VIEW_HEADER_HEIGHT (tree_view))?TREE_VIEW_HEADER_HEIGHT (tree_view):(gint)event->y; new_y = ((gint)event->y<TREE_VIEW_HEADER_HEIGHT (tree_view))?TREE_VIEW_HEADER_HEIGHT (tree_view):(gint)event->y;
@ -2351,7 +2352,14 @@ gtk_tree_view_motion_bin_window (GtkWidget *widget,
tree_view->priv->prelight_node, tree_view->priv->prelight_node,
NULL); NULL);
} }
else if (old_arrow_prelit != GTK_TREE_VIEW_FLAG_SET (tree_view, GTK_TREE_VIEW_ARROW_PRELIT))
{
if (tree_view->priv->prelight_node)
gtk_tree_view_queue_draw_node (tree_view,
tree_view->priv->prelight_tree,
tree_view->priv->prelight_node,
NULL);
}
return TRUE; return TRUE;
} }
@ -5191,7 +5199,9 @@ _gtk_tree_view_find_path (GtkTreeView *tree_view,
return path; return path;
} }
/* Returns TRUE if we ran out of tree before finding the path. /* Returns TRUE if we ran out of tree before finding the path. If the path is
* invalid (ie. points to a node that's not in the tree), *tree and *node are
* both set to NULL.
*/ */
gboolean gboolean
_gtk_tree_view_find_node (GtkTreeView *tree_view, _gtk_tree_view_find_node (GtkTreeView *tree_view,
@ -5208,31 +5218,29 @@ _gtk_tree_view_find_node (GtkTreeView *tree_view,
*node = NULL; *node = NULL;
*tree = NULL; *tree = NULL;
if (depth == 0) if (depth == 0 || tmptree == NULL)
return FALSE; return FALSE;
do do
{ {
if (tmptree == NULL)
{
*node = tmpnode;
if (tmpnode == NULL)
*tree = NULL;
else
*tree = tmptree;
return TRUE;
}
tmpnode = _gtk_rbtree_find_count (tmptree, indices[i] + 1); tmpnode = _gtk_rbtree_find_count (tmptree, indices[i] + 1);
++i; ++i;
if (i >= depth)
{
*node = tmpnode;
if (tmpnode == NULL) if (tmpnode == NULL)
{
*tree = NULL; *tree = NULL;
else *node = NULL;
*tree = tmptree;
return FALSE; return FALSE;
} }
if (i >= depth)
{
*tree = tmptree;
*node = tmpnode;
return FALSE;
}
*tree = tmptree;
*node = tmpnode;
tmptree = tmpnode->children; tmptree = tmpnode->children;
if (tmptree == NULL)
return TRUE;
} }
while (1); while (1);
} }
@ -5771,6 +5779,7 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
cursor_path = NULL; cursor_path = NULL;
if (!gtk_tree_row_reference_valid (tree_view->priv->cursor)) if (!gtk_tree_row_reference_valid (tree_view->priv->cursor))
/* FIXME: we lost the cursor; should we get the first? */
return; return;
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor); cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
@ -5778,6 +5787,9 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
&cursor_tree, &cursor_node); &cursor_tree, &cursor_node);
gtk_tree_path_free (cursor_path); gtk_tree_path_free (cursor_path);
if (cursor_tree == NULL)
/* FIXME: we lost the cursor; should we get the first? */
return;
if (count == -1) if (count == -1)
_gtk_rbtree_prev_full (cursor_tree, cursor_node, _gtk_rbtree_prev_full (cursor_tree, cursor_node,
&new_cursor_tree, &new_cursor_node); &new_cursor_tree, &new_cursor_node);
@ -5821,6 +5833,9 @@ gtk_tree_view_move_cursor_page_up_down (GtkTreeView *tree_view,
gtk_tree_path_free (cursor_path); gtk_tree_path_free (cursor_path);
if (cursor_tree == NULL)
/* FIXME: we lost the cursor. Should we try to get one? */
return;
g_return_if_fail (cursor_node != NULL); g_return_if_fail (cursor_node != NULL);
y = CELL_FIRST_PIXEL (tree_view, cursor_tree, cursor_node, vertical_separator); y = CELL_FIRST_PIXEL (tree_view, cursor_tree, cursor_node, vertical_separator);
@ -5920,7 +5935,10 @@ gtk_tree_view_real_select_cursor_row (GtkTreeView *tree_view)
_gtk_tree_view_find_node (tree_view, cursor_path, _gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node); &cursor_tree, &cursor_node);
if (cursor_tree == NULL) if (cursor_tree == NULL)
{
gtk_tree_path_free (cursor_path);
return; return;
}
_gtk_tree_selection_internal_select_node (tree_view->priv->selection, _gtk_tree_selection_internal_select_node (tree_view->priv->selection,
cursor_node, cursor_node,
@ -5952,7 +5970,10 @@ gtk_tree_view_real_toggle_cursor_row (GtkTreeView *tree_view)
_gtk_tree_view_find_node (tree_view, cursor_path, _gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node); &cursor_tree, &cursor_node);
if (cursor_tree == NULL) if (cursor_tree == NULL)
{
gtk_tree_path_free (cursor_path);
return; return;
}
_gtk_tree_selection_internal_select_node (tree_view->priv->selection, _gtk_tree_selection_internal_select_node (tree_view->priv->selection,
cursor_node, cursor_node,
@ -6011,7 +6032,10 @@ gtk_tree_view_real_select_cursor_parent (GtkTreeView *tree_view)
_gtk_tree_view_find_node (tree_view, cursor_path, _gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_node); &cursor_tree, &cursor_node);
if (cursor_tree == NULL) if (cursor_tree == NULL)
{
gtk_tree_path_free (cursor_path);
return; return;
}
if (cursor_tree->parent_node) if (cursor_tree->parent_node)
{ {
@ -7399,7 +7423,10 @@ gtk_tree_view_expand_row (GtkTreeView *tree_view,
&node)) &node))
return FALSE; return FALSE;
if (tree != NULL)
return gtk_tree_view_real_expand_row (tree_view, path, tree, node, open_all); return gtk_tree_view_real_expand_row (tree_view, path, tree, node, open_all);
else
return FALSE;
} }
static gboolean static gboolean
@ -7411,6 +7438,7 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
GtkTreeIter iter; GtkTreeIter iter;
GtkTreeIter children; GtkTreeIter children;
gboolean collapse; gboolean collapse;
gint x, y;
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path); gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
@ -7419,6 +7447,28 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
if (collapse) if (collapse)
return FALSE; return FALSE;
/* if the prelighted node is a child of us, we want to unprelight it. We have
* a chance to prelight the correct node below */
if (tree_view->priv->prelight_tree)
{
GtkRBTree *parent_tree;
GtkRBNode *parent_node;
parent_tree = tree_view->priv->prelight_tree->parent_tree;
parent_node = tree_view->priv->prelight_tree->parent_node;
while (parent_tree)
{
if (parent_tree == tree && parent_node == node)
{
ensure_unprelighted (tree_view);
break;
}
parent_node = parent_tree->parent_node;
parent_tree = parent_tree->parent_tree;
}
}
TREE_VIEW_INTERNAL_ASSERT (gtk_tree_model_iter_children (tree_view->priv->model, &children, &iter), FALSE); TREE_VIEW_INTERNAL_ASSERT (gtk_tree_model_iter_children (tree_view->priv->model, &children, &iter), FALSE);
gtk_tree_view_discover_dirty (tree_view, gtk_tree_view_discover_dirty (tree_view,
@ -7426,9 +7476,6 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
&children, &children,
gtk_tree_path_get_depth (path)); gtk_tree_path_get_depth (path));
/* Ensure we don't have a dangling pointer to a dead node */
ensure_unprelighted (tree_view);
if (tree_view->priv->destroy_count_func) if (tree_view->priv->destroy_count_func)
{ {
GtkTreePath *child_path; GtkTreePath *child_path;
@ -7494,6 +7541,21 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
g_signal_emit (G_OBJECT (tree_view), tree_view_signals[ROW_COLLAPSED], 0, &iter, path); g_signal_emit (G_OBJECT (tree_view), tree_view_signals[ROW_COLLAPSED], 0, &iter, path);
/* now that we've collapsed all rows, we want to try to set the prelight
* again. To do this, we fake a motion event and send it to ourselves. */
if (gdk_window_at_pointer (&x, &y) == tree_view->priv->bin_window)
{
GdkEventMotion event;
event.window = tree_view->priv->bin_window;
event.x = x;
event.y = y;
/* despite the fact this isn't a real event, I'm almost positive it will
* never trigger a drag event. maybe_drag is the only function that uses
* more than just event.x and event.y. */
gtk_tree_view_motion_bin_window (GTK_WIDGET (tree_view), &event);
}
return TRUE; return TRUE;
} }
@ -7523,7 +7585,7 @@ gtk_tree_view_collapse_row (GtkTreeView *tree_view,
&node)) &node))
return FALSE; return FALSE;
if (node->children == NULL) if (tree == NULL || node->children == NULL)
return FALSE; return FALSE;
return gtk_tree_view_real_collapse_row (tree_view, path, tree, node); return gtk_tree_view_real_collapse_row (tree_view, path, tree, node);