From: Jonathan Blandford Date: Mon, 1 Oct 2001 18:12:34 +0000 (+0000) Subject: change scroll_to_cell delayed code to happen in size_allocate. X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=58ed9e8bef2eb169917a0eef11fb6b6e0678fd47;p=~andy%2Fgtk change scroll_to_cell delayed code to happen in size_allocate. Mon Oct 1 14:07:02 2001 Jonathan Blandford * gtk/gtktreeview.c (gtk_tree_view_size_allocate): change scroll_to_cell delayed code to happen in size_allocate. * gtk/gtkstyle.c (gtk_default_draw_expander): change prelight/normal arrow drawing. * gtk/gtktreedatalist.c: Change compare func to use g_utf8_collate * gtk/gtktreestore.c: refactor. --- diff --git a/ChangeLog b/ChangeLog index f3e2c00e0..7a0bef694 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Mon Oct 1 14:07:02 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): change + scroll_to_cell delayed code to happen in size_allocate. + + * gtk/gtkstyle.c (gtk_default_draw_expander): change + prelight/normal arrow drawing. + + * gtk/gtktreedatalist.c: Change compare func to use g_utf8_collate + + * gtk/gtktreestore.c: refactor. + Sun Sep 30 22:15:52 2001 Manish Singh * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): Applied diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index f3e2c00e0..7a0bef694 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,15 @@ +Mon Oct 1 14:07:02 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): change + scroll_to_cell delayed code to happen in size_allocate. + + * gtk/gtkstyle.c (gtk_default_draw_expander): change + prelight/normal arrow drawing. + + * gtk/gtktreedatalist.c: Change compare func to use g_utf8_collate + + * gtk/gtktreestore.c: refactor. + Sun Sep 30 22:15:52 2001 Manish Singh * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): Applied diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f3e2c00e0..7a0bef694 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +Mon Oct 1 14:07:02 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): change + scroll_to_cell delayed code to happen in size_allocate. + + * gtk/gtkstyle.c (gtk_default_draw_expander): change + prelight/normal arrow drawing. + + * gtk/gtktreedatalist.c: Change compare func to use g_utf8_collate + + * gtk/gtktreestore.c: refactor. + Sun Sep 30 22:15:52 2001 Manish Singh * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): Applied diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index f3e2c00e0..7a0bef694 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +Mon Oct 1 14:07:02 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): change + scroll_to_cell delayed code to happen in size_allocate. + + * gtk/gtkstyle.c (gtk_default_draw_expander): change + prelight/normal arrow drawing. + + * gtk/gtktreedatalist.c: Change compare func to use g_utf8_collate + + * gtk/gtktreestore.c: refactor. + Sun Sep 30 22:15:52 2001 Manish Singh * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): Applied diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f3e2c00e0..7a0bef694 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +Mon Oct 1 14:07:02 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): change + scroll_to_cell delayed code to happen in size_allocate. + + * gtk/gtkstyle.c (gtk_default_draw_expander): change + prelight/normal arrow drawing. + + * gtk/gtktreedatalist.c: Change compare func to use g_utf8_collate + + * gtk/gtktreestore.c: refactor. + Sun Sep 30 22:15:52 2001 Manish Singh * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): Applied diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f3e2c00e0..7a0bef694 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +Mon Oct 1 14:07:02 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): change + scroll_to_cell delayed code to happen in size_allocate. + + * gtk/gtkstyle.c (gtk_default_draw_expander): change + prelight/normal arrow drawing. + + * gtk/gtktreedatalist.c: Change compare func to use g_utf8_collate + + * gtk/gtktreestore.c: refactor. + Sun Sep 30 22:15:52 2001 Manish Singh * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): Applied diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f3e2c00e0..7a0bef694 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +Mon Oct 1 14:07:02 2001 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): change + scroll_to_cell delayed code to happen in size_allocate. + + * gtk/gtkstyle.c (gtk_default_draw_expander): change + prelight/normal arrow drawing. + + * gtk/gtktreedatalist.c: Change compare func to use g_utf8_collate + + * gtk/gtktreestore.c: refactor. + Sun Sep 30 22:15:52 2001 Manish Singh * gtk/gtkcheckbutton.c (gtk_check_button_size_allocate): Applied diff --git a/docs/reference/gtk/tmpl/gtktreeview.sgml b/docs/reference/gtk/tmpl/gtktreeview.sgml index c08690247..39c0aa775 100644 --- a/docs/reference/gtk/tmpl/gtktreeview.sgml +++ b/docs/reference/gtk/tmpl/gtktreeview.sgml @@ -777,6 +777,13 @@ GtkTreeView @arg1: @arg2: + + + + + +@treeview: the object which received the signal. + @@ -790,6 +797,7 @@ GtkTreeView @treeview: the object which received the signal. +@arg1: diff --git a/gtk/gtkrbtree.c b/gtk/gtkrbtree.c index 348b120be..86690ea91 100644 --- a/gtk/gtkrbtree.c +++ b/gtk/gtkrbtree.c @@ -528,7 +528,7 @@ _gtk_rbtree_remove (GtkRBTree *tree) } tmp_tree = tree->parent_tree; - + tmp_node = tree->parent_node; _gtk_rbtree_free (tree); if (gtk_debug_flags & GTK_DEBUG_TREE) diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 3a4cdb8f8..b9c5afc3a 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -4057,10 +4057,8 @@ gtk_default_draw_expander (GtkStyle *style, if (state_type == GTK_STATE_PRELIGHT) { - gdk_draw_polygon (window, style->base_gc[GTK_STATE_NORMAL], - TRUE, points, 3); gdk_draw_polygon (window, style->fg_gc[GTK_STATE_NORMAL], - FALSE, points, 3); + TRUE, points, 3); } else if (state_type == GTK_STATE_ACTIVE) { @@ -4071,8 +4069,10 @@ gtk_default_draw_expander (GtkStyle *style, } else { - gdk_draw_polygon (window, style->fg_gc[GTK_STATE_NORMAL], + gdk_draw_polygon (window, style->base_gc[GTK_STATE_NORMAL], TRUE, points, 3); + gdk_draw_polygon (window, style->fg_gc[GTK_STATE_NORMAL], + FALSE, points, 3); } if (area) { diff --git a/gtk/gtktreedatalist.c b/gtk/gtktreedatalist.c index 5a429ad98..81d6332e6 100644 --- a/gtk/gtktreedatalist.c +++ b/gtk/gtktreedatalist.c @@ -303,11 +303,9 @@ gtk_tree_data_list_compare_func (GtkTreeModel *model, case G_TYPE_STRING: stra = g_value_get_string (&a_value); strb = g_value_get_string (&b_value); - if (stra == NULL) - stra = ""; - if (strb == NULL) - strb = ""; - retval = strcmp (stra, strb); + if (stra == NULL) stra = ""; + if (strb == NULL) strb = ""; + retval = g_utf8_collate (stra, strb); break; case G_TYPE_POINTER: case G_TYPE_BOXED: diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c index ffde83b8e..ecc23857f 100644 --- a/gtk/gtktreemodel.c +++ b/gtk/gtktreemodel.c @@ -1213,25 +1213,29 @@ gtk_tree_row_ref_inserted_callback (GObject *object, { GtkTreeRowReference *reference = tmp_list->data; - if (reference->path) + if (reference->path == NULL) + goto done; + + if (reference->path->depth >= path->depth) { - gint depth = gtk_tree_path_get_depth (path); - gint ref_depth = gtk_tree_path_get_depth (reference->path); + gint i; + gboolean ancestor = TRUE; - if (ref_depth >= depth) + for (i = 0; i < path->depth - 1; i ++) { - gint *indices = gtk_tree_path_get_indices (path); - gint *ref_indices = gtk_tree_path_get_indices (reference->path); - gint i; - - /* This is the depth that might affect us. */ - i = depth - 1; - - if (indices[i] <= ref_indices[i]) - ref_indices[i] += 1; + if (path->indices[i] != reference->path->indices[i]) + { + ancestor = FALSE; + break; + } } - } + if (ancestor == FALSE) + goto done; + if (path->indices[path->depth-1] <= reference->path->indices[path->depth-1]) + reference->path->indices[path->depth-1] += 1; + } + done: tmp_list = g_slist_next (tmp_list); } } @@ -1266,30 +1270,15 @@ gtk_tree_row_ref_deleted_callback (GObject *object, if (reference->path) { - gint depth = gtk_tree_path_get_depth (path); - gint ref_depth = gtk_tree_path_get_depth (reference->path); - - if (ref_depth >= depth) + if (gtk_tree_path_is_ancestor (path, reference->path)) { - /* Need to adjust path upward */ - gint *indices = gtk_tree_path_get_indices (path); - gint *ref_indices = gtk_tree_path_get_indices (reference->path); - gint i; - - i = depth - 1; - if (indices[i] < ref_indices[i]) - ref_indices[i] -= 1; - else if (indices[i] == ref_indices[i]) - { - /* the referenced node itself, or its parent, was - * deleted, mark invalid - */ - - gtk_tree_path_free (reference->path); - reference->path = NULL; - } + reference->path->indices[path->depth-1]-=1; + } + else if (gtk_tree_path_compare (path, reference->path) == 0) + { + gtk_tree_path_free (reference->path); + reference->path = NULL; } - } tmp_list = g_slist_next (tmp_list); } diff --git a/gtk/gtktreestore.c b/gtk/gtktreestore.c index 5418a0355..764b9d1e8 100644 --- a/gtk/gtktreestore.c +++ b/gtk/gtktreestore.c @@ -1179,23 +1179,20 @@ gtk_tree_store_prepend (GtkTreeStore *tree_store, if (parent_node->children == NULL) { GtkTreePath *path; - + iter->stamp = tree_store->stamp; iter->user_data = g_node_new (NULL); g_node_prepend (parent_node, iter->user_data); + path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter); + gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter); + if (parent_node != tree_store->root) { - path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), parent); + gtk_tree_path_up (path); gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, parent); - gtk_tree_path_append_index (path, 0); } - else - { - path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter); - } - gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter); gtk_tree_path_free (path); } else @@ -1245,18 +1242,14 @@ gtk_tree_store_append (GtkTreeStore *tree_store, g_node_append (parent_node, G_NODE (iter->user_data)); + path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter); + gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter); + if (parent_node != tree_store->root) { - path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), parent); + gtk_tree_path_up (path); gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (tree_store), path, parent); - gtk_tree_path_append_index (path, 0); - } - else - { - path = gtk_tree_store_get_path (GTK_TREE_MODEL (tree_store), iter); } - - gtk_tree_model_row_inserted (GTK_TREE_MODEL (tree_store), path, iter); gtk_tree_path_free (path); } else diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 6aa5ec47b..bd3e561aa 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -1262,24 +1262,7 @@ gtk_tree_view_realize (GtkWidget *widget) _gtk_tree_view_update_size (GTK_TREE_VIEW (widget)); - if (tree_view->priv->scroll_to_path != NULL || - tree_view->priv->scroll_to_column != NULL) - { - gtk_tree_view_scroll_to_cell (tree_view, - tree_view->priv->scroll_to_path, - tree_view->priv->scroll_to_column, - tree_view->priv->scroll_to_use_align, - tree_view->priv->scroll_to_row_align, - tree_view->priv->scroll_to_col_align); - if (tree_view->priv->scroll_to_path) - { - gtk_tree_path_free (tree_view->priv->scroll_to_path); - tree_view->priv->scroll_to_path = NULL; - } - tree_view->priv->scroll_to_column = NULL; - } - - if (GTK_WIDGET_CLASS (parent_class)->map) +if (GTK_WIDGET_CLASS (parent_class)->map) (* GTK_WIDGET_CLASS (parent_class)->map) (widget); } @@ -1518,6 +1501,23 @@ gtk_tree_view_size_allocate (GtkWidget *widget, gtk_signal_emit_by_name (GTK_OBJECT (tree_view->priv->vadjustment), "changed"); + if (tree_view->priv->scroll_to_path != NULL || + tree_view->priv->scroll_to_column != NULL) + { + gtk_tree_view_scroll_to_cell (tree_view, + tree_view->priv->scroll_to_path, + tree_view->priv->scroll_to_column, + tree_view->priv->scroll_to_use_align, + tree_view->priv->scroll_to_row_align, + tree_view->priv->scroll_to_col_align); + if (tree_view->priv->scroll_to_path) + { + gtk_tree_path_free (tree_view->priv->scroll_to_path); + tree_view->priv->scroll_to_path = NULL; + } + tree_view->priv->scroll_to_column = NULL; + } + } static gboolean @@ -4401,7 +4401,6 @@ gtk_tree_view_row_inserted (GtkTreeModel *model, /* Update all row-references */ gtk_tree_row_reference_inserted (G_OBJECT (data), path); - depth = gtk_tree_path_get_depth (path); indices = gtk_tree_path_get_indices (path); @@ -6067,13 +6066,14 @@ gtk_tree_view_real_expand_collapse_cursor_row (GtkTreeView *tree_view, if (cursor_path == NULL) return; + gtk_widget_grab_focus (GTK_WIDGET (tree_view)); + gtk_tree_view_queue_draw_path (tree_view, cursor_path, NULL); + if (expand) gtk_tree_view_expand_row (tree_view, cursor_path, open_all); else gtk_tree_view_collapse_row (tree_view, cursor_path); - 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); } @@ -7466,6 +7466,7 @@ gtk_tree_view_real_expand_row (GtkTreeView *tree_view, GtkTreeIter temp; gboolean expand; + if (node->children) return TRUE; @@ -7513,7 +7514,6 @@ gtk_tree_view_real_expand_row (GtkTreeView *tree_view, } g_signal_emit (G_OBJECT (tree_view), tree_view_signals[ROW_EXPANDED], 0, &iter, path); - return TRUE; } @@ -7914,7 +7914,7 @@ gtk_tree_view_real_set_cursor (GtkTreeView *tree_view, * @tree_view: A #GtkTreeView * @path: A pointer to be filled with the current cursor path, or %NULL * @focus_column: A pointer to be filled with the current focus column, or %NULL - * + * * Fills in @path and @focus_column with the current path and focus column. If * the cursor isn't currently set, then *path will be %NULL. If no column * currently has focus, then *focus_column will be %NULL. @@ -8829,7 +8829,7 @@ gtk_tree_view_get_search_equal_func (GtkTreeView *tree_view) * @search_equal_func: the compare function to use during the search * @search_user_data: user data to pass to @search_equal_func, or %NULL * @search_destroy: Destroy notifier for @search_user_data, or %NULL - * + * * Sets the compare function for the interactive search capabilities. **/ void