Re: GtkLabel patch



This looks good. Random comments follow below, but I think
it's ready to commit aside from that.

Regards,
                                        Owen


* No docs for gtk_label_get_accel_keyval()


* The docs for most of the properties are insufficient. (These will be the
  docs extracted out by gtk-doc and put into the SGML documentation
  as well.)

+						       _("The rendering attributes of this label."),

  "A list of style attributes to apply to the text of the label."

+							 _("The label is marked up."),

  "The text of the label includes XML markup. See pango_parse_markup()."

+							 _("Use underlin"),

  "Use underline
+							 _("Use underlines in the label text to mark accelerators."),

  "If set, an underline in the text indicates the next character should be used for the accelerator key"

+                                                      _("How to align each line of text in the label"),

 "The alignment of the lines in the text of the label relative to each
  other. This does NOT affect the alignment of the label within its
  allocation. See GtkMisc::xalign for that."

+                                                        _("Pattern for label underlines"),

 "A string with _ characters in positions correspond to characters in
  the text to underline."


+                                                        _("Whether words are wrapped at the end of a line."),

 "If set, wrap lines if the text becomes too wide."

+						      _("The accelerator key value of this label."),

 "The accelerator key for this label."

===
+/* Calculates text, attrs and accel_keyval from
+ * label, use_underline and use_markup */
+static void
+gtk_label_recalculate (GtkLabel *label)
+{
+  if (label->use_markup)
+      set_markup (label, label->label, label->use_underline);
+  else
+    {
+      if (label->use_underline)
+	gtk_label_set_uline_text_internal (label, label->label);
+      else
+	{
+	  gtk_label_set_text_internal (label, g_strdup (label->label));
+	  gtk_label_set_attributes_internal (label, NULL);
+	}
+    }
+
+  gtk_label_clear_layout (label);
   gtk_widget_queue_resize (GTK_WIDGET (label));
 }
===

* This needs to reset label->accel_keyval to GDK_VoidSymbol in
  the !label->use_underline case, right?

====
+static void
+gtk_label_set_use_underline_internal (GtkLabel *label,
+				      gboolean val)
+{
+  if (label->use_underline != val)
+    g_object_notify (G_OBJECT (label), "use_underline");
+  label->use_underline = val;
+}
====

* Even though this is an internal function and only currently
  called with TRUE/FALSE, I'd still code this (and similar places) as:

====
 val = val != FALSE;
 if (label->use_underline != value)
   {
     [...]
====   

=======
+guint
+gtk_label_parse_uline (GtkLabel    *label,
+		       const gchar *str)
+{
+  gtk_label_set_label_internal (label, g_strdup (str ? str : ""));
+  gtk_label_set_use_markup_internal (label, FALSE);
+  gtk_label_set_use_underline_internal (label, TRUE);
=======

* All public entry points need g_return_if_fail() at the start,
  even if the functions they call do subsequent checks.

  g_return_if_fail (GTK_IS_LABEL (label));






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