SeahorseSecureEntry

SeahorseSecureEntry

Synopsis

                    SeahorseSecureEntry;
GtkWidget*          seahorse_secure_entry_new           (void);
void                seahorse_secure_entry_reset_changed (SeahorseSecureEntry *entry);
gboolean            seahorse_secure_entry_get_changed   (SeahorseSecureEntry *entry);
void                seahorse_secure_entry_set_visibility
                                                        (SeahorseSecureEntry *entry,
                                                         gboolean setting);
gboolean            seahorse_secure_entry_get_visibility
                                                        (SeahorseSecureEntry *entry);
void                seahorse_secure_entry_set_invisible_char
                                                        (SeahorseSecureEntry *entry,
                                                         gunichar ch);
gunichar            seahorse_secure_entry_get_invisible_char
                                                        (SeahorseSecureEntry *entry);
void                seahorse_secure_entry_set_has_frame (SeahorseSecureEntry *entry,
                                                         gboolean setting);
gboolean            seahorse_secure_entry_get_has_frame (SeahorseSecureEntry *entry);
void                seahorse_secure_entry_set_max_length
                                                        (SeahorseSecureEntry *entry,
                                                         gint max);
gint                seahorse_secure_entry_get_max_length
                                                        (SeahorseSecureEntry *entry);
void                seahorse_secure_entry_set_activates_default
                                                        (SeahorseSecureEntry *entry,
                                                         gboolean setting);
gboolean            seahorse_secure_entry_get_activates_default
                                                        (SeahorseSecureEntry *entry);
void                seahorse_secure_entry_set_width_chars
                                                        (SeahorseSecureEntry *entry,
                                                         gint n_chars);
gint                seahorse_secure_entry_get_width_chars
                                                        (SeahorseSecureEntry *entry);
void                seahorse_secure_entry_set_text      (SeahorseSecureEntry *entry,
                                                         const gchar *text);
const gchar*        seahorse_secure_entry_get_text      (SeahorseSecureEntry *entry);
PangoLayout*        seahorse_secure_entry_get_layout    (SeahorseSecureEntry *entry);
void                seahorse_secure_entry_get_layout_offsets
                                                        (SeahorseSecureEntry *entry,
                                                         gint *x,
                                                         gint *y);

Description

Details

SeahorseSecureEntry

typedef struct {
    GtkWidget widget;

    gchar *text;

    guint overwrite_mode : 1;

    /* length in use, in chars */
    guint16 text_length; 
    guint16 text_max_length;
} SeahorseSecureEntry;


seahorse_secure_entry_new ()

GtkWidget*          seahorse_secure_entry_new           (void);

Returns :


seahorse_secure_entry_reset_changed ()

void                seahorse_secure_entry_reset_changed (SeahorseSecureEntry *entry);

entry :


seahorse_secure_entry_get_changed ()

gboolean            seahorse_secure_entry_get_changed   (SeahorseSecureEntry *entry);

entry :

Returns :


seahorse_secure_entry_set_visibility ()

void                seahorse_secure_entry_set_visibility
                                                        (SeahorseSecureEntry *entry,
                                                         gboolean setting);

entry :

setting :


seahorse_secure_entry_get_visibility ()

gboolean            seahorse_secure_entry_get_visibility
                                                        (SeahorseSecureEntry *entry);

entry :

Returns :


seahorse_secure_entry_set_invisible_char ()

void                seahorse_secure_entry_set_invisible_char
                                                        (SeahorseSecureEntry *entry,
                                                         gunichar ch);

Sets the character to use in place of the actual text when seahorse_secure_entry_set_visibility() has been called to set text to FALSE. i.e. this is the character used in "password mode" to show the user how many characters have been typed. The default invisible char is an asterisk ('*'). If you set the invisible char to 0, then the user will get no feedback at all; there will be no text on the screen as they type.

entry :

a SeahorseSecureEntry

ch :

a Unicode character

seahorse_secure_entry_get_invisible_char ()

gunichar            seahorse_secure_entry_get_invisible_char
                                                        (SeahorseSecureEntry *entry);

Retrieves the character displayed in place of the real characters for entries with visisbility set to false. See seahorse_secure_entry_set_invisible_char().

entry :

a SeahorseSecureEntry

Returns :

the current invisible char, or 0, if the entry does not show invisible text at all.

seahorse_secure_entry_set_has_frame ()

void                seahorse_secure_entry_set_has_frame (SeahorseSecureEntry *entry,
                                                         gboolean setting);

Sets whether the entry has a beveled frame around it.

entry :

a SeahorseSecureEntry

setting :

new value

seahorse_secure_entry_get_has_frame ()

gboolean            seahorse_secure_entry_get_has_frame (SeahorseSecureEntry *entry);

Gets the value set by seahorse_secure_entry_set_has_frame().

entry :

