Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
Fix some problems
Browse files Browse the repository at this point in the history
  • Loading branch information
ritze committed Jul 13, 2012
1 parent 7942cb5 commit ff6a6ad
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 40 deletions.
31 changes: 16 additions & 15 deletions plugins/language-support-python/python-assist.c
Expand Up @@ -187,8 +187,8 @@ python_assist_update_autocomplete (PythonAssist *assist)
suggestions = g_list_reverse (suggestions);

ianjuta_editor_assist_proposals (IANJUTA_EDITOR_ASSIST (assist->priv->iassist),
IANJUTA_PROVIDER(assist), proposals,
assist->priv->pre_word, finished, NULL);
IANJUTA_PROVIDER(assist), suggestions,
assist->priv->pre_word, TRUE, NULL);

g_list_foreach (suggestions, (GFunc) free_proposal, NULL);
g_list_free (suggestions);
Expand Down Expand Up @@ -474,7 +474,7 @@ python_assist_get_calltip_context_position (PythonAssist *assist)
return final_offset-1;
}

void
static void
python_assist_query_calltip (IAnjutaProvider *self,
const gchar *call_context,
GError** e)
Expand Down Expand Up @@ -531,15 +531,15 @@ python_assist_clear_calltip_context (PythonAssist* assist)
assist->priv->calltip_launcher = NULL;
}

void
static void
python_assist_clear_calltip_context_interface (IAnjutaProvider* self,
GError** e)
{
PythonAssist* assist = PYTHON_ASSIST (self);
python_assist_clear_calltip_context (assist);
}

gchar*
static gchar*
python_assist_get_calltip_context (IAnjutaProvider *self,
IAnjutaIterable *iter,
GError** e)
Expand Down Expand Up @@ -578,7 +578,7 @@ python_assist_completion_trigger_char (IAnjutaEditor* editor,
return retval;
}

IAnjutaIterable*
static IAnjutaIterable*
python_assist_populate (IAnjutaProvider* self, IAnjutaIterable* cursor, GError** e)
{
PythonAssist* assist = PYTHON_ASSIST (self);
Expand Down Expand Up @@ -633,7 +633,7 @@ python_assist_populate (IAnjutaProvider* self, IAnjutaIterable* cursor, GError**
return NULL;
}

gboolean
static gboolean
python_assist_get_boolean (IAnjutaProvider* self,
IAnjutaProviderSetting setting,
GError** e)
Expand Down Expand Up @@ -666,7 +666,7 @@ g_warning ("python_assist_get_boolean");
}

