text cell renderer: Convert to g_object_notify_by_pspec

This avoids pspec lookup overhead in g_object_notify.
This commit is contained in:
Matthias Clasen 2015-09-06 15:31:37 -04:00
parent 14c0ed8bae
commit 65be0f5be9

View File

@ -150,10 +150,13 @@ enum {
PROP_RISE_SET, PROP_RISE_SET,
PROP_LANGUAGE_SET, PROP_LANGUAGE_SET,
PROP_ELLIPSIZE_SET, PROP_ELLIPSIZE_SET,
PROP_ALIGN_SET PROP_ALIGN_SET,
LAST_PROP
}; };
static guint text_cell_renderer_signals [LAST_SIGNAL]; static guint text_cell_renderer_signals [LAST_SIGNAL];
static GParamSpec *text_cell_renderer_props [LAST_PROP];
#define GTK_CELL_RENDERER_TEXT_PATH "gtk-cell-renderer-text-path" #define GTK_CELL_RENDERER_TEXT_PATH "gtk-cell-renderer-text-path"
@ -247,46 +250,40 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
cell_class->get_preferred_height_for_width = gtk_cell_renderer_text_get_preferred_height_for_width; cell_class->get_preferred_height_for_width = gtk_cell_renderer_text_get_preferred_height_for_width;
cell_class->get_aligned_area = gtk_cell_renderer_text_get_aligned_area; cell_class->get_aligned_area = gtk_cell_renderer_text_get_aligned_area;
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_TEXT] =
PROP_TEXT,
g_param_spec_string ("text", g_param_spec_string ("text",
P_("Text"), P_("Text"),
P_("Text to render"), P_("Text to render"),
NULL, NULL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_MARKUP] =
PROP_MARKUP,
g_param_spec_string ("markup", g_param_spec_string ("markup",
P_("Markup"), P_("Markup"),
P_("Marked up text to render"), P_("Marked up text to render"),
NULL, NULL,
GTK_PARAM_WRITABLE)); GTK_PARAM_WRITABLE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_ATTRIBUTES] =
PROP_ATTRIBUTES,
g_param_spec_boxed ("attributes", g_param_spec_boxed ("attributes",
P_("Attributes"), P_("Attributes"),
P_("A list of style attributes to apply to the text of the renderer"), P_("A list of style attributes to apply to the text of the renderer"),
PANGO_TYPE_ATTR_LIST, PANGO_TYPE_ATTR_LIST,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_SINGLE_PARAGRAPH_MODE] =
PROP_SINGLE_PARAGRAPH_MODE,
g_param_spec_boolean ("single-paragraph-mode", g_param_spec_boolean ("single-paragraph-mode",
P_("Single Paragraph Mode"), P_("Single Paragraph Mode"),
P_("Whether to keep all text in a single paragraph"), P_("Whether to keep all text in a single paragraph"),
FALSE, FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
text_cell_renderer_props[PROP_BACKGROUND] =
g_object_class_install_property (object_class,
PROP_BACKGROUND,
g_param_spec_string ("background", g_param_spec_string ("background",
P_("Background color name"), P_("Background color name"),
P_("Background color as a string"), P_("Background color as a string"),
NULL, NULL,
GTK_PARAM_WRITABLE)); GTK_PARAM_WRITABLE);
/** /**
* GtkCellRendererText:background-gdk: * GtkCellRendererText:background-gdk:
@ -296,13 +293,12 @@ gtk_cell_renderer_text_class_init (GtkCellRendererTextClass *class)
* Deprecated: 3.4: Use #GtkCellRendererText:background-rgba instead. * Deprecated: 3.4: Use #GtkCellRendererText:background-rgba instead.
*/ */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_BACKGROUND_GDK] =
PROP_BACKGROUND_GDK,
g_param_spec_boxed ("background-gdk", g_param_spec_boxed ("background-gdk",
P_("Background color"), P_("Background color"),
P_("Background color as a GdkColor"), P_("Background color as a GdkColor"),
GDK_TYPE_COLOR, GDK_TYPE_COLOR,
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED)); GTK_PARAM_READWRITE | G_PARAM_DEPRECATED);
G_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_END_IGNORE_DEPRECATIONS
/** /**
@ -312,20 +308,18 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since: 3.0 * Since: 3.0
*/ */
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_BACKGROUND_RGBA] =
PROP_BACKGROUND_RGBA,
g_param_spec_boxed ("background-rgba", g_param_spec_boxed ("background-rgba",
P_("Background color as RGBA"), P_("Background color as RGBA"),
P_("Background color as a GdkRGBA"), P_("Background color as a GdkRGBA"),
GDK_TYPE_RGBA, GDK_TYPE_RGBA,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_FOREGROUND] =
PROP_FOREGROUND,
g_param_spec_string ("foreground", g_param_spec_string ("foreground",
P_("Foreground color name"), P_("Foreground color name"),
P_("Foreground color as a string"), P_("Foreground color as a string"),
NULL, NULL,
GTK_PARAM_WRITABLE)); GTK_PARAM_WRITABLE);
/** /**
* GtkCellRendererText:foreground-gdk: * GtkCellRendererText:foreground-gdk:
@ -335,13 +329,12 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* Deprecated: 3.4: Use #GtkCellRendererText:foreground-rgba instead. * Deprecated: 3.4: Use #GtkCellRendererText:foreground-rgba instead.
*/ */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_FOREGROUND_GDK] =
PROP_FOREGROUND_GDK,
g_param_spec_boxed ("foreground-gdk", g_param_spec_boxed ("foreground-gdk",
P_("Foreground color"), P_("Foreground color"),
P_("Foreground color as a GdkColor"), P_("Foreground color as a GdkColor"),
GDK_TYPE_COLOR, GDK_TYPE_COLOR,
GTK_PARAM_READWRITE | G_PARAM_DEPRECATED)); GTK_PARAM_READWRITE | G_PARAM_DEPRECATED);
G_GNUC_END_IGNORE_DEPRECATIONS G_GNUC_END_IGNORE_DEPRECATIONS
/** /**
@ -351,154 +344,130 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since: 3.0 * Since: 3.0
*/ */
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_FOREGROUND_RGBA] =
PROP_FOREGROUND_RGBA,
g_param_spec_boxed ("foreground-rgba", g_param_spec_boxed ("foreground-rgba",
P_("Foreground color as RGBA"), P_("Foreground color as RGBA"),
P_("Foreground color as a GdkRGBA"), P_("Foreground color as a GdkRGBA"),
GDK_TYPE_RGBA, GDK_TYPE_RGBA,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_EDITABLE] =
PROP_EDITABLE,
g_param_spec_boolean ("editable", g_param_spec_boolean ("editable",
P_("Editable"), P_("Editable"),
P_("Whether the text can be modified by the user"), P_("Whether the text can be modified by the user"),
FALSE, FALSE,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_FONT] =
PROP_FONT,
g_param_spec_string ("font", g_param_spec_string ("font",
P_("Font"), P_("Font"),
P_("Font description as a string, e.g. \"Sans Italic 12\""), P_("Font description as a string, e.g. \"Sans Italic 12\""),
NULL, NULL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_FONT_DESC] =
PROP_FONT_DESC,
g_param_spec_boxed ("font-desc", g_param_spec_boxed ("font-desc",
P_("Font"), P_("Font"),
P_("Font description as a PangoFontDescription struct"), P_("Font description as a PangoFontDescription struct"),
PANGO_TYPE_FONT_DESCRIPTION, PANGO_TYPE_FONT_DESCRIPTION,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
text_cell_renderer_props[PROP_FAMILY] =
g_object_class_install_property (object_class,
PROP_FAMILY,
g_param_spec_string ("family", g_param_spec_string ("family",
P_("Font family"), P_("Font family"),
P_("Name of the font family, e.g. Sans, Helvetica, Times, Monospace"), P_("Name of the font family, e.g. Sans, Helvetica, Times, Monospace"),
NULL, NULL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_STYLE] =
PROP_STYLE,
g_param_spec_enum ("style", g_param_spec_enum ("style",
P_("Font style"), P_("Font style"),
P_("Font style"), P_("Font style"),
PANGO_TYPE_STYLE, PANGO_TYPE_STYLE,
PANGO_STYLE_NORMAL, PANGO_STYLE_NORMAL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_VARIANT] =
PROP_VARIANT,
g_param_spec_enum ("variant", g_param_spec_enum ("variant",
P_("Font variant"), P_("Font variant"),
P_("Font variant"), P_("Font variant"),
PANGO_TYPE_VARIANT, PANGO_TYPE_VARIANT,
PANGO_VARIANT_NORMAL, PANGO_VARIANT_NORMAL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_WEIGHT] =
PROP_WEIGHT,
g_param_spec_int ("weight", g_param_spec_int ("weight",
P_("Font weight"), P_("Font weight"),
P_("Font weight"), P_("Font weight"),
0, 0, G_MAXINT,
G_MAXINT,
PANGO_WEIGHT_NORMAL, PANGO_WEIGHT_NORMAL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_STRETCH] =
PROP_STRETCH,
g_param_spec_enum ("stretch", g_param_spec_enum ("stretch",
P_("Font stretch"), P_("Font stretch"),
P_("Font stretch"), P_("Font stretch"),
PANGO_TYPE_STRETCH, PANGO_TYPE_STRETCH,
PANGO_STRETCH_NORMAL, PANGO_STRETCH_NORMAL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_SIZE] =
PROP_SIZE,
g_param_spec_int ("size", g_param_spec_int ("size",
P_("Font size"), P_("Font size"),
P_("Font size"), P_("Font size"),
0, G_MAXINT,
0, 0,
G_MAXINT, GTK_PARAM_READWRITE);
0,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_SIZE_POINTS] =
PROP_SIZE_POINTS,
g_param_spec_double ("size-points", g_param_spec_double ("size-points",
P_("Font points"), P_("Font points"),
P_("Font size in points"), P_("Font size in points"),
0.0, G_MAXDOUBLE,
0.0, 0.0,
G_MAXDOUBLE, GTK_PARAM_READWRITE);
0.0,
GTK_PARAM_READWRITE));
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_SCALE] =
PROP_SCALE,
g_param_spec_double ("scale", g_param_spec_double ("scale",
P_("Font scale"), P_("Font scale"),
P_("Font scaling factor"), P_("Font scaling factor"),
0.0, 0.0, G_MAXDOUBLE,
G_MAXDOUBLE,
1.0, 1.0,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_RISE] =
PROP_RISE,
g_param_spec_int ("rise", g_param_spec_int ("rise",
P_("Rise"), P_("Rise"),
P_("Offset of text above the baseline " P_("Offset of text above the baseline (below the baseline if rise is negative)"),
"(below the baseline if rise is negative)"), -G_MAXINT, G_MAXINT,
-G_MAXINT,
G_MAXINT,
0, 0,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_STRIKETHROUGH] =
PROP_STRIKETHROUGH,
g_param_spec_boolean ("strikethrough", g_param_spec_boolean ("strikethrough",
P_("Strikethrough"), P_("Strikethrough"),
P_("Whether to strike through the text"), P_("Whether to strike through the text"),
FALSE, FALSE,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_UNDERLINE] =
PROP_UNDERLINE,
g_param_spec_enum ("underline", g_param_spec_enum ("underline",
P_("Underline"), P_("Underline"),
P_("Style of underline for this text"), P_("Style of underline for this text"),
PANGO_TYPE_UNDERLINE, PANGO_TYPE_UNDERLINE,
PANGO_UNDERLINE_NONE, PANGO_UNDERLINE_NONE,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_LANGUAGE] =
PROP_LANGUAGE,
g_param_spec_string ("language", g_param_spec_string ("language",
P_("Language"), P_("Language"),
P_("The language this text is in, as an ISO code. " P_("The language this text is in, as an ISO code. "
"Pango can use this as a hint when rendering the text. " "Pango can use this as a hint when rendering the text. "
"If you don't understand this parameter, you probably don't need it"), "If you don't understand this parameter, you probably don't need it"),
NULL, NULL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
/** /**
* GtkCellRendererText:ellipsize: * GtkCellRendererText:ellipsize:
@ -510,8 +479,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since: 2.6 * Since: 2.6
*/ */
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_ELLIPSIZE] =
PROP_ELLIPSIZE,
g_param_spec_enum ("ellipsize", g_param_spec_enum ("ellipsize",
P_("Ellipsize"), P_("Ellipsize"),
P_("The preferred place to ellipsize the string, " P_("The preferred place to ellipsize the string, "
@ -519,7 +487,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
"to display the entire string"), "to display the entire string"),
PANGO_TYPE_ELLIPSIZE_MODE, PANGO_TYPE_ELLIPSIZE_MODE,
PANGO_ELLIPSIZE_NONE, PANGO_ELLIPSIZE_NONE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/** /**
* GtkCellRendererText:width-chars: * GtkCellRendererText:width-chars:
@ -530,16 +498,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since: 2.6 * Since: 2.6
**/ **/
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_WIDTH_CHARS] =
PROP_WIDTH_CHARS,
g_param_spec_int ("width-chars", g_param_spec_int ("width-chars",
P_("Width In Characters"), P_("Width In Characters"),
P_("The desired width of the label, in characters"), P_("The desired width of the label, in characters"),
-1, G_MAXINT,
-1, -1,
G_MAXINT, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
-1,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/** /**
* GtkCellRendererText:max-width-chars: * GtkCellRendererText:max-width-chars:
@ -555,15 +520,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since: 3.0 * Since: 3.0
**/ **/
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_MAX_WIDTH_CHARS] =
PROP_MAX_WIDTH_CHARS,
g_param_spec_int ("max-width-chars", g_param_spec_int ("max-width-chars",
P_("Maximum Width In Characters"), P_("Maximum Width In Characters"),
P_("The maximum width of the cell, in characters"), P_("The maximum width of the cell, in characters"),
-1, G_MAXINT,
-1, -1,
G_MAXINT, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
-1,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/** /**
* GtkCellRendererText:wrap-mode: * GtkCellRendererText:wrap-mode:
@ -574,8 +537,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since: 2.8 * Since: 2.8
*/ */
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_WRAP_MODE] =
PROP_WRAP_MODE,
g_param_spec_enum ("wrap-mode", g_param_spec_enum ("wrap-mode",
P_("Wrap mode"), P_("Wrap mode"),
P_("How to break the string into multiple lines, " P_("How to break the string into multiple lines, "
@ -583,7 +545,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
"to display the entire string"), "to display the entire string"),
PANGO_TYPE_WRAP_MODE, PANGO_TYPE_WRAP_MODE,
PANGO_WRAP_CHAR, PANGO_WRAP_CHAR,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/** /**
* GtkCellRendererText:wrap-width: * GtkCellRendererText:wrap-width:
@ -594,15 +556,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since: 2.8 * Since: 2.8
*/ */
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_WRAP_WIDTH] =
PROP_WRAP_WIDTH,
g_param_spec_int ("wrap-width", g_param_spec_int ("wrap-width",
P_("Wrap width"), P_("Wrap width"),
P_("The width at which the text is wrapped"), P_("The width at which the text is wrapped"),
-1, G_MAXINT,
-1, -1,
G_MAXINT, GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
-1,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
/** /**
* GtkCellRendererText:alignment: * GtkCellRendererText:alignment:
@ -615,14 +575,13 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since: 2.10 * Since: 2.10
*/ */
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_ALIGN] =
PROP_ALIGN,
g_param_spec_enum ("alignment", g_param_spec_enum ("alignment",
P_("Alignment"), P_("Alignment"),
P_("How to align the lines"), P_("How to align the lines"),
PANGO_TYPE_ALIGNMENT, PANGO_TYPE_ALIGNMENT,
PANGO_ALIGN_LEFT, PANGO_ALIGN_LEFT,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY)); GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
/** /**
* GtkCellRendererText:placeholder-text: * GtkCellRendererText:placeholder-text:
@ -632,18 +591,16 @@ G_GNUC_END_IGNORE_DEPRECATIONS
* *
* Since 3.6 * Since 3.6
*/ */
g_object_class_install_property (object_class, text_cell_renderer_props[PROP_PLACEHOLDER_TEXT] =
PROP_PLACEHOLDER_TEXT,
g_param_spec_string ("placeholder-text", g_param_spec_string ("placeholder-text",
P_("Placeholder text"), P_("Placeholder text"),
P_("Text rendered when an editable cell is empty"), P_("Text rendered when an editable cell is empty"),
NULL, NULL,
GTK_PARAM_READWRITE)); GTK_PARAM_READWRITE);
/* Style props are set or not */ /* Style props are set or not */
#define ADD_SET_PROP(propname, propval, nick, blurb) g_object_class_install_property (object_class, propval, g_param_spec_boolean (propname, nick, blurb, FALSE, GTK_PARAM_READWRITE)) #define ADD_SET_PROP(propname, propval, nick, blurb) text_cell_renderer_props[propval] = g_param_spec_boolean (propname, nick, blurb, FALSE, GTK_PARAM_READWRITE)
ADD_SET_PROP ("background-set", PROP_BACKGROUND_SET, ADD_SET_PROP ("background-set", PROP_BACKGROUND_SET,
P_("Background set"), P_("Background set"),
@ -709,6 +666,8 @@ G_GNUC_END_IGNORE_DEPRECATIONS
P_("Align set"), P_("Align set"),
P_("Whether this tag affects the alignment mode")); P_("Whether this tag affects the alignment mode"));
g_object_class_install_properties (object_class, LAST_PROP, text_cell_renderer_props);
/** /**
* GtkCellRendererText::edited: * GtkCellRendererText::edited:
* @renderer: the object which received the signal * @renderer: the object which received the signal
@ -995,7 +954,7 @@ set_bg_color (GtkCellRendererText *celltext,
if (!priv->background_set) if (!priv->background_set)
{ {
priv->background_set = TRUE; priv->background_set = TRUE;
g_object_notify (G_OBJECT (celltext), "background-set"); g_object_notify_by_pspec (G_OBJECT (celltext), text_cell_renderer_props[PROP_BACKGROUND_SET]);
} }
priv->background = *rgba; priv->background = *rgba;
@ -1005,7 +964,7 @@ set_bg_color (GtkCellRendererText *celltext,
if (priv->background_set) if (priv->background_set)
{ {
priv->background_set = FALSE; priv->background_set = FALSE;
g_object_notify (G_OBJECT (celltext), "background-set"); g_object_notify_by_pspec (G_OBJECT (celltext), text_cell_renderer_props[PROP_BACKGROUND_SET]);
} }
} }
} }
@ -1022,7 +981,7 @@ set_fg_color (GtkCellRendererText *celltext,
if (!priv->foreground_set) if (!priv->foreground_set)
{ {
priv->foreground_set = TRUE; priv->foreground_set = TRUE;
g_object_notify (G_OBJECT (celltext), "foreground-set"); g_object_notify_by_pspec (G_OBJECT (celltext), text_cell_renderer_props[PROP_FOREGROUND_SET]);
} }
priv->foreground = *rgba; priv->foreground = *rgba;
@ -1032,7 +991,7 @@ set_fg_color (GtkCellRendererText *celltext,
if (priv->foreground_set) if (priv->foreground_set)
{ {
priv->foreground_set = FALSE; priv->foreground_set = FALSE;
g_object_notify (G_OBJECT (celltext), "foreground-set"); g_object_notify_by_pspec (G_OBJECT (celltext), text_cell_renderer_props[PROP_FOREGROUND_SET]);
} }
} }
} }
@ -1082,17 +1041,17 @@ notify_set_changed (GObject *object,
PangoFontMask changed_mask) PangoFontMask changed_mask)
{ {
if (changed_mask & PANGO_FONT_MASK_FAMILY) if (changed_mask & PANGO_FONT_MASK_FAMILY)
g_object_notify (object, "family-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_FAMILY_SET]);
if (changed_mask & PANGO_FONT_MASK_STYLE) if (changed_mask & PANGO_FONT_MASK_STYLE)
g_object_notify (object, "style-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_STYLE_SET]);
if (changed_mask & PANGO_FONT_MASK_VARIANT) if (changed_mask & PANGO_FONT_MASK_VARIANT)
g_object_notify (object, "variant-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_VARIANT_SET]);
if (changed_mask & PANGO_FONT_MASK_WEIGHT) if (changed_mask & PANGO_FONT_MASK_WEIGHT)
g_object_notify (object, "weight-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_WEIGHT_SET]);
if (changed_mask & PANGO_FONT_MASK_STRETCH) if (changed_mask & PANGO_FONT_MASK_STRETCH)
g_object_notify (object, "stretch-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_STRETCH_SET]);
if (changed_mask & PANGO_FONT_MASK_SIZE) if (changed_mask & PANGO_FONT_MASK_SIZE)
g_object_notify (object, "size-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_SIZE_SET]);
} }
static void static void
@ -1100,17 +1059,20 @@ notify_fields_changed (GObject *object,
PangoFontMask changed_mask) PangoFontMask changed_mask)
{ {
if (changed_mask & PANGO_FONT_MASK_FAMILY) if (changed_mask & PANGO_FONT_MASK_FAMILY)
g_object_notify (object, "family"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_FAMILY]);
if (changed_mask & PANGO_FONT_MASK_STYLE) if (changed_mask & PANGO_FONT_MASK_STYLE)
g_object_notify (object, "style"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_STYLE]);
if (changed_mask & PANGO_FONT_MASK_VARIANT) if (changed_mask & PANGO_FONT_MASK_VARIANT)
g_object_notify (object, "variant"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_VARIANT]);
if (changed_mask & PANGO_FONT_MASK_WEIGHT) if (changed_mask & PANGO_FONT_MASK_WEIGHT)
g_object_notify (object, "weight"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_WEIGHT]);
if (changed_mask & PANGO_FONT_MASK_STRETCH) if (changed_mask & PANGO_FONT_MASK_STRETCH)
g_object_notify (object, "stretch"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_STRETCH]);
if (changed_mask & PANGO_FONT_MASK_SIZE) if (changed_mask & PANGO_FONT_MASK_SIZE)
g_object_notify (object, "size"); {
g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_SIZE]);
g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_SIZE_POINTS]);
}
} }
static void static void
@ -1138,25 +1100,10 @@ set_font_description (GtkCellRendererText *celltext,
g_object_freeze_notify (object); g_object_freeze_notify (object);
g_object_notify (object, "font-desc"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_FONT_DESC]);
g_object_notify (object, "font"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_FONT]);
if (changed_mask & PANGO_FONT_MASK_FAMILY)
g_object_notify (object, "family");
if (changed_mask & PANGO_FONT_MASK_STYLE)
g_object_notify (object, "style");
if (changed_mask & PANGO_FONT_MASK_VARIANT)
g_object_notify (object, "variant");
if (changed_mask & PANGO_FONT_MASK_WEIGHT)
g_object_notify (object, "weight");
if (changed_mask & PANGO_FONT_MASK_STRETCH)
g_object_notify (object, "stretch");
if (changed_mask & PANGO_FONT_MASK_SIZE)
{
g_object_notify (object, "size");
g_object_notify (object, "size-points");
}
notify_fields_changed (object, changed_mask);
notify_set_changed (object, set_changed_mask); notify_set_changed (object, set_changed_mask);
g_object_thaw_notify (object); g_object_thaw_notify (object);
@ -1185,7 +1132,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
} }
priv->text = g_value_dup_string (value); priv->text = g_value_dup_string (value);
g_object_notify (object, "text"); g_object_notify_by_pspec (object, pspec);
break; break;
case PROP_ATTRIBUTES: case PROP_ATTRIBUTES:
@ -1204,13 +1151,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
PangoAttrList *attrs = NULL; PangoAttrList *attrs = NULL;
str = g_value_get_string (value); str = g_value_get_string (value);
if (str && !pango_parse_markup (str, if (str && !pango_parse_markup (str, -1, 0, &attrs, &text, NULL, &error))
-1,
0,
&attrs,
&text,
NULL,
&error))
{ {
g_warning ("Failed to set text from markup due to error parsing markup: %s", g_warning ("Failed to set text from markup due to error parsing markup: %s",
error->message); error->message);
@ -1248,7 +1189,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
else else
g_warning ("Don't know color `%s'", g_value_get_string (value)); g_warning ("Don't know color `%s'", g_value_get_string (value));
g_object_notify (object, "background-gdk"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_BACKGROUND_GDK]);
} }
break; break;
@ -1263,7 +1204,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
else else
g_warning ("Don't know color `%s'", g_value_get_string (value)); g_warning ("Don't know color `%s'", g_value_get_string (value));
g_object_notify (object, "foreground-gdk"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_FOREGROUND_GDK]);
} }
break; break;
@ -1314,12 +1255,10 @@ gtk_cell_renderer_text_set_property (GObject *object,
break; break;
case PROP_BACKGROUND_RGBA: case PROP_BACKGROUND_RGBA:
/* This notifies the GObject itself. */
set_bg_color (celltext, g_value_get_boxed (value)); set_bg_color (celltext, g_value_get_boxed (value));
break; break;
case PROP_FOREGROUND_RGBA: case PROP_FOREGROUND_RGBA:
/* This notifies the GObject itself. */
set_fg_color (celltext, g_value_get_boxed (value)); set_fg_color (celltext, g_value_get_boxed (value));
break; break;
@ -1384,12 +1323,12 @@ gtk_cell_renderer_text_set_property (GObject *object,
case PROP_SIZE: case PROP_SIZE:
pango_font_description_set_size (priv->font, pango_font_description_set_size (priv->font,
g_value_get_int (value)); g_value_get_int (value));
g_object_notify (object, "size"); g_object_notify_by_pspec (object, pspec);
break; break;
case PROP_SIZE_POINTS: case PROP_SIZE_POINTS:
pango_font_description_set_size (priv->font, pango_font_description_set_size (priv->font,
g_value_get_double (value) * PANGO_SCALE); g_value_get_double (value) * PANGO_SCALE);
g_object_notify (object, "size-points"); g_object_notify_by_pspec (object, pspec);
break; break;
} }
@ -1397,8 +1336,8 @@ gtk_cell_renderer_text_set_property (GObject *object,
priv->calc_fixed_height = TRUE; priv->calc_fixed_height = TRUE;
notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (priv->font)); notify_set_changed (object, old_set_mask & pango_font_description_get_set_fields (priv->font));
g_object_notify (object, "font-desc"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_FONT_DESC]);
g_object_notify (object, "font"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_FONT]);
break; break;
} }
@ -1408,7 +1347,7 @@ gtk_cell_renderer_text_set_property (GObject *object,
priv->scale_set = TRUE; priv->scale_set = TRUE;
if (priv->fixed_height_rows != -1) if (priv->fixed_height_rows != -1)
priv->calc_fixed_height = TRUE; priv->calc_fixed_height = TRUE;
g_object_notify (object, "scale-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_SCALE_SET]);
break; break;
case PROP_EDITABLE: case PROP_EDITABLE:
@ -1418,26 +1357,26 @@ gtk_cell_renderer_text_set_property (GObject *object,
g_object_set (celltext, "mode", GTK_CELL_RENDERER_MODE_EDITABLE, NULL); g_object_set (celltext, "mode", GTK_CELL_RENDERER_MODE_EDITABLE, NULL);
else else
g_object_set (celltext, "mode", GTK_CELL_RENDERER_MODE_INERT, NULL); g_object_set (celltext, "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
g_object_notify (object, "editable-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_EDITABLE_SET]);
break; break;
case PROP_STRIKETHROUGH: case PROP_STRIKETHROUGH:
priv->strikethrough = g_value_get_boolean (value); priv->strikethrough = g_value_get_boolean (value);
priv->strikethrough_set = TRUE; priv->strikethrough_set = TRUE;
g_object_notify (object, "strikethrough-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_STRIKETHROUGH_SET]);
break; break;
case PROP_UNDERLINE: case PROP_UNDERLINE:
priv->underline_style = g_value_get_enum (value); priv->underline_style = g_value_get_enum (value);
priv->underline_set = TRUE; priv->underline_set = TRUE;
g_object_notify (object, "underline-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_UNDERLINE_SET]);
break; break;
case PROP_RISE: case PROP_RISE:
priv->rise = g_value_get_int (value); priv->rise = g_value_get_int (value);
priv->rise_set = TRUE; priv->rise_set = TRUE;
g_object_notify (object, "rise-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_RISE_SET]);
if (priv->fixed_height_rows != -1) if (priv->fixed_height_rows != -1)
priv->calc_fixed_height = TRUE; priv->calc_fixed_height = TRUE;
break; break;
@ -1447,13 +1386,13 @@ gtk_cell_renderer_text_set_property (GObject *object,
if (priv->language) if (priv->language)
g_object_unref (priv->language); g_object_unref (priv->language);
priv->language = pango_language_from_string (g_value_get_string (value)); priv->language = pango_language_from_string (g_value_get_string (value));
g_object_notify (object, "language-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_LANGUAGE_SET]);
break; break;
case PROP_ELLIPSIZE: case PROP_ELLIPSIZE:
priv->ellipsize = g_value_get_enum (value); priv->ellipsize = g_value_get_enum (value);
priv->ellipsize_set = TRUE; priv->ellipsize_set = TRUE;
g_object_notify (object, "ellipsize-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_ELLIPSIZE_SET]);
break; break;
case PROP_WRAP_MODE: case PROP_WRAP_MODE:
@ -1492,10 +1431,10 @@ gtk_cell_renderer_text_set_property (GObject *object,
if (priv->align != g_value_get_enum (value)) if (priv->align != g_value_get_enum (value))
{ {
priv->align = g_value_get_enum (value); priv->align = g_value_get_enum (value);
g_object_notify (object, "alignment"); g_object_notify_by_pspec (object, pspec);
} }
priv->align_set = TRUE; priv->align_set = TRUE;
g_object_notify (object, "align-set"); g_object_notify_by_pspec (object, text_cell_renderer_props[PROP_ALIGN_SET]);
break; break;
case PROP_BACKGROUND_SET: case PROP_BACKGROUND_SET: