From 57e15782ffbed8be5f366816fc27463747a0deba Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 26 Jun 2004 03:39:35 +0000 Subject: [PATCH] Allow passing NULL to unset the model. (#137211, patch by Mariano MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fri Jun 25 23:35:42 2004 Matthias Clasen * gtk/gtkentrycompletion.c (gtk_entry_completion_set_model): * gtk/gtkcombobox.c (gtk_combo_box_set_model): Allow passing NULL to unset the model. (#137211, patch by Mariano Suárez-Alvarez) Fri Jun 25 23:33:05 2004 Matthias Clasen * gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Fix the placement policy for GtkComboBoxEntry to be: if it fits below, place below, if it fits above place above, else place in the larger space and scroll so that the scroll arrow appear at the far end. (#144362, David A. Knight) --- ChangeLog | 14 ++++++++++++++ ChangeLog.pre-2-10 | 14 ++++++++++++++ ChangeLog.pre-2-6 | 14 ++++++++++++++ ChangeLog.pre-2-8 | 14 ++++++++++++++ gtk/gtkcombobox.c | 15 +++++++++++++-- gtk/gtkentrycompletion.c | 2 +- 6 files changed, 70 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 434a5de42f..fd57a6c1cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Fri Jun 25 23:35:42 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_set_model): + * gtk/gtkcombobox.c (gtk_combo_box_set_model): Allow passing + NULL to unset the model. (#137211, patch by Mariano Suárez-Alvarez) + +Fri Jun 25 23:33:05 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Fix the + placement policy for GtkComboBoxEntry to be: if it fits below, + place below, if it fits above place above, else place in the + larger space and scroll so that the scroll arrow appear at the + far end. (#144362, David A. Knight) + Fri Jun 25 22:49:58 2004 Matthias Clasen * gtk/gtktreestore.c (gtk_tree_store_move): Avoid uninitialized diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 434a5de42f..fd57a6c1cd 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +Fri Jun 25 23:35:42 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_set_model): + * gtk/gtkcombobox.c (gtk_combo_box_set_model): Allow passing + NULL to unset the model. (#137211, patch by Mariano Suárez-Alvarez) + +Fri Jun 25 23:33:05 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Fix the + placement policy for GtkComboBoxEntry to be: if it fits below, + place below, if it fits above place above, else place in the + larger space and scroll so that the scroll arrow appear at the + far end. (#144362, David A. Knight) + Fri Jun 25 22:49:58 2004 Matthias Clasen * gtk/gtktreestore.c (gtk_tree_store_move): Avoid uninitialized diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 434a5de42f..fd57a6c1cd 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +Fri Jun 25 23:35:42 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_set_model): + * gtk/gtkcombobox.c (gtk_combo_box_set_model): Allow passing + NULL to unset the model. (#137211, patch by Mariano Suárez-Alvarez) + +Fri Jun 25 23:33:05 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Fix the + placement policy for GtkComboBoxEntry to be: if it fits below, + place below, if it fits above place above, else place in the + larger space and scroll so that the scroll arrow appear at the + far end. (#144362, David A. Knight) + Fri Jun 25 22:49:58 2004 Matthias Clasen * gtk/gtktreestore.c (gtk_tree_store_move): Avoid uninitialized diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 434a5de42f..fd57a6c1cd 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +Fri Jun 25 23:35:42 2004 Matthias Clasen + + * gtk/gtkentrycompletion.c (gtk_entry_completion_set_model): + * gtk/gtkcombobox.c (gtk_combo_box_set_model): Allow passing + NULL to unset the model. (#137211, patch by Mariano Suárez-Alvarez) + +Fri Jun 25 23:33:05 2004 Matthias Clasen + + * gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Fix the + placement policy for GtkComboBoxEntry to be: if it fits below, + place below, if it fits above place above, else place in the + larger space and scroll so that the scroll arrow appear at the + far end. (#144362, David A. Knight) + Fri Jun 25 22:49:58 2004 Matthias Clasen * gtk/gtktreestore.c (gtk_tree_store_move): Avoid uninitialized diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 4f0d1d257f..7dc08dcf86 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -985,12 +985,16 @@ gtk_combo_box_menu_position_below (GtkMenu *menu, else if (*x + req.width > monitor.x + monitor.width) *x = monitor.x + monitor.width - req.width; - if (*y + child->allocation.height + req.height <= monitor.y + monitor.height) + if (monitor.y + monitor.height - *y - child->allocation.height >= req.height) + *y += child->allocation.height; + else if (*y - monitor.y >= req.height) + *y -= req.height; + else if (monitor.y + monitor.height - *y - child->allocation.height > *y - monitor.y) *y += child->allocation.height; else *y -= req.height; - *push_in = TRUE; + *push_in = FALSE; } static void @@ -3523,6 +3527,13 @@ gtk_combo_box_set_model (GtkComboBox *combo_box, GtkTreeModel *model) { g_return_if_fail (GTK_IS_COMBO_BOX (combo_box)); + + if (!model) + { + gtk_combo_box_unset_model (combo_box); + return; + } + g_return_if_fail (GTK_IS_TREE_MODEL (model)); if (model == combo_box->priv->model) diff --git a/gtk/gtkentrycompletion.c b/gtk/gtkentrycompletion.c index 3d6f15a889..35a1470489 100644 --- a/gtk/gtkentrycompletion.c +++ b/gtk/gtkentrycompletion.c @@ -827,7 +827,7 @@ gtk_entry_completion_set_model (GtkEntryCompletion *completion, GtkTreeModel *model) { g_return_if_fail (GTK_IS_ENTRY_COMPLETION (completion)); - g_return_if_fail (GTK_IS_TREE_MODEL (model)); + g_return_if_fail (model == NULL || GTK_IS_TREE_MODEL (model)); /* code will unref the old filter model (if any) */ completion->priv->filter_model =