From a646da3f1e144a46508c23299518e1eb12fd9b9c Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Thu, 21 Jan 1999 03:46:32 +0000 Subject: [PATCH] Don't search entire row list twice for element being removed. * gtk/gtkclist.c (real_remove_row): Don't search entire row list twice for element being removed. * gtk/gtkmenushell.c (gtk_menu_shell_insert): Replaced hand-coded implementation of g_list_insert with call to g_list_insert. * gtk/gtktooltips.c (gtk_tooltips_destroy_data, gtk_tooltips_layout_text): tooltipsdata->row test not-null test now properly encompasses both g_list_* calls. --- ChangeLog | 14 ++++++++++++++ ChangeLog.pre-2-0 | 14 ++++++++++++++ ChangeLog.pre-2-10 | 14 ++++++++++++++ ChangeLog.pre-2-2 | 14 ++++++++++++++ ChangeLog.pre-2-4 | 14 ++++++++++++++ ChangeLog.pre-2-6 | 14 ++++++++++++++ ChangeLog.pre-2-8 | 14 ++++++++++++++ gtk/gtkclist.c | 9 ++++++--- gtk/gtkmenushell.c | 28 +--------------------------- gtk/gtktooltips.c | 10 ++++++---- 10 files changed, 111 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 04696d55c..33422ec62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Wed Jan 20 21:52:51 1999 Jeff Garzik + + * gtk/gtkclist.c (real_remove_row): + Don't search entire row list twice for element being removed. + + * gtk/gtkmenushell.c (gtk_menu_shell_insert): + Replaced hand-coded implementation of g_list_insert with + call to g_list_insert. + + * gtk/gtktooltips.c + (gtk_tooltips_destroy_data, gtk_tooltips_layout_text): + tooltipsdata->row test not-null test now properly encompasses + both g_list_* calls. + Thu Jan 21 02:47:36 1999 Lars Hamann * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 04696d55c..33422ec62 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,17 @@ +Wed Jan 20 21:52:51 1999 Jeff Garzik + + * gtk/gtkclist.c (real_remove_row): + Don't search entire row list twice for element being removed. + + * gtk/gtkmenushell.c (gtk_menu_shell_insert): + Replaced hand-coded implementation of g_list_insert with + call to g_list_insert. + + * gtk/gtktooltips.c + (gtk_tooltips_destroy_data, gtk_tooltips_layout_text): + tooltipsdata->row test not-null test now properly encompasses + both g_list_* calls. + Thu Jan 21 02:47:36 1999 Lars Hamann * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 04696d55c..33422ec62 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,17 @@ +Wed Jan 20 21:52:51 1999 Jeff Garzik + + * gtk/gtkclist.c (real_remove_row): + Don't search entire row list twice for element being removed. + + * gtk/gtkmenushell.c (gtk_menu_shell_insert): + Replaced hand-coded implementation of g_list_insert with + call to g_list_insert. + + * gtk/gtktooltips.c + (gtk_tooltips_destroy_data, gtk_tooltips_layout_text): + tooltipsdata->row test not-null test now properly encompasses + both g_list_* calls. + Thu Jan 21 02:47:36 1999 Lars Hamann * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 04696d55c..33422ec62 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,17 @@ +Wed Jan 20 21:52:51 1999 Jeff Garzik + + * gtk/gtkclist.c (real_remove_row): + Don't search entire row list twice for element being removed. + + * gtk/gtkmenushell.c (gtk_menu_shell_insert): + Replaced hand-coded implementation of g_list_insert with + call to g_list_insert. + + * gtk/gtktooltips.c + (gtk_tooltips_destroy_data, gtk_tooltips_layout_text): + tooltipsdata->row test not-null test now properly encompasses + both g_list_* calls. + Thu Jan 21 02:47:36 1999 Lars Hamann * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 04696d55c..33422ec62 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,17 @@ +Wed Jan 20 21:52:51 1999 Jeff Garzik + + * gtk/gtkclist.c (real_remove_row): + Don't search entire row list twice for element being removed. + + * gtk/gtkmenushell.c (gtk_menu_shell_insert): + Replaced hand-coded implementation of g_list_insert with + call to g_list_insert. + + * gtk/gtktooltips.c + (gtk_tooltips_destroy_data, gtk_tooltips_layout_text): + tooltipsdata->row test not-null test now properly encompasses + both g_list_* calls. + Thu Jan 21 02:47:36 1999 Lars Hamann * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 04696d55c..33422ec62 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,17 @@ +Wed Jan 20 21:52:51 1999 Jeff Garzik + + * gtk/gtkclist.c (real_remove_row): + Don't search entire row list twice for element being removed. + + * gtk/gtkmenushell.c (gtk_menu_shell_insert): + Replaced hand-coded implementation of g_list_insert with + call to g_list_insert. + + * gtk/gtktooltips.c + (gtk_tooltips_destroy_data, gtk_tooltips_layout_text): + tooltipsdata->row test not-null test now properly encompasses + both g_list_* calls. + Thu Jan 21 02:47:36 1999 Lars Hamann * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 04696d55c..33422ec62 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,17 @@ +Wed Jan 20 21:52:51 1999 Jeff Garzik + + * gtk/gtkclist.c (real_remove_row): + Don't search entire row list twice for element being removed. + + * gtk/gtkmenushell.c (gtk_menu_shell_insert): + Replaced hand-coded implementation of g_list_insert with + call to g_list_insert. + + * gtk/gtktooltips.c + (gtk_tooltips_destroy_data, gtk_tooltips_layout_text): + tooltipsdata->row test not-null test now properly encompasses + both g_list_* calls. + Thu Jan 21 02:47:36 1999 Lars Hamann * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups. diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index 07c811a32..fbbb3b393 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -2824,6 +2824,7 @@ real_remove_row (GtkCList *clist, /* get the row we're going to delete */ list = g_list_nth (clist->row_list, row); + g_assert (list != NULL); clist_row = list->data; /* if we're removing a selected row, we have to make sure @@ -2837,10 +2838,12 @@ real_remove_row (GtkCList *clist, /* reset the row end pointer if we're removing at the * end of the list */ clist->rows--; - clist->row_list = g_list_remove (clist->row_list, clist_row); + if (clist->row_list == list) + clist->row_list = g_list_next (list); + if (clist->row_list_end == list) + clist->row_list_end = g_list_previous (list); + g_list_remove (list, clist_row); - if (row == clist->rows) - clist->row_list_end = list->prev; /*if (clist->focus_row >=0 && (row <= clist->focus_row || clist->focus_row >= clist->rows)) clist->focus_row--;*/ diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index b044b7ef2..a10e48bff 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -296,10 +296,6 @@ gtk_menu_shell_insert (GtkMenuShell *menu_shell, GtkWidget *child, gint position) { - GList *tmp_list; - GList *new_list; - gint nchildren; - g_return_if_fail (menu_shell != NULL); g_return_if_fail (GTK_IS_MENU_SHELL (menu_shell)); g_return_if_fail (child != NULL); @@ -318,29 +314,7 @@ gtk_menu_shell_insert (GtkMenuShell *menu_shell, gtk_widget_map (child); } - nchildren = g_list_length (menu_shell->children); - if ((position < 0) || (position > nchildren)) - position = nchildren; - - if (position == nchildren) - { - menu_shell->children = g_list_append (menu_shell->children, child); - } - else - { - tmp_list = g_list_nth (menu_shell->children, position); - new_list = g_list_alloc (); - new_list->data = child; - - if (tmp_list->prev) - tmp_list->prev->next = new_list; - new_list->next = tmp_list; - new_list->prev = tmp_list->prev; - tmp_list->prev = new_list; - - if (tmp_list == menu_shell->children) - menu_shell->children = new_list; - } + menu_shell->children = g_list_insert (menu_shell->children, child, position); if (GTK_WIDGET_VISIBLE (menu_shell)) gtk_widget_queue_resize (GTK_WIDGET (menu_shell)); diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c index 245039832..d7ae69eab 100644 --- a/gtk/gtktooltips.c +++ b/gtk/gtktooltips.c @@ -120,9 +120,10 @@ gtk_tooltips_destroy_data (GtkTooltipsData *tooltipsdata) { g_free (tooltipsdata->tip_text); g_free (tooltipsdata->tip_private); - g_list_foreach (tooltipsdata->row, gtk_tooltips_free_string, 0); - if (tooltipsdata->row) + if (tooltipsdata->row) { + g_list_foreach (tooltipsdata->row, gtk_tooltips_free_string, 0); g_list_free (tooltipsdata->row); + } gtk_signal_disconnect_by_data (GTK_OBJECT (tooltipsdata->widget), (gpointer) tooltipsdata); gtk_object_remove_data (GTK_OBJECT (tooltipsdata->widget), tooltips_data_key); @@ -200,9 +201,10 @@ gtk_tooltips_layout_text (GtkTooltips *tooltips, GtkTooltipsData *data) if (!tooltips->tip_window) gtk_tooltips_force_window (tooltips); - g_list_foreach (data->row, gtk_tooltips_free_string, 0); - if (data->row) + if (data->row) { + g_list_foreach (data->row, gtk_tooltips_free_string, 0); g_list_free (data->row); + } data->row = 0; data->font = tooltips->tip_window->style->font; data->width = 0; -- 2.43.2