Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.

Mon Jun  4 15:05:24 2001  Jonathan Blandford  <jrb@redhat.com>

	* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
	Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.
	(gtk_tree_view_column_set_min_width): ditto.
This commit is contained in:
Jonathan Blandford 2001-06-05 15:30:53 +00:00 committed by Jonathan Blandford
parent 04de6401f9
commit f3f7dd9e0c
9 changed files with 98 additions and 38 deletions

View File

@ -1,3 +1,9 @@
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.
(gtk_tree_view_column_set_min_width): ditto.
Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com> Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS): * gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS):

View File

@ -1,3 +1,9 @@
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.
(gtk_tree_view_column_set_min_width): ditto.
Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com> Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS): * gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS):

View File

@ -1,3 +1,9 @@
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.
(gtk_tree_view_column_set_min_width): ditto.
Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com> Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS): * gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS):

View File

@ -1,3 +1,9 @@
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.
(gtk_tree_view_column_set_min_width): ditto.
Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com> Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS): * gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS):

View File

@ -1,3 +1,9 @@
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.
(gtk_tree_view_column_set_min_width): ditto.
Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com> Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS): * gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS):

View File

@ -1,3 +1,9 @@
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.
(gtk_tree_view_column_set_min_width): ditto.
Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com> Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS): * gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS):

View File

@ -1,3 +1,9 @@
Mon Jun 4 15:05:24 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_set_max_width):
Fix segfault found by Vitaly Tishkov <tvv@sparc.spb.su>.
(gtk_tree_view_column_set_min_width): ditto.
Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com> Tue Jun 5 11:04:06 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS): * gdk/gdkpixmap.h (GDK_PIXMAP_GET_CLASS):

View File

@ -3803,6 +3803,7 @@ gtk_tree_view_focus (GtkContainer *container,
g_return_val_if_fail (GTK_IS_TREE_VIEW (container), FALSE); g_return_val_if_fail (GTK_IS_TREE_VIEW (container), FALSE);
g_return_val_if_fail (GTK_WIDGET_VISIBLE (container), FALSE); g_return_val_if_fail (GTK_WIDGET_VISIBLE (container), FALSE);
g_print ("gtk_tree_view_focus\n");
tree_view = GTK_TREE_VIEW (container); tree_view = GTK_TREE_VIEW (container);
if (!GTK_WIDGET_IS_SENSITIVE (container)) if (!GTK_WIDGET_IS_SENSITIVE (container))
@ -5559,52 +5560,49 @@ gtk_tree_view_move_cursor_up_down (GtkTreeView *tree_view,
{ {
GtkRBTree *cursor_tree = NULL; GtkRBTree *cursor_tree = NULL;
GtkRBNode *cursor_node = NULL; GtkRBNode *cursor_node = NULL;
GtkRBTree *new_cursor_tree = NULL;
GtkRBNode *new_cursor_node = NULL;
GtkTreePath *cursor_path = NULL; GtkTreePath *cursor_path = NULL;
cursor_path = NULL; cursor_path = NULL;
if (tree_view->priv->cursor) if (tree_view->priv->cursor)
cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor); cursor_path = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
g_print ("up_down: cursor path is %s\n", cursor_path?"non NULL":"NULL"); if (cursor_path == NULL)
return;
_gtk_tree_view_find_node (tree_view, cursor_path, _gtk_tree_view_find_node (tree_view, cursor_path,
&cursor_tree, &cursor_tree, &cursor_node);
&cursor_node);
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
if (tree_view->priv->cursor)
{
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = NULL;
}
if (count == -1) if (count == -1)
_gtk_rbtree_prev_full (cursor_tree, cursor_node, _gtk_rbtree_prev_full (cursor_tree, cursor_node,
&cursor_tree, &cursor_node); &new_cursor_tree, &new_cursor_node);
else else
_gtk_rbtree_next_full (cursor_tree, cursor_node, _gtk_rbtree_next_full (cursor_tree, cursor_node,
&cursor_tree, &cursor_node); &new_cursor_tree, &new_cursor_node);
if (new_cursor_node)
{
gtk_tree_path_free (cursor_path); gtk_tree_path_free (cursor_path);
if (cursor_node) cursor_path = _gtk_tree_view_find_path (tree_view, new_cursor_tree, new_cursor_node);
{
cursor_path = _gtk_tree_view_find_path (tree_view,
cursor_tree,
cursor_node);
if (cursor_path)
{
_gtk_tree_selection_internal_select_node (tree_view->priv->selection, _gtk_tree_selection_internal_select_node (tree_view->priv->selection,
cursor_node, new_cursor_node,
cursor_tree, new_cursor_tree,
cursor_path, cursor_path,
extend_selection?0:0); extend_selection?GDK_SHIFT_MASK:0);
gtk_tree_row_reference_free (tree_view->priv->cursor);
tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, cursor_path); tree_view->priv->cursor = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, cursor_path);
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL); gtk_tree_view_clamp_node_visible (tree_view, new_cursor_tree, new_cursor_node);
gtk_tree_path_free (cursor_path);
} }
else
{
gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node); gtk_tree_view_clamp_node_visible (tree_view, cursor_tree, cursor_node);
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
} }
gtk_widget_grab_focus (GTK_WIDGET (tree_view));
gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL);
gtk_tree_path_free (cursor_path);
} }
void void

