PageRenderTime 672ms CodeModel.GetById 39ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/filebrowser/gedit-file-browser-store.h

https://gitlab.com/tchaik/gedit
C Header | 188 lines | 146 code | 20 blank | 22 comment | 0 complexity | c75529bc083a1c9c2f2e98007a7a56bb MD5 | raw file
  1. /*
  2. * gedit-file-browser-store.h - Gedit plugin providing easy file access
  3. * from the sidepanel
  4. *
  5. * Copyright (C) 2006 - Jesse van den Kieboom <jesse@icecrew.nl>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2, or (at your option)
  10. * any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef GEDIT_FILE_BROWSER_STORE_H
  21. #define GEDIT_FILE_BROWSER_STORE_H
  22. #include <gtk/gtk.h>
  23. G_BEGIN_DECLS
  24. #define GEDIT_TYPE_FILE_BROWSER_STORE (gedit_file_browser_store_get_type ())
  25. #define GEDIT_FILE_BROWSER_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStore))
  26. #define GEDIT_FILE_BROWSER_STORE_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStore const))
  27. #define GEDIT_FILE_BROWSER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStoreClass))
  28. #define GEDIT_IS_FILE_BROWSER_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEDIT_TYPE_FILE_BROWSER_STORE))
  29. #define GEDIT_IS_FILE_BROWSER_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEDIT_TYPE_FILE_BROWSER_STORE))
  30. #define GEDIT_FILE_BROWSER_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEDIT_TYPE_FILE_BROWSER_STORE, GeditFileBrowserStoreClass))
  31. typedef enum
  32. {
  33. GEDIT_FILE_BROWSER_STORE_COLUMN_ICON = 0,
  34. GEDIT_FILE_BROWSER_STORE_COLUMN_ICON_NAME,
  35. GEDIT_FILE_BROWSER_STORE_COLUMN_MARKUP,
  36. GEDIT_FILE_BROWSER_STORE_COLUMN_LOCATION,
  37. GEDIT_FILE_BROWSER_STORE_COLUMN_FLAGS,
  38. /* Columns not in common with GeditFileBookmarksStore */
  39. GEDIT_FILE_BROWSER_STORE_COLUMN_NAME,
  40. GEDIT_FILE_BROWSER_STORE_COLUMN_EMBLEM,
  41. GEDIT_FILE_BROWSER_STORE_COLUMN_NUM
  42. } GeditFileBrowserStoreColumn;
  43. typedef enum
  44. {
  45. GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY = 1 << 0,
  46. GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN = 1 << 1,
  47. GEDIT_FILE_BROWSER_STORE_FLAG_IS_TEXT = 1 << 2,
  48. GEDIT_FILE_BROWSER_STORE_FLAG_LOADED = 1 << 3,
  49. GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED = 1 << 4,
  50. GEDIT_FILE_BROWSER_STORE_FLAG_IS_DUMMY = 1 << 5
  51. } GeditFileBrowserStoreFlag;
  52. typedef enum
  53. {
  54. GEDIT_FILE_BROWSER_STORE_RESULT_OK,
  55. GEDIT_FILE_BROWSER_STORE_RESULT_NO_CHANGE,
  56. GEDIT_FILE_BROWSER_STORE_RESULT_ERROR,
  57. GEDIT_FILE_BROWSER_STORE_RESULT_NO_TRASH,
  58. GEDIT_FILE_BROWSER_STORE_RESULT_MOUNTING,
  59. GEDIT_FILE_BROWSER_STORE_RESULT_NUM
  60. } GeditFileBrowserStoreResult;
  61. typedef enum
  62. {
  63. GEDIT_FILE_BROWSER_STORE_FILTER_MODE_NONE = 0,
  64. GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_HIDDEN = 1 << 0,
  65. GEDIT_FILE_BROWSER_STORE_FILTER_MODE_HIDE_BINARY = 1 << 1
  66. } GeditFileBrowserStoreFilterMode;
  67. #define FILE_IS_DIR(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY)
  68. #define FILE_IS_HIDDEN(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_HIDDEN)
  69. #define FILE_IS_TEXT(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_TEXT)
  70. #define FILE_LOADED(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_LOADED)
  71. #define FILE_IS_FILTERED(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_FILTERED)
  72. #define FILE_IS_DUMMY(flags) (flags & GEDIT_FILE_BROWSER_STORE_FLAG_IS_DUMMY)
  73. typedef struct _GeditFileBrowserStore GeditFileBrowserStore;
  74. typedef struct _GeditFileBrowserStoreClass GeditFileBrowserStoreClass;
  75. typedef struct _GeditFileBrowserStorePrivate GeditFileBrowserStorePrivate;
  76. typedef gboolean (*GeditFileBrowserStoreFilterFunc) (GeditFileBrowserStore *model,
  77. GtkTreeIter *iter,
  78. gpointer user_data);
  79. struct _GeditFileBrowserStore
  80. {
  81. GObject parent;
  82. GeditFileBrowserStorePrivate *priv;
  83. };
  84. struct _GeditFileBrowserStoreClass {
  85. GObjectClass parent_class;
  86. /* Signals */
  87. void (* begin_loading) (GeditFileBrowserStore *model,
  88. GtkTreeIter *iter);
  89. void (* end_loading) (GeditFileBrowserStore *model,
  90. GtkTreeIter *iter);
  91. void (* error) (GeditFileBrowserStore *model,
  92. guint code,
  93. gchar *message);
  94. gboolean (* no_trash) (GeditFileBrowserStore *model,
  95. GList *files);
  96. void (* rename) (GeditFileBrowserStore *model,
  97. GFile *oldfile,
  98. GFile *newfile);
  99. void (* begin_refresh) (GeditFileBrowserStore *model);
  100. void (* end_refresh) (GeditFileBrowserStore *model);
  101. void (* unload) (GeditFileBrowserStore *model,
  102. GFile *location);
  103. void (* before_row_deleted) (GeditFileBrowserStore *model,
  104. GtkTreePath *path);
  105. };
  106. GType gedit_file_browser_store_get_type (void) G_GNUC_CONST;
  107. GeditFileBrowserStore *gedit_file_browser_store_new (GFile *root);
  108. GeditFileBrowserStoreResult gedit_file_browser_store_set_root_and_virtual_root (GeditFileBrowserStore *model,
  109. GFile *root,
  110. GFile *virtual_root);
  111. GeditFileBrowserStoreResult gedit_file_browser_store_set_root (GeditFileBrowserStore *model,
  112. GFile *root);
  113. GeditFileBrowserStoreResult gedit_file_browser_store_set_virtual_root (GeditFileBrowserStore *model,
  114. GtkTreeIter *iter);
  115. GeditFileBrowserStoreResult gedit_file_browser_store_set_virtual_root_from_location (GeditFileBrowserStore *model,
  116. GFile *root);
  117. GeditFileBrowserStoreResult gedit_file_browser_store_set_virtual_root_up (GeditFileBrowserStore *model);
  118. GeditFileBrowserStoreResult gedit_file_browser_store_set_virtual_root_top (GeditFileBrowserStore *model);
  119. gboolean gedit_file_browser_store_get_iter_virtual_root (GeditFileBrowserStore *model,
  120. GtkTreeIter *iter);
  121. gboolean gedit_file_browser_store_get_iter_root (GeditFileBrowserStore *model,
  122. GtkTreeIter *iter);
  123. GFile *gedit_file_browser_store_get_root (GeditFileBrowserStore *model);
  124. GFile *gedit_file_browser_store_get_virtual_root (GeditFileBrowserStore *model);
  125. gboolean gedit_file_browser_store_iter_equal (GeditFileBrowserStore *model,
  126. GtkTreeIter *iter1,
  127. GtkTreeIter *iter2);
  128. void gedit_file_browser_store_set_value (GeditFileBrowserStore *tree_model,
  129. GtkTreeIter *iter,
  130. gint column,
  131. GValue *value);
  132. void _gedit_file_browser_store_iter_expanded (GeditFileBrowserStore *model,
  133. GtkTreeIter *iter);
  134. void _gedit_file_browser_store_iter_collapsed (GeditFileBrowserStore *model,
  135. GtkTreeIter *iter);
  136. GeditFileBrowserStoreFilterMode gedit_file_browser_store_get_filter_mode (GeditFileBrowserStore *model);
  137. void gedit_file_browser_store_set_filter_mode (GeditFileBrowserStore *model,
  138. GeditFileBrowserStoreFilterMode mode);
  139. void gedit_file_browser_store_set_filter_func (GeditFileBrowserStore *model,
  140. GeditFileBrowserStoreFilterFunc func,
  141. gpointer user_data);
  142. const gchar * const *gedit_file_browser_store_get_binary_patterns (GeditFileBrowserStore *model);
  143. void gedit_file_browser_store_set_binary_patterns (GeditFileBrowserStore *model,
  144. const gchar **binary_patterns);
  145. void gedit_file_browser_store_refilter (GeditFileBrowserStore *model);
  146. GeditFileBrowserStoreFilterMode gedit_file_browser_store_filter_mode_get_default (void);
  147. void gedit_file_browser_store_refresh (GeditFileBrowserStore *model);
  148. gboolean gedit_file_browser_store_rename (GeditFileBrowserStore *model,
  149. GtkTreeIter *iter,
  150. gchar const *new_name,
  151. GError **error);
  152. GeditFileBrowserStoreResult gedit_file_browser_store_delete (GeditFileBrowserStore *model,
  153. GtkTreeIter *iter,
  154. gboolean trash);
  155. GeditFileBrowserStoreResult gedit_file_browser_store_delete_all (GeditFileBrowserStore *model,
  156. GList *rows,
  157. gboolean trash);
  158. gboolean gedit_file_browser_store_new_file (GeditFileBrowserStore *model,
  159. GtkTreeIter *parent,
  160. GtkTreeIter *iter);
  161. gboolean gedit_file_browser_store_new_directory (GeditFileBrowserStore *model,
  162. GtkTreeIter *parent,
  163. GtkTreeIter *iter);
  164. void gedit_file_browser_store_cancel_mount_operation (GeditFileBrowserStore *store);
  165. void _gedit_file_browser_store_register_type (GTypeModule *type_module);
  166. G_END_DECLS
  167. #endif /* GEDIT_FILE_BROWSER_STORE_H */
  168. /* ex:set ts=8 noet: */