remove g_assert_not_reached() that was bogus, since we demand-create the

2001-12-04  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): remove
	g_assert_not_reached() that was bogus, since we demand-create the
	tag info. reported by Chris Phelps

        Jump through assorted hoops to fix bug from Chris Phelps where
	removing tags from the table resulted in btree trying to
	access tag->table

	* gtk/gtktextbuffer.c: set up mechanics of adding/removing
	ourselves to the tag table

	* gtk/gtktexttagtable.c (_gtk_text_tag_table_add_buffer)
	(_gtk_text_tag_table_remove_buffer): private cruft to
	let us notify buffer of disappearing tags

	* gtk/gtktexttag.h: remove BTreeNode typedef from this public
	header, put it in tagprivate

	* gtk/gtktextbtree.c (_gtk_text_btree_new): don't connect to
	tag_removed; it's emitted too late.
	(_gtk_text_btree_notify_will_remove_tag): rename tag_remove_cb to
	this

	Padding for ABI-compat expansion

	* gtk/gtktexttag.h (struct _GtkTextAttributes): pad this
	(struct _GtkTextAppearance): one pad in here too

	* gtk/gtktextlayout.h (struct _GtkTextLayoutClass): padding here

	* gtk/gtktextview.h (struct _GtkTextViewClass): more padding,
	since action signals etc. seem pretty likely

	* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): padding

	* gtk/gtktexttag.h (struct _GtkTextTagClass): padding

	* gtk/gtktexttagtable.h (struct _GtkTextTagTableClass): padding
This commit is contained in:
Havoc Pennington 2001-12-05 01:43:48 +00:00 committed by Havoc Pennington
parent a7bab735ad
commit 6b1407a3ec
17 changed files with 410 additions and 35 deletions

View File

