/* Creates the clist widget used in the "Contents" page of the Properties * dialog for a directory */ GtkWidget * dir_contents_list( GNode *dnode ) { char *col_titles[2]; char *clist_row[2]; GtkWidget *clist_w; Icon *icon; int i; g_assert( NODE_IS_DIR(dnode) ); col_titles[0] = _("Node type"); col_titles[1] = _("Quantity"); /* Don't use gui_clist_add( ) as this one shouldn't be placed * inside a scrolled window */ clist_w = gtk_clist_new_with_titles( 2, col_titles ); gtk_clist_set_selection_mode( GTK_CLIST(clist_w), GTK_SELECTION_SINGLE ); for (i = 0; i < 2; i++) gtk_clist_set_column_auto_resize( GTK_CLIST(clist_w), i, TRUE ); clist_row[0] = NULL; for (i = 1; i < NUM_NODE_TYPES; i++) { clist_row[1] = (char *)i64toa( DIR_NODE_DESC(dnode)->subtree.counts[i] ); gtk_clist_append( GTK_CLIST(clist_w), clist_row ); icon = &node_type_mini_icons[i]; gtk_clist_set_pixtext( GTK_CLIST(clist_w), i - 1, 0, _(node_type_plural_names[i]), 2, icon->pixmap, icon->mask ); } return clist_w; }
/* This replaces the file list widget with another one made specifically * to monitor the progress of an impending scan */ void filelist_scan_monitor_init( void ) { char *col_titles[3]; char *empty_row[3] = { NULL, NULL, NULL }; GtkWidget *parent_w; Icon *icon; int i; col_titles[0] = _("Type"); col_titles[1] = _("Found"); col_titles[2] = _("Bytes"); /* Replace current clist widget with a 3-column one */ parent_w = file_clist_w->parent->parent; gtk_widget_destroy( file_clist_w->parent ); file_clist_w = gui_clist_add( parent_w, 3, col_titles ); /* Place icons and static text */ for (i = 1; i <= NUM_NODE_TYPES; i++) { gtk_clist_append( GTK_CLIST(file_clist_w), empty_row ); if (i < NUM_NODE_TYPES) { icon = &node_type_mini_icons[i]; gtk_clist_set_pixtext( GTK_CLIST(file_clist_w), i - 1, 0, _(node_type_plural_names[i]), 2, icon->pixmap, icon->mask ); } else gtk_clist_set_text( GTK_CLIST(file_clist_w), i - 1, 0, _("TOTAL") ); gtk_clist_set_selectable( GTK_CLIST(file_clist_w), i - 1, FALSE ); } }
/* Displays contents of a directory in the file list */ void filelist_populate( GNode *dnode ) { GNode *node; GList *node_list = NULL, *node_llink; Icon *icon; int row, count = 0; char *empty_row[] = { NULL }; char strbuf[64]; g_assert( NODE_IS_DIR(dnode) ); /* Get an alphabetized list of directory's immediate children */ node = dnode->children; while (node != NULL) { G_LIST_PREPEND(node_list, node); node = node->next; } G_LIST_SORT(node_list, compare_node); /* Update file clist */ gtk_clist_freeze( GTK_CLIST(file_clist_w) ); gtk_clist_clear( GTK_CLIST(file_clist_w) ); node_llink = node_list; while (node_llink != NULL) { node = (GNode *)node_llink->data; row = gtk_clist_append( GTK_CLIST(file_clist_w), empty_row ); icon = &node_type_mini_icons[NODE_DESC(node)->type]; gtk_clist_set_pixtext( GTK_CLIST(file_clist_w), row, 0, NODE_DESC(node)->name, 2, icon->pixmap, icon->mask ); gtk_clist_set_row_data( GTK_CLIST(file_clist_w), row, node ); ++count; node_llink = node_llink->next; } gtk_clist_thaw( GTK_CLIST(file_clist_w) ); g_list_free( node_list ); /* Set node count message in the left statusbar */ switch (count) { case 0: strcpy( strbuf, "" ); break; case 1: strcpy( strbuf, _("1 node") ); break; default: sprintf( strbuf, _("%d nodes"), count ); break; } window_statusbar( SB_LEFT, strbuf ); filelist_current_dnode = dnode; filelist_reset_access( ); }
void update_list(void) { GList *pt; struct logentry *le; char tmp[8][128]; gchar *pp[8]; int ontime,h,m,s,i; int lc; gtk_clist_freeze(GTK_CLIST(loglist)); gtk_clist_clear(GTK_CLIST(loglist)); for(i=0;i<8;i++) pp[i]=tmp[i]; for(lc=0,pt=log;pt!=NULL;pt=g_list_next(pt),lc++) { le=(struct logentry *)(pt->data); strcpy(tmp[0],ctime(&(le->start))); strcpy(tmp[1],ctime(&(le->end))); ontime=(int)(le->end - le->start); h=ontime/3600; ontime-=3600*h; m=ontime/60; ontime-=60*m; s=ontime; sprintf(tmp[2],"%.4d:%.2d:%.2d",h,m,s); switch(le->status) { case 0: strcpy(tmp[3],"OK"); break; case 1: strcpy(tmp[3],"Error"); break; default: strcpy(tmp[3],"Crash"); } strcpy(tmp[4],le->shortname); strcpy(tmp[5],le->longname); strcpy(tmp[6],le->phone); strcpy(tmp[7],le->user); gtk_clist_append(GTK_CLIST(loglist),pp); gtk_clist_set_pixtext(GTK_CLIST(loglist),lc,3, tmp[3],6, iconmap[le->status%3], maskmap[le->status%3]); } gtk_clist_thaw(GTK_CLIST(loglist)); }
static void pattern_clist_update_row (struct player_pattern *pp, int row) { pattern_clist_update_groups (row, pp->groups, ~pp->groups); /* update all */ if (pp->error) { gtk_clist_set_pixtext (GTK_CLIST (pattern_clist), row, 3, mode_symbols[pp->mode], 2, error_pix.pix, error_pix.mask); } else { gtk_clist_set_text (GTK_CLIST (pattern_clist), row, 3, mode_symbols[pp->mode]); } gtk_clist_set_text (GTK_CLIST (pattern_clist), row, 4, pp->pattern); }