Ejemplo n.º 1
0
/* Return a string from resource file */
char *get_rsc_string( int idx) {
	char *txt;
	RsrcGaddr( h_gem_rsrc, R_STRING, idx,  &txt );
	return txt;
}
Ejemplo n.º 2
0
OBJECT *get_tree( int idx) {
  OBJECT *tree;
  RsrcGaddr( h_gem_rsrc, R_TREE, idx, &tree);
  return tree;
}
Ejemplo n.º 3
0
bool verify_ssl_form_do( const char * url, const struct ssl_cert_info * cert_infos_n ,
	unsigned long num_certs )
{
	OBJECT *tree;
	WINDOW * form;

	bool bres = false;
	bool cont = true;
	int res = 0;
	dp.cert_infos_n = (struct ssl_cert_info *)cert_infos_n;
	dp.num_certs = num_certs;
	dp.scrollx = 0;
	dp.scrolly = 0;
	dp.current = 0;
	dp.cols = cert_display_width( &dp.cert_infos_n[dp.current] );
	dp.rows = 8;
	dp.tree = tree;

	RsrcGaddr (h_gem_rsrc , R_TREE, VERIFY, &tree);
	ObjcString( tree, VERIFY_LBL_HOST, (char*)url );
	ObjcChange( OC_OBJC, tree, VERIFY_BT_ACCEPT, 0, 0 );
	ObjcChange( OC_OBJC, tree, VERIFY_BT_REJECT, 0, 0 );
	form = FormWindBegin( tree, (char*)"SSL Verify failed"  );
	EvntDataAdd( form, WM_REDRAW, cert_info_draw, (void*)&dp, EV_BOT );
	/* this results in some extended objects which can not be freed: :( */
	/* RsrcUserDraw( OC_FORM, tree, VERIFY_BOX_DETAILS, cert_info_draw,(void*)&dp ) ; */
	ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp );
	/*
	ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp );
	ObjcAttachFormFunc( form, VERIFY_BT_NEXT_CERT, do_popup, &dp );
	*/
	while( cont ) {
		res = FormWindDo( MU_MESAG );
		cont = false;
		switch( res ){
			case VERIFY_BT_ACCEPT:
				bres = true;
				break;

			case VERIFY_BT_NEXT_CERT:
			/* select box clicked or dragged... */
				cont = true;
				break;

			case VERIFY_BT_REJECT:
				bres = false;
				break;

			case VERIFY_BT_SCROLL_D:
					cont = true;
					dp.scrolly += 1;
					ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG );
				break;

			case VERIFY_BT_SCROLL_U:
					cont = true;
					dp.scrolly -= 1;
					ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG );
				break;

			case VERIFY_BT_SCROLL_R:
					LOG(( "scroll r!" ));
					cont = true;
					dp.scrollx += 1;
					if( dp.scrollx > (dp.cols - (272 / 8 )) )
						dp.scrollx -= 1;
					ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG);
				break;

			case VERIFY_BT_SCROLL_L:
					cont = true;
					dp.scrollx -= 1;
					if( dp.scrollx < 0 )
						dp.scrollx = 0;
					ObjcDrawParent( OC_FORM, form, VERIFY_BOX_DETAILS, 1, 7 | OC_MSG );
				break;

			default:
				break;
		}
	}
	FormWindEnd( );
  return( bres );
}