Top |
TeplTab * | tepl_tab_new () |
TeplTab * | tepl_tab_new_with_view () |
TeplView * | tepl_tab_get_view () |
TeplBuffer * | tepl_tab_get_buffer () |
TeplGotoLineBar * | tepl_tab_get_goto_line_bar () |
void | tepl_tab_add_info_bar () |
void | tepl_tab_load_file () |
void | tepl_tab_save_async () |
gboolean | tepl_tab_save_finish () |
void | tepl_tab_save_async_simple () |
void | tepl_tab_save_as_async () |
gboolean | tepl_tab_save_as_finish () |
void | tepl_tab_save_as_async_simple () |
GObject ╰── GInitiallyUnowned ╰── GtkWidget ╰── GtkContainer ╰── GtkGrid ╰── TeplTab
TeplTab implements AtkImplementorIface, GtkBuildable, GtkOrientable and TeplTabGroup.
TeplTab is meant to be the content of one tab in the text editor (if the text editor has a Tabbed Document Interface). It is a GtkGrid container that contains the TeplView and can contain one or several GtkInfoBar's. Since it is a GtkGrid, an application can of course add any other widget to it.
To create a new GtkInfoBar, it is recommended to use TeplInfoBar (but TeplTab doesn't enforce it).
By default:
TeplTab has a vertical GtkOrientation.
The main child widget of TeplTab is a GtkScrolledWindow which contains the TeplView.
GtkInfoBar's are added on top of the GtkScrolledWindow.
The way that the TeplView is packed into the TeplTab is customizable with the ::pack_view virtual function. Similarly, the way that GtkInfoBar's are added can be customized with ::pack_info_bar.
TeplTab implements the TeplTabGroup interface, for a group of only one tab.
It is useful for text editors that open each file in a separate window, or
for applications that don't require to open more than one file. But the
tepl_tab_group_append_tab()
operation is not supported, so some higher-level
features of Tepl don't work with TeplTab as the TeplTabGroup of the window.
This will maybe be improved in the future by creating automatically a new
window.
TeplTab *
tepl_tab_new (void
);
Creates a new TeplTab with a new TeplView. The new TeplView can be
retrieved afterwards with tepl_tab_get_view()
.
Since: 3.0
TeplBuffer *
tepl_tab_get_buffer (TeplTab *tab
);
A convenience function that calls gtk_text_view_get_buffer()
on the
“view” associated with the tab
.
Since: 3.0
TeplGotoLineBar *
tepl_tab_get_goto_line_bar (TeplTab *tab
);
Gets the TeplGotoLineBar widget belonging to tab
. The TeplGotoLineBar must
not be destroyed by the application, the purpose of this function is to
show/hide the widget.
Since: 5.0
void tepl_tab_add_info_bar (TeplTab *tab
,GtkInfoBar *info_bar
);
Attaches info_bar
to tab
.
This function calls the ::pack_info_bar virtual function.
Since: 1.0
void tepl_tab_load_file (TeplTab *tab
,GFile *location
);
Unconditionally loads a file in tab
, regardless if there are unsaved changes
in the GtkTextBuffer. The previous buffer content is lost.
This function is asynchronous, there is no way to know when the file loading is finished.
Since: 4.0
void tepl_tab_save_async (TeplTab *tab
,GAsyncReadyCallback callback
,gpointer user_data
);
Saves asynchronously the content of the tab
. The “location” must not
be NULL
.
See the GAsyncResult documentation to know how to use this function.
tab |
a TeplTab. |
|
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
user data to pass to |
Since: 4.0
gboolean tepl_tab_save_finish (TeplTab *tab
,GAsyncResult *result
);
Finishes a tab saving started with tepl_tab_save_async()
.
Since: 4.0
void
tepl_tab_save_async_simple (TeplTab *tab
);
The same as tepl_tab_save_async()
, but without callback.
This function is useful when you don't need to know:
when the operation is finished;
and whether the operation ran successfully.
Since: 4.0
void tepl_tab_save_as_async (TeplTab *tab
,GAsyncReadyCallback callback
,gpointer user_data
);
Shows a GtkFileChooser to save the tab
to a different location, creates an
appropriate TeplFileSaver and asynchronously runs it.
See the GAsyncResult documentation to know how to use this function.
tab |
a TeplTab. |
|
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
user data to pass to |
Since: 4.0
gboolean tepl_tab_save_as_finish (TeplTab *tab
,GAsyncResult *result
);
Finishes a tab saving started with tepl_tab_save_as_async()
.
Since: 4.0
void
tepl_tab_save_as_async_simple (TeplTab *tab
);
The same as tepl_tab_save_as_async()
, but without callback.
This function is useful when you don't need to know:
when the operation is finished;
and whether the operation ran successfully.
Since: 4.0
struct TeplTabClass { GtkGridClass parent_class; /* Vfuncs */ void (* pack_view) (TeplTab *tab, TeplView *view); void (* pack_info_bar) (TeplTab *tab, GtkInfoBar *info_bar); void (* pack_goto_line_bar) (TeplTab *tab, TeplGotoLineBar *goto_line_bar); /* Signals */ void (* close_request) (TeplTab *tab); };
Virtual function pointer to add the TeplView in the TeplTab
container. Called only once at object construction time, when the
“view” property is set. By default the TeplView is added to a
GtkScrolledWindow and the GtkScrolledWindow is added to the TeplTab with
|
||
Virtual function pointer to add a GtkInfoBar in the TeplTab container. By default the GtkInfoBar is inserted just above the GtkScrolledWindow containing the TeplView. |
||
Virtual function pointer to add a TeplGotoLineBar in the TeplTab container. By default the TeplGotoLineBar is added at the bottom. |
||
For the “close-request” signal. |
“close-request”
signalvoid user_function (TeplTab *tab, gpointer user_data)
The ::close-request signal is emitted when there is a request to close the TeplTab, for example if the user clicks on a close button.
The default object method handler does the following:
If the buffer is not modified (according to
gtk_text_buffer_get_modified()
), close the tab.
Else, show a message dialog to propose to save the file before closing.
To override the default object method handler, either override the
virtual function in a TeplTab subclass or connect to the signal and
call g_signal_stop_emission_by_name()
.
tab |
the TeplTab emitting the signal. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 3.0