diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-0 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-2 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-4 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-6 | 9 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 9 | ||||
-rw-r--r-- | gtk/gtkcellrenderertext.c | 55 | ||||
-rw-r--r-- | gtk/gtkcellrenderertext.h | 2 | ||||
-rw-r--r-- | gtk/treestoretest.c | 8 | ||||
-rw-r--r-- | tests/treestoretest.c | 8 |
11 files changed, 121 insertions, 15 deletions
@@ -1,5 +1,14 @@ 2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtkcellrenderertext.[ch]: + Add a "markup" property. + + * gtk/treestoretest.c: + Use the markup property, remove some leftover stuff from + GtkTreeModelMapping. + +2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtklabel.c (gtk_label_set_selectable): Queue a redraw if the selectable setting was changed. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 72fc3f592a..6f499f155d 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,5 +1,14 @@ 2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtkcellrenderertext.[ch]: + Add a "markup" property. + + * gtk/treestoretest.c: + Use the markup property, remove some leftover stuff from + GtkTreeModelMapping. + +2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtklabel.c (gtk_label_set_selectable): Queue a redraw if the selectable setting was changed. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 72fc3f592a..6f499f155d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,14 @@ 2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtkcellrenderertext.[ch]: + Add a "markup" property. + + * gtk/treestoretest.c: + Use the markup property, remove some leftover stuff from + GtkTreeModelMapping. + +2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtklabel.c (gtk_label_set_selectable): Queue a redraw if the selectable setting was changed. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 72fc3f592a..6f499f155d 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,5 +1,14 @@ 2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtkcellrenderertext.[ch]: + Add a "markup" property. + + * gtk/treestoretest.c: + Use the markup property, remove some leftover stuff from + GtkTreeModelMapping. + +2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtklabel.c (gtk_label_set_selectable): Queue a redraw if the selectable setting was changed. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 72fc3f592a..6f499f155d 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,5 +1,14 @@ 2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtkcellrenderertext.[ch]: + Add a "markup" property. + + * gtk/treestoretest.c: + Use the markup property, remove some leftover stuff from + GtkTreeModelMapping. + +2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtklabel.c (gtk_label_set_selectable): Queue a redraw if the selectable setting was changed. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 72fc3f592a..6f499f155d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,14 @@ 2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtkcellrenderertext.[ch]: + Add a "markup" property. + + * gtk/treestoretest.c: + Use the markup property, remove some leftover stuff from + GtkTreeModelMapping. + +2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtklabel.c (gtk_label_set_selectable): Queue a redraw if the selectable setting was changed. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 72fc3f592a..6f499f155d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,14 @@ 2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtkcellrenderertext.[ch]: + Add a "markup" property. + + * gtk/treestoretest.c: + Use the markup property, remove some leftover stuff from + GtkTreeModelMapping. + +2001-02-20 Alexander Larsson <alexl@redhat.com> + * gtk/gtklabel.c (gtk_label_set_selectable): Queue a redraw if the selectable setting was changed. diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c index cf803dd1b8..a37a728705 100644 --- a/gtk/gtkcellrenderertext.c +++ b/gtk/gtkcellrenderertext.c @@ -53,6 +53,7 @@ enum { PROP_0, PROP_TEXT, + PROP_MARKUP, /* Style args */ PROP_BACKGROUND, @@ -150,6 +151,14 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class) G_PARAM_READWRITE)); g_object_class_install_property (object_class, + PROP_MARKUP, + g_param_spec_string ("markup", + _("Markup"), + _("Marked up text to render"), + NULL, + G_PARAM_WRITABLE)); + + g_object_class_install_property (object_class, PROP_BACKGROUND, g_param_spec_string ("background", _("Background color name"), @@ -364,7 +373,10 @@ gtk_cell_renderer_text_finalize (GObject *object) if (celltext->text) g_free (celltext->text); - + + if (celltext->extra_attrs) + pango_attr_list_unref (celltext->extra_attrs); + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -516,6 +528,7 @@ gtk_cell_renderer_text_get_property (GObject *object, case PROP_BACKGROUND: case PROP_FOREGROUND: + case PROP_MARKUP: default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; @@ -655,6 +668,39 @@ gtk_cell_renderer_text_set_property (GObject *object, celltext->text = g_strdup (g_value_get_string (value)); break; + case PROP_MARKUP: + { + const gchar *str; + gchar *text = NULL; + GError *error = NULL; + PangoAttrList *attrs = NULL; + + if (celltext->text) + g_free (celltext->text); + + if (celltext->extra_attrs) + pango_attr_list_unref (celltext->extra_attrs); + + str = g_value_get_string (value); + if (str && !pango_parse_markup (str, + -1, + 0, + &attrs, + &text, + NULL, + &error)) + { + g_warning ("Failed to set cell text from markup due to error parsing markup: %s", + error->message); + g_error_free (error); + return; + } + + celltext->text = text; + celltext->extra_attrs = attrs; + } + break; + case PROP_BACKGROUND: { GdkColor color; @@ -893,8 +939,11 @@ get_layout (GtkCellRendererText *celltext, PangoUnderline uline; layout = gtk_widget_create_pango_layout (widget, celltext->text); - - attr_list = pango_attr_list_new (); + + if (celltext->extra_attrs) + attr_list = pango_attr_list_copy (celltext->extra_attrs); + else + attr_list = pango_attr_list_new (); if (will_render) { diff --git a/gtk/gtkcellrenderertext.h b/gtk/gtkcellrenderertext.h index b2270b3de0..fd906a3350 100644 --- a/gtk/gtkcellrenderertext.h +++ b/gtk/gtkcellrenderertext.h @@ -46,6 +46,8 @@ struct _GtkCellRendererText PangoFontDescription font; PangoColor foreground; PangoColor background; + + PangoAttrList *extra_attrs; PangoUnderline underline_style; diff --git a/gtk/treestoretest.c b/gtk/treestoretest.c index 8244bb4931..1b2222f2b4 100644 --- a/gtk/treestoretest.c +++ b/gtk/treestoretest.c @@ -21,7 +21,7 @@ node_set (GtkTreeIter *iter) gint n; gchar *str; - str = g_strdup_printf ("Row (%d)", i++); + str = g_strdup_printf ("Row (<span color=\"red\">%d</span>)", i++); gtk_tree_store_set (base_model, iter, 0, str, -1); g_free (str); @@ -236,9 +236,6 @@ make_window (gint view_type) case 1: gtk_window_set_title (GTK_WINDOW (window), "Sorted list"); break; - case 2: - gtk_window_set_title (GTK_WINDOW (window), "Uppercase flipped list"); - break; } vbox = gtk_vbox_new (FALSE, 8); @@ -321,7 +318,7 @@ make_window (gint view_type) /* The selected column */ cell = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes ("Node ID", cell, "text", 0, NULL); + column = gtk_tree_view_column_new_with_attributes ("Node ID", cell, "markup", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); cell = gtk_cell_renderer_text_new (); @@ -352,7 +349,6 @@ main (int argc, char *argv[]) /* FIXME: reverse this */ make_window (0); make_window (1); - make_window (2); gtk_main (); diff --git a/tests/treestoretest.c b/tests/treestoretest.c index 8244bb4931..1b2222f2b4 100644 --- a/tests/treestoretest.c +++ b/tests/treestoretest.c @@ -21,7 +21,7 @@ node_set (GtkTreeIter *iter) gint n; gchar *str; - str = g_strdup_printf ("Row (%d)", i++); + str = g_strdup_printf ("Row (<span color=\"red\">%d</span>)", i++); gtk_tree_store_set (base_model, iter, 0, str, -1); g_free (str); @@ -236,9 +236,6 @@ make_window (gint view_type) case 1: gtk_window_set_title (GTK_WINDOW (window), "Sorted list"); break; - case 2: - gtk_window_set_title (GTK_WINDOW (window), "Uppercase flipped list"); - break; } vbox = gtk_vbox_new (FALSE, 8); @@ -321,7 +318,7 @@ make_window (gint view_type) /* The selected column */ cell = gtk_cell_renderer_text_new (); - column = gtk_tree_view_column_new_with_attributes ("Node ID", cell, "text", 0, NULL); + column = gtk_tree_view_column_new_with_attributes ("Node ID", cell, "markup", 0, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column); cell = gtk_cell_renderer_text_new (); @@ -352,7 +349,6 @@ main (int argc, char *argv[]) /* FIXME: reverse this */ make_window (0); make_window (1); - make_window (2); gtk_main (); |