diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index f4920c8667..1c8a31f231 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -892,6 +892,26 @@ get_cursor_direction (GtkLabel *self) return PANGO_DIRECTION_LTR; } +static int +_gtk_label_get_link_at (GtkLabel *self, + int pos) +{ + if (self->select_info) + { + guint i; + + for (i = 0; i < self->select_info->n_links; i++) + { + const GtkLabelLink *link = &self->select_info->links[i]; + + if (link->start <= pos && pos < link->end) + return i; + } + } + + return -1; +} + static GtkLabelLink * gtk_label_get_focus_link (GtkLabel *self, int *out_index) @@ -5559,111 +5579,6 @@ gtk_label_get_lines (GtkLabel *self) return self->lines; } -int -_gtk_label_get_n_links (GtkLabel *self) -{ - if (self->select_info) - return self->select_info->n_links; - - return 0; -} - -const char * -_gtk_label_get_link_uri (GtkLabel *self, - int idx) -{ - if (self->select_info) - return self->select_info->links[idx].uri; - - return NULL; -} - -void -_gtk_label_get_link_extent (GtkLabel *self, - int idx, - int *start, - int *end) -{ - if (self->select_info) - { - const GtkLabelLink *link = &self->select_info->links[idx]; - - *start = link->start; - *end = link->end; - } - else - { - *start = -1; - *end = -1; - } -} - -int -_gtk_label_get_link_at (GtkLabel *self, - int pos) -{ - if (self->select_info) - { - guint i; - - for (i = 0; i < self->select_info->n_links; i++) - { - const GtkLabelLink *link = &self->select_info->links[i]; - - if (link->start <= pos && pos < link->end) - return i; - } - } - - return -1; -} - -void -_gtk_label_activate_link (GtkLabel *self, - int idx) -{ - if (self->select_info) - { - GtkLabelLink *link = &self->select_info->links[idx]; - - emit_activate_link (self, link); - } -} - -gboolean -_gtk_label_get_link_visited (GtkLabel *self, - int idx) -{ - if (self->select_info) - return self->select_info->links[idx].visited; - - return FALSE; -} - -gboolean -_gtk_label_get_link_focused (GtkLabel *self, - int idx) -{ - GtkLabelSelectionInfo *info = self->select_info; - - if (!info) - return FALSE; - - if (info->selection_anchor != info->selection_end) - return FALSE; - - if (idx >= 0 && idx < info->n_links) - { - const GtkLabelLink *link = &info->links[idx]; - - if (link->start <= info->selection_anchor && - info->selection_anchor <= link->end) - return TRUE; - } - - return FALSE; -} - /** * gtk_label_set_xalign: * @self: a #GtkLabel diff --git a/gtk/gtklabelprivate.h b/gtk/gtklabelprivate.h index 8eb73d3af0..5fbbf79cc3 100644 --- a/gtk/gtklabelprivate.h +++ b/gtk/gtklabelprivate.h @@ -27,22 +27,6 @@ G_BEGIN_DECLS int _gtk_label_get_cursor_position (GtkLabel *label); int _gtk_label_get_selection_bound (GtkLabel *label); -int _gtk_label_get_n_links (GtkLabel *label); -int _gtk_label_get_link_at (GtkLabel *label, - int pos); -void _gtk_label_activate_link (GtkLabel *label, - int idx); -const char *_gtk_label_get_link_uri (GtkLabel *label, - int idx); -void _gtk_label_get_link_extent (GtkLabel *label, - int idx, - int *start, - int *end); -gboolean _gtk_label_get_link_visited (GtkLabel *label, - int idx); -gboolean _gtk_label_get_link_focused (GtkLabel *label, - int idx); - G_END_DECLS #endif /* __GTK_LABEL_PRIVATE_H__ */