aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-03-21 10:53:55 +0800
committerChris Lahey <clahey@src.gnome.org>2000-03-21 10:53:55 +0800
commitf60b9107e9d0a10bc54307c279f789c26a794736 (patch)
treef4912fca26063ba92abbddf3240f7a38d4ed8651
parent5fe5e0f7431c00d4438eaed35825cb6a33dbe05f (diff)
downloadgsoc2013-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
-rw-r--r--ChangeLog11
-rw-r--r--addressbook/demo/addressbook-widget.c16
-rw-r--r--widgets/e-text/e-text.c52
-rw-r--r--widgets/e-text/e-text.h1
-rw-r--r--widgets/text/e-text.c52
-rw-r--r--widgets/text/e-text.h1
6 files changed, 97 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index 38ed40b9fa..8878e4ff9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+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.
+
2000-03-20 Matt Loper <matt@helixcode.com>
* tests/ui-tests/.cvsignore: added filter.
diff --git a/addressbook/demo/addressbook-widget.c b/addressbook/demo/addressbook-widget.c
index 4efca22e3f..1252f9993c 100644
--- a/addressbook/demo/addressbook-widget.c
+++ b/addressbook/demo/addressbook-widget.c
@@ -79,25 +79,33 @@ static ETestModel *
get_model(char *filename)
{
ETestModel *model;
+ gboolean free_filename = FALSE;
- if ( filename == NULL )
- filename = "addressbook.xml";
+ if ( filename == NULL ) {
+ filename = gnome_util_prepend_user_home("addressbook.xml");
+ free_filename = TRUE;
+ }
if ( models == NULL ) {
models = g_hash_table_new(g_str_hash, g_str_equal);
}
model = g_hash_table_lookup(models, filename);
- if ( model )
+ if ( model ) {
+ if (free_filename)
+ g_free(filename);
return model;
+ }
- filename = g_strdup(filename);
+ if ( !free_filename )
+ filename = g_strdup(filename);
model = E_TEST_MODEL(e_test_model_new(filename));
g_hash_table_insert(models,
filename, model);
gtk_signal_connect(GTK_OBJECT(model), "destroy",
GTK_SIGNAL_FUNC(remove_model), filename);
+
return model;
}
diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c
index 85950f149a..da4e2ba64b 100644
--- a/widgets/e-text/e-text.c
+++ b/widgets/e-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);
}
}
diff --git a/widgets/e-text/e-text.h b/widgets/e-text/e-text.h
index a4bc06d820..e7dbd8761c 100644
--- a/widgets/e-text/e-text.h
+++ b/widgets/e-text/e-text.h
@@ -164,6 +164,7 @@ struct _EText {
gboolean button_down; /* Is mouse button 1 down */
ETextEventProcessor *tep; /* Text Event Processor */
+ gint tep_command_id;
GtkWidget *invisible; /* For selection handling */
gboolean has_selection; /* TRUE if we have the selection */
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);
}
}
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
index a4bc06d820..e7dbd8761c 100644
--- a/widgets/text/e-text.h
+++ b/widgets/text/e-text.h
@@ -164,6 +164,7 @@ struct _EText {
gboolean button_down; /* Is mouse button 1 down */
ETextEventProcessor *tep; /* Text Event Processor */
+ gint tep_command_id;
GtkWidget *invisible; /* For selection handling */
gboolean has_selection; /* TRUE if we have the selection */