Gnome User Interface Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#include <gnome.h> struct GnomeLess; GtkWidget* gnome_less_new (void); void gnome_less_clear (GnomeLess *gl); gboolean gnome_less_show_file (GnomeLess *gl, const gchar *path); gboolean gnome_less_show_command (GnomeLess *gl, const gchar *command_line); void gnome_less_show_string (GnomeLess *gl, const gchar *s); gboolean gnome_less_show_filestream (GnomeLess *gl, FILE *f); gboolean gnome_less_show_fd (GnomeLess *gl, int file_descriptor); gboolean gnome_less_write_file (GnomeLess *gl, const gchar *path); gboolean gnome_less_write_fd (GnomeLess *gl, int fd); void gnome_less_set_font (GnomeLess *gl, GdkFont *font); void gnome_less_set_fixed_font (GnomeLess *gl, gboolean fixed); void gnome_less_reshow (GnomeLess *gl); void gnome_less_fixed_font (GnomeLess *gl); |
This widget implements a graphical "more" command. It allows the user to view a text file. There are various possible ways to specify the contents to display: loading the data from a file (by providing a filename) or by loading it from an open C FILE data stream or from the output of a Unix command or from a Unix file descriptor.
The following is a simple example of its use. The code creates a GnomeLess widget, sets a custom font, and fills the widget with the contents of a file.
GtkWidget *gl; GdkFont *font; /* create a new widget */ gl = gnome_less_new(); /* set our custom font */ font = gdk_font_load("-adobe-helvetica-bold-o-normal-*-*-140-*-*-p-*-iso8859-1"); gnome_less_set_font(GNOME_LESS(gl), font); /* display some text */ gnome_less_show_file(GNOME_LESS(gl), "/home/user/file.txt"); |
gboolean gnome_less_show_file (GnomeLess *gl, const gchar *path); |
Displays a file in a GnomeLess widget. Replaces any text already being displayed in the widget.
gboolean gnome_less_show_command (GnomeLess *gl, const gchar *command_line); |
Runs the shell command specified in command_line, and places the output of that command in the GnomeLess widget specified by gl. Replaces any text already being displayed in the widget.
void gnome_less_show_string (GnomeLess *gl, const gchar *s); |
Displays a string in the GnomeLess widget gl. Replaces any text already being displayed.
gboolean gnome_less_show_filestream (GnomeLess *gl, FILE *f); |
Reads all of the text from filestream f, and places it in the GnomeLess widget gl. Replaces any text already being displayed.
gboolean gnome_less_show_fd (GnomeLess *gl, int file_descriptor); |
Reads all of the text from file descriptor file_descriptor, and places it in the GnomeLess widget gl. Replaces any text already being displayed.
gboolean gnome_less_write_file (GnomeLess *gl, const gchar *path); |
Writes the text displayed in the GnomeLess widget gl to the file specified by path.
gboolean gnome_less_write_fd (GnomeLess *gl, int fd); |
Writes the text displayed in the GnomeLess widget gl to file descriptor fd.
void gnome_less_set_font (GnomeLess *gl, GdkFont *font); |
Sets the font of the text to be displayed in the GnomeLess widget gl to font.
Note: This will not affect text already being displayed. If you use this function after adding text to the widget, you must show it again by using gnome_less_reshow or one of the gnome_less_show commands.
void gnome_less_set_fixed_font (GnomeLess *gl, gboolean fixed); |
Specifies whether or not new text should be displayed using a fixed font. Pass TRUE in fixed to use a fixed font, or FALSE to revert to the default GtkText font.
Note: This will not affect text already being displayed. If you use this function after adding text to the widget, you must show it again by using gnome_less_reshow or one of the gnome_less_show commands.
void gnome_less_reshow (GnomeLess *gl); |
Re-displays all of the text in the GnomeLess widget gl. If the font has changed since the last show/reshow of text, it will update the current text to the new font.
void gnome_less_fixed_font (GnomeLess *gl); |
This function is obsolete. Please use gnome_less_set_fixed_font instead.