/** $Id: gitkrtools.c,v 1.3 2004/06/08 10:30:49 sast Exp $
*
* @file gitk-renderer-phone/gitkrtools.c
* @author Steffen ast <sast@users.sf.net>
* @date Thu Mar 30 16:09:59 2004
*
* @brief gitk renderer tool routines
* @ingroup gitkrendererphone
*
*/
#define GITK_RENDERER_C
#define GITKR_TOOLS_C
#include "gitkrincludes.h"
/** @brief return the result as string of the evaluation of the supplied xpath expression agains the given document
* and converts the codeset of the result
* @param dialog gitk dialog
* @param xpath_expr compiles xpath expression to use
* @param root_node from where to search, uses doc root when NULL
* @return gchar pointer to result of NULL, do not forget to free the result after use.
*/
gchar *gitkr_cxpath_get_string(GitkDialogPtr dialog, xmlXPathCompExprPtr xpath_expr, xmlNodePtr root_node) {
gchar *str,*res;
str=gitk_cxpath_get_string(dialog,xpath_expr,root_node);
res=g_convert(str,-1,code_set,"UTF-8",NULL,NULL,NULL);
g_free(str);
return(res);
}
/** @brief set data value of the attribute name of the given widget
* and converts the codeset of the data
* @param dialog the dialog which contains the widget
* @param widget_id the id of the widget to look up
* @param name child-node, of which the value should be retrieved
* @param data the new content of the value
*/
void gitkr_widget_set_value(GitkDialogPtr const dialog,gchar * const widget_id,const gchar *name, const gchar *data) {
gchar *str;
str=g_convert(data,-1,"UTF-8",code_set,NULL,NULL,NULL);
gitk_widget_set_value(dialog,widget_id,name,str);
g_free(str);
}
/** @brief get data value of the attribute name of the given widget
* and converts the codeset of the result
* don't forget to free the returned value
* @param dialog the dialog which contains the widget
* @param widget_id the id of the widget to look up
* @param name child-node, of which the value should be retrieved
* @return the value of the widget
*/
gchar *gitkr_widget_get_value(GitkDialogPtr const dialog,gchar * const widget_id,const gchar *name) {
gchar *str,*res;
str=gitk_widget_get_value(dialog,widget_id,name);
res=g_convert(str,-1,code_set,"UTF-8",NULL,NULL,NULL);
g_free(str);
gitk_log1("gitkr_widget_get_value() value ist %s", res);
return(res);
}