CList oddity.
- From: Sean Cody <umcodysw cc UManitoba CA>
- To: gtk-list redhat com
- Subject: CList oddity.
- Date: Tue, 18 Jan 2000 17:30:06 -0600 (CST)
I am having a problem adding rows to a clist. Every so often there will
be rows that are blank or have "garbage" values. If I output the values
to be added to the clist (via printf) they are fine but they are not being
added to the clist properties. Below is my code for adding to the clist
any ideas on what it could be?
void populate_msg_list(GtkWidget *List)
{
GtkWidget *Progress = progress_panel_new("Processing Mail"),
*Status =
(GtkWidget*)gtk_object_get_data(GTK_OBJECT(Progress),STATUS_LABEL),
*Bar =
(GtkWidget*)gtk_object_get_data(GTK_OBJECT(Progress),PROGRESS_BAR),
*Ok =
(GtkWidget*)gtk_object_get_data(GTK_OBJECT(Progress),OK_BUTTON);
char *Temp = (char *)g_malloc0(MAX_LINE_BUFFER);
gint i;
gint Messages,Size;
/* I tried using pointers but that produces worse results. */
char MNumber[100],MSize[100],From[100],Subject[100],Date[100];
pop_get_stat(&Messages,&Size,0);
gtk_widget_show(Progress);
while(g_main_iteration(FALSE));
gtk_clist_freeze(GTK_CLIST(List));
for(i = 1; i < Messages+1; i++)
{
char *ListRow[6] = { NULL,MNumber,MSize,From,Subject,Date };
/* I know I should use memset but I don't trust it... */
bzero((char *)MNumber,100);
bzero((char *)MSize,100);
bzero((char *)From,100);
bzero((char *)Subject,100);
bzero((char *)Date,100);
sprintf(Temp,"Processing Message %i Of %i.",i,Messages);
gtk_label_set_text(GTK_LABEL(Status),Temp);
gtk_progress_set_value(GTK_PROGRESS(Bar),((gfloat)i/Messages)*100);
Size = pop_get_msg_size(i,0);
sprintf(&MSize,"%i",Size);
sprintf(&MNumber,"%i",i);
pop_get_msg_info(i,(char *)From,(char *)Subject,(char *)Date,0);
gtk_clist_append(GTK_CLIST(List),ListRow);
/*
Test output.
printf("%s\n%s\n%s\n%s\n%s\n",ListRow[1],ListRow[2],ListRow[3],ListRow[4],ListRow[5]);
*/
while(g_main_iteration(FALSE));
}
gtk_clist_thaw(GTK_CLIST(List));
gtk_widget_hide(GTK_WIDGET(Bar));
gtk_widget_show(GTK_WIDGET(Ok));
}
Sean Cody (aka NullStream)
umcodysw@cc.umanitoba.ca (SCHOOL)
null@fuzyscsi.dhs.org (HOME)
"If God's my witness then God must be blind."
Garbage - As Heaven Is Wide
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]