diff options
author | Jon Trowbridge <trow@gnu.org> | 2001-06-06 01:46:56 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-06-06 01:46:56 +0800 |
commit | dc04c9c3fa6c5dd075f2f1c0853ab1213b02f92c (patch) | |
tree | c53a5b9bda2cf03f8a397553bb4bc5665168bbf0 /widgets/text/e-completion-view.c | |
parent | ce23de3eeb67e8140f67f056644223f6c9cdb44a (diff) | |
download | gsoc2013-evolution-dc04c9c3fa6c5dd075f2f1c0853ab1213b02f92c.tar gsoc2013-evolution-dc04c9c3fa6c5dd075f2f1c0853ab1213b02f92c.tar.gz gsoc2013-evolution-dc04c9c3fa6c5dd075f2f1c0853ab1213b02f92c.tar.bz2 gsoc2013-evolution-dc04c9c3fa6c5dd075f2f1c0853ab1213b02f92c.tar.lz gsoc2013-evolution-dc04c9c3fa6c5dd075f2f1c0853ab1213b02f92c.tar.xz gsoc2013-evolution-dc04c9c3fa6c5dd075f2f1c0853ab1213b02f92c.tar.zst gsoc2013-evolution-dc04c9c3fa6c5dd075f2f1c0853ab1213b02f92c.zip |
Small changes throughout to use ECompletionMatch.
2001-06-05 Jon Trowbridge <trow@gnu.org>
* gal/e-text/e-entry.c: Small changes throughout to use
ECompletionMatch.
* gal/e-text/e-completion-view.c: Small changes throughout
to use ECompletionMatch.
* gal/e-text/e-completion.c: Small changes throughout to use
ECompletionMatch.
* gal/e-text/e-completion-match.h:
* gal/e-text/e-completion-match.c: Added. A struct to contain
completion matches. This lets us more easily pass around
information between the various bits of completion machinery.
svn path=/trunk/; revision=10118
Diffstat (limited to 'widgets/text/e-completion-view.c')
-rw-r--r-- | widgets/text/e-completion-view.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c index 2ffb19f3e3..50f1c6b469 100644 --- a/widgets/text/e-completion-view.c +++ b/widgets/text/e-completion-view.c @@ -143,9 +143,9 @@ e_completion_view_class_init (ECompletionViewClass *klass) GTK_RUN_LAST, object_class->type, GTK_SIGNAL_OFFSET (ECompletionViewClass, activate), - gtk_marshal_NONE__POINTER_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, GTK_TYPE_POINTER); + gtk_marshal_NONE__POINTER, + GTK_TYPE_NONE, 1, + GTK_TYPE_POINTER); gtk_object_class_add_signals (object_class, e_completion_view_signals, E_COMPLETION_VIEW_LAST_SIGNAL); @@ -217,8 +217,9 @@ e_completion_view_clear_choices (ECompletionView *cv) g_return_if_fail (cv != NULL); g_return_if_fail (E_IS_COMPLETION_VIEW (cv)); - for (i = cv->choices; i != NULL; i = g_list_next (i)) - g_free (i->data); + for (i = cv->choices; i != NULL; i = g_list_next (i)) { + e_completion_match_unref ((ECompletionMatch *) i->data); + } g_list_free (cv->choices); cv->choices = NULL; @@ -293,12 +294,11 @@ e_completion_view_set_cursor_row (ECompletionView *cv, gint r) static void e_completion_view_select (ECompletionView *cv, gint r) { - const gchar *sel = (const gchar *) g_list_nth_data (cv->choices, r); - gpointer extra = e_completion_find_extra_data (cv->completion, sel); + ECompletionMatch *match = (ECompletionMatch *) g_list_nth_data (cv->choices, r); cv->selection = r; e_completion_view_set_cursor_row (cv, r); - gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], sel, extra); + gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], match); } static gint @@ -421,13 +421,14 @@ cancel_completion_cb (ECompletion *completion, gpointer user_data) } static void -completion_cb (ECompletion *completion, const gchar *text, gpointer extra_data, gpointer user_data) +completion_cb (ECompletion *completion, ECompletionMatch *match, gpointer user_data) { ECompletionView *cv = E_COMPLETION_VIEW (user_data); gint r = cv->choice_count; gboolean first = (cv->choices == NULL); - cv->choices = g_list_append (cv->choices, g_strdup (text)); + cv->choices = g_list_append (cv->choices, match); + e_completion_match_ref (match); ++cv->choice_count; e_table_model_row_inserted (cv->model, r); @@ -486,11 +487,11 @@ static gpointer table_value_at (ETableModel *etm, gint c, gint r, gpointer data) { ECompletionView *cv = E_COMPLETION_VIEW (data); - gpointer p; + ECompletionMatch *match; - p = g_list_nth_data (cv->choices, r); + match = (ECompletionMatch *) g_list_nth_data (cv->choices, r); - return p; + return (gpointer) e_completion_match_get_menu_text (match); } static gchar * |