gnomeutil.inc 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. {$IfDef read_interface}
  2. const
  3. PATH_SEP = '/';
  4. PATH_SEP_STR = '/';
  5. function gnome_libdir_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_libdir_file';
  6. function gnome_datadir_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_datadir_file';
  7. function gnome_sound_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_sound_file';
  8. function gnome_pixmap_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_pixmap_file';
  9. function gnome_config_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_config_file';
  10. function gnome_unconditional_libdir_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_unconditional_libdir_file';
  11. function gnome_unconditional_datadir_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_unconditional_datadir_file';
  12. function gnome_unconditional_sound_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_unconditional_sound_file';
  13. function gnome_unconditional_pixmap_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_unconditional_pixmap_file';
  14. function gnome_unconditional_config_file(filename:Pchar):pchar;cdecl;external libgnomedll name 'gnome_unconditional_config_file';
  15. const
  16. G_FILE_TEST_EXISTS = ((1 shl 0) or (1 shl 1)) or (1 shl 2);
  17. G_FILE_TEST_ISFILE = 1 shl 0;
  18. G_FILE_TEST_ISLINK = 1 shl 1;
  19. G_FILE_TEST_ISDIR = 1 shl 2;
  20. function g_file_test(filename:Pchar; test:longint):longint;cdecl;external libgnomedll name 'g_file_test';
  21. function g_file_exists(filename:Pchar):longint;cdecl;external libgnomedll name 'g_file_exists';
  22. function gnome_is_program_in_path(aprogram:Pgchar):Pgchar;cdecl;external libgnomedll name 'gnome_is_program_in_path';
  23. function g_unix_error_string(error_num:longint):pchar;cdecl;external libgnomedll name 'g_unix_error_string';
  24. function g_concat_dir_and_file(dir:Pchar; afile:Pchar):pchar;cdecl;external libgnomedll name 'g_concat_dir_and_file';
  25. function g_extension_pointer(path:Pchar):pchar;cdecl;external libgnomedll name 'g_extension_pointer';
  26. function g_copy_vector(vec:PPchar):Ppchar;cdecl;external libgnomedll name 'g_copy_vector';
  27. function gnome_util_user_shell:pchar;cdecl;external libgnomedll name 'gnome_util_user_shell';
  28. function g_is_image_filename(path:Pchar):gboolean;cdecl;external libgnomedll name 'g_is_image_filename';
  29. //Function g_copy_strings(string1:Pgchar; args:array of const):Pgchar;
  30. Function g_filename_index(path : Pgchar) : Pgchar;
  31. Function g_filename_pointer(file_name:Pgchar):Pgchar;
  32. Function g_flatten_vector(separator:Pgchar; str_array:PPgchar) : Pgchar;
  33. Function gnome_util_user_home : Pgchar;
  34. Function gnome_util_prepend_user_home(x : Pgchar) : Pgchar;
  35. Function gnome_util_home_file(afile : Pgchar) : Pgchar;
  36. {$EndIf read_interface}
  37. {$Ifdef read_implementation}
  38. {Function g_copy_strings(string1:Pgchar; args:array of const):Pgchar;
  39. begin
  40. g_copy_strings := g_strconcat(string1, args);
  41. end;}
  42. Function g_filename_index(path : Pgchar) : Pgchar;
  43. begin
  44. g_filename_index := Pointer(Longint(g_basename(path))-Longint(path));
  45. end;
  46. Function g_filename_pointer(file_name:Pgchar):Pgchar;
  47. begin
  48. g_filename_pointer := g_basename(file_name);
  49. end;
  50. Function g_flatten_vector(separator:Pgchar; str_array:PPgchar) : Pgchar;
  51. begin
  52. g_flatten_vector := g_strjoinv(separator, str_array);
  53. end;
  54. Function gnome_util_user_home : Pgchar;
  55. begin
  56. gnome_util_user_home := g_get_home_dir;
  57. end;
  58. Function gnome_util_prepend_user_home(x : Pgchar) : PgChar;
  59. begin
  60. gnome_util_prepend_user_home := g_concat_dir_and_file(gnome_util_user_home, x);
  61. end;
  62. Function gnome_util_home_file(afile : Pgchar) : Pgchar;
  63. begin
  64. gnome_util_home_file := g_strconcat(gnome_util_user_home, ['/.gnome/', afile, nil]);
  65. end;
  66. {$Endif read_implementation}