TfeTextView – Child object of GtkTextView. It is connected to a certain file.
GObject
+--GInitiallyUnowned
+--GtkWidget
+--GtkTextView
+--TfeTextView
#include <gtk/gtk.h>
TfeTextView holds GFile corresponds to the contents of GtkTextBuffer. It has some file manipulation functions.
GFile *
tfe_text_view_get_file (TfeTextView *tv);
Returns the copy of the GFile in the TfeTextView.
Parameters
void
tfe_text_view_open (TfeTextView *tv, GtkWidget *win);
Just shows a GtkFileChooserDialog so that a user can choose a file to
read. This function doesn’t do any I/O operations. They are done by the
signal handler connected to the response
signal emitted by
GtkFileChooserDialog. Therefore the caller can’t know the I/O status
directly from tfe_text_view_open
. Instead, the status is
informed by open-response
signal. The caller needs to set a
handler to this signal in advance.
parameters
void
tfe_text_view_save (TfeTextView *tv);
Saves the contents of the TfeTextView to a file. If tv
holds a GFile, it is used. Otherwise, this function shows
GtkFileChooserDialog so that the user can choose a file to save.
Parameters
void
tfe_text_view_saveas (TfeTextView *tv);
Saves the content of a TfeTextView to a file. This function shows GtkFileChooserDialog so that a user can choose a file to save.
Parameters
GtkWidget *
tfe_text_view_new_with_file (GFile *file);
Creates a new TfeTextView and reads the contents of the
file
and set it to the GtkTextBuffer corresponds to the
newly created TfeTextView. Then returns the TfeTextView as GtkWidget. If
an error happens, it returns NULL
.
Parameters
Returns
GtkWidget *
tfe_text_view_new (void);
Creates a new TfeTextView and returns the TfeTextView as GtkWidget.
If an error happens, it returns NULL
.
Returns
typedef struct _TfeTextView TfeTextView
struct _TfeTextView
{
GtkTextView parent;
GFile *file;
};
The members of this structure are not allowed to be accessed by any
outer objects. If you want to obtain a copy of the GFile, use
tfe_text_view_get_file
.
typedef struct {
GtkTextViewClass parent_class;
} TfeTextViewClass;
No member is added because TfeTextView is a final type object.
Predefined values for the response id given by
open-response
signal.
Members:
The property “wrap-mode” belongs to GtkTextView. TfeTextView inherits it and the value is set to GTK_WRAP_WORD_CHAR as a default.
void
user_function (TfeTextView *tv,
gpointer user_data)
Emitted when the GFile in the TfeTextView object is changed. The signal is emitted when:
void
user_function (TfeTextView *tv,
TfeTextViewOpenResponseType response-id,
gpointer user_data)
Emitted after the user calls tfe_text_view_open
. This
signal informs the status of file opening and reading.