[anjuta] python-support: Connect to "cancelled" signal to cancel queries
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] python-support: Connect to "cancelled" signal to cancel queries
- Date: Sun, 8 Aug 2010 10:22:27 +0000 (UTC)
commit 5b4f40e16ebeed63632bc9e7d9f7e2223e247cc5
Author: Johannes Schmid <jhs gnome org>
Date: Sun Aug 8 12:21:45 2010 +0200
python-support: Connect to "cancelled" signal to cancel queries
plugins/language-support-python/python-assist.c | 24 ++++++++++++++++++++--
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/plugins/language-support-python/python-assist.c b/plugins/language-support-python/python-assist.c
index d311cda..825ee75 100644
--- a/plugins/language-support-python/python-assist.c
+++ b/plugins/language-support-python/python-assist.c
@@ -243,14 +243,20 @@ python_assist_get_pre_word (IAnjutaEditor* editor, IAnjutaIterable *iter, IAnjut
return preword_chars;
}
-static void
-python_assist_destroy_completion_cache (PythonAssist *assist)
+static void
+python_assist_cancel_queries (PythonAssist* assist)
{
if (assist->priv->launcher)
{
g_object_unref (assist->priv->launcher);
assist->priv->launcher = NULL;
}
+}
+
+static void
+python_assist_destroy_completion_cache (PythonAssist *assist)
+{
+ python_assist_cancel_queries (assist);
if (assist->priv->search_cache)
{
g_free (assist->priv->search_cache);
@@ -281,6 +287,13 @@ static void free_proposal (IAnjutaEditorAssistProposal* proposal)
}
static void
+python_assist_cancelled (IAnjutaEditorAssist* editor,
+ PythonAssist* assist)
+{
+ python_assist_cancel_queries (assist);
+}
+
+static void
python_assist_update_autocomplete (PythonAssist *assist)
{
GList *node, *suggestions = NULL;
@@ -933,6 +946,7 @@ python_assist_install (PythonAssist *assist, IAnjutaEditor *ieditor)
{
assist->priv->iassist = IANJUTA_EDITOR_ASSIST (ieditor);
ianjuta_editor_assist_add (IANJUTA_EDITOR_ASSIST (ieditor), IANJUTA_PROVIDER(assist), NULL);
+ g_signal_connect (ieditor, "cancelled", G_CALLBACK (python_assist_cancelled), assist);
}
else
{
@@ -954,7 +968,11 @@ python_assist_uninstall (PythonAssist *assist)
{
g_return_if_fail (assist->priv->iassist != NULL);
- ianjuta_editor_assist_remove (assist->priv->iassist, IANJUTA_PROVIDER(assist), NULL);
+ if (IANJUTA_EDITOR_ASSIST (assist->priv->iassist))
+ {
+ ianjuta_editor_assist_remove (assist->priv->iassist, IANJUTA_PROVIDER(assist), NULL);
+ g_signal_handlers_disconnect_by_func (assist->priv->iassist, python_assist_cancelled, assist);
+ }
assist->priv->iassist = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]