@ -1,3 +1,44 @@
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): remove
g_assert_not_reached() that was bogus, since we demand-create the
tag info. reported by Chris Phelps
Jump through assorted hoops to fix bug from Chris Phelps where
removing tags from the table resulted in btree trying to
access tag->table
* gtk/gtktextbuffer.c: set up mechanics of adding/removing
ourselves to the tag table
* gtk/gtktexttagtable.c (_gtk_text_tag_table_add_buffer)
(_gtk_text_tag_table_remove_buffer): private cruft to
let us notify buffer of disappearing tags
* gtk/gtktexttag.h: remove BTreeNode typedef from this public
header, put it in tagprivate
* gtk/gtktextbtree.c (_gtk_text_btree_new): don't connect to
tag_removed; it's emitted too late.
(_gtk_text_btree_notify_will_remove_tag): rename tag_remove_cb to
this
Padding for ABI-compat expansion
* gtk/gtktexttag.h (struct _GtkTextAttributes): pad this
(struct _GtkTextAppearance): one pad in here too
* gtk/gtktextlayout.h (struct _GtkTextLayoutClass): padding here
* gtk/gtktextview.h (struct _GtkTextViewClass): more padding,
since action signals etc. seem pretty likely
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): padding
* gtk/gtktexttag.h (struct _GtkTextTagClass): padding
* gtk/gtktexttagtable.h (struct _GtkTextTagTableClass): padding
2001-12-04 Matthias Clasen <matthiasc@poet.de>
* gdk/gdkcolor.h (gdk_colormap_change): Deprecate. (#65851)
@ -26,7 +67,7 @@ Tue Dec 4 18:38:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.h: ditto
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (gtk_text_tag_set_property): add a warning for
"invisible" property, #65999

View File

@ -1,3 +1,44 @@
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): remove
g_assert_not_reached() that was bogus, since we demand-create the
tag info. reported by Chris Phelps
Jump through assorted hoops to fix bug from Chris Phelps where
removing tags from the table resulted in btree trying to
access tag->table
* gtk/gtktextbuffer.c: set up mechanics of adding/removing
ourselves to the tag table
* gtk/gtktexttagtable.c (_gtk_text_tag_table_add_buffer)
(_gtk_text_tag_table_remove_buffer): private cruft to
let us notify buffer of disappearing tags
* gtk/gtktexttag.h: remove BTreeNode typedef from this public
header, put it in tagprivate
* gtk/gtktextbtree.c (_gtk_text_btree_new): don't connect to
tag_removed; it's emitted too late.
(_gtk_text_btree_notify_will_remove_tag): rename tag_remove_cb to
this
Padding for ABI-compat expansion
* gtk/gtktexttag.h (struct _GtkTextAttributes): pad this
(struct _GtkTextAppearance): one pad in here too
* gtk/gtktextlayout.h (struct _GtkTextLayoutClass): padding here
* gtk/gtktextview.h (struct _GtkTextViewClass): more padding,
since action signals etc. seem pretty likely
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): padding
* gtk/gtktexttag.h (struct _GtkTextTagClass): padding
* gtk/gtktexttagtable.h (struct _GtkTextTagTableClass): padding
2001-12-04 Matthias Clasen <matthiasc@poet.de>
* gdk/gdkcolor.h (gdk_colormap_change): Deprecate. (#65851)
@ -26,7 +67,7 @@ Tue Dec 4 18:38:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.h: ditto
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (gtk_text_tag_set_property): add a warning for
"invisible" property, #65999

View File

@ -1,3 +1,44 @@
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): remove
g_assert_not_reached() that was bogus, since we demand-create the
tag info. reported by Chris Phelps
Jump through assorted hoops to fix bug from Chris Phelps where
removing tags from the table resulted in btree trying to
access tag->table
* gtk/gtktextbuffer.c: set up mechanics of adding/removing
ourselves to the tag table
* gtk/gtktexttagtable.c (_gtk_text_tag_table_add_buffer)
(_gtk_text_tag_table_remove_buffer): private cruft to
let us notify buffer of disappearing tags
* gtk/gtktexttag.h: remove BTreeNode typedef from this public
header, put it in tagprivate
* gtk/gtktextbtree.c (_gtk_text_btree_new): don't connect to
tag_removed; it's emitted too late.
(_gtk_text_btree_notify_will_remove_tag): rename tag_remove_cb to
this
Padding for ABI-compat expansion
* gtk/gtktexttag.h (struct _GtkTextAttributes): pad this
(struct _GtkTextAppearance): one pad in here too
* gtk/gtktextlayout.h (struct _GtkTextLayoutClass): padding here
* gtk/gtktextview.h (struct _GtkTextViewClass): more padding,
since action signals etc. seem pretty likely
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): padding
* gtk/gtktexttag.h (struct _GtkTextTagClass): padding
* gtk/gtktexttagtable.h (struct _GtkTextTagTableClass): padding
2001-12-04 Matthias Clasen <matthiasc@poet.de>
* gdk/gdkcolor.h (gdk_colormap_change): Deprecate. (#65851)
@ -26,7 +67,7 @@ Tue Dec 4 18:38:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.h: ditto
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (gtk_text_tag_set_property): add a warning for
"invisible" property, #65999

View File

@ -1,3 +1,44 @@
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): remove
g_assert_not_reached() that was bogus, since we demand-create the
tag info. reported by Chris Phelps
Jump through assorted hoops to fix bug from Chris Phelps where
removing tags from the table resulted in btree trying to
access tag->table
* gtk/gtktextbuffer.c: set up mechanics of adding/removing
ourselves to the tag table
* gtk/gtktexttagtable.c (_gtk_text_tag_table_add_buffer)
(_gtk_text_tag_table_remove_buffer): private cruft to
let us notify buffer of disappearing tags
* gtk/gtktexttag.h: remove BTreeNode typedef from this public
header, put it in tagprivate
* gtk/gtktextbtree.c (_gtk_text_btree_new): don't connect to
tag_removed; it's emitted too late.
(_gtk_text_btree_notify_will_remove_tag): rename tag_remove_cb to
this
Padding for ABI-compat expansion
* gtk/gtktexttag.h (struct _GtkTextAttributes): pad this
(struct _GtkTextAppearance): one pad in here too
* gtk/gtktextlayout.h (struct _GtkTextLayoutClass): padding here
* gtk/gtktextview.h (struct _GtkTextViewClass): more padding,
since action signals etc. seem pretty likely
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): padding
* gtk/gtktexttag.h (struct _GtkTextTagClass): padding
* gtk/gtktexttagtable.h (struct _GtkTextTagTableClass): padding
2001-12-04 Matthias Clasen <matthiasc@poet.de>
* gdk/gdkcolor.h (gdk_colormap_change): Deprecate. (#65851)
@ -26,7 +67,7 @@ Tue Dec 4 18:38:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.h: ditto
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (gtk_text_tag_set_property): add a warning for
"invisible" property, #65999

View File

@ -1,3 +1,44 @@
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): remove
g_assert_not_reached() that was bogus, since we demand-create the
tag info. reported by Chris Phelps
Jump through assorted hoops to fix bug from Chris Phelps where
removing tags from the table resulted in btree trying to
access tag->table
* gtk/gtktextbuffer.c: set up mechanics of adding/removing
ourselves to the tag table
* gtk/gtktexttagtable.c (_gtk_text_tag_table_add_buffer)
(_gtk_text_tag_table_remove_buffer): private cruft to
let us notify buffer of disappearing tags
* gtk/gtktexttag.h: remove BTreeNode typedef from this public
header, put it in tagprivate
* gtk/gtktextbtree.c (_gtk_text_btree_new): don't connect to
tag_removed; it's emitted too late.
(_gtk_text_btree_notify_will_remove_tag): rename tag_remove_cb to
this
Padding for ABI-compat expansion
* gtk/gtktexttag.h (struct _GtkTextAttributes): pad this
(struct _GtkTextAppearance): one pad in here too
* gtk/gtktextlayout.h (struct _GtkTextLayoutClass): padding here
* gtk/gtktextview.h (struct _GtkTextViewClass): more padding,
since action signals etc. seem pretty likely
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): padding
* gtk/gtktexttag.h (struct _GtkTextTagClass): padding
* gtk/gtktexttagtable.h (struct _GtkTextTagTableClass): padding
2001-12-04 Matthias Clasen <matthiasc@poet.de>
* gdk/gdkcolor.h (gdk_colormap_change): Deprecate. (#65851)
@ -26,7 +67,7 @@ Tue Dec 4 18:38:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.h: ditto
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (gtk_text_tag_set_property): add a warning for
"invisible" property, #65999

View File

@ -1,3 +1,44 @@
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): remove
g_assert_not_reached() that was bogus, since we demand-create the
tag info. reported by Chris Phelps
Jump through assorted hoops to fix bug from Chris Phelps where
removing tags from the table resulted in btree trying to
access tag->table
* gtk/gtktextbuffer.c: set up mechanics of adding/removing
ourselves to the tag table
* gtk/gtktexttagtable.c (_gtk_text_tag_table_add_buffer)
(_gtk_text_tag_table_remove_buffer): private cruft to
let us notify buffer of disappearing tags
* gtk/gtktexttag.h: remove BTreeNode typedef from this public
header, put it in tagprivate
* gtk/gtktextbtree.c (_gtk_text_btree_new): don't connect to
tag_removed; it's emitted too late.
(_gtk_text_btree_notify_will_remove_tag): rename tag_remove_cb to
this
Padding for ABI-compat expansion
* gtk/gtktexttag.h (struct _GtkTextAttributes): pad this
(struct _GtkTextAppearance): one pad in here too
* gtk/gtktextlayout.h (struct _GtkTextLayoutClass): padding here
* gtk/gtktextview.h (struct _GtkTextViewClass): more padding,
since action signals etc. seem pretty likely
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): padding
* gtk/gtktexttag.h (struct _GtkTextTagClass): padding
* gtk/gtktexttagtable.h (struct _GtkTextTagTableClass): padding
2001-12-04 Matthias Clasen <matthiasc@poet.de>
* gdk/gdkcolor.h (gdk_colormap_change): Deprecate. (#65851)
@ -26,7 +67,7 @@ Tue Dec 4 18:38:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.h: ditto
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (gtk_text_tag_set_property): add a warning for
"invisible" property, #65999

View File

@ -1,3 +1,44 @@
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): remove
g_assert_not_reached() that was bogus, since we demand-create the
tag info. reported by Chris Phelps
Jump through assorted hoops to fix bug from Chris Phelps where
removing tags from the table resulted in btree trying to
access tag->table
* gtk/gtktextbuffer.c: set up mechanics of adding/removing
ourselves to the tag table
* gtk/gtktexttagtable.c (_gtk_text_tag_table_add_buffer)
(_gtk_text_tag_table_remove_buffer): private cruft to
let us notify buffer of disappearing tags
* gtk/gtktexttag.h: remove BTreeNode typedef from this public
header, put it in tagprivate
* gtk/gtktextbtree.c (_gtk_text_btree_new): don't connect to
tag_removed; it's emitted too late.
(_gtk_text_btree_notify_will_remove_tag): rename tag_remove_cb to
this
Padding for ABI-compat expansion
* gtk/gtktexttag.h (struct _GtkTextAttributes): pad this
(struct _GtkTextAppearance): one pad in here too
* gtk/gtktextlayout.h (struct _GtkTextLayoutClass): padding here
* gtk/gtktextview.h (struct _GtkTextViewClass): more padding,
since action signals etc. seem pretty likely
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): padding
* gtk/gtktexttag.h (struct _GtkTextTagClass): padding
* gtk/gtktexttagtable.h (struct _GtkTextTagTableClass): padding
2001-12-04 Matthias Clasen <matthiasc@poet.de>
* gdk/gdkcolor.h (gdk_colormap_change): Deprecate. (#65851)
@ -26,7 +67,7 @@ Tue Dec 4 18:38:35 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeviewcolumn.h: ditto
2001-12-04 Havoc Pennington <hp@redhat.com>
* gtk/gtktexttag.c (gtk_text_tag_set_property): add a warning for
"invisible" property, #65999

View File

@ -184,7 +184,7 @@ struct _GtkTextBTree {
BTreeView *views;
GSList *tag_infos;
guint tag_changed_handler;
guint tag_removed_handler;
/* Incremented when a segment with a byte size > 0
* is added to or removed from the tree (i.e. the
* length of a line may have changed, and lines may
@ -315,9 +315,6 @@ static void tag_changed_cb (GtkTextTagTable *table,
GtkTextTag *tag,
gboolean size_changed,
GtkTextBTree *tree);
static void tag_removed_cb (GtkTextTagTable *table,
GtkTextTag *tag,
GtkTextBTree *tree);
static void cleanup_line (GtkTextLine *line);
static void recompute_node_counts (GtkTextBTree *tree,
GtkTextBTreeNode *node);
@ -436,11 +433,6 @@ _gtk_text_btree_new (GtkTextTagTable *table,
G_CALLBACK (tag_changed_cb),
tree);
tree->tag_removed_handler = g_signal_connect (G_OBJECT (tree->table),
"tag_removed",
G_CALLBACK (tag_removed_cb),
tree);
tree->mark_table = g_hash_table_new (g_str_hash, g_str_equal);
tree->child_anchor_table = NULL;
@ -519,9 +511,6 @@ _gtk_text_btree_unref (GtkTextBTree *tree)
g_signal_handler_disconnect (G_OBJECT (tree->table),
tree->tag_changed_handler);
g_signal_handler_disconnect (G_OBJECT (tree->table),
tree->tag_removed_handler);
g_object_unref (G_OBJECT (tree->table));
g_free (tree);
@ -5480,10 +5469,9 @@ tag_changed_cb (GtkTextTagTable *table,
}
}
static void
tag_removed_cb (GtkTextTagTable *table,
GtkTextTag *tag,
GtkTextBTree *tree)
void
_gtk_text_btree_notify_will_remove_tag (GtkTextBTree *tree,
GtkTextTag *tag)
{
/* Remove the tag from the tree */
@ -5852,9 +5840,6 @@ gtk_text_btree_remove_tag_info (GtkTextBTree *tree,
list = g_slist_next (list);
}
g_assert_not_reached ();
return;
}
static void

View File

@ -292,6 +292,10 @@ void _gtk_change_node_toggle_count (GtkTextBTreeNode *node,
void _gtk_text_btree_release_mark_segment (GtkTextBTree *tree,
GtkTextLineSegment *segment);
/* for coordination with the tag table */
void _gtk_text_btree_notify_will_remove_tag (GtkTextBTree *tree,
GtkTextTag *tag);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -327,6 +327,8 @@ gtk_text_buffer_new (GtkTextTagTable *table)
text_buffer->tag_table = table;
g_object_ref (G_OBJECT (text_buffer->tag_table));
_gtk_text_tag_table_add_buffer (table, text_buffer);
}
return text_buffer;
@ -344,6 +346,7 @@ gtk_text_buffer_finalize (GObject *object)
if (buffer->tag_table)
{
_gtk_text_tag_table_remove_buffer (buffer->tag_table, buffer);
g_object_unref (G_OBJECT (buffer->tag_table));
buffer->tag_table = NULL;
}
@ -366,7 +369,10 @@ static GtkTextTagTable*
get_table (GtkTextBuffer *buffer)
{
if (buffer->tag_table == NULL)
buffer->tag_table = gtk_text_tag_table_new ();
{
buffer->tag_table = gtk_text_tag_table_new ();
_gtk_text_tag_table_add_buffer (buffer->tag_table, buffer);
}
return buffer->tag_table;
}
@ -376,7 +382,7 @@ get_btree (GtkTextBuffer *buffer)
{
if (buffer->btree == NULL)
buffer->btree = _gtk_text_btree_new (gtk_text_buffer_get_tag_table (buffer),
buffer);
buffer);
return buffer->btree;
}
@ -3502,6 +3508,19 @@ _gtk_text_buffer_get_line_log_attrs (GtkTextBuffer *buffer,
return cache->entries[0].attrs;
}
void
_gtk_text_buffer_notify_will_remove_tag (GtkTextBuffer *buffer,
GtkTextTag *tag)
{
/* This removes tag from the buffer, but DOESN'T emit the
* remove_tag signal, because we can't afford to have user
* code messing things up at this point; the tag MUST be removed
* entirely.
*/
if (buffer->btree)
_gtk_text_btree_notify_will_remove_tag (buffer->btree, tag);
}
/*
* Debug spew
*/
@ -3511,8 +3530,3 @@ _gtk_text_buffer_spew (GtkTextBuffer *buffer)
{
_gtk_text_btree_spew (get_btree (buffer));
}

