gitkrtools.c

Go to the documentation of this file.
00001 
00012 #define GITK_RENDERER_C
00013 #define GITKR_TOOLS_C
00014 
00015 #include "gitkrincludes.h"
00016 
00024 gchar *gitkr_cxpath_get_string(GitkDialogPtr dialog, xmlXPathCompExprPtr xpath_expr, xmlNodePtr root_node) {
00025   gchar *str,*res,*cs;
00026   
00027   #ifdef ENABLE_NLS
00028     cs=nl_langinfo(CODESET);
00029   #else
00030     cs="ISO-8859-1";
00031   #endif
00032   str=gitk_cxpath_get_string(dialog,xpath_expr,root_node);
00033   res=g_convert(str,-1,cs,"UTF-8",NULL,NULL,NULL);
00034   g_free(str);
00035   return(res);
00036 }
00037 
00045 void gitkr_widget_set_value(GitkDialogPtr const dialog,gchar * const widget_id,const gchar *name, const gchar *data) {
00046   gchar *str,*cs;
00047   
00048   #ifdef ENABLE_NLS
00049     cs=nl_langinfo(CODESET);
00050   #else
00051     cs="ISO-8859-1";
00052   #endif
00053   
00054   str=g_convert(data,-1,"UTF-8",cs,NULL,NULL,NULL);
00055   gitk_widget_set_value(dialog,widget_id,name,str);
00056   g_free(str);
00057 }
00058 
00067 gchar *gitkr_widget_get_value(GitkDialogPtr const dialog,gchar * const widget_id,const gchar *name) {
00068   gchar *str,*res,*cs;
00069   
00070   #ifdef ENABLE_NLS
00071     cs=nl_langinfo(CODESET);
00072   #else
00073     cs="ISO-8859-1";
00074   #endif
00075   
00076   str=gitk_widget_get_value(dialog,widget_id,name);
00077   res=g_convert(str,-1,cs,"UTF-8",NULL,NULL,NULL);
00078   xmlFree(str);
00079   return(res);
00080 }
00081 
00085 guint color_name_to_code(gchar *name,guint def) {
00086   if(name) {
00087     if(!strncasecmp(name,"black",5)) def=COLOR_BLACK;
00088     else if(!strncasecmp(name,"red",3)) def=COLOR_RED;
00089     else if(!strncasecmp(name,"green",5)) def=COLOR_GREEN;
00090     else if(!strncasecmp(name,"yellow",6)) def=COLOR_YELLOW;
00091     else if(!strncasecmp(name,"blue",4)) def=COLOR_BLUE;
00092     else if(!strncasecmp(name,"magenta",7)) def=COLOR_MAGENTA;
00093     else if(!strncasecmp(name,"cyan",4)) def=COLOR_CYAN;
00094     else if(!strncasecmp(name,"white",5)) def=COLOR_WHITE;
00095     else gitk_log1("unknown color=\"%s\"",name);
00096   }
00097   return(def);
00098 }
00099 
00103 gboolean color_name_to_attr(gchar *name,gboolean def) {
00104   if(name) {
00105     def=(gboolean)isupper((int)name[0]);
00106   }
00107   return(def);  
00108 }
00109 

Generated on Thu Oct 28 10:59:12 2004 for gitk by doxygen 1.3.6