a SeahorseSecureEntry

Returns :

whether the entry has a beveled frame

seahorse_secure_entry_set_max_length ()

void                seahorse_secure_entry_set_max_length
                                                        (SeahorseSecureEntry *entry,
                                                         gint max);

Sets the maximum allowed length of the contents of the widget. If the current contents are longer than the given length, then they will be truncated to fit.

entry :

a SeahorseSecureEntry.

max :

the maximum length of the entry, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536.

seahorse_secure_entry_get_max_length ()

gint                seahorse_secure_entry_get_max_length
                                                        (SeahorseSecureEntry *entry);

Retrieves the maximum allowed length of the text in entry. See seahorse_secure_entry_set_max_length().

entry :

a SeahorseSecureEntry

Returns :

the maximum allowed number of characters in SeahorseSecureEntry, or 0 if there is no maximum.

seahorse_secure_entry_set_activates_default ()

void                seahorse_secure_entry_set_activates_default
                                                        (SeahorseSecureEntry *entry,
                                                         gboolean setting);

If setting is TRUE, pressing Enter in the entry will activate the default widget for the window containing the entry. This usually means that the dialog box containing the entry will be closed, since the default widget is usually one of the dialog buttons.

(For experts: if setting is TRUE, the entry calls gtk_window_activate_default() on the window containing the entry, in the default handler for the "activate" signal.)

entry :

a SeahorseSecureEntry

setting :

TRUE to activate window's default widget on Enter keypress

seahorse_secure_entry_get_activates_default ()

gboolean            seahorse_secure_entry_get_activates_default
                                                        (SeahorseSecureEntry *entry);

Retrieves the value set by seahorse_secure_entry_set_activates_default().

entry :

a SeahorseSecureEntry

Returns :

TRUE if the entry will activate the default widget

seahorse_secure_entry_set_width_chars ()

void                seahorse_secure_entry_set_width_chars
                                                        (SeahorseSecureEntry *entry,
                                                         gint n_chars);

Changes the size request of the entry to be about the right size for n_chars characters. Note that it changes the size request, the size can still be affected by how you pack the widget into containers. If n_chars is -1, the size reverts to the default entry size.

entry :

a SeahorseSecureEntry

n_chars :

width in chars

seahorse_secure_entry_get_width_chars ()

gint                seahorse_secure_entry_get_width_chars
                                                        (SeahorseSecureEntry *entry);

Gets the value set by seahorse_secure_entry_set_width_chars().

entry :

a SeahorseSecureEntry

Returns :

number of chars to request space for, or negative if unset

seahorse_secure_entry_set_text ()

void                seahorse_secure_entry_set_text      (SeahorseSecureEntry *entry,
                                                         const gchar *text);

entry :

text :


seahorse_secure_entry_get_text ()

const gchar*        seahorse_secure_entry_get_text      (SeahorseSecureEntry *entry);

Retrieves the contents of the entry widget. See also gtk_editable_get_chars().

entry :

a SeahorseSecureEntry

Returns :

a pointer to the contents of the widget as a string. This string points to internally allocated storage in the widget and must not be freed, modified or stored.

seahorse_secure_entry_get_layout ()

PangoLayout*        seahorse_secure_entry_get_layout    (SeahorseSecureEntry *entry);

Gets the PangoLayout used to display the entry. The layout is useful to e.g. convert text positions to pixel positions, in combination with seahorse_secure_entry_get_layout_offsets(). The returned layout is owned by the entry so need not be freed by the caller.

Keep in mind that the layout text may contain a preedit string, so seahorse_secure_entry_layout_index_to_text_index() and seahorse_secure_entry_text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

entry :

a SeahorseSecureEntry

Returns :

the PangoLayout for this entry

seahorse_secure_entry_get_layout_offsets ()

void                seahorse_secure_entry_get_layout_offsets
                                                        (SeahorseSecureEntry *entry,
                                                         gint *x,
                                                         gint *y);

Obtains the position of the PangoLayout used to render text in the entry, in widget coordinates. Useful if you want to line up the text in an entry with some other text, e.g. when using the entry to implement editable cells in a sheet widget.

Also useful to convert mouse events into coordinates inside the PangoLayout, e.g. to take some action if some part of the entry text is clicked.

Note that as the user scrolls around in the entry the offsets will change; you'll need to connect to the "notify::scroll_offset" signal to track this. Remember when using the PangoLayout functions you need to convert to and from pixels using PANGO_PIXELS() or PANGO_SCALE.

Keep in mind that the layout text may contain a preedit string, so seahorse_secure_entry_layout_index_to_text_index() and seahorse_secure_entry_text_index_to_layout_index() are needed to convert byte indices in the layout to byte indices in the entry contents.

entry :

a SeahorseSecureEntry

x :

location to store X offset of layout, or NULL

y :

location to store Y offset of layout, or NULL