static IAnjutaEditor*
python_assist_get_editor (IAnjutaProvider* provider, GError** e)
python_assist_get_editor (IAnjutaProvider* self, GError** e)
{
PythonAssist* assist = PYTHON_ASSIST (self);
return IANJUTA_EDITOR (assist->priv->iassist);
Expand All @@ -687,6 +687,7 @@ python_assist_install (PythonAssist *assist,
if (IANJUTA_IS_EDITOR_ASSIST (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
Expand Down Expand Up @@ -766,11 +767,11 @@ python_assist_new (IAnjutaEditor *ieditor,
static void
python_assist_iface_init (IAnjutaProviderIface* iface)
{
iface->populate = python_assist_populate;
iface->clear_context = python_assist_clear_calltip_context_interface;
iface->query = python_assist_query_calltip;
iface->get_context = python_assist_get_calltip_context;
iface->get_boolean = python_assist_get_boolean;
iface->get_assist = python_assist_get_editor;
iface->get_name = python_assist_get_name;
iface->populate = python_assist_populate;
iface->clear_context = python_assist_clear_calltip_context_interface;
iface->query = python_assist_query_calltip;
iface->get_context = python_assist_get_calltip_context;
iface->get_boolean = python_assist_get_boolean;
iface->get_editor = python_assist_get_editor;
iface->get_name = python_assist_get_name;
}
29 changes: 15 additions & 14 deletions plugins/parser-cxx/assist.c
Expand Up @@ -610,7 +610,7 @@ g_warning ("parser_cxx_assist_create_autocompletion_cache");
*
* Returns: name of the method to show a calltip for or NULL
*/
gchar*
static gchar*
parser_cxx_assist_get_calltip_context (IAnjutaProvider *self,
IAnjutaIterable *iter,
GError** e)
Expand Down Expand Up @@ -731,7 +731,7 @@ g_warning ("on_calltip_search_complete");
*
* Starts an async query for the calltip
*/
void
static void
parser_cxx_assist_query_calltip (IAnjutaProvider *self,
const gchar *call_context,
GError** e)
Expand Down Expand Up @@ -786,7 +786,7 @@ g_warning ("parser_cxx_assist_clear_calltip_context");
g_warning ("parser_cxx_assist_clear_calltip_context: works");
}

void
static void
parser_cxx_assist_clear_calltip_context_interface (IAnjutaProvider* self,
GError** e)
{
Expand All @@ -811,7 +811,7 @@ g_warning ("parser_cxx_assist_cancelled");
g_warning ("parser_cxx_assist_cancelled: works");
}

IAnjutaIterable*
static IAnjutaIterable*
parser_cxx_assist_populate (IAnjutaProvider* self, IAnjutaIterable* cursor, GError** e)
{
g_warning ("parser_cxx_populate");
Expand Down Expand Up @@ -855,7 +855,7 @@ g_warning ("parser_cxx_populate");
return start_iter;
}

gboolean
static gboolean
parser_cxx_assist_get_boolean (IAnjutaProvider* self,
IAnjutaProviderSetting setting,
GError** e)
Expand All @@ -867,7 +867,7 @@ g_warning ("parser_cxx_assist_get_boolean");
switch (setting)
{
case IANJUTA_PROVIDER_PREF_CALLTIP_ENABLE:
key = PREF_ENABLE;
key = PREF_CALLTIP_ENABLE;
break;
case IANJUTA_PROVIDER_PREF_AUTOCOMPLETE_ENABLE:
key = PREF_AUTOCOMPLETE_ENABLE;
Expand All @@ -888,7 +888,7 @@ g_warning ("parser_cxx_assist_get_boolean");
}

static IAnjutaEditor*
parser_cxx_assist_get_editor (IAnjutaProvider* provider, GError** e)
parser_cxx_assist_get_editor (IAnjutaProvider* self, GError** e)
{
ParserCxxAssist* assist = PARSER_CXX_ASSIST (self);
return IANJUTA_EDITOR (assist->priv->iassist);
Expand Down Expand Up @@ -925,6 +925,7 @@ g_warning ("parser_cxx_assist_install");
if (IANJUTA_IS_EDITOR_ASSIST (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 (parser_cxx_assist_cancelled), assist);
}
else
Expand Down Expand Up @@ -1261,11 +1262,11 @@ g_warning ("parser_cxx_assist_new: works");
static void
parser_cxx_assist_iface_init (IAnjutaProviderIface* iface)
{
iface->populate = parser_cxx_assist_populate;
iface->clear_context = parser_cxx_assist_clear_calltip_context_interface;
iface->query = parser_cxx_assist_query_calltip;
iface->get_context = parser_cxx_assist_get_calltip_context;
iface->get_boolean = parser_cxx_assist_get_boolean;
iface->get_assist = parser_cxx_assist_get_editor;
iface->get_name = parser_cxx_assist_get_name;
iface->populate = parser_cxx_assist_populate;
iface->clear_context = parser_cxx_assist_clear_calltip_context_interface;
iface->query = parser_cxx_assist_query_calltip;
iface->get_context = parser_cxx_assist_get_calltip_context;
iface->get_boolean = parser_cxx_assist_get_boolean;
iface->get_editor = parser_cxx_assist_get_editor;
iface->get_name = parser_cxx_assist_get_name;
}
28 changes: 25 additions & 3 deletions plugins/snippets-manager/snippets-provider.c
Expand Up @@ -70,15 +70,26 @@ static void snippets_provider_iface_init (IAnjutaProviderIface*
static void snippets_provider_populate (IAnjutaProvider *self,
IAnjutaIterable *cursor,
GError **error);
/*TODO:
static IAnjutaIterable* snippets_provider_get_start_iter (IAnjutaProvider *self,
GError **error);
//TODO:
static void snippets_provider_activate (IAnjutaProvider *self,
IAnjutaIterable *iter,
gpointer data,
GError **error);
*/
static const gchar* snippets_provider_get_name (IAnjutaProvider *self,
GError **error);



iface->clear_context = snippets_providert_clear_calltip_context_interface;
iface->query = snippets_provider_query_calltip;
iface->get_context = snippets_provider_get_calltip_context;
iface->get_boolean = snippets_provider_get_boolean;
iface->get_editor = snippets_provider_get_editor;

G_DEFINE_TYPE_WITH_CODE (SnippetsProvider,
snippets_provider,
G_TYPE_OBJECT,
Expand Down Expand Up @@ -116,10 +127,18 @@ static void
snippets_provider_iface_init (IAnjutaProviderIface* iface)
{
iface->populate = snippets_provider_populate;
iface->get_start_iter = snippets_provider_get_start_iter;
iface->activate = snippets_provider_activate;
//TODO:
// iface->get_start_iter = snippets_provider_get_start_iter;
//TODO:
// iface->activate = snippets_provider_activate;
iface->get_name = snippets_provider_get_name;



iface->clear_context = snippets_providert_clear_calltip_context_interface;
iface->query = snippets_provider_query_calltip;
iface->get_context = snippets_provider_get_calltip_context;
iface->get_boolean = snippets_provider_get_boolean;
iface->get_editor = snippets_provider_get_editor;
}

/* Private methods */
Expand Down Expand Up @@ -690,6 +709,7 @@ snippets_provider_populate (IAnjutaProvider *self,

}

//TODO:
static IAnjutaIterable*
snippets_provider_get_start_iter (IAnjutaProvider *self,
GError **error)
Expand All @@ -703,6 +723,8 @@ snippets_provider_get_start_iter (IAnjutaProvider *self,
return priv->start_iter;
}


//TODO:
static void
snippets_provider_activate (IAnjutaProvider *self,
IAnjutaIterable *iter,
Expand Down
25 changes: 17 additions & 8 deletions plugins/sourceview/sourceview-provider.c
Expand Up @@ -21,6 +21,11 @@
#include "sourceview-cell.h"
#include "sourceview-private.h"
#include <libanjuta/anjuta-debug.h>
#include <libanjuta/interfaces/ianjuta-document.h>
#include <libanjuta/interfaces/ianjuta-editor-assist.h>
#include <libanjuta/interfaces/ianjuta-editor-cell.h>
#include <libanjuta/interfaces/ianjuta-editor-selection.h>
#include <libanjuta/interfaces/ianjuta-editor-tip.h>


static void
Expand All @@ -45,6 +50,7 @@ struct _SourceviewProviderPriv {
static void
sourceview_provider_clear_calltip_context (SourceviewProvider* prov)
{
g_warning ("sourceview_provider_clear_calltip_context");
g_free (prov->priv->calltip_context);
prov->priv->calltip_context = NULL;

Expand Down Expand Up @@ -93,7 +99,7 @@ g_warning ("sourceview_provider_calltip");
IAnjutaIterable *iter;
gchar *call_context;

editor = ianjuta_provider_get_editor (IANJUTA_PROVIDER (prov), NULL)
editor = ianjuta_provider_get_editor (prov->iprov, NULL);
tip = IANJUTA_EDITOR_TIP (editor);

iter = ianjuta_editor_get_position (editor, NULL);
Expand Down Expand Up @@ -197,11 +203,11 @@ static void
sourceview_provider_none (SourceviewProvider* prov)
{
g_warning ("sourceview_provider_none");
IAnjutaEditor *editor = ianjuta_provider_get_editor (prov->ipriv, NULL);
IAnjutaEditor *editor = ianjuta_provider_get_editor (prov->iprov, NULL);

if (IANJUTA_IS_EDITOR_ASSIST (editor))
ianjuta_editor_assist_proposals (IANJUTA_EDITOR_ASSIST (editor),
prov->ipriv, NULL, NULL, TRUE, NULL);
prov->iprov, NULL, NULL, TRUE, NULL);
}

/**
Expand All @@ -218,7 +224,7 @@ sourceview_provider_activate (SourceviewProvider* prov,
gpointer data)
{
g_warning ("sourceview_provider_activate");
IAnjutaProviderAssistProposalData *prop_data;
IAnjutaProviderProposalData *prop_data;
GString *assistance;
IAnjutaEditor *editor;
gboolean add_space_after_func = FALSE;
Expand Down Expand Up @@ -254,7 +260,7 @@ g_warning ("sourceview_provider_activate");

if (ianjuta_iterable_compare (iter, prov->priv->start_iter, NULL) != 0)
{
ianjuta_editor_selection_set (IANJUTA_EDITOR_SELECTION (te),
ianjuta_editor_selection_set (IANJUTA_EDITOR_SELECTION (editor),
prov->priv->start_iter, iter, FALSE, NULL);
ianjuta_editor_selection_replace (IANJUTA_EDITOR_SELECTION (editor),
assistance->str, -1, NULL);
Expand Down Expand Up @@ -353,7 +359,8 @@ g_warning ("sourceview_provider_populate");

/* Check if we actually want autocompletion at all */
if (!ianjuta_provider_get_boolean (prov->iprov,
IANJUTA_PROVIDER_PREF_AUTOCOMPLETE_ENABLE, NULL))
IANJUTA_PROVIDER_PREF_AUTOCOMPLETE_ENABLE,
NULL))
{
sourceview_provider_none (prov);
return;
Expand All @@ -370,13 +377,13 @@ g_warning ("sourceview_provider_populate");
}

/* Check for calltip */
IAnjutaEditor editor = ianjuta_provider_get_editor (prov->iprov, NULL);
IAnjutaEditor *editor = ianjuta_provider_get_editor (prov->iprov, NULL);
if (IANJUTA_IS_EDITOR_TIP (editor) &&
ianjuta_provider_get_boolean (prov->iprov,
IANJUTA_PROVIDER_PREF_CALLTIP_ENABLE,
NULL))
{
sourceview_provider_calltip (provider);
sourceview_provider_calltip (prov);
}

/* Execute language-specific part */
Expand Down Expand Up @@ -413,6 +420,7 @@ sourceview_provider_get_start_iter (GtkSourceCompletionProvider* provider,
GtkSourceCompletionProposal* proposal,
GtkTextIter* iter)
{
g_warning ("sourceview_provider_get_start_iter");
SourceviewProvider* prov = SOURCEVIEW_PROVIDER(provider);
if (prov->priv->start_iter)
{
Expand All @@ -431,6 +439,7 @@ sourceview_provider_activate_proposal (GtkSourceCompletionProvider* provider,
GtkSourceCompletionProposal* proposal,
GtkTextIter* iter)
{
g_warning ("sourceview_provider_activate_proposal");
SourceviewProvider* prov = SOURCEVIEW_PROVIDER (provider);
SourceviewCell* cell = sourceview_cell_new (iter, GTK_TEXT_VIEW(prov->sv->priv->view));
gpointer data = g_object_get_data (G_OBJECT(proposal), "__data");
Expand Down

0 comments on commit ff6a6ad

Please sign in to comment.