[Glade-devel] [Glade3] Problems with GtkTable

Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Content-Disposition: inline


I finaly found and correct the problem. I rewrite the
glade_gtk_table_set_n_common (GObject *object, GValue
*value, gboolean for_rows)

(glade-gtk.c line 405)


Like I said before, I am a beginner in GTK & Glade
developping so I prefer do not make a patch but submit
my version (I'm sure of my "GTK quality" of my work).
I can make a patch if my function is OK.

With this modification, we can add/remove rows/columns
without problems in Glade3. I hope it will interesting

I continue to use Glade3 and if I found other
problems, I'll post again.

Glade3 is a great work. Thanks.

(You can find my "patch function" as attachement)


Micka�l wrote:
I've got this idea, but with Glade2 no problem, when
we add or remove a row or a column, no crash and we
can see the good number of rows/column on screen.
ran Glade2 on the same system, that's why I think
<there is a problem with Glade3.


 --- Shane Butler <shane_b users sourceforge net> a

�crit :

BTW Mickael, have you checked to see what glade2 is
doing to make tables
smaller? If there is a "work around" or a better way
to do it glade2
might have already figured it out...
Regards, Shane

On Tue, 2004-08-24 at 00:45, Cornet Mickael wrote:

Thanks Shane.

I test gtk_table_resize() on line 469 and it
effectively set the good value.

I noticed that we can increase number of rows and
columns (4,5,....) the table is redrawn with

rows and columns but if we decrease it, the
stay at the max value, very strange...

Glade crashes when number of column is 1.

I continue to debugging



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
Content-Type: text/x-patch; name="glade-gtk.c.patch"
Content-Description: glade-gtk.c.patch
Content-Disposition: inline; filename="glade-gtk.c.patch"


line 405:

glade_gtk_table_set_n_common (GObject *object, GValue *value, gboolean for_rows)
        GladeWidget *widget;
        GtkTable *table;
        int new_size;
        int old_size;
        int i, j;

        table = GTK_TABLE (object);
        g_return_if_fail (GTK_IS_TABLE (table));

        new_size = g_value_get_int (value);
        old_size = for_rows ? table->nrows : table->ncols;

        if (new_size == old_size)
        if (new_size < 1)

        widget = glade_widget_get_from_gtk_widget (GTK_WIDGET (table));
        g_return_if_fail (widget != NULL);

        if (new_size > old_size) {
                if (for_rows) {
                        gtk_table_resize (table, new_size, table->ncols);

                        for (i = 0; i < table->ncols; i++)
                                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++)
                                        gtk_table_attach_defaults (table, glade_placeholder_new (),
                                                                   i, i + 1, j, j + 1);
        } else {
                GList *list;
                GList *list_to_free = NULL;

      for (list = table->children; list; list = list->next)
                        GtkTableChild *child;
                        child = list->data;
                        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) {
                                list_to_free = g_list_append(list_to_free,child);
                        /* 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),
                                                         for_rows ? "bottom_attach" : "right_attach",
                                                         new_size, NULL);
                for (list_to_free = g_list_first(list_to_free); list_to_free; list_to_free = 
                        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);

        g_object_set_data (object, "glade_nb_placeholders", GINT_TO_POINTER (new_size * (for_rows ? 
table->ncols : table->nrows)));

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]