Fix a warning.

* gtk/gtktextlayout.c: Fix a warning.

	* gtk/gtktextsegment.h:
	* gtk/gtktextsegment.c:
	* gtk/gtktextchild.c:
	* gtk/gtktextbtree.c:
	* gtk/gtktextmark.c:
	* gtk/gtktexttypes.h: Make the segment class pointers const.

	* gtk/gtktextbufferserialize.c: Make parser struct const.

	* gtk/gtkuimanager.c: Make parser struct const.
This commit is contained in:
Matthias Clasen 2006-04-03 15:50:30 +00:00
parent 0351d5671d
commit 8de7c8b761
11 changed files with 50 additions and 30 deletions

View File

@ -1,5 +1,16 @@
2006-04-03 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextlayout.c: Fix a warning.
* gtk/gtktextsegment.h:
* gtk/gtktextsegment.c:
* gtk/gtktextmark.c:
* gtk/gtktexttypes.h: Make the segment class pointers const.
* gtk/gtktextbufferserialize.c: Make parser struct const.
* gtk/gtkuimanager.c: Make parser struct const.
* gtk/gtklinkbutton.c: Make the default colors const.
* gtk/gtkuimanager.c: Avoid relocations.

View File

@ -1,5 +1,16 @@
2006-04-03 Matthias Clasen <mclasen@redhat.com>
* gtk/gtktextlayout.c: Fix a warning.
* gtk/gtktextsegment.h:
* gtk/gtktextsegment.c:
* gtk/gtktextmark.c:
* gtk/gtktexttypes.h: Make the segment class pointers const.
* gtk/gtktextbufferserialize.c: Make parser struct const.
* gtk/gtkuimanager.c: Make parser struct const.
* gtk/gtklinkbutton.c: Make the default colors const.
* gtk/gtkuimanager.c: Avoid relocations.

View File

