1 /* ide-buffer-manager.h 2 * 3 * Copyright 2018-2019 Christian Hergert <chergert@redhat.com> 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * SPDX-License-Identifier: GPL-3.0-or-later 19 */ 20 21 #pragma once 22 23 #if !defined (IDE_CODE_INSIDE) && !defined (IDE_CODE_COMPILATION) 24 # error "Only <libide-code.h> can be included directly." 25 #endif 26 27 #include <libide-core.h> 28 29 #include "ide-buffer.h" 30 31 G_BEGIN_DECLS 32 33 /** 34 * IdeBufferOpenFlags: 35 * @IDE_BUFFER_OPEN_FLAGS_NONE: No special processing will be performed 36 * @IDE_BUFFER_OPEN_FLAGS_BACKGROUND: Open the document in the background (behind current view) 37 * @IDE_BUFFER_OPEN_FLAGS_NO_VIEW: Open the document but do not create a new view for it 38 * @IDE_BUFFER_OPEN_FLAGS_DISABLE_ADDINS: Disables any buffer addin for this buffer. 39 * 40 * The #IdeBufferOpenFlags enumeration is used to specify how a document should 41 * be opened by the workbench. Plugins may want to have a bit of control over 42 * where the document is opened, and this provides a some control over that. 43 * 44 * Since: 3.32 45 */ 46 typedef enum 47 { 48 IDE_BUFFER_OPEN_FLAGS_NONE = 0, 49 IDE_BUFFER_OPEN_FLAGS_BACKGROUND = 1 << 0, 50 IDE_BUFFER_OPEN_FLAGS_NO_VIEW = 1 << 1, 51 IDE_BUFFER_OPEN_FLAGS_FORCE_RELOAD = 1 << 2, 52 IDE_BUFFER_OPEN_FLAGS_DISABLE_ADDINS = 1 << 3, 53 } IdeBufferOpenFlags; 54 55 /** 56 * IdeBufferForeachFunc: 57 * @buffer: an #IdeBuffer 58 * @user_data: closure data 59 * 60 * Callback prototype for ide_buffer_manager_foreach(). 61 * 62 * Since: 3.32 63 */ 64 typedef void (*IdeBufferForeachFunc) (IdeBuffer *buffer, 65 gpointer user_data); 66 67 #define IDE_TYPE_BUFFER_MANAGER (ide_buffer_manager_get_type()) 68 69 IDE_AVAILABLE_IN_3_32 70 G_DECLARE_FINAL_TYPE (IdeBufferManager, ide_buffer_manager, IDE, BUFFER_MANAGER, IdeObject) 71 72 IDE_AVAILABLE_IN_3_32 73 IdeBufferManager *ide_buffer_manager_from_context (IdeContext *context); 74 IDE_AVAILABLE_IN_3_32 75 void ide_buffer_manager_foreach (IdeBufferManager *self, 76 IdeBufferForeachFunc foreach_func, 77 gpointer user_data); 78 IDE_AVAILABLE_IN_3_32 79 void ide_buffer_manager_load_file_async (IdeBufferManager *self, 80 GFile *file, 81 IdeBufferOpenFlags flags, 82 IdeNotification *notif, 83 GCancellable *cancellable, 84 GAsyncReadyCallback callback, 85 gpointer user_data); 86 IDE_AVAILABLE_IN_3_32 87 IdeBuffer *ide_buffer_manager_load_file_finish (IdeBufferManager *self, 88 GAsyncResult *result, 89 GError **error); 90 IDE_AVAILABLE_IN_3_32 91 void ide_buffer_manager_save_all_async (IdeBufferManager *self, 92 GCancellable *cancellable, 93 GAsyncReadyCallback callback, 94 gpointer user_data); 95 IDE_AVAILABLE_IN_3_32 96 gboolean ide_buffer_manager_save_all_finish (IdeBufferManager *self, 97 GAsyncResult *result, 98 GError **error); 99 IDE_AVAILABLE_IN_3_36 100 void ide_buffer_manager_reload_all_async (IdeBufferManager *self, 101 GCancellable *cancellable, 102 GAsyncReadyCallback callback, 103 gpointer user_data); 104 IDE_AVAILABLE_IN_3_36 105 gboolean ide_buffer_manager_reload_all_finish (IdeBufferManager *self, 106 GAsyncResult *result, 107 GError **error); 108 IDE_AVAILABLE_IN_3_32 109 gboolean ide_buffer_manager_has_file (IdeBufferManager *self, 110 GFile *file); 111 IDE_AVAILABLE_IN_3_32 112 IdeBuffer *ide_buffer_manager_find_buffer (IdeBufferManager *self, 113 GFile *file); 114 IDE_AVAILABLE_IN_3_32 115 gssize ide_buffer_manager_get_max_file_size (IdeBufferManager *self); 116 IDE_AVAILABLE_IN_3_32 117 void ide_buffer_manager_set_max_file_size (IdeBufferManager *self, 118 gssize max_file_size); 119 IDE_AVAILABLE_IN_3_32 120 void ide_buffer_manager_apply_edits_async (IdeBufferManager *self, 121 GPtrArray *edits, 122 GCancellable *cancellable, 123 GAsyncReadyCallback callback, 124 gpointer user_data); 125 IDE_AVAILABLE_IN_3_32 126 gboolean ide_buffer_manager_apply_edits_finish (IdeBufferManager *self, 127 GAsyncResult *result, 128 GError **error); 129 130 G_END_DECLS 131