[gtk/wip/baedert/for-master: 74/96] label: Remove public pattern API



commit 065b822db68ac0dc7589043bbda2895067e9d8a1
Author: Timm Bäder <mail baedert org>
Date:   Sun Apr 12 07:58:09 2020 +0200

    label: Remove public pattern API

 gtk/gtklabel.c  | 51 +--------------------------------------------------
 gtk/gtklabel.h  |  3 ---
 tests/testgtk.c |  1 -
 3 files changed, 1 insertion(+), 54 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 8e9f31b23c..cbf2055993 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -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
diff --git a/gtk/gtklabel.h b/gtk/gtklabel.h
index b00e8cc0ad..a18c70af0b 100644
--- a/gtk/gtklabel.h
+++ b/gtk/gtklabel.h
@@ -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
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 61b66b69fc..57d194aa4c 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]