@ -6923,7 +6923,7 @@ _gtk_text_btree_check (GtkTextBTree *tree)
}
else
{
GtkTextLineSegmentClass * last = NULL;
const GtkTextLineSegmentClass *last = NULL;
for (line = node->children.line ; line != NULL ;
line = line->next)

View File

@ -1798,8 +1798,7 @@ deserialize_text (GtkTextBuffer *buffer,
ParseInfo info;
gboolean retval = FALSE;
static GMarkupParser rich_text_parser = {
static const GMarkupParser rich_text_parser = {
start_element_handler,
end_element_handler,
text_handler,

View File

@ -108,7 +108,7 @@ pixbuf_segment_check_func (GtkTextLineSegment *seg,
}
GtkTextLineSegmentClass gtk_text_pixbuf_type = {
const GtkTextLineSegmentClass gtk_text_pixbuf_type = {
"pixbuf", /* name */
FALSE, /* leftGravity */
NULL, /* splitFunc */
@ -206,7 +206,7 @@ child_segment_check_func (GtkTextLineSegment *seg,
g_error ("child segment has char count of %d", seg->char_count);
}
GtkTextLineSegmentClass gtk_text_child_type = {
const GtkTextLineSegmentClass gtk_text_child_type = {
"child-widget", /* name */
FALSE, /* leftGravity */
NULL, /* splitFunc */

View File

@ -1293,7 +1293,6 @@ set_para_values (GtkTextLayout *layout,
pango_layout_set_width (display->layout, layout_width * PANGO_SCALE);
pango_layout_set_wrap (display->layout, PANGO_WRAP_CHAR);
break;
case GTK_WRAP_WORD:
layout_width = layout->screen_width - display->left_margin - display->right_margin;
pango_layout_set_width (display->layout, layout_width * PANGO_SCALE);
@ -1329,14 +1328,14 @@ gtk_text_attr_appearance_copy (const PangoAttribute *attr)
static void
gtk_text_attr_appearance_destroy (PangoAttribute *attr)
{
GtkTextAppearance *appearance = &((GtkTextAttrAppearance *)attr)->appearance;
GtkTextAttrAppearance *appearance_attr = (GtkTextAttrAppearance *)attr;
if (appearance->bg_stipple)
g_object_unref (appearance->bg_stipple);
if (appearance->fg_stipple)
g_object_unref (appearance->fg_stipple);
if (appearance_attr->appearance.bg_stipple)
g_object_unref (appearance_attr->appearance.bg_stipple);
if (appearance_attr->appearance.fg_stipple)
g_object_unref (appearance_attr->appearance.fg_stipple);
g_slice_free (GtkTextAttrAppearance, attr);
g_slice_free (GtkTextAttrAppearance, appearance_attr);
}
static gboolean

View File

@ -291,7 +291,7 @@ static void mark_segment_check_func (GtkTextLineSegment *segPtr
* their gravity property.
*/
GtkTextLineSegmentClass gtk_text_right_mark_type = {
const GtkTextLineSegmentClass gtk_text_right_mark_type = {
"mark", /* name */
FALSE, /* leftGravity */
NULL, /* splitFunc */
@ -301,7 +301,7 @@ GtkTextLineSegmentClass gtk_text_right_mark_type = {
mark_segment_check_func /* checkFunc */
};
GtkTextLineSegmentClass gtk_text_left_mark_type = {
const GtkTextLineSegmentClass gtk_text_left_mark_type = {
"mark", /* name */
TRUE, /* leftGravity */
NULL, /* splitFunc */

View File

@ -196,7 +196,7 @@ _gtk_char_segment_new (const gchar *text, guint len)
g_assert (gtk_text_byte_begins_utf8_char (text));
seg = g_malloc (CSEG_SIZE (len));
seg->type = &gtk_text_char_type;
seg->type = (GtkTextLineSegmentClass *)&gtk_text_char_type;
seg->next = NULL;
seg->byte_count = len;
memcpy (seg->body.chars, text, len);
@ -590,7 +590,7 @@ toggle_segment_line_change_func (segPtr, line)
*/
GtkTextLineSegmentClass gtk_text_char_type = {
const GtkTextLineSegmentClass gtk_text_char_type = {
"character", /* name */
0, /* leftGravity */
char_segment_split_func, /* splitFunc */
@ -605,7 +605,7 @@ GtkTextLineSegmentClass gtk_text_char_type = {
* range:
*/
GtkTextLineSegmentClass gtk_text_toggle_on_type = {
const GtkTextLineSegmentClass gtk_text_toggle_on_type = {
"toggleOn", /* name */
0, /* leftGravity */
NULL, /* splitFunc */
@ -620,7 +620,7 @@ GtkTextLineSegmentClass gtk_text_toggle_on_type = {
* range:
*/
GtkTextLineSegmentClass gtk_text_toggle_off_type = {
const GtkTextLineSegmentClass gtk_text_toggle_off_type = {
"toggleOff", /* name */
1, /* leftGravity */
NULL, /* splitFunc */

View File

@ -131,10 +131,10 @@ struct _GtkTextLineSegmentClass {
*/
struct _GtkTextLineSegment {
GtkTextLineSegmentClass *type; /* Pointer to record describing
* segment's type. */
GtkTextLineSegment *next; /* Next in list of segments for this
* line, or NULL for end of list. */
const GtkTextLineSegmentClass *type; /* Pointer to record describing
* segment's type. */
GtkTextLineSegment *next; /* Next in list of segments for this
* line, or NULL for end of list. */
int char_count; /* # of chars of index space occupied */

View File

@ -55,17 +55,17 @@ typedef struct _GtkTextMarkBody GtkTextMarkBody;
#endif
/* In gtktextbtree.c */
extern GtkTextLineSegmentClass gtk_text_char_type;
extern GtkTextLineSegmentClass gtk_text_toggle_on_type;
extern GtkTextLineSegmentClass gtk_text_toggle_off_type;
extern const GtkTextLineSegmentClass gtk_text_char_type;
extern const GtkTextLineSegmentClass gtk_text_toggle_on_type;
extern const GtkTextLineSegmentClass gtk_text_toggle_off_type;
/* In gtktextmark.c */
extern GtkTextLineSegmentClass gtk_text_left_mark_type;
extern GtkTextLineSegmentClass gtk_text_right_mark_type;
extern const GtkTextLineSegmentClass gtk_text_left_mark_type;
extern const GtkTextLineSegmentClass gtk_text_right_mark_type;
/* In gtktextchild.c */
extern GtkTextLineSegmentClass gtk_text_pixbuf_type;
extern GtkTextLineSegmentClass gtk_text_child_type;
extern const GtkTextLineSegmentClass gtk_text_pixbuf_type;
extern const GtkTextLineSegmentClass gtk_text_child_type;
/*
* UTF 8 Stubs

View File

@ -1467,7 +1467,7 @@ text_handler (GMarkupParseContext *context,
}
static GMarkupParser ui_parser = {
static const GMarkupParser ui_parser = {
start_element_handler,
end_element_handler,
text_handler,