View File

@ -125,6 +125,13 @@ struct _GtkTextBufferClass
/* Called at the start and end of an atomic user action */
void (* begin_user_action) (GtkTextBuffer *buffer);
void (* end_user_action) (GtkTextBuffer *buffer);
GtkFunction pad1;
GtkFunction pad2;
GtkFunction pad3;
GtkFunction pad4;
GtkFunction pad5;
GtkFunction pad6;
};
GType gtk_text_buffer_get_type (void) G_GNUC_CONST;
@ -361,6 +368,9 @@ const PangoLogAttr* _gtk_text_buffer_get_line_log_attrs (GtkTextBuffer *buff
const GtkTextIter *anywhere_in_line,
gint *char_len);
void _gtk_text_buffer_notify_will_remove_tag (GtkTextBuffer *buffer,
GtkTextTag *tag);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -205,6 +205,9 @@ struct _GtkTextLayoutClass
GtkWidget *child,
gint x,
gint y);
GtkFunction pad1;
GtkFunction pad2;
};
struct _GtkTextAttrAppearance

View File

@ -9,7 +9,6 @@ extern "C" {
#endif /* __cplusplus */
typedef struct _GtkTextIter GtkTextIter;
typedef struct _GtkTextBTreeNode GtkTextBTreeNode;
typedef struct _GtkTextTagTable GtkTextTagTable;
typedef struct _GtkTextAttributes GtkTextAttributes;
@ -47,7 +46,7 @@ struct _GtkTextTag
*/
GtkTextAttributes *values;
/* Flags for whether a given value is set; if a value is unset, then
* this tag does not affect it.
*/
@ -85,6 +84,9 @@ struct _GtkTextTagClass
GObject *event_object, /* widget, canvas item, whatever */
GdkEvent *event, /* the event itself */
const GtkTextIter *iter); /* location of event in buffer */
GtkFunction pad1;
GtkFunction pad2;
};
GType gtk_text_tag_get_type (void) G_GNUC_CONST;
@ -112,6 +114,11 @@ struct _GtkTextAppearance
/* super/subscript rise, can be negative */
gint rise;
/* I'm not sure this can really be used without breaking some things
* an app might do :-/
*/
gpointer padding1;
guint underline : 4; /* PangoUnderline */
guint strikethrough : 1;
@ -129,6 +136,11 @@ struct _GtkTextAppearance
*/
guint inside_selection : 1;
guint is_text : 1;
guint pad1 : 1;
guint pad2 : 1;
guint pad3 : 1;
guint pad4 : 1;
};
struct _GtkTextAttributes
@ -166,6 +178,11 @@ struct _GtkTextAttributes
PangoLanguage *language;
/* I'm not sure this can really be used without breaking some things
* an app might do :-/
*/
gpointer padding1;
/* hide the text */
guint invisible : 1;

