From 9f9683d27e22bd2e09b7be3d2630529a85ccea49 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Mon, 6 Dec 2004 04:25:40 +0000 Subject: set the table spacings to 6 for generated tables. 2004-12-06 Not Zed * e-config.c (ec_rebuild): set the table spacings to 6 for generated tables. 2004-11-22 Not Zed * e-config.c (ec_rebuild): if the table existed before and we have no factory, destroy it always. svn path=/trunk/; revision=28069 --- e-util/e-config.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'e-util/e-config.c') diff --git a/e-util/e-config.c b/e-util/e-config.c index 422c480134..6e03c19b2f 100644 --- a/e-util/e-config.c +++ b/e-util/e-config.c @@ -47,7 +47,7 @@ #include -#define d(x) +#define d(x) struct _EConfigFactory { struct _EConfigFactory *next, *prev; @@ -597,7 +597,7 @@ ec_rebuild(EConfig *emp) } else page = wn->widget; - d(printf("page %d:%s widget %p\n", pageno, item->path, w)); + d(printf("page %d:%s widget %p\n", pageno, item->path, page)); if (wn->widget && wn->widget != page) { d(printf("destroy old widget for page '%s'\n", item->path)); @@ -632,16 +632,24 @@ ec_rebuild(EConfig *emp) if (item->factory) { section = item->factory(emp, item, page, wn->widget, wn->context->data); wn->frame = section; - itemno = 1; + if (section) + itemno = 1; if (section && ((item->type == E_CONFIG_SECTION && !GTK_IS_BOX(section)) || (item->type == E_CONFIG_SECTION_TABLE && !GTK_IS_TABLE(section)))) g_warning("EConfig section type is wrong"); - } else if (wn->widget == NULL) { + } else { GtkWidget *frame; GtkWidget *label = NULL; + if (wn->frame) { + d(printf("Item %s, clearing generated section widget\n", wn->item->path)); + gtk_widget_destroy(wn->frame); + wn->widget = NULL; + wn->frame = NULL; + } + if (item->label) { char *txt = g_strdup_printf("%s", item->label); @@ -654,8 +662,11 @@ ec_rebuild(EConfig *emp) if (item->type == E_CONFIG_SECTION) section = gtk_vbox_new(FALSE, 6); - else + else { section = gtk_table_new(1, 1, FALSE); + gtk_table_set_col_spacings((GtkTable *)section, 6); + gtk_table_set_row_spacings((GtkTable *)section, 6); + } frame = g_object_new(gtk_frame_get_type(), "shadow_type", GTK_SHADOW_NONE, @@ -668,8 +679,6 @@ ec_rebuild(EConfig *emp) gtk_widget_show_all(frame); gtk_box_pack_start((GtkBox *)page, frame, FALSE, FALSE, 0); wn->frame = frame; - } else { - section = wn->widget; } nopage: if (wn->widget && wn->widget != section) { @@ -677,12 +686,18 @@ ec_rebuild(EConfig *emp) gtk_widget_destroy(wn->widget); } + d(printf("Item %s, setting section widget\n", wn->item->path)); + sectionno++; wn->widget = section; sectionnode = wn; break; case E_CONFIG_ITEM: case E_CONFIG_ITEM_TABLE: + /* generated sections never retain their widgets on a rebuild */ + if (sectionnode->item->factory == NULL) + wn->widget = NULL; + /* ITEMs are called with the section parent. The type depends on the section type, either a GtkTable, or a GtkVBox */ -- cgit v1.2.3