]> Pileus Git - ~andy/gtk/commitdiff
Don't search entire row list twice for element being removed.
authorJeff Garzik <jgarzik@src.gnome.org>
Thu, 21 Jan 1999 03:46:32 +0000 (03:46 +0000)
committerJeff Garzik <jgarzik@src.gnome.org>
Thu, 21 Jan 1999 03:46:32 +0000 (03:46 +0000)
        * 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
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkclist.c
gtk/gtkmenushell.c
gtk/gtktooltips.c

index 04696d55c01612cd6fadff761f45b3f3cf5df3fb..33422ec62bfa2b84d9021bde765d4949871ac18f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Wed Jan 20 21:52:51 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * 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  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
index 04696d55c01612cd6fadff761f45b3f3cf5df3fb..33422ec62bfa2b84d9021bde765d4949871ac18f 100644 (file)
@@ -1,3 +1,17 @@
+Wed Jan 20 21:52:51 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * 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  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
index 04696d55c01612cd6fadff761f45b3f3cf5df3fb..33422ec62bfa2b84d9021bde765d4949871ac18f 100644 (file)
@@ -1,3 +1,17 @@
+Wed Jan 20 21:52:51 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * 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  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
index 04696d55c01612cd6fadff761f45b3f3cf5df3fb..33422ec62bfa2b84d9021bde765d4949871ac18f 100644 (file)
@@ -1,3 +1,17 @@
+Wed Jan 20 21:52:51 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * 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  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
index 04696d55c01612cd6fadff761f45b3f3cf5df3fb..33422ec62bfa2b84d9021bde765d4949871ac18f 100644 (file)
@@ -1,3 +1,17 @@
+Wed Jan 20 21:52:51 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * 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  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
index 04696d55c01612cd6fadff761f45b3f3cf5df3fb..33422ec62bfa2b84d9021bde765d4949871ac18f 100644 (file)
@@ -1,3 +1,17 @@
+Wed Jan 20 21:52:51 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * 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  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
index 04696d55c01612cd6fadff761f45b3f3cf5df3fb..33422ec62bfa2b84d9021bde765d4949871ac18f 100644 (file)
@@ -1,3 +1,17 @@
+Wed Jan 20 21:52:51 1999  Jeff Garzik  <jgarzik@pobox.com>
+
+       * 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  <lars@gtk.org>
 
        * gtk/gtknotebook.c (gtk_notebook_focus): few cleanups.
index 07c811a325cec949ee958a08619478e1e5bee933..fbbb3b393d5bf81a6d92027da5413cf274f9fab6 100644 (file)
@@ -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--;*/
index b044b7ef2a4b6bb0d0d3fc76ee44164acd9a7640..a10e48bff37b423d29279f342caeaec4dba14093 100644 (file)
@@ -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));
index 2450398329e936fcd22c4a77f0ca2483c184e50a..d7ae69eabd5d3e167ef63f3ced5a4afed5b96cfe 100644 (file)
@@ -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;