aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-08-09 14:44:59 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-08-09 14:44:59 +0800
commit9ca73ebd87d811931bce784496b4141f722f7eb8 (patch)
treefc4faf09a547914a286f5d0bac0b767ddc225ade /widgets/text
parentee974e6d09d80808df9275e44295575815a230e4 (diff)
downloadgsoc2013-evolution-9ca73ebd87d811931bce784496b4141f722f7eb8.tar
gsoc2013-evolution-9ca73ebd87d811931bce784496b4141f722f7eb8.tar.gz
gsoc2013-evolution-9ca73ebd87d811931bce784496b4141f722f7eb8.tar.bz2
gsoc2013-evolution-9ca73ebd87d811931bce784496b4141f722f7eb8.tar.lz
gsoc2013-evolution-9ca73ebd87d811931bce784496b4141f722f7eb8.tar.xz
gsoc2013-evolution-9ca73ebd87d811931bce784496b4141f722f7eb8.tar.zst
gsoc2013-evolution-9ca73ebd87d811931bce784496b4141f722f7eb8.zip
Bumped version up to 0.10.99.2.
2001-08-09 Jon Trowbridge <trow@ximian.com> * configure.in: Bumped version up to 0.10.99.2. * gal/e-text/e-entry.c (e_entry_class_init): Added "completion_popup" signal. (e_entry_show_popup): Emit "completion_popup" signal if the popup has appeared or disappeared. (e_entry_enable_completion_full): Listen for "cancel_completion" signals from our model, and disable our completion if get one. (e_entry_completion_popup_is_visible): Added. Returns TRUE if the completion popup is on the screen. * gal/e-text/e-text-model.c (e_text_model_class_init): Added "cancel_completion" signal. (e_text_model_cancel_completion): Added. Emits "cancel_completion" signal. svn path=/trunk/; revision=11824
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-entry.c90
-rw-r--r--widgets/text/e-entry.h2
-rw-r--r--widgets/text/e-text-model.c17
-rw-r--r--widgets/text/e-text-model.h8
4 files changed, 89 insertions, 28 deletions
diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c
index 8c116b2708..b47e6c8ddd 100644
--- a/widgets/text/e-entry.c
+++ b/widgets/text/e-entry.c
@@ -67,6 +67,7 @@ enum {
E_ENTRY_CHANGED,
E_ENTRY_ACTIVATE,
E_ENTRY_POPUP,
+ E_ENTRY_COMPLETION_POPUP,
E_ENTRY_LAST_SIGNAL
};
@@ -529,7 +530,11 @@ e_entry_show_popup (EEntry *entry, gboolean visible)
}
e_completion_view_set_editable (E_COMPLETION_VIEW (entry->priv->completion_view), visible);
- entry->priv->popup_is_visible = visible;
+
+ if (entry->priv->popup_is_visible != visible) {
+ entry->priv->popup_is_visible = visible;
+ gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals[E_ENTRY_COMPLETION_POPUP], (gint) visible);
+ }
}
static void
@@ -549,7 +554,7 @@ e_entry_start_completion (EEntry *entry)
if (e_entry_is_empty (entry))
return;
-
+
e_completion_begin_search (entry->priv->completion,
e_entry_get_text (entry),
entry->priv->last_completion_pos = e_entry_get_position (entry),
@@ -695,6 +700,18 @@ button_press_cb (GtkWidget *w, GdkEvent *ev, gpointer user_data)
unbrowse_cb (E_COMPLETION_VIEW (w), entry);
}
+static void
+cancel_completion_cb (ETextModel *model, gpointer user_data)
+{
+ EEntry *entry = E_ENTRY (user_data);
+
+ /* If we get the signal from the underlying text model, unbrowse.
+ This usually means that the text model itself has done some
+ sort of completion, or has otherwise transformed its contents
+ in some way that would render any previous completion invalid. */
+ unbrowse_cb (E_COMPLETION_VIEW (entry->priv->completion_view), entry);
+}
+
static gint
key_press_cb (GtkWidget *w, GdkEventKey *ev, gpointer user_data)
{
@@ -771,6 +788,11 @@ e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint del
entry->priv->completion_view_popup = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_signal_connect (GTK_OBJECT (entry->item->model),
+ "cancel_completion",
+ GTK_SIGNAL_FUNC (cancel_completion_cb),
+ entry);
+
gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view_popup),
"key_press_event",
GTK_SIGNAL_FUNC (key_press_cb),
@@ -786,9 +808,16 @@ e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint del
gtk_container_add (GTK_CONTAINER (entry->priv->completion_view_popup), entry->priv->completion_view);
gtk_widget_show (entry->priv->completion_view);
- e_completion_view_connect_keys (
- E_COMPLETION_VIEW (entry->priv->completion_view),
- GTK_WIDGET (entry->canvas));
+ e_completion_view_connect_keys (E_COMPLETION_VIEW (entry->priv->completion_view),
+ GTK_WIDGET (entry->canvas));
+}
+
+gboolean
+e_entry_completion_popup_is_visible (EEntry *entry)
+{
+ g_return_val_if_fail (E_IS_ENTRY (entry), FALSE);
+
+ return entry->priv->popup_is_visible;
}
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
@@ -1124,26 +1153,37 @@ e_entry_class_init (GtkObjectClass *object_class)
klass->changed = NULL;
klass->activate = NULL;
- e_entry_signals[E_ENTRY_CHANGED] = gtk_signal_new ("changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EEntryClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_entry_signals[E_ENTRY_ACTIVATE] = gtk_signal_new ("activate",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EEntryClass, activate),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_entry_signals[E_ENTRY_POPUP] = gtk_signal_new ("popup",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EEntryClass, popup),
- gtk_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
+ e_entry_signals[E_ENTRY_CHANGED] =
+ gtk_signal_new ("changed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EEntryClass, changed),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ e_entry_signals[E_ENTRY_ACTIVATE] =
+ gtk_signal_new ("activate",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EEntryClass, activate),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ e_entry_signals[E_ENTRY_POPUP] =
+ gtk_signal_new ("popup",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EEntryClass, popup),
+ gtk_marshal_NONE__POINTER_INT,
+ GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
+
+ e_entry_signals[E_ENTRY_COMPLETION_POPUP] =
+ gtk_signal_new ("completion_popup",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EEntryClass, completion_popup),
+ gtk_marshal_NONE__INT,
+ GTK_TYPE_NONE, 1, GTK_TYPE_INT);
gtk_object_class_add_signals (object_class, e_entry_signals, E_ENTRY_LAST_SIGNAL);
diff --git a/widgets/text/e-entry.h b/widgets/text/e-entry.h
index 948bb8a4b2..8c2f387414 100644
--- a/widgets/text/e-entry.h
+++ b/widgets/text/e-entry.h
@@ -68,6 +68,7 @@ struct _EEntryClass {
void (* changed) (EEntry *entry);
void (* activate) (EEntry *entry);
void (* popup) (EEntry *entry, GdkEventButton *ev, gint pos);
+ void (* completion_popup) (EEntry *entry, gint visible);
};
GtkType e_entry_get_type (void);
@@ -87,6 +88,7 @@ void e_entry_set_editable (EEntry *entry, gboolean editable);
void e_entry_enable_completion (EEntry *entry, ECompletion *completion);
void e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint autocomplete_delay,
EEntryCompletionHandler handler);
+gboolean e_entry_completion_popup_is_visible (EEntry *entry);
END_GNOME_DECLS
diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c
index 4fec8724d8..6d96f0769c 100644
--- a/widgets/text/e-text-model.c
+++ b/widgets/text/e-text-model.c
@@ -31,6 +31,7 @@ enum {
E_TEXT_MODEL_CHANGED,
E_TEXT_MODEL_REPOSITION,
E_TEXT_MODEL_OBJECT_ACTIVATED,
+ E_TEXT_MODEL_CANCEL_COMPLETION,
E_TEXT_MODEL_LAST_SIGNAL
};
@@ -124,6 +125,14 @@ e_text_model_class_init (ETextModelClass *klass)
gtk_marshal_NONE__INT,
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
+
+ e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION] =
+ gtk_signal_new ("cancel_completion",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (ETextModelClass, cancel_completion),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, e_text_model_signals, E_TEXT_MODEL_LAST_SIGNAL);
@@ -327,6 +336,14 @@ e_text_model_changed (ETextModel *model)
}
void
+e_text_model_cancel_completion (ETextModel *model)
+{
+ g_return_if_fail (E_IS_TEXT_MODEL (model));
+
+ gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION]);
+}
+
+void
e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data)
{
g_return_if_fail (model != NULL);
diff --git a/widgets/text/e-text-model.h b/widgets/text/e-text-model.h
index b697ca8396..536028f256 100644
--- a/widgets/text/e-text-model.h
+++ b/widgets/text/e-text-model.h
@@ -49,9 +49,10 @@ struct _ETextModelClass {
GtkObjectClass parent_class;
/* Signal */
- void (* changed) (ETextModel *model);
- void (* reposition) (ETextModel *model, ETextModelReposFn fn, gpointer repos_fn_data);
- void (* object_activated) (ETextModel *model, gint obj_num);
+ void (* changed) (ETextModel *model);
+ void (* reposition) (ETextModel *model, ETextModelReposFn fn, gpointer repos_fn_data);
+ void (* object_activated) (ETextModel *model, gint obj_num);
+ void (* cancel_completion) (ETextModel *model);
/* Virtual methods */
@@ -75,6 +76,7 @@ GtkType e_text_model_get_type (void);
ETextModel *e_text_model_new (void);
void e_text_model_changed (ETextModel *model);
+void e_text_model_cancel_completion (ETextModel *model);
void e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data);
gint e_text_model_validate_position (ETextModel *model, gint pos);