View File

@ -235,7 +235,7 @@ gtk_tree_view_column_class_init (GtkTreeViewColumnClass *class)
PROP_ALIGNMENT, PROP_ALIGNMENT,
g_param_spec_float ("alignment", g_param_spec_float ("alignment",
_("Alignment"), _("Alignment"),
_("Alignment of the column header text or widget"), _("X Alignment of the column header text or widget"),
0.0, 0.0,
1.0, 1.0,
0.5, 0.5,
@ -1422,13 +1422,18 @@ gtk_tree_view_column_set_min_width (GtkTreeViewColumn *tree_column,
if (min_width == tree_column->min_width) if (min_width == tree_column->min_width)
return; return;
if (tree_column->tree_view == NULL)
{
tree_column->min_width = min_width;
return;
}
real_min_width = (tree_column->min_width == -1) ? real_min_width = (tree_column->min_width == -1) ?
tree_column->button->requisition.width : tree_column->min_width; tree_column->button->requisition.width : tree_column->min_width;
/* We want to queue a resize if the either the old min_size or the /* We want to queue a resize if the either the old min_size or the
* new min_size determined the size of the column */ * new min_size determined the size of the column */
if (tree_column->tree_view && if (GTK_WIDGET_REALIZED (tree_column->tree_view))
GTK_WIDGET_REALIZED (tree_column->tree_view))
{ {
if ((tree_column->min_width > tree_column->width) || if ((tree_column->min_width > tree_column->width) ||
(tree_column->min_width == -1 && (tree_column->min_width == -1 &&
@ -1477,7 +1482,7 @@ void
gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column, gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
gint max_width) gint max_width)
{ {
gint real_min_width; gint real_max_width;
g_return_if_fail (tree_column != NULL); g_return_if_fail (tree_column != NULL);
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column)); g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
@ -1486,8 +1491,14 @@ gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
if (max_width == tree_column->max_width) if (max_width == tree_column->max_width)
return; return;
real_min_width = tree_column->min_width == -1 ? if (tree_column->tree_view == NULL)
tree_column->button->requisition.width : tree_column->min_width; {
tree_column->max_width = max_width;
return;
}
real_max_width = tree_column->max_width == -1 ?
tree_column->button->requisition.width : tree_column->max_width;
if (tree_column->tree_view && if (tree_column->tree_view &&
GTK_WIDGET_REALIZED (tree_column->tree_view) && GTK_WIDGET_REALIZED (tree_column->tree_view) &&
@ -1497,8 +1508,8 @@ gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
tree_column->max_width = max_width; tree_column->max_width = max_width;
if (real_min_width > max_width) if (real_max_width > max_width)
tree_column->min_width = max_width; tree_column->max_width = max_width;
g_object_notify (G_OBJECT (tree_column), "max_width"); g_object_notify (G_OBJECT (tree_column), "max_width");
} }
@ -1689,6 +1700,15 @@ gtk_tree_view_column_set_alignment (GtkTreeViewColumn *tree_column,
g_object_notify (G_OBJECT (tree_column), "alignment"); g_object_notify (G_OBJECT (tree_column), "alignment");
} }
/**
* gtk_tree_view_column_get_alignment:
* @tree_column: A #GtkTreeViewColumn.
*
* Returns the current x alignment of @tree_column. This value can range
* between 0.0 and 1.0.
*
* Return value: The current alignent of @tree_column.
**/
gfloat gfloat
gtk_tree_view_column_get_alignment (GtkTreeViewColumn *tree_column) gtk_tree_view_column_get_alignment (GtkTreeViewColumn *tree_column)
{ {