tree view, sort model and combo box: a custom search entry is released with the view, deleting a row with a selected child emits changed, the first pixel of a column belongs to it, grid lines in right-to-left order, row deletions reach views that do not ref rows, autosize columns outside a view are quiet, combo popups free paths and read no uninitialized cells, as in GTK+ 3
This commit is contained in:
parent
c787fa9d78
commit
5dcf0992da
4 changed files with 51 additions and 11 deletions
|
|
@ -4123,7 +4123,10 @@ gtk_combo_box_list_button_released (GtkWidget *widget,
|
|||
gtk_tree_view_get_cell_area (GTK_TREE_VIEW (priv->tree_view),
|
||||
path, column, &cell_area);
|
||||
if (x < cell_area.x || x >= cell_area.x + cell_area.width)
|
||||
return TRUE;
|
||||
{
|
||||
gtk_tree_path_free (path);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gtk_tree_model_get_iter (priv->model, &iter, path);
|
||||
|
||||
|
|
@ -4301,13 +4304,14 @@ gtk_combo_box_list_select_func (GtkTreeSelection *selection,
|
|||
NULL);
|
||||
|
||||
if (cell_visible && cell_sensitive)
|
||||
break;
|
||||
{
|
||||
sensitive = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
cell = cell->next;
|
||||
}
|
||||
g_list_free (cells);
|
||||
|
||||
sensitive = cell_sensitive;
|
||||
}
|
||||
|
||||
return sensitive;
|
||||
|
|
|
|||
|
|
@ -756,7 +756,11 @@ gtk_tree_model_sort_row_deleted (GtkTreeModel *s_model,
|
|||
while (elt->ref_count > 0)
|
||||
gtk_tree_model_sort_real_unref_node (GTK_TREE_MODEL (data), &iter, FALSE);
|
||||
|
||||
if (level->ref_count == 0)
|
||||
/* Views that do not ref their rows (as GtkIconView) leave the root
|
||||
* level unreffed; drop it only with its last row, or the deletion of
|
||||
* the other rows is no longer passed on */
|
||||
if (level->ref_count == 0 &&
|
||||
(level != tree_model_sort->root || level->array->len == 1))
|
||||
{
|
||||
/* This will prune the level, so I can just emit the signal and
|
||||
* not worry about cleaning this level up.
|
||||
|
|
|
|||
|
|
@ -1677,6 +1677,7 @@ gtk_tree_view_destroy (GtkObject *object)
|
|||
gtk_widget_destroy (tree_view->priv->search_window);
|
||||
tree_view->priv->search_window = NULL;
|
||||
tree_view->priv->search_entry = NULL;
|
||||
tree_view->priv->search_entry_changed_id = 0;
|
||||
if (tree_view->priv->typeselect_flush_timeout)
|
||||
{
|
||||
g_source_remove (tree_view->priv->typeselect_flush_timeout);
|
||||
|
|
@ -1684,6 +1685,26 @@ gtk_tree_view_destroy (GtkObject *object)
|
|||
}
|
||||
}
|
||||
|
||||
/* a search entry of the program's own outlives the tree view: it
|
||||
* must neither call into it nor be kept by it */
|
||||
if (tree_view->priv->search_custom_entry_set)
|
||||
{
|
||||
if (tree_view->priv->search_entry_changed_id)
|
||||
{
|
||||
g_signal_handler_disconnect (tree_view->priv->search_entry,
|
||||
tree_view->priv->search_entry_changed_id);
|
||||
tree_view->priv->search_entry_changed_id = 0;
|
||||
}
|
||||
g_signal_handlers_disconnect_by_func (tree_view->priv->search_entry,
|
||||
G_CALLBACK (gtk_tree_view_search_key_press_event),
|
||||
tree_view);
|
||||
|
||||
g_object_unref (tree_view->priv->search_entry);
|
||||
|
||||
tree_view->priv->search_entry = NULL;
|
||||
tree_view->priv->search_custom_entry_set = FALSE;
|
||||
}
|
||||
|
||||
if (tree_view->priv->search_destroy && tree_view->priv->search_user_data)
|
||||
{
|
||||
tree_view->priv->search_destroy (tree_view->priv->search_user_data);
|
||||
|
|
@ -4286,7 +4307,8 @@ gtk_tree_view_draw_grid_lines (GtkTreeView *tree_view,
|
|||
GdkEventExpose *event,
|
||||
gint n_visible_columns)
|
||||
{
|
||||
GList *list = tree_view->priv->columns;
|
||||
GList *list;
|
||||
gboolean rtl;
|
||||
gint i = 0;
|
||||
gint current_x = 0;
|
||||
|
||||
|
|
@ -4294,8 +4316,13 @@ gtk_tree_view_draw_grid_lines (GtkTreeView *tree_view,
|
|||
&& tree_view->priv->grid_lines != GTK_TREE_VIEW_GRID_LINES_BOTH)
|
||||
return;
|
||||
|
||||
/* The columns are laid out from the right in RTL */
|
||||
rtl = (gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL);
|
||||
|
||||
/* Only draw the lines for visible rows and columns */
|
||||
for (list = tree_view->priv->columns; list; list = list->next)
|
||||
for (list = (rtl ? g_list_last (tree_view->priv->columns) : g_list_first (tree_view->priv->columns));
|
||||
list;
|
||||
list = (rtl ? list->prev : list->next))
|
||||
{
|
||||
GtkTreeViewColumn *column = list->data;
|
||||
|
||||
|
|
@ -8624,7 +8651,7 @@ check_selection_helper (GtkRBTree *tree,
|
|||
{
|
||||
gint *value = (gint *)data;
|
||||
|
||||
*value = GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED);
|
||||
*value |= GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_SELECTED);
|
||||
|
||||
if (node->children && !*value)
|
||||
_gtk_rbtree_traverse (node->children, node->children->root, G_POST_ORDER, check_selection_helper, data);
|
||||
|
|
@ -12904,7 +12931,7 @@ gtk_tree_view_get_path_at_pos (GtkTreeView *tree_view,
|
|||
continue;
|
||||
|
||||
last_column = tmp_column;
|
||||
if (remaining_x <= tmp_column->width)
|
||||
if (remaining_x < tmp_column->width)
|
||||
{
|
||||
found = TRUE;
|
||||
|
||||
|
|
@ -14180,6 +14207,9 @@ gtk_tree_view_set_search_entry (GtkTreeView *tree_view,
|
|||
gtk_widget_destroy (tree_view->priv->search_window);
|
||||
|
||||
tree_view->priv->search_window = NULL;
|
||||
/* the handler went with the entry of the window; a new entry
|
||||
* needs its own */
|
||||
tree_view->priv->search_entry_changed_id = 0;
|
||||
}
|
||||
|
||||
if (entry)
|
||||
|
|
|
|||
|
|
@ -2004,7 +2004,8 @@ gtk_tree_view_column_set_min_width (GtkTreeViewColumn *tree_column,
|
|||
g_object_notify (G_OBJECT (tree_column), "min-width");
|
||||
g_object_thaw_notify (G_OBJECT (tree_column));
|
||||
|
||||
if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
|
||||
if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE &&
|
||||
tree_column->tree_view != NULL)
|
||||
_gtk_tree_view_column_autosize (GTK_TREE_VIEW (tree_column->tree_view),
|
||||
tree_column);
|
||||
}
|
||||
|
|
@ -2064,7 +2065,8 @@ gtk_tree_view_column_set_max_width (GtkTreeViewColumn *tree_column,
|
|||
g_object_notify (G_OBJECT (tree_column), "max-width");
|
||||
g_object_thaw_notify (G_OBJECT (tree_column));
|
||||
|
||||
if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE)
|
||||
if (tree_column->column_type == GTK_TREE_VIEW_COLUMN_AUTOSIZE &&
|
||||
tree_column->tree_view != NULL)
|
||||
_gtk_tree_view_column_autosize (GTK_TREE_VIEW (tree_column->tree_view),
|
||||
tree_column);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue