gtkfilesystem.inc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. { This is a "semi-private" header; it is meant only for
  2. alternate GtkFileChooser backend modules; no stability guarantees
  3. are made at this point
  4. }
  5. {$IFDEF read_forward_definitions}
  6. {$ENDIF}
  7. {$IFDEF read_interface_types}
  8. type
  9. PGtkFileTime = ^TGtkFileTime;
  10. TGtkFileTime = gint64;
  11. PGtkFileSystem = pointer;
  12. PPGtkFileSystem = ^PGtkFileSystem;
  13. PGtkFilePath = Pgchar; { Seems to be implemented in GTK 2.4 by now }
  14. PPGtkFilePath = ^PGtkFilePath;
  15. PGtkFileSystemVolume = pointer;
  16. PPGtkFileSystemVolume = ^PGtkFileSystemVolume;
  17. PGtkFileFolder = pointer;
  18. PPGtkFileFolder = ^PGtkFileFolder;
  19. PGtkFileInfo = pointer;
  20. PPGtkFileInfo = ^PGtkFileInfo;
  21. { Mask of information about a file, for monitoring and
  22. gtk_file_system_get_info()
  23. }
  24. PGtkFileInfoType = ^TGtkFileInfoType;
  25. TGtkFileInfoType = (GTK_FILE_INFO_DISPLAY_NAME := 1 shl 0,
  26. GTK_FILE_INFO_IS_FOLDER := 1 shl 1,
  27. GTK_FILE_INFO_IS_HIDDEN := 1 shl 2,
  28. GTK_FILE_INFO_MIME_TYPE := 1 shl 3,
  29. GTK_FILE_INFO_MODIFICATION_TIME := 1 shl 4,
  30. GTK_FILE_INFO_SIZE := 1 shl 5,
  31. GTK_FILE_INFO_ALL := (1 shl 6) - 1 );
  32. type
  33. PGtkFileSystemError = ^TGtkFileSystemError;
  34. TGtkFileSystemError = (GTK_FILE_SYSTEM_ERROR_NONEXISTENT,
  35. GTK_FILE_SYSTEM_ERROR_NOT_FOLDER,
  36. GTK_FILE_SYSTEM_ERROR_INVALID_URI,
  37. GTK_FILE_SYSTEM_ERROR_BAD_FILENAME,
  38. GTK_FILE_SYSTEM_ERROR_FAILED,
  39. GTK_FILE_SYSTEM_ERROR_ALREADY_EXISTS);
  40. type
  41. PGtkFileSystemIface = ^TGtkFileSystemIface;
  42. TGtkFileSystemIface = record
  43. base_iface : TGTypeInterface;
  44. { Methods }
  45. { Volumes }
  46. list_volumes : function (file_system:PGtkFileSystem):PGSList;cdecl;
  47. get_volume_for_path : function (file_system:PGtkFileSystem; path:PGtkFilePath):PGtkFileSystemVolume;
  48. get_folder : function (file_system:PGtkFileSystem; path:PGtkFilePath; types:TGtkFileInfoType; error:PPGError):PGtkFileFolder;
  49. create_folder : function (file_system:PGtkFileSystem; path:PGtkFilePath; error:PPGError):gboolean;
  50. volume_free : procedure (file_system:PGtkFileSystem; volume:PGtkFileSystemVolume);
  51. volume_get_base_path : function (file_system:PGtkFileSystem; volume:PGtkFileSystemVolume):PGtkFilePath;
  52. volume_get_is_mounted : function (file_system:PGtkFileSystem; volume:PGtkFileSystemVolume):gboolean;
  53. volume_mount : function (file_system:PGtkFileSystem; volume:PGtkFileSystemVolume; error:PPGError):gboolean;
  54. volume_get_display_name : function (file_system:PGtkFileSystem; volume:PGtkFileSystemVolume):Pchar;
  55. volume_render_icon : function (file_system:PGtkFileSystem; volume:PGtkFileSystemVolume; widget:PGtkWidget; pixel_size:gint; error:PPGError):PGdkPixbuf;
  56. get_parent : function (file_system:PGtkFileSystem; path:PGtkFilePath; parent:PPGtkFilePath; error:PPGError):gboolean;
  57. make_path : function (file_system:PGtkFileSystem; base_path:PGtkFilePath; display_name:Pgchar; error:PPGError):PGtkFilePath;
  58. parse : function (file_system:PGtkFileSystem; base_path:PGtkFilePath; str:Pgchar; folder:PPGtkFilePath; file_part:PPgchar;
  59. error:PPGError):gboolean;
  60. { Path Manipulation }
  61. path_to_uri : function (file_system:PGtkFileSystem; path:PGtkFilePath):Pgchar;
  62. path_to_filename : function (file_system:PGtkFileSystem; path:PGtkFilePath):Pgchar;
  63. uri_to_path : function (file_system:PGtkFileSystem; uri:Pgchar):PGtkFilePath;
  64. filename_to_path : function (file_system:PGtkFileSystem; path:Pgchar):PGtkFilePath;
  65. { Icons }
  66. render_icon : function (file_system:PGtkFileSystem; path:PGtkFilePath; widget:PGtkWidget; pixel_size:gint; error:PPGError):PGdkPixbuf;
  67. { Bookmarks }
  68. insert_bookmark : function (file_system:PGtkFileSystem; path:PGtkFilePath; position:gint; error:PPGError):gboolean;
  69. remove_bookmark : function (file_system:PGtkFileSystem; path:PGtkFilePath; error:PPGError):gboolean;
  70. list_bookmarks : function (file_system:PGtkFileSystem):PGSList;
  71. { Signals }
  72. volumes_changed : procedure (file_system:PGtkFileSystem);
  73. bookmarks_changed : procedure (file_system:PGtkFileSystem);
  74. end;
  75. type
  76. PGtkFileFolderIface = ^TGtkFileFolderIface;
  77. TGtkFileFolderIface = record
  78. base_iface : TGTypeInterface;
  79. { Methods }
  80. get_info : function (folder:PGtkFileFolder; path:PGtkFilePath; error:PPGError):PGtkFileInfo;cdecl;
  81. list_children : function (folder:PGtkFileFolder; children:PPGSList; error:PPGError):gboolean;
  82. { ??? refresh() ??? }
  83. { Signals }
  84. deleted : procedure (monitor:PGtkFileFolder);
  85. files_added : procedure (monitor:PGtkFileFolder; paths:PGSList);
  86. files_changed : procedure (monitor:PGtkFileFolder; paths:PGSList);
  87. files_removed : procedure (monitor:PGtkFileFolder; paths:PGSList);
  88. end;
  89. {$ENDIF} {types }
  90. {$IFDEF read_interface_rest}
  91. { GError enumeration for GtkFileSystem }
  92. function GTK_FILE_SYSTEM_ERROR : TGQuark;
  93. function gtk_file_system_error_quark:TGQuark;cdecl;external gtklib name 'gtk_file_system_error_quark';
  94. { Boxed-type for gtk_file_folder_get_info() results }
  95. function GTK_TYPE_FILE_INFO : GType;
  96. function gtk_file_info_get_type:GType;cdecl;external gtklib name 'gtk_file_info_get_type';
  97. function gtk_file_info_new:PGtkFileInfo;cdecl;external gtklib name 'gtk_file_info_new';
  98. function gtk_file_info_copy(info:PGtkFileInfo):PGtkFileInfo;cdecl;external gtklib name 'gtk_file_info_copy';
  99. procedure gtk_file_info_free(info:PGtkFileInfo);cdecl;external gtklib name 'gtk_file_info_free';
  100. function gtk_file_info_get_display_name(info:PGtkFileInfo):Pgchar;cdecl;external gtklib name 'gtk_file_info_get_display_name';
  101. function gtk_file_info_get_display_key(info:PGtkFileInfo):Pgchar;cdecl;external gtklib name 'gtk_file_info_get_display_key';
  102. procedure gtk_file_info_set_display_name(info:PGtkFileInfo; display_name:Pgchar);cdecl;external gtklib name 'gtk_file_info_set_display_name';
  103. function gtk_file_info_get_is_folder(info:PGtkFileInfo):gboolean;cdecl;external gtklib name 'gtk_file_info_get_is_folder';
  104. procedure gtk_file_info_set_is_folder(info:PGtkFileInfo; is_folder:gboolean);cdecl;external gtklib name 'gtk_file_info_set_is_folder';
  105. function gtk_file_info_get_is_hidden(info:PGtkFileInfo):gboolean;cdecl;external gtklib name 'gtk_file_info_get_is_hidden';
  106. procedure gtk_file_info_set_is_hidden(info:PGtkFileInfo; is_hidden:gboolean);cdecl;external gtklib name 'gtk_file_info_set_is_hidden';
  107. function gtk_file_info_get_mime_type(info:PGtkFileInfo):Pgchar;cdecl;external gtklib name 'gtk_file_info_get_mime_type';
  108. procedure gtk_file_info_set_mime_type(info:PGtkFileInfo; mime_type:Pgchar);cdecl;external gtklib name 'gtk_file_info_set_mime_type';
  109. function gtk_file_info_get_modification_time(info:PGtkFileInfo):TGtkFileTime;cdecl;external gtklib name 'gtk_file_info_get_modification_time';
  110. procedure gtk_file_info_set_modification_time(info:PGtkFileInfo; modification_time:TGtkFileTime);cdecl;external gtklib name 'gtk_file_info_set_modification_time';
  111. function gtk_file_info_get_size(info:PGtkFileInfo):gint64;cdecl;external gtklib name 'gtk_file_info_get_size';
  112. procedure gtk_file_info_set_size(info:PGtkFileInfo; size:gint64);cdecl;external gtklib name 'gtk_file_info_set_size';
  113. { The base GtkFileSystem interface }
  114. function GTK_TYPE_FILE_SYSTEM : GType;
  115. function GTK_FILE_SYSTEM(obj : pointer) : PGtkFileSystem;
  116. function GTK_IS_FILE_SYSTEM(obj : pointer) : gboolean;
  117. function GTK_FILE_SYSTEM_GET_IFACE(inst : pointer) : PGtkFileSystemIface;
  118. function gtk_file_system_get_type:GType;cdecl;external gtklib name 'gtk_file_system_get_type';
  119. function gtk_file_system_list_volumes(file_system:PGtkFileSystem):PGSList;cdecl;external gtklib name 'gtk_file_system_list_volumes';
  120. function gtk_file_system_get_volume_for_path(file_system:PGtkFileSystem; path:PGtkFilePath):PGtkFileSystemVolume;cdecl;external gtklib name 'gtk_file_system_get_volume_for_path';
  121. procedure gtk_file_system_volume_free(file_system:PGtkFileSystem; volume:PGtkFileSystemVolume);cdecl;external gtklib name 'gtk_file_system_volume_free';
  122. function gtk_file_system_volume_get_base_path(file_system:PGtkFileSystem; volume:PGtkFileSystemVolume):PGtkFilePath;cdecl;external gtklib name 'gtk_file_system_volume_get_base_path';
  123. function gtk_file_system_volume_get_is_mounted(file_system:PGtkFileSystem; volume:PGtkFileSystemVolume):gboolean;cdecl;external gtklib name 'gtk_file_system_volume_get_is_mounted';
  124. function gtk_file_system_volume_mount(file_system:PGtkFileSystem; volume:PGtkFileSystemVolume; error:PPGError):gboolean;cdecl;external gtklib name 'gtk_file_system_volume_mount';
  125. function gtk_file_system_volume_get_display_name(file_system:PGtkFileSystem; volume:PGtkFileSystemVolume):Pchar;cdecl;external gtklib name 'gtk_file_system_volume_get_display_name';
  126. function gtk_file_system_volume_render_icon(file_system:PGtkFileSystem; volume:PGtkFileSystemVolume; widget:PGtkWidget; pixel_size:gint; error:PPGError):PGdkPixbuf;cdecl;external gtklib name 'gtk_file_system_volume_render_icon';
  127. function gtk_file_system_get_parent(file_system:PGtkFileSystem; path:PGtkFilePath; parent:PPGtkFilePath; error:PPGError):gboolean;cdecl;external gtklib name 'gtk_file_system_get_parent';
  128. function gtk_file_system_get_folder(file_system:PGtkFileSystem; path:PGtkFilePath; types:TGtkFileInfoType; error:PPGError):PGtkFileFolder;cdecl;external gtklib name 'gtk_file_system_get_folder';
  129. function gtk_file_system_create_folder(file_system:PGtkFileSystem; path:PGtkFilePath; error:PPGError):gboolean;cdecl;external gtklib name 'gtk_file_system_create_folder';
  130. function gtk_file_system_make_path(file_system:PGtkFileSystem; base_path:PGtkFilePath; display_name:Pgchar; error:PPGError):PGtkFilePath;cdecl;external gtklib name 'gtk_file_system_make_path';
  131. function gtk_file_system_parse(file_system:PGtkFileSystem; base_path:PGtkFilePath; str:Pgchar; folder:PPGtkFilePath; file_part:PPgchar;
  132. error:PPGError):gboolean;cdecl;external gtklib name 'gtk_file_system_parse';
  133. function gtk_file_system_path_to_uri(file_system:PGtkFileSystem; path:PGtkFilePath):Pgchar;cdecl;external gtklib name 'gtk_file_system_path_to_uri';
  134. function gtk_file_system_path_to_filename(file_system:PGtkFileSystem; path:PGtkFilePath):Pgchar;cdecl;external gtklib name 'gtk_file_system_path_to_filename';
  135. function gtk_file_system_uri_to_path(file_system:PGtkFileSystem; uri:Pgchar):PGtkFilePath;cdecl;external gtklib name 'gtk_file_system_uri_to_path';
  136. function gtk_file_system_filename_to_path(file_system:PGtkFileSystem; filename:Pgchar):PGtkFilePath;cdecl;external gtklib name 'gtk_file_system_filename_to_path';
  137. function gtk_file_system_render_icon(file_system:PGtkFileSystem; path:PGtkFilePath; widget:PGtkWidget; pixel_size:gint; error:PPGError):PGdkPixbuf;cdecl;external gtklib name 'gtk_file_system_render_icon';
  138. function gtk_file_system_insert_bookmark(file_system:PGtkFileSystem; path:PGtkFilePath; position:gint; error:PPGError):gboolean;cdecl;external gtklib name 'gtk_file_system_insert_bookmark';
  139. function gtk_file_system_remove_bookmark(file_system:PGtkFileSystem; path:PGtkFilePath; error:PPGError):gboolean;cdecl;external gtklib name 'gtk_file_system_remove_bookmark';
  140. function gtk_file_system_list_bookmarks(file_system:PGtkFileSystem):PGSList;cdecl;external gtklib name 'gtk_file_system_list_bookmarks';
  141. { Detailed information about a particular folder }
  142. function GTK_TYPE_FILE_FOLDER : GType;
  143. function GTK_FILE_FOLDER(obj : pointer) : PGtkFileFolder;
  144. function GTK_IS_FILE_FOLDER(obj : pointer) : gboolean;
  145. function GTK_FILE_FOLDER_GET_IFACE(inst : pointer) : PGtkFileSystemIface;
  146. function gtk_file_folder_get_type:GType;cdecl;external gtklib name 'gtk_file_folder_get_type';
  147. function gtk_file_folder_list_children(folder:PGtkFileFolder; children:PPGSList; error:PPGError):gboolean;cdecl;external gtklib name 'gtk_file_folder_list_children';
  148. function gtk_file_folder_get_info(folder:PGtkFileFolder; path:PGtkFilePath; error:PPGError):PGtkFileInfo;cdecl;external gtklib name 'gtk_file_folder_get_info';
  149. function gtk_file_path_new_dup(str : Pgchar) : PGtkFilePath;
  150. function gtk_file_path_new_steal(str : Pgchar) : PGtkFilePath;
  151. function gtk_file_path_get_string(str : PGtkFilePath) : Pgchar;
  152. procedure gtk_file_path_free(path : PGtkFilePath);
  153. function gtk_file_path_copy(path : PGtkFilePath) : PGtkFilePath;
  154. function gtk_file_path_compare(path1,path2 : PGtkFilePath) : longint;
  155. function gtk_file_paths_sort(paths:PGSList):PGSList;cdecl;external gtklib name 'gtk_file_paths_sort';
  156. function gtk_file_paths_copy(paths:PGSList):PGSList;cdecl;external gtklib name 'gtk_file_paths_copy';
  157. procedure gtk_file_paths_free(paths:PGSList);cdecl;external gtklib name 'gtk_file_paths_free';
  158. { GtkFileSystem modules support }
  159. function _gtk_file_system_create(file_system_name:Pchar):PGtkFileSystem;cdecl;external gtklib name '_gtk_file_system_create';
  160. {$endif} {read_interface_rest}
  161. {$ifdef read_implementation}
  162. function GTK_FILE_SYSTEM_ERROR : TGQuark;
  163. begin
  164. GTK_FILE_SYSTEM_ERROR:=gtk_file_system_error_quark;
  165. end;
  166. function GTK_TYPE_FILE_INFO : GType;
  167. begin
  168. GTK_TYPE_FILE_INFO:=gtk_file_info_get_type;
  169. end;
  170. function GTK_TYPE_FILE_SYSTEM : GType;
  171. begin
  172. GTK_TYPE_FILE_SYSTEM:=gtk_file_system_get_type;
  173. end;
  174. function GTK_FILE_SYSTEM(obj : pointer) : PGtkFileSystem;
  175. begin
  176. GTK_FILE_SYSTEM:=G_TYPE_CHECK_INSTANCE_CAST(obj,GTK_TYPE_FILE_SYSTEM);
  177. end;
  178. function GTK_IS_FILE_SYSTEM(obj : pointer) : gboolean;
  179. begin
  180. GTK_IS_FILE_SYSTEM:=G_TYPE_CHECK_INSTANCE_TYPE(obj,GTK_TYPE_FILE_SYSTEM);
  181. end;
  182. function GTK_FILE_SYSTEM_GET_IFACE(inst : pointer) : PGtkFileSystemIface;
  183. begin
  184. GTK_FILE_SYSTEM_GET_IFACE:=G_TYPE_INSTANCE_GET_INTERFACE(inst,GTK_TYPE_FILE_SYSTEM);
  185. end;
  186. function GTK_TYPE_FILE_FOLDER : GType;
  187. begin
  188. GTK_TYPE_FILE_FOLDER:=gtk_file_folder_get_type;
  189. end;
  190. function GTK_FILE_FOLDER(obj : pointer) : PGtkFileFolder;
  191. begin
  192. GTK_FILE_FOLDER:=G_TYPE_CHECK_INSTANCE_CAST(obj,GTK_TYPE_FILE_FOLDER);
  193. end;
  194. function GTK_IS_FILE_FOLDER(obj : pointer) : gboolean;
  195. begin
  196. GTK_IS_FILE_FOLDER:=G_TYPE_CHECK_INSTANCE_TYPE(obj,GTK_TYPE_FILE_FOLDER);
  197. end;
  198. function GTK_FILE_FOLDER_GET_IFACE(inst : pointer) : PGtkFileSystemIface;
  199. begin
  200. GTK_FILE_FOLDER_GET_IFACE:=G_TYPE_INSTANCE_GET_INTERFACE(inst,GTK_TYPE_FILE_FOLDER);
  201. end;
  202. function gtk_file_path_new_dup(str : Pgchar) : PGtkFilePath;
  203. begin
  204. gtk_file_path_new_dup:=PGtkFilePath(g_strdup(str));
  205. end;
  206. function gtk_file_path_new_steal(str : Pgchar) : PGtkFilePath;
  207. begin
  208. gtk_file_path_new_steal:=PGtkFilePath(str);
  209. end;
  210. function gtk_file_path_get_string(str : PGtkFilePath) : Pgchar;
  211. begin
  212. gtk_file_path_get_string:=Pgchar(str);
  213. end;
  214. procedure gtk_file_path_free(path : PGtkFilePath);
  215. begin
  216. g_free( Pgchar(path));
  217. end;
  218. function gtk_file_path_copy(path : PGtkFilePath) : PGtkFilePath;
  219. begin
  220. gtk_file_path_copy:=gtk_file_path_new_dup(gtk_file_path_get_string(path));
  221. end;
  222. function strcmp (str1, str2: pchar): longint; cdecl; external;
  223. function gtk_file_path_compare(path1,path2 : PGtkFilePath) : longint;
  224. begin
  225. gtk_file_path_compare:=strcmp(gtk_file_path_get_string(path1),gtk_file_path_get_string(path2));
  226. end;
  227. {$endif} {read_implementation}