View File

@ -3,6 +3,8 @@
#include <gtk/gtktexttag.h>
typedef struct _GtkTextBTreeNode GtkTextBTreeNode;
/* values should already have desired defaults; this function will override
* the defaults with settings in the given tags, which should be sorted in
* ascending order of priority

View File

@ -2,6 +2,7 @@
#include "gtktexttagtable.h"
#include "gtkmarshalers.h"
#include "gtksignal.h"
#include "gtktextbuffer.h" /* just for the lame notify_will_remove_tag hack */
#include <stdlib.h>
@ -154,6 +155,8 @@ gtk_text_tag_table_finalize (GObject *object)
g_hash_table_destroy (table->hash);
g_slist_free (table->anonymous);
g_slist_free (table->buffers);
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
static void
@ -277,10 +280,24 @@ void
gtk_text_tag_table_remove (GtkTextTagTable *table,
GtkTextTag *tag)
{
GSList *tmp;
g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table));
g_return_if_fail (GTK_IS_TEXT_TAG (tag));
g_return_if_fail (tag->table == table);
/* Our little bad hack to be sure buffers don't still have the tag
* applied to text in the buffer
*/
tmp = table->buffers;
while (tmp != NULL)
{
_gtk_text_buffer_notify_will_remove_tag (GTK_TEXT_BUFFER (tmp->data),
tag);
tmp = tmp->next;
}
/* Set ourselves to the highest priority; this means
when we're removed, there won't be any gaps in the
priorities of the tags in the table. */
@ -368,3 +385,21 @@ gtk_text_tag_table_get_size (GtkTextTagTable *table)
return g_hash_table_size (table->hash) + table->anon_count;
}
void
_gtk_text_tag_table_add_buffer (GtkTextTagTable *table,
gpointer buffer)
{
g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table));
table->buffers = g_slist_prepend (table->buffers, buffer);
}
void
_gtk_text_tag_table_remove_buffer (GtkTextTagTable *table,
gpointer buffer)
{
g_return_if_fail (GTK_IS_TEXT_TAG_TABLE (table));
table->buffers = g_slist_remove (table->buffers, buffer);
}

