diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-10-29 19:52:22 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-10-29 19:52:22 +0800 |
commit | f2feef8356f9e3a2996224a215c52c5432603bd8 (patch) | |
tree | 88754554559d3f1cfd36fb54bcf942b6f53077a9 /widgets/text | |
parent | f754f63274e335e0d9a858d000a0152f51f14651 (diff) | |
download | gsoc2013-evolution-f2feef8356f9e3a2996224a215c52c5432603bd8.tar.gz gsoc2013-evolution-f2feef8356f9e3a2996224a215c52c5432603bd8.tar.zst gsoc2013-evolution-f2feef8356f9e3a2996224a215c52c5432603bd8.zip |
Bumped version number here to 0.15.99.7.
2001-10-29 Christopher James Lahey <clahey@ximian.com>
* configure.in: Bumped version number here to 0.15.99.7.
* gal/e-text/e-text.c, gal/e-text/e-text.h (e_text_stop_editing):
Exported this function.
(e_text_cancel_editing): New function. Allows you to revert
edits.
svn path=/trunk/; revision=14332
Diffstat (limited to 'widgets/text')
-rw-r--r-- | widgets/text/e-text.c | 20 | ||||
-rw-r--r-- | widgets/text/e-text.h | 6 |
2 files changed, 22 insertions, 4 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 42d31e0e75..bbcb0ec227 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -378,6 +378,8 @@ e_text_init (EText *text) text->model = e_text_model_new (); text->text = e_text_model_get_text (text->model); + text->revert = NULL; + gtk_object_ref (GTK_OBJECT (text->model)); gtk_object_sink (GTK_OBJECT (text->model)); @@ -503,6 +505,7 @@ e_text_destroy (GtkObject *object) g_free (text->lines); g_free (text->primary_selection); g_free (text->clipboard_selection); + g_free (text->revert); if (text->font) e_font_unref (text->font); @@ -3062,6 +3065,8 @@ start_editing (EText *text) if (text->editing) return; + text->revert = g_strdup (text->text); + text->editing = TRUE; if (text->pointer_in) { if (text->default_cursor_shown && (!text->draw_borders)) { @@ -3079,12 +3084,14 @@ start_editing (EText *text) g_timer_start(text->timer); } -static void -stop_editing (EText *text) +void +e_text_stop_editing (EText *text) { if (!text->editing) return; + g_free (text->revert); + text->editing = FALSE; if ( (!text->default_cursor_shown) && (!text->draw_borders) ) { gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas)->window, text->default_cursor); @@ -3097,6 +3104,13 @@ stop_editing (EText *text) } } +void +e_text_cancel_editing (EText *text) +{ + e_text_model_set_text(text->model, text->revert); + e_text_stop_editing (text); +} + static gboolean _click (gpointer data) { @@ -3124,7 +3138,7 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event) if (focus_event->in) { start_editing (text); } else { - stop_editing (text); + e_text_stop_editing (text); if (text->timeout_id) { g_source_remove(text->timeout_id); text->timeout_id = 0; diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h index 4a6a30188e..a5deedad3b 100644 --- a/widgets/text/e-text.h +++ b/widgets/text/e-text.h @@ -138,6 +138,8 @@ struct _EText { gpointer lines; /* Text split into lines (private field) */ int num_lines; /* Number of lines of text */ + gchar *revert; /* Text to revert to */ + #if 0 GdkFont *font; /* Font for text */ #else @@ -261,7 +263,9 @@ struct _ETextClass { /* Standard Gtk function */ -GtkType e_text_get_type (void); +GtkType e_text_get_type (void); +void e_text_cancel_editing (EText *text); +void e_text_stop_editing (EText *text); END_GNOME_DECLS |