diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-03-21 10:53:55 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-03-21 10:53:55 +0800 |
commit | f60b9107e9d0a10bc54307c279f789c26a794736 (patch) | |
tree | f4912fca26063ba92abbddf3240f7a38d4ed8651 /widgets/text/e-text.c | |
parent | 5fe5e0f7431c00d4438eaed35825cb6a33dbe05f (diff) | |
download | gsoc2013-evolution-f60b9107e9d0a10bc54307c279f789c26a794736.tar gsoc2013-evolution-f60b9107e9d0a10bc54307c279f789c26a794736.tar.gz gsoc2013-evolution-f60b9107e9d0a10bc54307c279f789c26a794736.tar.bz2 gsoc2013-evolution-f60b9107e9d0a10bc54307c279f789c26a794736.tar.lz gsoc2013-evolution-f60b9107e9d0a10bc54307c279f789c26a794736.tar.xz gsoc2013-evolution-f60b9107e9d0a10bc54307c279f789c26a794736.tar.zst gsoc2013-evolution-f60b9107e9d0a10bc54307c279f789c26a794736.zip |
Added the ability to access the text event processor.
2000-03-20 Christopher James Lahey <clahey@helixcode.com>
* widgets/e-text/e-text.c, widgets/e-text/e-text.h: Added the
ability to access the text event processor.
2000-03-13 Christopher James Lahey <clahey@helixcode.com>
* addressbook/demo/addressbook-widget.c: Made the addressbook
component look in the users home directory for the addressbook.xml
file.
svn path=/trunk/; revision=2125
Diffstat (limited to 'widgets/text/e-text.c')
-rw-r--r-- | widgets/text/e-text.c | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index 85950f149a..da4e2ba64b 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -30,7 +30,6 @@ #include "e-text-event-processor-emacs-like.h" enum { - E_TEXT_RESIZE, E_TEXT_CHANGE, E_TEXT_LAST_SIGNAL }; @@ -53,6 +52,7 @@ struct line { enum { ARG_0, ARG_MODEL, + ARG_EVENT_PROCESSOR, ARG_TEXT, ARG_X, ARG_Y, @@ -120,6 +120,8 @@ static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, static void e_text_text_model_changed(ETextModel *model, EText *text); +static void _get_tep(EText *text); + static GtkWidget *e_text_get_invisible(EText *text); static void _selection_clear_event (GtkInvisible *invisible, GdkEventSelection *event, @@ -188,15 +190,6 @@ e_text_class_init (ETextClass *klass) parent_class = gtk_type_class (gnome_canvas_item_get_type ()); - e_text_signals[E_TEXT_RESIZE] = - gtk_signal_new ("resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextClass, resize), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_text_signals[E_TEXT_CHANGE] = gtk_signal_new ("change", GTK_RUN_LAST, @@ -210,6 +203,8 @@ e_text_class_init (ETextClass *klass) gtk_object_add_arg_type ("EText::model", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_MODEL); + gtk_object_add_arg_type ("EText::event_processor", + GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR); gtk_object_add_arg_type ("EText::text", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT); gtk_object_add_arg_type ("EText::x", @@ -270,7 +265,6 @@ e_text_class_init (ETextClass *klass) - klass->resize = NULL; klass->change = NULL; object_class->destroy = e_text_destroy; @@ -334,6 +328,7 @@ e_text_init (EText *text) text->button_down = FALSE; text->tep = NULL; + text->tep_command_id = 0; text->has_selection = FALSE; @@ -371,6 +366,10 @@ e_text_destroy (GtkObject *object) if (text->model) gtk_object_unref(GTK_OBJECT(text->model)); + if (text->tep_command_id) + gtk_signal_disconnect(GTK_OBJECT(text->tep), + text->tep_command_id); + if (text->tep) gtk_object_unref (GTK_OBJECT(text->tep)); @@ -428,7 +427,7 @@ get_bounds_item_relative (EText *text, double *px1, double *py1, double *px2, do text->height = 0; if (old_height != text->height) - gtk_signal_emit_by_name (GTK_OBJECT (text), "resize"); + e_canvas_item_request_parent_reflow(item); /* Anchor text */ @@ -918,6 +917,21 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) needs_reflow = 1; break; + case ARG_EVENT_PROCESSOR: + if ( text->tep && text->tep_command_id ) + gtk_signal_disconnect(GTK_OBJECT(text->tep), + text->tep_command_id); + if ( text->tep ) + gtk_object_unref(GTK_OBJECT(text->tep)); + text->tep = E_TEXT_EVENT_PROCESSOR(GTK_VALUE_OBJECT (*arg)); + gtk_object_ref(GTK_OBJECT(text->tep)); + text->tep_command_id = + gtk_signal_connect(GTK_OBJECT(text->tep), + "command", + GTK_SIGNAL_FUNC(e_text_command), + text); + break; + case ARG_TEXT: e_text_model_set_text(text->model, GTK_VALUE_STRING (*arg)); break; @@ -1180,6 +1194,11 @@ e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(text->model); break; + case ARG_EVENT_PROCESSOR: + _get_tep(text); + GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(text->tep); + break; + case ARG_TEXT: GTK_VALUE_STRING (*arg) = g_strdup (text->text); break; @@ -1529,10 +1548,11 @@ _get_tep(EText *text) text->tep = e_text_event_processor_emacs_like_new(); gtk_object_ref (GTK_OBJECT (text->tep)); gtk_object_sink (GTK_OBJECT (text->tep)); - gtk_signal_connect(GTK_OBJECT(text->tep), - "command", - GTK_SIGNAL_FUNC(e_text_command), - (gpointer) text); + text->tep_command_id = + gtk_signal_connect(GTK_OBJECT(text->tep), + "command", + GTK_SIGNAL_FUNC(e_text_command), + (gpointer) text); } } |