All pastes #196710 Raw Edit

Nagappan

public c v1 · immutable
·published 2006-10-10 20:39 UTC
rendered paste body
*** /home/nags/fd.o/ldtp/src/client-handler.c	2006-09-27 09:02:22.000000000 -0800--- client-handler.c	2006-10-10 12:43:30.000000000 -0800*************** createpo (gchar *package_name, gchar *lo*** 589,597 ****  		g_free (mopathfilename);  	}  }- #endif  - #ifdef ENABLE_LOCALIZATION  static void  deletepo (char *filename, FILE *log_fp, LDTPError **err)  {--- 589,595 ----*************** bind_text (LDTPClientContext *cctxt, gch*** 624,641 ****  	 * FIXME  	 * Currently only mo files are handled  	 */! 	filename = g_strdup_printf ("%s/%s-%d.po", g_get_tmp_dir (),! 				    package_name, g_random_int_range (G_MININT, G_MAXINT));! 	createpo (package_name, locale_dir, filename, mode, cctxt->log_fp, err);! 	if (*err && (*err)->err_code != LDTP_ERROR_SUCCESS) {! 		*err = ldtp_error_get_error (LDTP_ERROR_UNABLE_TO_CREATE_PO);! 		log_msg (LDTP_LOG_CAUSE, (*err)->message, cctxt->log_fp);! 		return;  	}  	temp_flag = init_catalog (filename, cctxt->log_fp);  	if (!cctxt->locale_set && temp_flag)  		cctxt->locale_set = temp_flag;! 	deletepo (filename, cctxt->log_fp, err);  	g_free (filename);  #else  	g_print ("Localization option not enabled in LDTP\n");--- 622,645 ----  	 * FIXME  	 * Currently only mo files are handled  	 */! 	if (g_ascii_strcasecmp (mode, "mo") == 0) {! 		filename = g_strdup_printf ("%s/%s-%d.po", g_get_tmp_dir (),! 					    package_name, g_random_int_range (G_MININT, G_MAXINT));! 		createpo (package_name, locale_dir, filename, mode, cctxt->log_fp, err);! 		if (*err && (*err)->err_code != LDTP_ERROR_SUCCESS) {! 			*err = ldtp_error_get_error (LDTP_ERROR_UNABLE_TO_CREATE_PO);! 			log_msg (LDTP_LOG_CAUSE, (*err)->message, cctxt->log_fp);! 			return;! 		}! 	}! 	else {! 		filename = g_strdup_printf ("%s/%s", locale_dir, package_name);  	}  	temp_flag = init_catalog (filename, cctxt->log_fp);  	if (!cctxt->locale_set && temp_flag)  		cctxt->locale_set = temp_flag;! 	if (g_ascii_strcasecmp (mode, "mo") == 0)! 		deletepo (filename, cctxt->log_fp, err);  	g_free (filename);  #else  	g_print ("Localization option not enabled in LDTP\n");*************** handle_request (LDTPClientContext* cctxt*** 712,717 ****--- 716,728 ----  		return;  	}  	switch (command) {+ 	case LDTP_CMD_SETLOCALE:+ 		if (cctxt->locale_lang)+ 			g_free (cctxt->locale_lang);+ 		cctxt->locale_lang = g_strdup (cctxt->req->context);+ 		cctxt->locale_set = TRUE;+ 		setlocale (LC_ALL, "");+ 		return;  	case LDTP_CMD_LAUNCHAPP: {  		GError *error = NULL;  		if (cctxt->req->component && g_ascii_strcasecmp(cctxt->req->component, "1") == 0) {*************** handle_client (void *ptr)*** 1430,1436 ****  	char *resp_pckt = NULL;    	LDTPError* err = NULL;- 	gchar *locale_lang = NULL;    	LDTPClientContext *cctxt = NULL;  	Packet *pckt = NULL;--- 1441,1446 ----*************** handle_client (void *ptr)*** 1443,1460 ****  	cctxt->resp = calloc (1, sizeof (LDTPResponse));  	cctxt->sock_fd = *sock_fd;  	cctxt->log_fp = NULL;! ! 	/*! 	  Check whether locale lang set or not! 	*/! 	locale_lang = getenv ("LANG");! 	if (locale_lang && ! 	    g_utf8_collate (locale_lang, "en_US.UTF-8") != 0) {! 		g_print ("Locale languages: %s\n", locale_lang);! 		cctxt->locale_set = TRUE;! 		setlocale (LC_ALL, "");! 	} else! 		cctxt->locale_set = FALSE;    	while (1) {  		packet_len = 0;--- 1453,1459 ----  	cctxt->resp = calloc (1, sizeof (LDTPResponse));  	cctxt->sock_fd = *sock_fd;  	cctxt->log_fp = NULL;! 	cctxt->locale_set = FALSE;    	while (1) {  		packet_len = 0;*** /home/nags/fd.o/ldtp/src/ldtp-command.c	2006-09-28 03:22:35.000000000 -0800--- ldtp-command.c	2006-10-10 12:33:35.000000000 -0800*************** ldtp_command_init_command_table ()*** 200,205 ****--- 200,206 ----  			ldtp_command_new ( LDTP_CMD_HASSTATE, "hasstate"),  			ldtp_command_new ( LDTP_CMD_LAUNCHAPP, "launchapp"),  			ldtp_command_new ( LDTP_CMD_SINGLECLICKROW, "singleclickrow"),+ 			ldtp_command_new ( LDTP_CMD_SETLOCALE, "setlocale"),  			NULL  		};  *** /home/nags/fd.o/ldtp/src/ldtp-command.h	2006-09-28 03:22:35.000000000 -0800--- ldtp-command.h	2006-10-10 12:37:15.000000000 -0800*************** enum _LDTPCommandId {*** 174,180 ****  	LDTP_CMD_STOPRECORD,  	LDTP_CMD_HASSTATE,  	LDTP_CMD_LAUNCHAPP,! 	LDTP_CMD_SINGLECLICKROW  };    struct _LDTPCommand {--- 174,181 ----  	LDTP_CMD_STOPRECORD,  	LDTP_CMD_HASSTATE,  	LDTP_CMD_LAUNCHAPP,! 	LDTP_CMD_SINGLECLICKROW,! 	LDTP_CMD_SETLOCALE  };    struct _LDTPCommand {