aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names-manager.c
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-12-28 11:08:27 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-12-28 11:08:27 +0800
commit2786536d7f25b29b20a41b417896cff810368d85 (patch)
tree3ecdda5c24e1de152937a451a10bc09a5be891ba /addressbook/gui/component/select-names/e-select-names-manager.c
parentb054d4b4e6f7eff593a2ac7c3b40f2d8bb92b82c (diff)
downloadgsoc2013-evolution-2786536d7f25b29b20a41b417896cff810368d85.tar
gsoc2013-evolution-2786536d7f25b29b20a41b417896cff810368d85.tar.gz
gsoc2013-evolution-2786536d7f25b29b20a41b417896cff810368d85.tar.bz2
gsoc2013-evolution-2786536d7f25b29b20a41b417896cff810368d85.tar.lz
gsoc2013-evolution-2786536d7f25b29b20a41b417896cff810368d85.tar.xz
gsoc2013-evolution-2786536d7f25b29b20a41b417896cff810368d85.tar.zst
gsoc2013-evolution-2786536d7f25b29b20a41b417896cff810368d85.zip
When we clean, don't clean the model's last element. This helps keep
2001-12-27 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names.c (real_add_address_cb): When we clean, don't clean the model's last element. This helps keep things working properly when we have signal-character separators. (section_right_click_cb): Changed to work properly with our EText-emitted popup signal. (e_select_names_add_section): Use ETexts for the recipient sections, rather than tables. This lets us make them directly editable. (Bug #1721) * gui/component/select-names/e-select-names-popup.c (popup_info_new): Pass in a ESelectNamesTextModel, not a ESelectNamesModel. (e_select_names_popup): Adjust for the new signature for e_select_names_model_text_pos. * gui/component/select-names/e-select-names-manager.c (focus_out_cb): Schedule a cleaning when we focus out. (focus_in_cb): Cancel pending cleaning when we get focus. This helps us avoid bad things happening during the fast focus out/ins that happen when the completion dropdown appears. (completion_handler): Adjust for new signatures of e_select_names_model_text_pos and e_select_names_model_name_pos. (e_select_names_manager_entry_new): Pass in our ESelectNamesTextModel when constructing the ESelectNamesCompletion. (e_select_names_manager_entry_free): Cancel any pending clean-ups. * gui/component/select-names/e-select-names-bonobo.c (entry_get_property_fn): Get the text off of the text model. Which is the only way that really makes sense when you think about it. * gui/component/select-names/e-select-names-completion.c: Added a copy of the associated ESelectNamesTextModel to ESelectNamesCompletionPrivate. This replaces the ESelectNamesModel. (e_select_names_completion_destroy): Unref ->text_model. (e_select_names_completion_handle_request): Pass in our text model's separator info when calling e_select_names_model_text_pos. (e_select_names_completion_new): Pass in the text model as an arg instead of the model, and ref it as needed. * gui/component/select-names/e-select-names-text-model.c (e_select_names_text_model_init): Set separator as either ", " or ",", depending on the value of the EVOLUTION_DISABLE_MAGIC_COMMA environment variable. (e_select_names_text_model_destroy): Free the separator. (changed_cb): Flush our cached text on changed. (e_select_names_text_model_set_source): Use our own changed_cb callback on changed, rather than just connecting up e_text_model_changed. (e_select_names_text_model_set_separator): Added. Lets the separator between recipients be specified. (e_select_names_text_model_get_text): Cache the text we get from calling e_select_names_model_get_textification. (e_select_names_text_model_insert_length): A bunch of small changes to properly support generic separators, rather than (implicit and explicitly) assuming ", ". (e_select_names_text_model_delete): More small tweaks to handle generic separators. (e_select_names_text_model_get_nth_obj): Use new signature when calling e_select_names_model_name_pos, and use our cached text. * gui/component/select-names/e-select-names-model.c (e_select_names_model_destroy): We don't cache the text or addr_text anymore, so no need to free them here. (e_select_names_model_changed): ...and no need to reset our text and addr_text caches here. (e_select_names_model_get_textification): Take a separator as an arg, rather than just using ", ". Also, no caching. (e_select_names_model_get_address_text): Take a separator as an arg, rather than just using ", ". And no caching here either. (e_select_names_model_clean): Add arg that give us control over whether or not the last entry should get cleaned. We need this when using a one-character separator, so that new destinations that get tacked onto the end don't get immediately cleaned away for being empty. (e_select_names_model_name_pos): Take the separator length as an argument, remove implicit assumption of length 2. (e_select_names_model_text_pos): Take the separator length as an argument, remove implicit assumption of length 2.CVS: ---------------------------------------------------------------------- svn path=/trunk/; revision=15221
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-manager.c')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
index 54d7344ece..53978ac502 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ b/addressbook/gui/component/select-names/e-select-names-manager.c
@@ -51,6 +51,7 @@ typedef struct {
EEntry *entry;
ESelectNamesManager *manager;
ESelectNamesModel *model;
+ guint cleaning_tag;
} ESelectNamesManagerEntry;
static void e_select_names_manager_init (ESelectNamesManager *manager);
@@ -136,9 +137,24 @@ get_entry_info (EEntry *entry)
static void
popup_cb (EEntry *eentry, GdkEventButton *ev, gint pos, gpointer user_data)
{
- ESelectNamesManagerEntry *entry = user_data;
+ ESelectNamesTextModel *text_model;
+
+ gtk_object_get (GTK_OBJECT (eentry),
+ "model", &text_model,
+ NULL);
+ g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model));
+
+ e_select_names_popup (text_model, ev, pos);
+}
- e_select_names_popup (entry->model, ev, pos);
+static gboolean
+clean_cb (gpointer ptr)
+{
+ ESelectNamesManagerEntry *entry = ptr;
+
+ e_select_names_model_clean (entry->model, TRUE);
+ entry->cleaning_tag = 0;
+ return FALSE;
}
static gint
@@ -146,6 +162,11 @@ focus_in_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data)
{
ESelectNamesManagerEntry *entry = user_data;
+ if (entry->cleaning_tag) {
+ gtk_timeout_remove (entry->cleaning_tag);
+ entry->cleaning_tag = 0;
+ }
+
e_select_names_model_cancel_cardify_all (entry->model);
return FALSE;
@@ -155,11 +176,13 @@ static gint
focus_out_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data)
{
ESelectNamesManagerEntry *entry = user_data;
+ gboolean visible = e_entry_completion_popup_is_visible (entry->entry);
- e_select_names_model_clean (entry->model);
-
- if (!e_entry_completion_popup_is_visible (entry->entry))
+ if (! visible) {
e_select_names_model_cardify_all (entry->model, entry->manager->completion_book, 100);
+ if (entry->cleaning_tag == 0)
+ entry->cleaning_tag = gtk_timeout_add (100, clean_cb, entry);
+ }
return FALSE;
}
@@ -177,6 +200,7 @@ static void
completion_handler (EEntry *entry, ECompletionMatch *match)
{
ESelectNamesManagerEntry *mgr_entry;
+ ESelectNamesTextModel *text_model;
EDestination *dest;
gint i, pos, start_pos, len;
@@ -191,10 +215,15 @@ completion_handler (EEntry *entry, ECompletionMatch *match)
bitch. */
gtk_object_ref (GTK_OBJECT (dest));
+ gtk_object_get (GTK_OBJECT (entry),
+ "model", &text_model,
+ NULL);
+ g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model));
+
pos = e_entry_get_position (entry);
- e_select_names_model_text_pos (mgr_entry->model, pos, &i, NULL, NULL);
+ e_select_names_model_text_pos (mgr_entry->model, text_model->seplen, pos, &i, NULL, NULL);
e_select_names_model_replace (mgr_entry->model, i, dest);
- e_select_names_model_name_pos (mgr_entry->model, i, &start_pos, &len);
+ e_select_names_model_name_pos (mgr_entry->model, text_model->seplen, i, &start_pos, &len);
e_entry_set_position (entry, start_pos+len);
}
@@ -223,7 +252,7 @@ e_select_names_manager_entry_new (ESelectNamesManager *manager, ESelectNamesMode
gtk_object_ref (GTK_OBJECT (entry->entry));
- comp = e_select_names_completion_new (NULL, model);
+ comp = e_select_names_completion_new (NULL, E_SELECT_NAMES_TEXT_MODEL (text_model));
if (manager->completion_book)
e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION (comp),
manager->completion_book);
@@ -257,6 +286,7 @@ e_select_names_manager_entry_new (ESelectNamesManager *manager, ESelectNamesMode
gtk_object_set_data (GTK_OBJECT (entry->entry), "entry_info", entry);
gtk_object_set_data (GTK_OBJECT (entry->entry), "select_names_model", model);
+ gtk_object_set_data (GTK_OBJECT (entry->entry), "select_names_text_model", text_model);
gtk_object_set_data (GTK_OBJECT (entry->entry), "completion_handler", comp);
return entry;
@@ -272,6 +302,9 @@ e_select_names_manager_entry_free (ESelectNamesManagerEntry *entry)
gtk_object_unref (GTK_OBJECT (entry->model));
gtk_object_unref (GTK_OBJECT (entry->entry));
+ if (entry->cleaning_tag)
+ gtk_timeout_remove (entry->cleaning_tag);
+
g_free (entry);
}