pike.git / src / post_modules / GTK2 / source / gtkfilechooserdialog.pre

version» Context lines:

pike.git/src/post_modules/GTK2/source/gtkfilechooserdialog.pre:37:   //! Mode is wither this is open or save mode. See   //! GTK2.FileChooser.set_action() for modes.   {    GPtrArray *gpa;    struct array *a;    char *s1;    INT_TYPE mm,xx;    struct object *o;    int i;    -  if (Pike_sp[2-1-args].type==PIKE_T_INT) +  if (TYPEOF(Pike_sp[2-1-args]) == PIKE_T_INT)    get_all_args("create",args,"%s%i%i%a",&s1,&xx,&mm,&a);    else    get_all_args("create",args,"%s%O%i%a",&s1,&o,&mm,&a);    gpa=g_ptr_array_new(); -  if (Pike_sp[4-1-args].type!=PIKE_T_ARRAY) +  if (TYPEOF(Pike_sp[4-1-args]) != PIKE_T_ARRAY)    Pike_error("Wrong type of argument 4.\n");    a=Pike_sp[4-1-args].u.array;    if (a->size>5)    Pike_error("Too many buttons.\n");    for (i=0; i<a->size; i++) {    struct array *b;    gchar *s2;    INT_TYPE *m1; -  if ((ITEM(a)+i)->type!=PIKE_T_ARRAY) +  if (TYPEOF(ITEM(a)[i]) != PIKE_T_ARRAY)    continue;    b=(ITEM(a)+i)->u.array; -  if (ITEM(b)->type!=PIKE_T_STRING || (ITEM(b)+1)->type!=PIKE_T_INT) +  if (TYPEOF(*ITEM(b)) != PIKE_T_STRING || TYPEOF(ITEM(b)[1]) != PIKE_T_INT)    continue;    s2=PGTK_GETSTR(ITEM(b));    g_ptr_array_add(gpa,s2);    m1=g_malloc(sizeof(INT_TYPE));    if (m1==NULL)    SIMPLE_OUT_OF_MEMORY_ERROR("create",sizeof(INT_TYPE));    *m1=PGTK_GETINT(ITEM(b)+1);    g_ptr_array_add(gpa,m1);    }    switch (a->size) {    case 0:    Pike_error("Not enough buttons.\n");    case 1:    THIS->obj=(void *)gtk_file_chooser_dialog_new(s1, -  (Pike_sp[2-1-args].type==PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)), +  (TYPEOF(Pike_sp[2-1-args]) == PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)),    mm,    (gchar *)g_ptr_array_index(gpa,0),*(int *)g_ptr_array_index(gpa,1),    NULL);    break;    case 2:    THIS->obj=(void *)gtk_file_chooser_dialog_new(s1, -  (Pike_sp[2-1-args].type==PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)), +  (TYPEOF(Pike_sp[2-1-args]) == PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)),    mm,    (gchar *)g_ptr_array_index(gpa,0),*(int *)g_ptr_array_index(gpa,1),    (gchar *)g_ptr_array_index(gpa,2),*(int *)g_ptr_array_index(gpa,3),    NULL);    break;    case 3:    THIS->obj=(void *)gtk_file_chooser_dialog_new(s1, -  (Pike_sp[2-1-args].type==PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)), +  (TYPEOF(Pike_sp[2-1-args]) == PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)),    mm,    (gchar *)g_ptr_array_index(gpa,0),*(int *)g_ptr_array_index(gpa,1),    (gchar *)g_ptr_array_index(gpa,2),*(int *)g_ptr_array_index(gpa,3),    (gchar *)g_ptr_array_index(gpa,4),*(int *)g_ptr_array_index(gpa,5),    NULL);    break;    case 4:    THIS->obj=(void *)gtk_file_chooser_dialog_new(s1, -  (Pike_sp[2-1-args].type==PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)), +  (TYPEOF(Pike_sp[2-1-args]) == PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)),    mm,    (gchar *)g_ptr_array_index(gpa,0),*(int *)g_ptr_array_index(gpa,1),    (gchar *)g_ptr_array_index(gpa,2),*(int *)g_ptr_array_index(gpa,3),    (gchar *)g_ptr_array_index(gpa,4),*(int *)g_ptr_array_index(gpa,5),    (gchar *)g_ptr_array_index(gpa,6),*(int *)g_ptr_array_index(gpa,7),    NULL);    break;    case 5:    THIS->obj=(void *)gtk_file_chooser_dialog_new(s1, -  (Pike_sp[2-1-args].type==PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)), +  (TYPEOF(Pike_sp[2-1-args]) == PIKE_T_INT)?0:GTK_WINDOW(get_gobject(o)),    mm,    (gchar *)g_ptr_array_index(gpa,0),*(int *)g_ptr_array_index(gpa,1),    (gchar *)g_ptr_array_index(gpa,2),*(int *)g_ptr_array_index(gpa,3),    (gchar *)g_ptr_array_index(gpa,4),*(int *)g_ptr_array_index(gpa,5),    (gchar *)g_ptr_array_index(gpa,6),*(int *)g_ptr_array_index(gpa,7),    (gchar *)g_ptr_array_index(gpa,8),*(int *)g_ptr_array_index(gpa,9),    NULL);    break;    default:    Pike_error("Invalid number of buttons.\n");
pike.git/src/post_modules/GTK2/source/gtkfilechooserdialog.pre:151:    GTK_WINDOW(get_gobject(o1)),    mode,NULL,NULL);    pop_stack();    THIS->obj=G_OBJECT(gf);    if (a) {    for (i=0; i<a->size; i++) {    char *text;    int response_id = 0;    struct svalue *sv;    struct mapping *m; -  if ((ITEM(a)+i)->type!=PIKE_T_MAPPING) +  if (TYPEOF(ITEM(a)[i]) != PIKE_T_MAPPING)    continue;    m=(ITEM(a)+i)->u.mapping;    sv=low_mapping_string_lookup(m,_STR("text"));    if (sv==NULL)    continue;    text=(char *)STR0(sv->u.string);    sv=low_mapping_string_lookup(m,_STR("id"));    if (sv)    response_id=PGTK_GETINT(sv);    gtk_dialog_add_button(GTK_DIALOG(THIS->obj),text,response_id);    }    }    pgtk2_pop_n_elems(args);    }    pgtk2__init_this_object();   }      endrequire;