I18nEnv.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /* $XConsortium: I18nEnv.h /main/1 1996/03/25 00:51:43 pascale $ */
  24. /************************************<+>*************************************
  25. ****************************************************************************
  26. **
  27. ** File: I18nEnv.h
  28. **
  29. **
  30. ** This file contains function definitions for the corresponding .c
  31. ** file
  32. **
  33. **
  34. ****************************************************************************
  35. ************************************<+>*************************************/
  36. /*
  37. * (c) Copyright 1996 Digital Equipment Corporation.
  38. * (c) Copyright 1996 Hewlett-Packard Company.
  39. * (c) Copyright 1996 International Business Machines Corp.
  40. * (c) Copyright 1996 Sun Microsystems, Inc.
  41. * (c) Copyright 1996 Novell, Inc.
  42. * (c) Copyright 1996 FUJITSU LIMITED.
  43. * (c) Copyright 1996 Hitachi.
  44. */
  45. #ifndef _i18nEnv_h
  46. #define _i18nEnv_h
  47. #include <stdio.h>
  48. #include <ctype.h>
  49. #include <unistd.h>
  50. #include <stdlib.h>
  51. #include <sys/stat.h>
  52. #include <sys/param.h>
  53. #include <sys/socket.h>
  54. #include <netdb.h>
  55. #ifndef MAXPATHLEN
  56. #define MAXPATHLEN 1024
  57. #endif
  58. #define DtUSER_TMP_DIR "./dt/tmp"
  59. #define DtUSER_IMSFS_DIR "/.dt/ims"
  60. #define NAME_NONE "none"
  61. #define NAME_LOCAL "local"
  62. #define NAME_BUILTIN "builtin"
  63. #define STR_PREFIX_CHAR '@'
  64. #define STR_DEFAULTIMS "DefaultIms"
  65. #define STR_SELECTMODE "SelectMode"
  66. #define STR_IMSNAME "ImsName"
  67. #define STR_HOSTNAME "HostName"
  68. #define TAG_END_CHAR ':'
  69. /* host type */
  70. #define HOST_LOCAL 0
  71. #define HOST_REMOTE 1
  72. #define HOST_UNKNOWN 2
  73. typedef struct _FileSel {
  74. char *fname; /* IM selection file full path name */
  75. char *hostname; /* User selected hostname */
  76. char *im_name; /* User selected Input Method */
  77. int start_mode; /* User selected start mode */
  78. } FileSel;
  79. typedef struct {
  80. int inactive; /* Status of the IM */
  81. char *im_name; /* File name of the IM as found in the locale
  82. entry file */
  83. char *im_label; /* Label to present to the user */
  84. Boolean im_default; /* Is this the default one? */
  85. } ImsEnt;
  86. typedef struct {
  87. char *host_name; /* hostname selected in the ComboBox */
  88. ImsEnt *ims_list ; /* list of IMS entities on this host */
  89. int ims_list_size ; /* number of IMS entities */
  90. } ImsSel;
  91. typedef struct _UserEnv {
  92. char *localhostname; /* hostname the user has started dtstyle */
  93. char *username; /* user name */
  94. char *displayname; /* display dtstyle is running on */
  95. char *locale; /* system-specific locale from $LANG */
  96. char *CDE_locale; /* CDE generic locale name */
  97. char *homedir;
  98. } UserEnv;
  99. typedef struct _PipeRec {
  100. FILE *pipe ;
  101. XtInputId input_id ;
  102. XtIntervalId timer_id ;
  103. } PipeRec;
  104. typedef struct _I18nEnv {
  105. UserEnv *user_env; /* User environmnet */
  106. ImsSel *ims_sel; /* Available IMS */
  107. FileSel *file_sel; /* User IMS Selection File values */
  108. PipeRec *pipe_info; /* Info needed for the pipe execution */
  109. Widget shell;
  110. } I18nEnv;
  111. /* Error Codes */
  112. #define NO_ERROR 0
  113. typedef enum {
  114. NoError = 0,
  115. ErrNoHome,
  116. ErrNoLocale,
  117. ErrNoCDELocale,
  118. /* File I/O */
  119. ErrFileCreate,
  120. /* Selection */
  121. ErrNoSelectionFile,
  122. ErrSaveSelection,
  123. /* Remote */
  124. ErrUnknownHost,
  125. ErrNoDtimsstart,
  126. ErrRemoteFailed,
  127. /* Pipe */
  128. ErrNoPopen,
  129. ErrTimeOut,
  130. ErrUnknown,
  131. LastErrorCode
  132. } ximsError;
  133. /* External declarations */
  134. extern I18nEnv i18n_env;
  135. extern int _DtI18nGetEnvValues(I18nEnv *env);
  136. extern int _DtI18nGetImList(I18nEnv *env, char *hostname);
  137. extern void _DtI18nSetSensitiveImTB(I18nEnv *env, Boolean sensitivity);
  138. extern int _DtI18nWriteImSelectionFile(I18nEnv *env);
  139. extern void _DtI18nErrorDialog(int err) ;
  140. #include "I18nUtil.h"
  141. #endif /* _i18nEnv_h */
  142. /* DON'T ADD ANYTHING AFTER THIS #endif */