[Geany] getting project base_path from plugin

Jeff Pohlmeyer yetanothergeek at xxxxx
Tue Dec 25 09:27:58 UTC 2007


On Dec 24, 2007 4:15 PM, Bo Lorentsen <bl at lue.dk> wrote:

> While getting my cmake plugin working I got this strange error while
> compiling.
>
> cmakeprj.c:256: error: 'GeanyApp' has no member named 'geany_data'

I think this is because there is already a macro named "project" in the
pluginmacros.h file:
  #define project  app->project

So when you say app->project, the preprocessor expands it
to app->app->project, which causes the error you are seeing.

Maybe try this instead:

  256 : if( project != NULL )
  257 :   base_path = project->base_path;




> Also, how do I get noted if the project is changed or saved ?


Your callbacks will be automatically registered if you do
something like this:


void my_proj_open(GObject *obj, GKeyFile *config, gpointer user_data)
{
  g_print("Project opened!")
}

void my_proj_saved(GObject *obj, GKeyFile *config, gpointer user_data)
{
  g_print("Project saved!")
}

void my_proj_close(GObject *obj, GKeyFile *config, gpointer user_data)
{
  g_print("Project closed!")
}


GeanyCallback	geany_callbacks[] = {
  {"project-open", (GCallback) &my_proj_open, TRUE, NULL},
  {"project-save", (GCallback) &my_proj_save, TRUE, NULL},
  {"project-close", (GCallback) &my_proj_close, TRUE, NULL},
  {NULL, NULL, FALSE, NULL}
};


Hope this helps,

 - Jeff



More information about the Users mailing list