diff --git a/ChangeLog b/ChangeLog index 7345129cbe..1911a4e550 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +Fri Feb 22 22:39:59 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h: add last_single_clicked and + last_single_clicked_2 rowrefs and add disable_popdown to the + bitfield + + * gtk/gtktreeview.c (gtk_tree_view_destroy): add destroy stuff + for two new rowrefs + (gtk_tree_view_button_press): add some 'advanced' button handling, + so double click is being handled right (double click madness was + discovered by Anders Carlsson) + + * gtk/gtktreeview.c (gtk_tree_view_set_property): add missing + break + (gtk_tree_view_class_init): default value of headers_visible + should be TRUE (both pointed out by Damon Chaplin, #71986) + + * gtk/gtktreeview.c (gtk_tree_view_real_start_interactive_search): + connect to populate_popup, + (gtk_tree_view_search_disable_popdown): new function, + (gtk_tree_view_real_search_enable_popdown): ditto, + (gtk_tree_view_search_enable_popdown): ditto, + (gtk_tree_view_search_dialog_destroy): check for + gtk-tree-view-popdown-disabled (#71868) + + * gtk/gtktreeview.c (gtk_tree_view_set_reorderable): move + ->priv->reorderable assignment to bottom. (#72122) + 2002-02-22 Havoc Pennington * gtk/gtkstyle.c (_gtk_draw_insertion_cursor): subtract 1 from diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 7345129cbe..1911a4e550 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,31 @@ +Fri Feb 22 22:39:59 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h: add last_single_clicked and + last_single_clicked_2 rowrefs and add disable_popdown to the + bitfield + + * gtk/gtktreeview.c (gtk_tree_view_destroy): add destroy stuff + for two new rowrefs + (gtk_tree_view_button_press): add some 'advanced' button handling, + so double click is being handled right (double click madness was + discovered by Anders Carlsson) + + * gtk/gtktreeview.c (gtk_tree_view_set_property): add missing + break + (gtk_tree_view_class_init): default value of headers_visible + should be TRUE (both pointed out by Damon Chaplin, #71986) + + * gtk/gtktreeview.c (gtk_tree_view_real_start_interactive_search): + connect to populate_popup, + (gtk_tree_view_search_disable_popdown): new function, + (gtk_tree_view_real_search_enable_popdown): ditto, + (gtk_tree_view_search_enable_popdown): ditto, + (gtk_tree_view_search_dialog_destroy): check for + gtk-tree-view-popdown-disabled (#71868) + + * gtk/gtktreeview.c (gtk_tree_view_set_reorderable): move + ->priv->reorderable assignment to bottom. (#72122) + 2002-02-22 Havoc Pennington * gtk/gtkstyle.c (_gtk_draw_insertion_cursor): subtract 1 from diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 7345129cbe..1911a4e550 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,31 @@ +Fri Feb 22 22:39:59 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h: add last_single_clicked and + last_single_clicked_2 rowrefs and add disable_popdown to the + bitfield + + * gtk/gtktreeview.c (gtk_tree_view_destroy): add destroy stuff + for two new rowrefs + (gtk_tree_view_button_press): add some 'advanced' button handling, + so double click is being handled right (double click madness was + discovered by Anders Carlsson) + + * gtk/gtktreeview.c (gtk_tree_view_set_property): add missing + break + (gtk_tree_view_class_init): default value of headers_visible + should be TRUE (both pointed out by Damon Chaplin, #71986) + + * gtk/gtktreeview.c (gtk_tree_view_real_start_interactive_search): + connect to populate_popup, + (gtk_tree_view_search_disable_popdown): new function, + (gtk_tree_view_real_search_enable_popdown): ditto, + (gtk_tree_view_search_enable_popdown): ditto, + (gtk_tree_view_search_dialog_destroy): check for + gtk-tree-view-popdown-disabled (#71868) + + * gtk/gtktreeview.c (gtk_tree_view_set_reorderable): move + ->priv->reorderable assignment to bottom. (#72122) + 2002-02-22 Havoc Pennington * gtk/gtkstyle.c (_gtk_draw_insertion_cursor): subtract 1 from diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 7345129cbe..1911a4e550 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,31 @@ +Fri Feb 22 22:39:59 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h: add last_single_clicked and + last_single_clicked_2 rowrefs and add disable_popdown to the + bitfield + + * gtk/gtktreeview.c (gtk_tree_view_destroy): add destroy stuff + for two new rowrefs + (gtk_tree_view_button_press): add some 'advanced' button handling, + so double click is being handled right (double click madness was + discovered by Anders Carlsson) + + * gtk/gtktreeview.c (gtk_tree_view_set_property): add missing + break + (gtk_tree_view_class_init): default value of headers_visible + should be TRUE (both pointed out by Damon Chaplin, #71986) + + * gtk/gtktreeview.c (gtk_tree_view_real_start_interactive_search): + connect to populate_popup, + (gtk_tree_view_search_disable_popdown): new function, + (gtk_tree_view_real_search_enable_popdown): ditto, + (gtk_tree_view_search_enable_popdown): ditto, + (gtk_tree_view_search_dialog_destroy): check for + gtk-tree-view-popdown-disabled (#71868) + + * gtk/gtktreeview.c (gtk_tree_view_set_reorderable): move + ->priv->reorderable assignment to bottom. (#72122) + 2002-02-22 Havoc Pennington * gtk/gtkstyle.c (_gtk_draw_insertion_cursor): subtract 1 from diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 7345129cbe..1911a4e550 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,31 @@ +Fri Feb 22 22:39:59 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h: add last_single_clicked and + last_single_clicked_2 rowrefs and add disable_popdown to the + bitfield + + * gtk/gtktreeview.c (gtk_tree_view_destroy): add destroy stuff + for two new rowrefs + (gtk_tree_view_button_press): add some 'advanced' button handling, + so double click is being handled right (double click madness was + discovered by Anders Carlsson) + + * gtk/gtktreeview.c (gtk_tree_view_set_property): add missing + break + (gtk_tree_view_class_init): default value of headers_visible + should be TRUE (both pointed out by Damon Chaplin, #71986) + + * gtk/gtktreeview.c (gtk_tree_view_real_start_interactive_search): + connect to populate_popup, + (gtk_tree_view_search_disable_popdown): new function, + (gtk_tree_view_real_search_enable_popdown): ditto, + (gtk_tree_view_search_enable_popdown): ditto, + (gtk_tree_view_search_dialog_destroy): check for + gtk-tree-view-popdown-disabled (#71868) + + * gtk/gtktreeview.c (gtk_tree_view_set_reorderable): move + ->priv->reorderable assignment to bottom. (#72122) + 2002-02-22 Havoc Pennington * gtk/gtkstyle.c (_gtk_draw_insertion_cursor): subtract 1 from diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 7345129cbe..1911a4e550 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,31 @@ +Fri Feb 22 22:39:59 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h: add last_single_clicked and + last_single_clicked_2 rowrefs and add disable_popdown to the + bitfield + + * gtk/gtktreeview.c (gtk_tree_view_destroy): add destroy stuff + for two new rowrefs + (gtk_tree_view_button_press): add some 'advanced' button handling, + so double click is being handled right (double click madness was + discovered by Anders Carlsson) + + * gtk/gtktreeview.c (gtk_tree_view_set_property): add missing + break + (gtk_tree_view_class_init): default value of headers_visible + should be TRUE (both pointed out by Damon Chaplin, #71986) + + * gtk/gtktreeview.c (gtk_tree_view_real_start_interactive_search): + connect to populate_popup, + (gtk_tree_view_search_disable_popdown): new function, + (gtk_tree_view_real_search_enable_popdown): ditto, + (gtk_tree_view_search_enable_popdown): ditto, + (gtk_tree_view_search_dialog_destroy): check for + gtk-tree-view-popdown-disabled (#71868) + + * gtk/gtktreeview.c (gtk_tree_view_set_reorderable): move + ->priv->reorderable assignment to bottom. (#72122) + 2002-02-22 Havoc Pennington * gtk/gtkstyle.c (_gtk_draw_insertion_cursor): subtract 1 from diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 7345129cbe..1911a4e550 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,31 @@ +Fri Feb 22 22:39:59 2002 Kristian Rietveld + + * gtk/gtktreeprivate.h: add last_single_clicked and + last_single_clicked_2 rowrefs and add disable_popdown to the + bitfield + + * gtk/gtktreeview.c (gtk_tree_view_destroy): add destroy stuff + for two new rowrefs + (gtk_tree_view_button_press): add some 'advanced' button handling, + so double click is being handled right (double click madness was + discovered by Anders Carlsson) + + * gtk/gtktreeview.c (gtk_tree_view_set_property): add missing + break + (gtk_tree_view_class_init): default value of headers_visible + should be TRUE (both pointed out by Damon Chaplin, #71986) + + * gtk/gtktreeview.c (gtk_tree_view_real_start_interactive_search): + connect to populate_popup, + (gtk_tree_view_search_disable_popdown): new function, + (gtk_tree_view_real_search_enable_popdown): ditto, + (gtk_tree_view_search_enable_popdown): ditto, + (gtk_tree_view_search_dialog_destroy): check for + gtk-tree-view-popdown-disabled (#71868) + + * gtk/gtktreeview.c (gtk_tree_view_set_reorderable): move + ->priv->reorderable assignment to bottom. (#72122) + 2002-02-22 Havoc Pennington * gtk/gtkstyle.c (_gtk_draw_insertion_cursor): subtract 1 from diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h index 792a3bbdd3..820e846b5f 100644 --- a/gtk/gtktreeprivate.h +++ b/gtk/gtktreeprivate.h @@ -101,6 +101,9 @@ struct _GtkTreeViewPrivate GdkWindow *drag_highlight_window; GtkTreeViewColumn *drag_column; + GtkTreeRowReference *last_single_clicked; + GtkTreeRowReference *last_single_clicked_2; + /* bin_window offset */ GtkTreeRowReference *top_row; gint top_row_dy; @@ -181,6 +184,7 @@ struct _GtkTreeViewPrivate /* interactive search */ guint enable_search : 1; + guint disable_popdown : 1; gint search_column; GtkTreeViewSearchDialogPositionFunc search_dialog_position_func; GtkTreeViewSearchEqualFunc search_equal_func; diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 2db1766e60..91f3ec3164 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -351,6 +351,12 @@ static void gtk_tree_view_search_dialog_destroy (GtkWidget *searc GtkTreeView *tree_view); static void gtk_tree_view_search_position_func (GtkTreeView *tree_view, GtkWidget *search_dialog); +static void gtk_tree_view_search_disable_popdown (GtkEntry *entry, + GtkMenu *menu, + gpointer data); +static gboolean gtk_tree_view_real_search_enable_popdown(gpointer data); +static void gtk_tree_view_search_enable_popdown (GtkWidget *widget, + gpointer data); static gboolean gtk_tree_view_search_delete_event (GtkWidget *widget, GdkEventAny *event, GtkTreeView *tree_view); @@ -531,7 +537,7 @@ gtk_tree_view_class_init (GtkTreeViewClass *class) g_param_spec_boolean ("headers_visible", _("Visible"), _("Show the column header buttons"), - FALSE, + TRUE, G_PARAM_READWRITE)); g_object_class_install_property (o_class, @@ -983,6 +989,7 @@ gtk_tree_view_set_property (GObject *object, break; case PROP_RULES_HINT: gtk_tree_view_set_rules_hint (tree_view, g_value_get_boolean (value)); + break; case PROP_ENABLE_SEARCH: gtk_tree_view_set_enable_search (tree_view, g_value_get_boolean (value)); break; @@ -1103,6 +1110,18 @@ gtk_tree_view_destroy (GtkObject *object) tree_view->priv->drag_dest_row = NULL; } + if (tree_view->priv->last_single_clicked != NULL) + { + gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); + tree_view->priv->last_single_clicked = NULL; + } + + if (tree_view->priv->last_single_clicked_2 != NULL) + { + gtk_tree_row_reference_free (tree_view->priv->last_single_clicked_2); + tree_view->priv->last_single_clicked_2 = NULL; + } + if (tree_view->priv->top_row != NULL) { gtk_tree_row_reference_free (tree_view->priv->top_row); @@ -1865,20 +1884,46 @@ gtk_tree_view_button_press (GtkWidget *widget, tree_view->priv->press_start_y = event->y; } - if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) + if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && + tree_view->priv->last_single_clicked) { - if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT)) + GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_single_clicked); + + if (lsc) { - if (node->children == NULL) - gtk_tree_view_real_expand_row (tree_view, path, - tree, node, FALSE, TRUE); - else - gtk_tree_view_real_collapse_row (GTK_TREE_VIEW (widget), path, - tree, node, TRUE); + if (!gtk_tree_path_compare (lsc, path)) + { + if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT)) + { + if (node->children == NULL) + gtk_tree_view_real_expand_row (tree_view, path, + tree, node, FALSE, + TRUE); + else + gtk_tree_view_real_collapse_row (tree_view, path, + tree, node, TRUE); + } + + gtk_tree_view_row_activated (tree_view, path, column); + } + gtk_tree_path_free (lsc); } - gtk_tree_view_row_activated (tree_view, path, column); + if (tree_view->priv->last_single_clicked) + gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); + if (tree_view->priv->last_single_clicked_2) + gtk_tree_row_reference_free (tree_view->priv->last_single_clicked_2); + tree_view->priv->last_single_clicked = NULL; + tree_view->priv->last_single_clicked_2 = NULL; } + else if (event->button == 1 && event->type == GDK_BUTTON_PRESS) + { + if (tree_view->priv->last_single_clicked) + gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); + tree_view->priv->last_single_clicked = tree_view->priv->last_single_clicked_2; + tree_view->priv->last_single_clicked_2 = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path); + } + GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); gtk_tree_path_free (path); return TRUE; @@ -7025,6 +7070,9 @@ gtk_tree_view_real_start_interactive_search (GtkTreeView *tree_view) gtk_widget_show (entry); g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (gtk_tree_view_search_init), tree_view); + g_signal_connect (G_OBJECT (entry), "populate_popup", + G_CALLBACK (gtk_tree_view_search_disable_popdown), + tree_view); gtk_container_add (GTK_CONTAINER (window), entry); /* done, show it */ @@ -8734,8 +8782,6 @@ gtk_tree_view_set_reorderable (GtkTreeView *tree_view, if (tree_view->priv->reorderable == reorderable) return; - tree_view->priv->reorderable = reorderable; - if (reorderable) { gtk_tree_view_enable_model_drag_source (tree_view, @@ -8754,6 +8800,8 @@ gtk_tree_view_set_reorderable (GtkTreeView *tree_view, gtk_tree_view_unset_rows_drag_dest (tree_view); } + tree_view->priv->reorderable = reorderable; + g_object_notify (G_OBJECT (tree_view), "reorderable"); } @@ -9764,6 +9812,9 @@ gtk_tree_view_search_dialog_destroy (GtkWidget *search_dialog, GtkEntry *entry = (GtkEntry *)(gtk_container_get_children (GTK_CONTAINER (search_dialog)))->data; gint *selected_iter; + if (tree_view->priv->disable_popdown) + return; + if (entry) { GdkEventFocus focus_event; @@ -9822,6 +9873,39 @@ gtk_tree_view_search_position_func (GtkTreeView *tree_view, gtk_window_move (GTK_WINDOW (search_dialog), x, y); } +static void +gtk_tree_view_search_disable_popdown (GtkEntry *entry, + GtkMenu *menu, + gpointer data) +{ + GtkTreeView *tree_view = (GtkTreeView *)data; + + tree_view->priv->disable_popdown = 1; + g_signal_connect (G_OBJECT (menu), "hide", + G_CALLBACK (gtk_tree_view_search_enable_popdown), data); +} + +static gboolean +gtk_tree_view_real_search_enable_popdown (gpointer data) +{ + GtkTreeView *tree_view = (GtkTreeView *)data; + + GDK_THREADS_ENTER (); + + tree_view->priv->disable_popdown = 0; + + GDK_THREADS_LEAVE (); + + return FALSE; +} + +static void +gtk_tree_view_search_enable_popdown (GtkWidget *widget, + gpointer data) +{ + g_timeout_add (200, gtk_tree_view_real_search_enable_popdown, data); +} + static gboolean gtk_tree_view_search_delete_event (GtkWidget *widget, GdkEventAny *event,