diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-10-27 22:48:20 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-10-27 22:48:20 +0800 |
commit | dfdfa72ec5b7d56e9b6894b491e3b00d9bd21be2 (patch) | |
tree | 959b75aac9c36dc36b3c953e90727b0e8de691ed /e-util | |
parent | 0e9dae0eb6c2f22aeb8904c7d161d68133a385b7 (diff) | |
download | gsoc2013-evolution-dfdfa72ec5b7d56e9b6894b491e3b00d9bd21be2.tar.gz gsoc2013-evolution-dfdfa72ec5b7d56e9b6894b491e3b00d9bd21be2.tar.zst gsoc2013-evolution-dfdfa72ec5b7d56e9b6894b491e3b00d9bd21be2.zip |
Added an "allow_newlines" argument.
2000-10-27 Christopher James Lahey <clahey@helixcode.com>
* gal/e-text/e-entry.c,
gal/e-text/e-text-event-processor-emacs-like.c,
gal/e-text/e-text-event-processor-emacs-like.h,
gal/e-text/e-text-event-processor.c,
gal/e-text/e-text-event-processor.h, gal/e-text/e-text.c: Added an
"allow_newlines" argument.
svn path=/trunk/; revision=6226
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-text-event-processor-emacs-like.c | 2 | ||||
-rw-r--r-- | e-util/e-text-event-processor-emacs-like.h | 2 | ||||
-rw-r--r-- | e-util/e-text-event-processor.c | 72 | ||||
-rw-r--r-- | e-util/e-text-event-processor.h | 6 |
4 files changed, 62 insertions, 20 deletions
diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c index 2910ec36ab..bfba76885b 100644 --- a/e-util/e-text-event-processor-emacs-like.c +++ b/e-util/e-text-event-processor-emacs-like.c @@ -303,7 +303,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro break; case GDK_Return: case GDK_KP_Enter: - if (key.state & GDK_CONTROL_MASK) { + if ((key.state & GDK_CONTROL_MASK) || (!tep->allow_newlines)) { command.action = E_TEP_ACTIVATE; command.position = E_TEP_SELECTION; } else { diff --git a/e-util/e-text-event-processor-emacs-like.h b/e-util/e-text-event-processor-emacs-like.h index a2a7bc478c..708ddfcbeb 100644 --- a/e-util/e-text-event-processor-emacs-like.h +++ b/e-util/e-text-event-processor-emacs-like.h @@ -48,7 +48,7 @@ struct _ETextEventProcessorEmacsLike ETextEventProcessor parent; /* object specific fields */ - gboolean mouse_down; + guint mouse_down : 1; }; struct _ETextEventProcessorEmacsLikeClass diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c index cded8171e6..772ae5c12b 100644 --- a/e-util/e-text-event-processor.c +++ b/e-util/e-text-event-processor.c @@ -25,11 +25,15 @@ static void e_text_event_processor_init (ETextEventProcessor *card); static void e_text_event_processor_class_init (ETextEventProcessorClass *klass); +static void e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void e_text_event_processor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); + static GtkObjectClass *parent_class = NULL; /* The arguments we take */ enum { - ARG_0 + ARG_0, + ARG_ALLOW_NEWLINES, }; enum { @@ -67,30 +71,37 @@ e_text_event_processor_get_type (void) static void e_text_event_processor_class_init (ETextEventProcessorClass *klass) { - GtkObjectClass *object_class; + GtkObjectClass *object_class; + + object_class = (GtkObjectClass*) klass; - object_class = (GtkObjectClass*) klass; + parent_class = gtk_type_class (gtk_object_get_type ()); - parent_class = gtk_type_class (gtk_object_get_type ()); + e_tep_signals[E_TEP_EVENT] = + gtk_signal_new ("command", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command), + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); - e_tep_signals[E_TEP_EVENT] = - gtk_signal_new ("command", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); + gtk_object_class_add_signals (object_class, e_tep_signals, E_TEP_LAST_SIGNAL); - gtk_object_class_add_signals (object_class, e_tep_signals, E_TEP_LAST_SIGNAL); + gtk_object_add_arg_type ("ETextEventProcessor::allow_newlines", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES); - klass->event = NULL; - klass->command = NULL; + klass->event = NULL; + klass->command = NULL; + + object_class->set_arg = e_text_event_processor_set_arg; + object_class->get_arg = e_text_event_processor_get_arg; } static void e_text_event_processor_init (ETextEventProcessor *tep) { + tep->allow_newlines = TRUE; } gint @@ -102,3 +113,34 @@ e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcess return 0; } } + +/* Set_arg handler for the text item */ +static void +e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object); + + switch (arg_id) { + case ARG_ALLOW_NEWLINES: + tep->allow_newlines = GTK_VALUE_BOOL (*arg); + break; + default: + return; + } +} + +/* Get_arg handler for the text item */ +static void +e_text_event_processor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object); + + switch (arg_id) { + case ARG_ALLOW_NEWLINES: + GTK_VALUE_BOOL (*arg) = tep->allow_newlines; + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} diff --git a/e-util/e-text-event-processor.h b/e-util/e-text-event-processor.h index d6937383f0..9f9fbc9c24 100644 --- a/e-util/e-text-event-processor.h +++ b/e-util/e-text-event-processor.h @@ -45,10 +45,10 @@ typedef struct _ETextEventProcessorClass ETextEventProcessorClass; struct _ETextEventProcessor { - GtkObject parent; + GtkObject parent; - /* object specific fields */ - + /* object specific fields */ + guint allow_newlines : 1; }; struct _ETextEventProcessorClass |