changeset 1890:0f3df50bfc4f

Untested GTK3 change to use the new gtk_grid_remove_*() which were introduced in version 3.10. I don't have 3.10 installed yet, but will test this code soon. These allow me to remove a crude work-around in earlier versions that skipped over empty grid spaces. In 3.10 and later the grid should contract and remove the unused rows/columns. Might need a similar change in dw_box_unpack().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 08 Oct 2013 18:30:39 +0000
parents fef27d312696
children 11a16c117748
files gtk3/dw.c
diffstat 1 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gtk3/dw.c	Wed Sep 11 17:40:21 2013 +0000
+++ b/gtk3/dw.c	Tue Oct 08 18:30:39 2013 +0000
@@ -2460,6 +2460,34 @@
       {
          /* Get the number of items in the box... */
          int boxcount = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxcount"));
+#if GTK_CHECK_VERSION(3,10,0)               
+         int boxtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxtype"));
+         int z;
+            
+         /* Figure out where in the grid this widget is and remove that row/column */
+         if(boxtype == DW_VERT)
+         {
+            for(z=0;z<index;z++)
+            {
+               if(gtk_grid_get_child_at(GTK_GRID(box), 0, z) == handle2)
+               {
+                  gtk_grid_remove_row(GTK_GRID(box), z);
+                  break;
+               }
+            }
+         }
+         else
+         {
+            for(z=0;z<index;z++)
+            {
+               if(gtk_grid_get_child_at(GTK_GRID(box), z, 0) == handle2)
+               {
+                  gtk_grid_remove_column(GTK_GRID(box), z);
+                  break;
+               }
+            }
+         }
+#endif
 			
          if(boxcount > 0)
          {
@@ -8713,6 +8741,7 @@
          warn = TRUE;
       }
 
+#if !GTK_CHECK_VERSION(3,10,0)               
       /* Do some sanity bounds checking */
       if(index < 0)
          index = 0;
@@ -8740,6 +8769,7 @@
                index++;
          }
       }
+#endif
 
       g_object_set_data(G_OBJECT(item), "_dw_table", box);
       /* Set the expand attribute on the widgets now instead of the container */
@@ -8892,6 +8922,7 @@
       int boxtype = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(box), "_dw_boxtype"));
       GtkWidget *item;
 		
+#if !GTK_CHECK_VERSION(3,10,0)               
       /* Fix the index by taking into account empty cells */
       if(boxtype == DW_VERT)
       {
@@ -8915,6 +8946,7 @@
          }
          item = gtk_grid_get_child_at(GTK_GRID(box), index, 0);
       }
+#endif
 
       if(boxcount > 0)
       {