label: Remove public pattern API

This commit is contained in:
Timm Bäder 2020-04-12 07:58:09 +02:00
parent 13fde6f4cd
commit 4851081a77
3 changed files with 1 additions and 54 deletions

View File

@ -392,7 +392,6 @@ enum {
PROP_USE_MARKUP,
PROP_USE_UNDERLINE,
PROP_JUSTIFY,
PROP_PATTERN,
PROP_WRAP,
PROP_WRAP_MODE,
PROP_SELECTABLE,
@ -837,13 +836,6 @@ gtk_label_class_init (GtkLabelClass *class)
0.5,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
label_props[PROP_PATTERN] =
g_param_spec_string ("pattern",
P_("Pattern"),
P_("A string with _ characters in positions correspond to characters in the text to underline"),
NULL,
GTK_PARAM_WRITABLE);
label_props[PROP_WRAP] =
g_param_spec_boolean ("wrap",
P_("Line wrap"),
@ -1195,9 +1187,6 @@ gtk_label_set_property (GObject *object,
case PROP_JUSTIFY:
gtk_label_set_justify (label, g_value_get_enum (value));
break;
case PROP_PATTERN:
gtk_label_set_pattern (label, g_value_get_string (value));
break;
case PROP_WRAP:
gtk_label_set_wrap (label, g_value_get_boolean (value));
break;
@ -1343,7 +1332,6 @@ gtk_label_init (GtkLabel *label)
priv->use_underline = FALSE;
priv->use_markup = FALSE;
priv->pattern_set = FALSE;
priv->track_links = TRUE;
priv->mnemonic_keyval = GDK_KEY_VoidSymbol;
@ -1865,8 +1853,7 @@ gtk_label_recalculate (GtkLabel *label)
gtk_label_set_uline_text_internal (label, priv->label);
else
{
if (!priv->pattern_set)
g_clear_pointer (&priv->markup_attrs, pango_attr_list_unref);
g_clear_pointer (&priv->markup_attrs, pango_attr_list_unref);
gtk_label_set_text_internal (label, g_strdup (priv->label));
}
@ -2573,9 +2560,6 @@ gtk_label_set_pattern_internal (GtkLabel *label,
PangoAttrList *attrs;
gboolean auto_mnemonics = TRUE;
if (priv->pattern_set)
return;
if (is_mnemonic)
{
if (priv->mnemonics_visible && pattern &&
@ -2595,39 +2579,6 @@ gtk_label_set_pattern_internal (GtkLabel *label,
priv->markup_attrs = attrs;
}
/**
* gtk_label_set_pattern:
* @label: The #GtkLabel you want to set the pattern to.
* @pattern: The pattern as described above.
*
* The pattern of underlines you want under the existing text within the
* #GtkLabel widget. For example if the current text of the label says
* FooBarBaz passing a pattern of ___ ___ will underline
* Foo and Baz but not Bar.
*/
void
gtk_label_set_pattern (GtkLabel *label,
const gchar *pattern)
{
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
g_return_if_fail (GTK_IS_LABEL (label));
priv->pattern_set = FALSE;
if (pattern)
{
gtk_label_set_pattern_internal (label, pattern, FALSE);
priv->pattern_set = TRUE;
}
else
gtk_label_recalculate (label);
gtk_label_clear_layout (label);
gtk_widget_queue_resize (GTK_WIDGET (label));
}
/**
* gtk_label_set_justify:
* @label: a #GtkLabel

View File

@ -114,9 +114,6 @@ void gtk_label_set_lines (GtkLabel *label,
GDK_AVAILABLE_IN_ALL
gint gtk_label_get_lines (GtkLabel *label);
GDK_AVAILABLE_IN_ALL
void gtk_label_set_pattern (GtkLabel *label,
const gchar *pattern);
GDK_AVAILABLE_IN_ALL
void gtk_label_set_wrap (GtkLabel *label,
gboolean wrap);
GDK_AVAILABLE_IN_ALL

View File

@ -1043,7 +1043,6 @@ static void create_labels (GtkWidget *widget)
label = gtk_label_new ("This label is underlined!\n"
"This one is underlined (\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257) in quite a funky fashion");
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
gtk_label_set_pattern (GTK_LABEL (label), "_________________________ _ _________ _ _____ _ __ __ ___ ____ _____");
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_container_add (GTK_CONTAINER (vbox), frame);