forked from AuroraMiddleware/gtk
label: Remove GtkLabel:track-visited-links
Always track visited state of links. This way all visited links in all labels look the same. Whether the theme wants to style :visited is the theme's business.
This commit is contained in:
parent
f6bedd0d5e
commit
36248c609d
@ -401,7 +401,6 @@ enum {
|
||||
PROP_WIDTH_CHARS,
|
||||
PROP_SINGLE_LINE_MODE,
|
||||
PROP_MAX_WIDTH_CHARS,
|
||||
PROP_TRACK_VISITED_LINKS,
|
||||
PROP_LINES,
|
||||
PROP_XALIGN,
|
||||
PROP_YALIGN,
|
||||
@ -949,20 +948,6 @@ gtk_label_class_init (GtkLabelClass *class)
|
||||
-1,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkLabel:track-visited-links:
|
||||
*
|
||||
* Set this property to %TRUE to make the label track which links
|
||||
* have been visited. It will then apply the #GTK_STATE_FLAG_VISITED
|
||||
* when rendering this link, in addition to #GTK_STATE_FLAG_LINK.
|
||||
*/
|
||||
label_props[PROP_TRACK_VISITED_LINKS] =
|
||||
g_param_spec_boolean ("track-visited-links",
|
||||
P_("Track visited links"),
|
||||
P_("Whether visited links should be tracked"),
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GtkLabel:lines:
|
||||
*
|
||||
@ -1189,9 +1174,6 @@ gtk_label_set_property (GObject *object,
|
||||
case PROP_MAX_WIDTH_CHARS:
|
||||
gtk_label_set_max_width_chars (label, g_value_get_int (value));
|
||||
break;
|
||||
case PROP_TRACK_VISITED_LINKS:
|
||||
gtk_label_set_track_visited_links (label, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_LINES:
|
||||
gtk_label_set_lines (label, g_value_get_int (value));
|
||||
break;
|
||||
@ -1263,9 +1245,6 @@ gtk_label_get_property (GObject *object,
|
||||
case PROP_MAX_WIDTH_CHARS:
|
||||
g_value_set_int (value, gtk_label_get_max_width_chars (label));
|
||||
break;
|
||||
case PROP_TRACK_VISITED_LINKS:
|
||||
g_value_set_boolean (value, gtk_label_get_track_visited_links (label));
|
||||
break;
|
||||
case PROP_LINES:
|
||||
g_value_set_int (value, gtk_label_get_lines (label));
|
||||
break;
|
||||
@ -1304,7 +1283,6 @@ gtk_label_init (GtkLabel *label)
|
||||
|
||||
priv->use_underline = FALSE;
|
||||
priv->use_markup = FALSE;
|
||||
priv->track_links = TRUE;
|
||||
|
||||
priv->mnemonic_keyval = GDK_KEY_VoidSymbol;
|
||||
priv->layout = NULL;
|
||||
@ -2069,7 +2047,7 @@ start_element_handler (GMarkupParseContext *context,
|
||||
}
|
||||
|
||||
visited = FALSE;
|
||||
if (priv->track_links && priv->select_info)
|
||||
if (priv->select_info)
|
||||
{
|
||||
for (i = 0; i < priv->select_info->n_links; i++)
|
||||
{
|
||||
@ -5787,7 +5765,7 @@ emit_activate_link (GtkLabel *label,
|
||||
if (!priv->layout)
|
||||
return;
|
||||
|
||||
if (handled && priv->track_links && !link->visited &&
|
||||
if (handled && !link->visited &&
|
||||
priv->select_info && priv->select_info->links)
|
||||
{
|
||||
link->visited = TRUE;
|
||||
@ -5856,54 +5834,6 @@ gtk_label_get_current_uri (GtkLabel *label)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_label_set_track_visited_links:
|
||||
* @label: a #GtkLabel
|
||||
* @track_links: %TRUE to track visited links
|
||||
*
|
||||
* Sets whether the label should keep track of clicked
|
||||
* links (and use a different color for them).
|
||||
*/
|
||||
void
|
||||
gtk_label_set_track_visited_links (GtkLabel *label,
|
||||
gboolean track_links)
|
||||
{
|
||||
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
|
||||
|
||||
g_return_if_fail (GTK_IS_LABEL (label));
|
||||
|
||||
track_links = track_links != FALSE;
|
||||
|
||||
if (priv->track_links != track_links)
|
||||
{
|
||||
priv->track_links = track_links;
|
||||
|
||||
/* FIXME: shouldn't have to redo everything here */
|
||||
gtk_label_recalculate (label);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (label), label_props[PROP_TRACK_VISITED_LINKS]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_label_get_track_visited_links:
|
||||
* @label: a #GtkLabel
|
||||
*
|
||||
* Returns whether the label is currently keeping track
|
||||
* of clicked links.
|
||||
*
|
||||
* Returns: %TRUE if clicked links are remembered
|
||||
*/
|
||||
gboolean
|
||||
gtk_label_get_track_visited_links (GtkLabel *label)
|
||||
{
|
||||
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
|
||||
|
||||
g_return_val_if_fail (GTK_IS_LABEL (label), FALSE);
|
||||
|
||||
return priv->track_links;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_label_query_tooltip (GtkWidget *widget,
|
||||
gint x,
|
||||
|
@ -152,11 +152,6 @@ gboolean gtk_label_get_single_line_mode (GtkLabel *label);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
const gchar *gtk_label_get_current_uri (GtkLabel *label);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_label_set_track_visited_links (GtkLabel *label,
|
||||
gboolean track_links);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_label_get_track_visited_links (GtkLabel *label);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_label_set_xalign (GtkLabel *label,
|
||||
|
Loading…
Reference in New Issue
Block a user