diff options
author | Johan Dahlin <johan@src.gnome.org> | 2005-04-04 23:29:53 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2005-04-04 23:29:53 +0000 |
commit | 6675c29a7d8b3d60d83af065a2a13eeea3ae125d (patch) | |
tree | 99e95f60f467700465d5579f8821b9d3bcb1149c /gtk/gtktextbuffer.c | |
parent | 415750b2530cb57219ddc1625c6efb9fba8b0b4d (diff) | |
download | gtk+-6675c29a7d8b3d60d83af065a2a13eeea3ae125d.tar.gz |
Add GtkTextBuffer::text (#172631)
* gtk/gtktextbuffer.c: (gtk_text_buffer_class_init),
(gtk_text_buffer_set_property), (gtk_text_buffer_get_property),
(gtk_text_buffer_set_text): Add GtkTextBuffer::text (#172631)
Diffstat (limited to 'gtk/gtktextbuffer.c')
-rw-r--r-- | gtk/gtktextbuffer.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index 1bb9ec9fa6..3a18a739fc 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -72,7 +72,10 @@ enum { PROP_0, /* Construct */ - PROP_TAG_TABLE + PROP_TAG_TABLE, + + /* Normal */ + PROP_TEXT }; enum { @@ -187,6 +190,24 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass) GTK_TYPE_TEXT_TAG_TABLE, GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + /* Normal properties*/ + + /** + * GtkTextBuffer:text: + * + * The text content of the buffer. Without child widgets and images, + * see gtk_text_buffer_get_text () for more information. + * + * Since: 2.8 + */ + g_object_class_install_property (object_class, + PROP_TEXT, + g_param_spec_string ("text", + P_("Text"), + P_("Current text of the buffer"), + "", + GTK_PARAM_READWRITE)); + signals[INSERT_TEXT] = g_signal_new ("insert_text", G_OBJECT_CLASS_TYPE (object_class), @@ -386,6 +407,11 @@ gtk_text_buffer_set_property (GObject *object, case PROP_TAG_TABLE: set_table (text_buffer, g_value_get_object (value)); break; + + case PROP_TEXT: + gtk_text_buffer_set_text (text_buffer, + g_value_get_string (value), -1); + break; default: break; @@ -407,6 +433,18 @@ gtk_text_buffer_get_property (GObject *object, case PROP_TAG_TABLE: g_value_set_object (value, get_table (text_buffer)); break; + + case PROP_TEXT: + { + GtkTextIter start, end; + + gtk_text_buffer_get_start_iter (text_buffer, &start); + gtk_text_buffer_get_end_iter (text_buffer, &end); + + g_value_set_string (value, + gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE)); + break; + } default: break; @@ -524,8 +562,12 @@ gtk_text_buffer_set_text (GtkTextBuffer *buffer, gtk_text_buffer_get_iter_at_offset (buffer, &start, 0); gtk_text_buffer_insert (buffer, &start, text, len); } + + g_object_notify (G_OBJECT (buffer), "text"); } + + /* * Insertion */ |