1 /* 2 * pluma-tab.h 3 * This file is part of pluma 4 * 5 * Copyright (C) 2005 - Paolo Maggi 6 * Copyright (C) 2012-2021 MATE Developers 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 2 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin St, Fifth Floor, 21 * Boston, MA 02110-1301, USA. 22 */ 23 24 /* 25 * Modified by the pluma Team, 2005. See the AUTHORS file for a 26 * list of people on the pluma Team. 27 * See the ChangeLog files for a list of changes. 28 * 29 * $Id$ 30 */ 31 32 #ifndef __PLUMA_TAB_H__ 33 #define __PLUMA_TAB_H__ 34 35 #include <gtk/gtk.h> 36 37 #include <pluma/pluma-view.h> 38 #include <pluma/pluma-document.h> 39 40 G_BEGIN_DECLS 41 42 typedef enum 43 { 44 PLUMA_TAB_STATE_NORMAL = 0, 45 PLUMA_TAB_STATE_LOADING, 46 PLUMA_TAB_STATE_REVERTING, 47 PLUMA_TAB_STATE_SAVING, 48 PLUMA_TAB_STATE_PRINTING, 49 PLUMA_TAB_STATE_PRINT_PREVIEWING, 50 PLUMA_TAB_STATE_SHOWING_PRINT_PREVIEW, 51 PLUMA_TAB_STATE_GENERIC_NOT_EDITABLE, 52 PLUMA_TAB_STATE_LOADING_ERROR, 53 PLUMA_TAB_STATE_REVERTING_ERROR, 54 PLUMA_TAB_STATE_SAVING_ERROR, 55 PLUMA_TAB_STATE_GENERIC_ERROR, 56 PLUMA_TAB_STATE_CLOSING, 57 PLUMA_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION, 58 PLUMA_TAB_NUM_OF_STATES /* This is not a valid state */ 59 } PlumaTabState; 60 61 /* 62 * Type checking and casting macros 63 */ 64 #define PLUMA_TYPE_TAB (pluma_tab_get_type()) 65 #define PLUMA_TAB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_TAB, PlumaTab)) 66 #define PLUMA_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUMA_TYPE_TAB, PlumaTabClass)) 67 #define PLUMA_IS_TAB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUMA_TYPE_TAB)) 68 #define PLUMA_IS_TAB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_TAB)) 69 #define PLUMA_TAB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_TAB, PlumaTabClass)) 70 71 /* Private structure type */ 72 typedef struct _PlumaTabPrivate PlumaTabPrivate; 73 74 /* 75 * Main object structure 76 */ 77 typedef struct _PlumaTab PlumaTab; 78 79 struct _PlumaTab 80 { 81 GtkBox vbox; 82 83 /*< private > */ 84 PlumaTabPrivate *priv; 85 }; 86 87 /* 88 * Class definition 89 */ 90 typedef struct _PlumaTabClass PlumaTabClass; 91 92 struct _PlumaTabClass 93 { 94 GtkBoxClass parent_class; 95 }; 96 97 /* 98 * Public methods 99 */ 100 GType pluma_tab_get_type (void) G_GNUC_CONST; 101 102 PlumaView *pluma_tab_get_view (PlumaTab *tab); 103 104 /* This is only an helper function */ 105 PlumaDocument *pluma_tab_get_document (PlumaTab *tab); 106 107 PlumaTab *pluma_tab_get_from_document (PlumaDocument *doc); 108 109 PlumaTabState pluma_tab_get_state (PlumaTab *tab); 110 111 gboolean pluma_tab_get_auto_save_enabled 112 (PlumaTab *tab); 113 114 void pluma_tab_set_auto_save_enabled 115 (PlumaTab *tab, 116 gboolean enable); 117 118 gint pluma_tab_get_auto_save_interval 119 (PlumaTab *tab); 120 121 void pluma_tab_set_auto_save_interval 122 (PlumaTab *tab, 123 gint interval); 124 125 void pluma_tab_set_info_bar (PlumaTab *tab, 126 GtkWidget *info_bar); 127 /* 128 * Non exported methods 129 */ 130 GtkWidget *_pluma_tab_new (void); 131 132 /* Whether create is TRUE, creates a new empty document if location does 133 not refer to an existing file */ 134 GtkWidget *_pluma_tab_new_from_uri (const gchar *uri, 135 const PlumaEncoding *encoding, 136 gint line_pos, 137 gboolean create); 138 gchar *_pluma_tab_get_name (PlumaTab *tab); 139 gchar *_pluma_tab_get_tooltips (PlumaTab *tab); 140 GdkPixbuf *_pluma_tab_get_icon (PlumaTab *tab); 141 void _pluma_tab_load (PlumaTab *tab, 142 const gchar *uri, 143 const PlumaEncoding *encoding, 144 gint line_pos, 145 gboolean create); 146 void _pluma_tab_revert (PlumaTab *tab); 147 void _pluma_tab_save (PlumaTab *tab); 148 void _pluma_tab_save_as (PlumaTab *tab, 149 const gchar *uri, 150 const PlumaEncoding *encoding, 151 PlumaDocumentNewlineType newline_type); 152 153 void _pluma_tab_print (PlumaTab *tab); 154 void _pluma_tab_print_preview (PlumaTab *tab); 155 156 void _pluma_tab_mark_for_closing (PlumaTab *tab); 157 158 gboolean _pluma_tab_can_close (PlumaTab *tab); 159 160 G_END_DECLS 161 162 #endif /* __PLUMA_TAB_H__ */ 163