#include <string.h>
#include <stdio.h>

#include "support.h"
#include "perspic.h"

int
archive_init(GtkWidget *window1) {

  GList *list=NULL;
  GtkWidget *c3;
  char *s1=NULL,*s=NULL,*se=NULL,*c;
  int i;
  FILE *p;
  char b[256];
  
  p=popen("find /usr/lib/perspic/* -type d -maxdepth 0 | sort","r");
  for (;fgets(b,sizeof(b),p) && (c=strchr(b,10));) {
    *c=0;
    l_str(s,b);
    s++;
  }
  pclose(p);
  
  i=s-s1;
  for (s=s1;s<s1+i;s+=strlen(s)+1)
    list=g_list_append(list,s);
  
  c3=lookup_widget(window1,"combo3");
  if (list) {
    gtk_combo_set_popdown_strings(GTK_COMBO(c3),list);
    g_list_free(list);
    pfree1(s1);
    gtk_signal_emit_by_name(GTK_OBJECT(GTK_COMBO(c3)->popwin),"hide");
  }

  return 0;
  
}    

