[Glade-devel] [Glade3] Problems with GtkTable

Cornet Mickael mickael_cornet@yahoo.fr
Tue, 31 Aug 2004 10:29:53 +0200 (CEST)


--0-1434086973-1093940993=:68725
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Content-Id: 
Content-Disposition: inline

Here my patch for src/glade-gtk.c and
widget/gtktable.xml for Glade3.


	

	
		
Vous manquez d’espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.com
--0-1434086973-1093940993=:68725
Content-Type: text/x-patch; name="gtktable.xml.patch"
Content-Description: gtktable.xml.patch
Content-Disposition: inline; filename="gtktable.xml.patch"

Index: gtktable.xml
===================================================================
RCS file: /cvs/gnome/glade3/widgets/gtktable.xml,v
retrieving revision 1.19
diff -u -r1.19 gtktable.xml
--- gtktable.xml	1 May 2004 22:05:31 -0000	1.19
+++ gtktable.xml	31 Aug 2004 08:00:23 -0000
@@ -7,7 +7,7 @@
 
     <Property Id="n-rows" Default="3">
 	 <Parameters>
-	   <Parameter Key="Min" Value="0"/>
+	   <Parameter Key="Min" Value="1"/>
 	   <Parameter Key="Max" Value="10000"/>
 	   <Parameter Key="StepIncrement" Value="1"/>
 	   <Parameter Key="PageIncrement" Value="10"/>
@@ -21,7 +21,7 @@
 
     <Property Id="n-columns" Default="3">
 	 <Parameters>
-	   <Parameter Key="Min" Value="0"/>
+	   <Parameter Key="Min" Value="1"/>
 	   <Parameter Key="Max" Value="10000"/>
 	   <Parameter Key="StepIncrement" Value="1"/>
 	   <Parameter Key="PageIncrement" Value="10"/>

--0-1434086973-1093940993=:68725
Content-Type: text/x-patch; name="glade-gtk.c.patch"
Content-Description: glade-gtk.c.patch
Content-Disposition: inline; filename="glade-gtk.c.patch"

Index: glade-gtk.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-gtk.c,v
retrieving revision 1.48
diff -u -r1.48 glade-gtk.c
--- glade-gtk.c	8 May 2004 20:01:30 -0000	1.48
+++ glade-gtk.c	31 Aug 2004 08:17:05 -0000
@@ -430,33 +430,39 @@
 			gtk_table_resize (table, new_size, table->ncols);
 
 			for (i = 0; i < table->ncols; i++)
-				for (j = old_size; j < table->nrows; j++)
+				for (j = old_size; j < table->nrows; j++){
 					gtk_table_attach_defaults (table, glade_placeholder_new (),
 								   i, i + 1, j, j + 1);
+									
+				}
 		} else {
 			gtk_table_resize (table, table->nrows, new_size);
 
 			for (i = old_size; i < table->ncols; i++)
-				for (j = 0; j < table->nrows; j++)
+				for (j = 0; j < table->nrows; j++){
 					gtk_table_attach_defaults (table, glade_placeholder_new (),
 								   i, i + 1, j, j + 1);
+									
+				}
 		}
 	} else {
-		/* Remove from the bottom up */
-		GList *list = g_list_reverse (g_list_copy (gtk_container_get_children (GTK_CONTAINER (table))));
-		GList *freeme = list;
-		for (; list; list = list->next) {
-			GtkTableChild *child = list->data;
+		GList *list;
+		GList *list_to_free = NULL;
+
+      		for (list = table->children; list; list = list->next){
+			GtkTableChild *child;
+		
+			child = list->data;
+			if(!child)continue;
 			gint start = for_rows ? child->top_attach : child->left_attach;
 			gint end = for_rows ? child->bottom_attach : child->right_attach;
-
+			
 			/* We need to completely remove it */
 			if (start >= new_size) {
-				gtk_container_remove (GTK_CONTAINER (table),
-						      child->widget);
+				list_to_free = g_list_append(list_to_free,child);
 				continue;
 			}
-
+			
 			/* If the widget spans beyond the new border, we should resize it to fit on the new table */
 			if (end > new_size)
 				gtk_container_child_set (GTK_CONTAINER (table), GTK_WIDGET (child),
@@ -464,10 +470,19 @@
 							 new_size, NULL);
 			
 		}
-		g_list_free (freeme);
+		if(list_to_free){
+			for (list_to_free = g_list_first(list_to_free); list_to_free; list_to_free = list_to_free->next){
+				GtkTableChild *child;
+			
+				child = list_to_free->data;
+				gtk_container_remove (GTK_CONTAINER (table), child->widget);
+			}
+			g_list_free (list_to_free);
+		}
 		gtk_table_resize (table,
-				  for_rows ? new_size : table->nrows,
-				  for_rows ? table->ncols : new_size);
+				for_rows ? new_size : table->nrows,
+				for_rows ? table->ncols : new_size);
+		
 	}
 
 	g_object_set_data (object, "glade_nb_placeholders", GINT_TO_POINTER (new_size * (for_rows ? table->ncols : table->nrows)));

--0-1434086973-1093940993=:68725--