label: Remove unused private functions

This commit is contained in:
Timm Bäder 2020-12-25 12:20:35 +01:00
parent 0b15aba82a
commit 03f5a368ec
2 changed files with 20 additions and 121 deletions

View File

@ -892,6 +892,26 @@ get_cursor_direction (GtkLabel *self)
return PANGO_DIRECTION_LTR; 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 * static GtkLabelLink *
gtk_label_get_focus_link (GtkLabel *self, gtk_label_get_focus_link (GtkLabel *self,
int *out_index) int *out_index)
@ -5559,111 +5579,6 @@ gtk_label_get_lines (GtkLabel *self)
return self->lines; 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: * gtk_label_set_xalign:
* @self: a #GtkLabel * @self: a #GtkLabel

View File

@ -27,22 +27,6 @@ G_BEGIN_DECLS
int _gtk_label_get_cursor_position (GtkLabel *label); int _gtk_label_get_cursor_position (GtkLabel *label);
int _gtk_label_get_selection_bound (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 G_END_DECLS
#endif /* __GTK_LABEL_PRIVATE_H__ */ #endif /* __GTK_LABEL_PRIVATE_H__ */