View File

@ -26,6 +26,8 @@ struct _GtkTextTagTable {
GHashTable *hash;
GSList *anonymous;
gint anon_count;
GSList *buffers;
};
struct _GtkTextTagTableClass {
@ -34,6 +36,9 @@ struct _GtkTextTagTableClass {
void (* tag_changed) (GtkTextTagTable *table, GtkTextTag *tag, gboolean size_changed);
void (* tag_added) (GtkTextTagTable *table, GtkTextTag *tag);
void (* tag_removed) (GtkTextTagTable *table, GtkTextTag *tag);
GtkFunction pad1;
GtkFunction pad2;
};
GType gtk_text_tag_table_get_type (void) G_GNUC_CONST;
@ -51,6 +56,14 @@ void gtk_text_tag_table_foreach (GtkTextTagTable *table,
gint gtk_text_tag_table_get_size (GtkTextTagTable *table);
/* INTERNAL private stuff - not even exported from the library on
* many platforms
*/
void _gtk_text_tag_table_add_buffer (GtkTextTagTable *table,
gpointer buffer);
void _gtk_text_tag_table_remove_buffer (GtkTextTagTable *table,
gpointer buffer);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -189,6 +189,11 @@ struct _GtkTextViewClass
GtkFunction pad2;
GtkFunction pad3;
GtkFunction pad4;
GtkFunction pad5;
GtkFunction pad6;
GtkFunction pad7;
GtkFunction pad8;
};
GtkType gtk_text_view_get_type (void) G_GNUC_CONST;