Commit bc31a1bc authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

add insert_child_anchor signal, bug #50245

2001-02-19  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): add
	insert_child_anchor signal, bug #50245

	* gtk/gtktextbtree.c (_gtk_text_btree_insert_child_anchor): change
	from create_child_anchor, so the anchor is passed in

	* gtk/gtktextchild.c (gtk_text_child_anchor_new): new function
	(_gtk_widget_segment_new): have the child anchor object passed in,
	instead of creating it.

	* gtk/gtktextbuffer.c (gtk_text_buffer_modified): rename
	to gtk_text_buffer_get_modified
parent 027c3154
2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): add
insert_child_anchor signal, bug #50245
* gtk/gtktextbtree.c (_gtk_text_btree_insert_child_anchor): change
from create_child_anchor, so the anchor is passed in
* gtk/gtktextchild.c (gtk_text_child_anchor_new): new function
(_gtk_widget_segment_new): have the child anchor object passed in,
instead of creating it.
* gtk/gtktextbuffer.c (gtk_text_buffer_modified): rename
to gtk_text_buffer_get_modified
2001-02-19 Havoc Pennington <hp@redhat.com> 2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone * gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone
......
2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): add
insert_child_anchor signal, bug #50245
* gtk/gtktextbtree.c (_gtk_text_btree_insert_child_anchor): change
from create_child_anchor, so the anchor is passed in
* gtk/gtktextchild.c (gtk_text_child_anchor_new): new function
(_gtk_widget_segment_new): have the child anchor object passed in,
instead of creating it.
* gtk/gtktextbuffer.c (gtk_text_buffer_modified): rename
to gtk_text_buffer_get_modified
2001-02-19 Havoc Pennington <hp@redhat.com> 2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone * gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone
......
2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): add
insert_child_anchor signal, bug #50245
* gtk/gtktextbtree.c (_gtk_text_btree_insert_child_anchor): change
from create_child_anchor, so the anchor is passed in
* gtk/gtktextchild.c (gtk_text_child_anchor_new): new function
(_gtk_widget_segment_new): have the child anchor object passed in,
instead of creating it.
* gtk/gtktextbuffer.c (gtk_text_buffer_modified): rename
to gtk_text_buffer_get_modified
2001-02-19 Havoc Pennington <hp@redhat.com> 2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone * gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone
......
2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): add
insert_child_anchor signal, bug #50245
* gtk/gtktextbtree.c (_gtk_text_btree_insert_child_anchor): change
from create_child_anchor, so the anchor is passed in
* gtk/gtktextchild.c (gtk_text_child_anchor_new): new function
(_gtk_widget_segment_new): have the child anchor object passed in,
instead of creating it.
* gtk/gtktextbuffer.c (gtk_text_buffer_modified): rename
to gtk_text_buffer_get_modified
2001-02-19 Havoc Pennington <hp@redhat.com> 2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone * gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone
......
2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): add
insert_child_anchor signal, bug #50245
* gtk/gtktextbtree.c (_gtk_text_btree_insert_child_anchor): change
from create_child_anchor, so the anchor is passed in
* gtk/gtktextchild.c (gtk_text_child_anchor_new): new function
(_gtk_widget_segment_new): have the child anchor object passed in,
instead of creating it.
* gtk/gtktextbuffer.c (gtk_text_buffer_modified): rename
to gtk_text_buffer_get_modified
2001-02-19 Havoc Pennington <hp@redhat.com> 2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone * gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone
......
2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): add
insert_child_anchor signal, bug #50245
* gtk/gtktextbtree.c (_gtk_text_btree_insert_child_anchor): change
from create_child_anchor, so the anchor is passed in
* gtk/gtktextchild.c (gtk_text_child_anchor_new): new function
(_gtk_widget_segment_new): have the child anchor object passed in,
instead of creating it.
* gtk/gtktextbuffer.c (gtk_text_buffer_modified): rename
to gtk_text_buffer_get_modified
2001-02-19 Havoc Pennington <hp@redhat.com> 2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone * gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone
......
2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktextbuffer.h (struct _GtkTextBufferClass): add
insert_child_anchor signal, bug #50245
* gtk/gtktextbtree.c (_gtk_text_btree_insert_child_anchor): change
from create_child_anchor, so the anchor is passed in
* gtk/gtktextchild.c (gtk_text_child_anchor_new): new function
(_gtk_widget_segment_new): have the child anchor object passed in,
instead of creating it.
* gtk/gtktextbuffer.c (gtk_text_buffer_modified): rename
to gtk_text_buffer_get_modified
2001-02-19 Havoc Pennington <hp@redhat.com> 2001-02-19 Havoc Pennington <hp@redhat.com>
* gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone * gtk/gtktreemodel.c (gtk_tree_model_get_valist): hmm, someone
......
...@@ -1125,13 +1125,20 @@ _gtk_text_btree_insert_pixbuf (GtkTextIter *iter, ...@@ -1125,13 +1125,20 @@ _gtk_text_btree_insert_pixbuf (GtkTextIter *iter,
insert_pixbuf_or_widget_segment (iter, seg); insert_pixbuf_or_widget_segment (iter, seg);
} }
GtkTextChildAnchor* void
_gtk_text_btree_create_child_anchor (GtkTextIter *iter) _gtk_text_btree_insert_child_anchor (GtkTextIter *iter,
GtkTextChildAnchor *anchor)
{ {
GtkTextLineSegment *seg; GtkTextLineSegment *seg;
GtkTextBTree *tree; GtkTextBTree *tree;
if (anchor->segment != NULL)
{
g_warning (G_STRLOC": Same child anchor can't be inserted twice");
return;
}
seg = _gtk_widget_segment_new (); seg = _gtk_widget_segment_new (anchor);
tree = seg->body.child.tree = _gtk_text_iter_get_btree (iter); tree = seg->body.child.tree = _gtk_text_iter_get_btree (iter);
...@@ -1143,8 +1150,6 @@ _gtk_text_btree_create_child_anchor (GtkTextIter *iter) ...@@ -1143,8 +1150,6 @@ _gtk_text_btree_create_child_anchor (GtkTextIter *iter)
g_hash_table_insert (tree->child_anchor_table, g_hash_table_insert (tree->child_anchor_table,
seg->body.child.obj, seg->body.child.obj,
seg->body.child.obj); seg->body.child.obj);
return seg->body.child.obj;
} }
void void
......
...@@ -34,7 +34,8 @@ void _gtk_text_btree_insert (GtkTextIter *iter, ...@@ -34,7 +34,8 @@ void _gtk_text_btree_insert (GtkTextIter *iter,
void _gtk_text_btree_insert_pixbuf (GtkTextIter *iter, void _gtk_text_btree_insert_pixbuf (GtkTextIter *iter,
GdkPixbuf *pixbuf); GdkPixbuf *pixbuf);
GtkTextChildAnchor* _gtk_text_btree_create_child_anchor (GtkTextIter *iter); void _gtk_text_btree_insert_child_anchor (GtkTextIter *iter,
GtkTextChildAnchor *anchor);
void _gtk_text_btree_unregister_child_anchor (GtkTextChildAnchor *anchor); void _gtk_text_btree_unregister_child_anchor (GtkTextChildAnchor *anchor);
......
...@@ -49,6 +49,7 @@ struct _ClipboardRequest ...@@ -49,6 +49,7 @@ struct _ClipboardRequest
enum { enum {
INSERT_TEXT, INSERT_TEXT,
INSERT_PIXBUF, INSERT_PIXBUF,
INSERT_CHILD_ANCHOR,
DELETE_RANGE, DELETE_RANGE,
CHANGED, CHANGED,
MODIFIED_CHANGED, MODIFIED_CHANGED,
...@@ -87,6 +88,9 @@ static void gtk_text_buffer_real_insert_text (GtkTextBuffer *buffe ...@@ -87,6 +88,9 @@ static void gtk_text_buffer_real_insert_text (GtkTextBuffer *buffe
static void gtk_text_buffer_real_insert_pixbuf (GtkTextBuffer *buffer, static void gtk_text_buffer_real_insert_pixbuf (GtkTextBuffer *buffer,
GtkTextIter *iter, GtkTextIter *iter,
GdkPixbuf *pixbuf); GdkPixbuf *pixbuf);
static void gtk_text_buffer_real_insert_anchor (GtkTextBuffer *buffer,
GtkTextIter *iter,
GtkTextChildAnchor *anchor);
static void gtk_text_buffer_real_delete_range (GtkTextBuffer *buffer, static void gtk_text_buffer_real_delete_range (GtkTextBuffer *buffer,
GtkTextIter *start, GtkTextIter *start,
GtkTextIter *end); GtkTextIter *end);
...@@ -184,6 +188,22 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass) ...@@ -184,6 +188,22 @@ gtk_text_buffer_class_init (GtkTextBufferClass *klass)
#endif #endif
GTK_TYPE_POINTER, GTK_TYPE_POINTER,
GDK_TYPE_PIXBUF); GDK_TYPE_PIXBUF);
signals[INSERT_CHILD_ANCHOR] =
g_signal_newc ("insert_child_anchor",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkTextBufferClass, insert_child_anchor),
NULL,
gtk_marshal_VOID__BOXED_OBJECT,
GTK_TYPE_NONE,
2,
#if 0
/* FIXME */
GTK_TYPE_TEXT_ITER,
#endif
GTK_TYPE_POINTER,
GTK_TYPE_TEXT_CHILD_ANCHOR);
signals[DELETE_RANGE] = signals[DELETE_RANGE] =
g_signal_newc ("delete_range", g_signal_newc ("delete_range",
...@@ -1427,6 +1447,63 @@ gtk_text_buffer_insert_pixbuf (GtkTextBuffer *buffer, ...@@ -1427,6 +1447,63 @@ gtk_text_buffer_insert_pixbuf (GtkTextBuffer *buffer,
* Child anchor * Child anchor
*/ */
static void
gtk_text_buffer_real_insert_anchor (GtkTextBuffer *buffer,
GtkTextIter *iter,
GtkTextChildAnchor *anchor)
{
_gtk_text_btree_insert_child_anchor (iter, anchor);
g_signal_emit (G_OBJECT (buffer), signals[CHANGED], 0);
}
/**
* gtk_text_buffer_insert_child_anchor:
* @buffer: a #GtkTextBuffer
* @iter: location to insert the anchor
* @anchor: a #GtkTextChildAnchor
*
* Inserts a child widget anchor into the text buffer at @iter. The
* anchor will be counted as one character in character counts, and
* when obtaining the buffer contents as a string, will be represented
* by the Unicode "object replacement character" 0xFFFC. Note that the
* "slice" variants for obtaining portions of the buffer as a string
* include this character for pixbufs, but the "text" variants do
* not. e.g. see gtk_text_buffer_get_slice() and
* gtk_text_buffer_get_text(). Consider
* gtk_text_buffer_create_child_anchor() as a more convenient
* alternative to this function. The buffer will add a reference to
* the anchor, so you can unref it after insertion.
*
**/
void
gtk_text_buffer_insert_child_anchor (GtkTextBuffer *buffer,
GtkTextIter *iter,
GtkTextChildAnchor *anchor)
{
GtkTextChildAnchor *anchor;
g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
g_return_val_if_fail (iter != NULL, NULL);
g_return_val_if_fail (GTK_IS_TEXT_CHILD_ANCHOR (anchor), NULL);
g_signal_emit (G_OBJECT (buffer), signals[INSERT_CHILD_ANCHOR], 0,
iter, anchor);
}
/**
* gtk_text_buffer_create_child_anchor:
* @buffer: a #GtkTextBuffer
* @iter: location in the buffer
*
* This is a convenience function which simply creates a child anchor
* with gtk_text_child_anchor_new() and inserts it into the buffer
* with gtk_text_buffer_insert_child_anchor().
*
* Return value: the created child anchor
**/
GtkTextChildAnchor* GtkTextChildAnchor*
gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer, gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer,
GtkTextIter *iter) GtkTextIter *iter)
...@@ -1436,16 +1513,15 @@ gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer, ...@@ -1436,16 +1513,15 @@ gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer,
g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL); g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), NULL);
g_return_val_if_fail (iter != NULL, NULL); g_return_val_if_fail (iter != NULL, NULL);
anchor = _gtk_text_btree_create_child_anchor (iter); anchor = gtk_text_child_anchor_new ();
/* FIXME child-anchor-specific signal */ gtk_text_buffer_insert_child_anchor (buffer, iter, anchor);
gtk_signal_emit (GTK_OBJECT (buffer), signals[CHANGED]); g_object_unref (G_OBJECT (anchor));
return anchor; return anchor;
} }
/* /*
* Mark manipulation * Mark manipulation
*/ */
...@@ -2180,7 +2256,7 @@ gtk_text_buffer_get_bounds (GtkTextBuffer *buffer, ...@@ -2180,7 +2256,7 @@ gtk_text_buffer_get_bounds (GtkTextBuffer *buffer,
*/ */
/** /**
* gtk_text_buffer_modified: * gtk_text_buffer_get_modified:
* @buffer: a #GtkTextBuffer * @buffer: a #GtkTextBuffer
* *
* Indicates whether the buffer has been modified since the last call * Indicates whether the buffer has been modified since the last call
...@@ -2191,7 +2267,7 @@ gtk_text_buffer_get_bounds (GtkTextBuffer *buffer, ...@@ -2191,7 +2267,7 @@ gtk_text_buffer_get_bounds (GtkTextBuffer *buffer,
* Return value: %TRUE if the buffer has been modified * Return value: %TRUE if the buffer has been modified
**/ **/
gboolean gboolean
gtk_text_buffer_modified (GtkTextBuffer *buffer) gtk_text_buffer_get_modified (GtkTextBuffer *buffer)
{ {
g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE); g_return_val_if_fail (GTK_IS_TEXT_BUFFER (buffer), FALSE);
......
...@@ -85,14 +85,9 @@ struct _GtkTextBufferClass ...@@ -85,14 +85,9 @@ struct _GtkTextBufferClass
GtkTextIter *pos, GtkTextIter *pos,
GdkPixbuf *pixbuf); GdkPixbuf *pixbuf);
#if 0 void (* insert_child_anchor) (GtkTextBuffer *buffer,
/* FIXME To do this, first have to implement the sequence GtkTextIter *pos,
* gtk_text_child_anchor_new(); gtk_text_buffer_insert_child_anchor();
*/
void (* insert_child_anchor) (GtkTextBuffer *buffer,
GtkTextIter *pos,
GtkTextChildAnchor *anchor); GtkTextChildAnchor *anchor);
#endif
void (* delete_range) (GtkTextBuffer *buffer, void (* delete_range) (GtkTextBuffer *buffer,
GtkTextIter *start, GtkTextIter *start,
...@@ -217,7 +212,12 @@ void gtk_text_buffer_insert_pixbuf (GtkTextBuffer *buffer, ...@@ -217,7 +212,12 @@ void gtk_text_buffer_insert_pixbuf (GtkTextBuffer *buffer,
GtkTextIter *iter, GtkTextIter *iter,
GdkPixbuf *pixbuf); GdkPixbuf *pixbuf);
/* Create a child anchor */ /* Insert a child anchor */
void gtk_text_buffer_insert_child_anchor (GtkTextBuffer *buffer,
GtkTextIter *iter,
GtkTextChildAnchor *anchor);
/* Convenience, create and insert a child anchor */
GtkTextChildAnchor *gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer, GtkTextChildAnchor *gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer,
GtkTextIter *iter); GtkTextIter *iter);
...@@ -313,7 +313,7 @@ void gtk_text_buffer_get_iter_at_child_anchor (GtkTextBuffer *buffer, ...@@ -313,7 +313,7 @@ void gtk_text_buffer_get_iter_at_child_anchor (GtkTextBuffer *buffer,
flag, but if you would like them to you can connect a handler to flag, but if you would like them to you can connect a handler to
the tag/mark signals and call set_modified in your handler */ the tag/mark signals and call set_modified in your handler */
gboolean gtk_text_buffer_modified (GtkTextBuffer *buffer); gboolean gtk_text_buffer_get_modified (GtkTextBuffer *buffer);
void gtk_text_buffer_set_modified (GtkTextBuffer *buffer, void gtk_text_buffer_set_modified (GtkTextBuffer *buffer,
gboolean setting); gboolean setting);
......
...@@ -199,7 +199,7 @@ GtkTextLineSegmentClass gtk_text_child_type = { ...@@ -199,7 +199,7 @@ GtkTextLineSegmentClass gtk_text_child_type = {
+ sizeof (GtkTextChildBody))) + sizeof (GtkTextChildBody)))
GtkTextLineSegment * GtkTextLineSegment *
_gtk_widget_segment_new (void) _gtk_widget_segment_new (GtkTextChildAnchor *anchor)
{ {
GtkTextLineSegment *seg; GtkTextLineSegment *seg;
...@@ -214,12 +214,14 @@ _gtk_widget_segment_new (void) ...@@ -214,12 +214,14 @@ _gtk_widget_segment_new (void)
*/ */
seg->char_count = 1; seg->char_count = 1;
seg->body.child.obj = g_object_new (GTK_TYPE_TEXT_CHILD_ANCHOR, NULL); seg->body.child.obj = anchor;
seg->body.child.obj->segment = seg; seg->body.child.obj->segment = seg;
seg->body.child.widgets = NULL; seg->body.child.widgets = NULL;
seg->body.child.tree = NULL; seg->body.child.tree = NULL;
seg->body.child.line = NULL; seg->body.child.line = NULL;
g_object_ref (G_OBJECT (anchor));
return seg; return seg;
} }
...@@ -331,6 +333,13 @@ gtk_text_child_anchor_class_init (GtkTextChildAnchorClass *klass) ...@@ -331,6 +333,13 @@ gtk_text_child_anchor_class_init (GtkTextChildAnchorClass *klass)
object_class->finalize = gtk_text_child_anchor_finalize; object_class->finalize = gtk_text_child_anchor_finalize;
} }
GtkTextChildAnchor*
gtk_text_child_anchor_new (void)
{
return GTK_TEXT_CHILD_ANCHOR (g_object_new (GTK_TYPE_TEXT_CHILD_ANCHOR,
NULL));
}
static void static void
gtk_text_child_anchor_finalize (GObject *obj) gtk_text_child_anchor_finalize (GObject *obj)
{ {
......
...@@ -64,6 +64,8 @@ struct _GtkTextChildAnchorClass ...@@ -64,6 +64,8 @@ struct _GtkTextChildAnchorClass
GType gtk_text_child_anchor_get_type (void) G_GNUC_CONST; GType gtk_text_child_anchor_get_type (void) G_GNUC_CONST;
GtkTextChildAnchor* gtk_text_child_anchor_new (void);
GList* gtk_text_child_anchor_get_widgets (GtkTextChildAnchor *anchor); GList* gtk_text_child_anchor_get_widgets (GtkTextChildAnchor *anchor);
gboolean gtk_text_child_anchor_get_deleted (GtkTextChildAnchor *anchor); gboolean gtk_text_child_anchor_get_deleted (GtkTextChildAnchor *anchor);
......
...@@ -75,7 +75,7 @@ struct _GtkTextChildBody ...@@ -75,7 +75,7 @@ struct _GtkTextChildBody
GtkTextLine *line; GtkTextLine *line;
}; };
GtkTextLineSegment *_gtk_widget_segment_new (void); GtkTextLineSegment *_gtk_widget_segment_new (GtkTextChildAnchor *anchor);
void _gtk_widget_segment_add (GtkTextLineSegment *widget_segment, void _gtk_widget_segment_add (GtkTextLineSegment *widget_segment,
GtkWidget *child); GtkWidget *child);
void _gtk_widget_segment_remove (GtkTextLineSegment *widget_segment, void _gtk_widget_segment_remove (GtkTextLineSegment *widget_segment,
......
...@@ -429,7 +429,6 @@ fill_example_buffer (GtkTextBuffer *buffer) ...@@ -429,7 +429,6 @@ fill_example_buffer (GtkTextBuffer *buffer)
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
int i; int i;
char *str; char *str;
GtkTextChildAnchor *anchor;
/* FIXME this is broken if called twice on a buffer, since /* FIXME this is broken if called twice on a buffer, since
* we try to create tags a second time. * we try to create tags a second time.
...@@ -510,7 +509,7 @@ fill_example_buffer (GtkTextBuffer *buffer) ...@@ -510,7 +509,7 @@ fill_example_buffer (GtkTextBuffer *buffer)
"direction", GTK_TEXT_DIR_RTL, "direction", GTK_TEXT_DIR_RTL,
"indent", 30, "indent", 30,
"left_margin", 20, "left_margin", 20,
"right_margin", 20, "right_margin", 20,
NULL); NULL);
...@@ -693,7 +692,7 @@ static View * ...@@ -693,7 +692,7 @@ static View *
get_empty_view (View *view) get_empty_view (View *view)
{ {
if (!view->buffer->filename && if (!view->buffer->filename &&
!gtk_text_buffer_modified (view->buffer->buffer)) !gtk_text_buffer_get_modified (view->buffer->buffer))
return view; return view;
else else
return create_view (create_buffer ()); return create_view (create_buffer ());
...@@ -1366,7 +1365,7 @@ save_as_buffer (Buffer *buffer) ...@@ -1366,7 +1365,7 @@ save_as_buffer (Buffer *buffer)
static gboolean static gboolean
check_buffer_saved (Buffer *buffer) check_buffer_saved (Buffer *buffer)
{ {
if (gtk_text_buffer_modified (buffer->buffer)) if (gtk_text_buffer_get_modified (buffer->buffer))
{ {
char *pretty_name = buffer_pretty_name (buffer); char *pretty_name = buffer_pretty_name (buffer);
char *msg = g_strdup_printf ("Save changes to '%s'?", pretty_name); char *msg = g_strdup_printf ("Save changes to '%s'?", pretty_name);
......
...@@ -429,7 +429,6 @@ fill_example_buffer (GtkTextBuffer *buffer) ...@@ -429,7 +429,6 @@ fill_example_buffer (GtkTextBuffer *buffer)
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
int i; int i;
char *str; char *str;
GtkTextChildAnchor *anchor;
/* FIXME this is broken if called twice on a buffer, since /* FIXME this is broken if called twice on a buffer, since
* we try to create tags a second time. * we try to create tags a second time.
...@@ -510,7 +509,7 @@ fill_example_buffer (GtkTextBuffer *buffer) ...@@ -510,7 +509,7 @@ fill_example_buffer (GtkTextBuffer *buffer)
"direction", GTK_TEXT_DIR_RTL, "direction", GTK_TEXT_DIR_RTL,
"indent", 30, "indent", 30,
"left_margin", 20, "left_margin", 20,
"right_margin", 20, "right_margin", 20,
NULL); NULL);
...@@ -693,7 +692,7 @@ static View * ...@@ -693,7 +692,7 @@ static View *
get_empty_view (View *view) get_empty_view (View *view)
{ {
if (!view->buffer->filename && if (!view->buffer->filename &&
!gtk_text_buffer_modified (view->buffer->buffer)) !gtk_text_buffer_get_modified (view->buffer->buffer))
return view; return view;
else else
return create_view (create_buffer ()); return create_view (create_buffer ());
...@@ -1366,7 +1365,7 @@ save_as_buffer (Buffer *buffer) ...@@ -1366,7 +1365,7 @@ save_as_buffer (Buffer *buffer)
static gboolean static gboolean
check_buffer_saved (Buffer *buffer) check_buffer_saved (Buffer *buffer)
{ {
if (gtk_text_buffer_modified (buffer->buffer)) if (gtk_text_buffer_get_modified (buffer->buffer))
{ {
char *pretty_name = buffer_pretty_name (buffer); char *pretty_name = buffer_pretty_name (buffer);
char *msg = g_strdup_printf ("Save changes to '%s'?", pretty_name); char *msg = g_strdup_printf ("Save changes to '%s'?", pretty_name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment