Branch: refs/heads/master Author: Frank Lanitz frank@frank.uvena.de Committer: Frank Lanitz frank@frank.uvena.de Date: Wed, 03 Sep 2014 22:45:19 UTC Commit: cd5bd3b5e2ce64e2457317c963aa9402b36138f2 https://github.com/geany/geany-plugins/commit/cd5bd3b5e2ce64e2457317c963aa94...
Log Message: ----------- Merge pull request #149 from codebrainz/geanylua-fixups
Minor GeanyLua fixups
Modified Paths: -------------- geanylua/geanylua.c geanylua/glspi.h geanylua/glspi_app.c geanylua/glspi_init.c geanylua/glspi_sci.c
Modified: geanylua/geanylua.c 9 lines changed, 1 insertions(+), 8 deletions(-) =================================================================== @@ -35,14 +35,7 @@ #endif
-#include "geany.h" -#include "plugindata.h" -#include "keybindings.h" -#include "ui_utils.h" - -#include "geanyfunctions.h" - -#include <glib/gi18n.h> +#include <geanyplugin.h>
#include "glspi_ver.h"
Modified: geanylua/glspi.h 15 lines changed, 1 insertions(+), 14 deletions(-) =================================================================== @@ -16,20 +16,7 @@ #include <string.h> #include <ctype.h>
-#include "geany.h" -#include "plugindata.h" - -#include "prefs.h" -#include "project.h" -#include "support.h" -#include "document.h" -#include "filetypes.h" -#include "keybindings.h" -#include "ui_utils.h" -#include "editor.h" -#include "templates.h" - -#include "geanyfunctions.h" +#include <geanyplugin.h> #define main_widgets geany->main_widgets
#include "glspi_ver.h"
Modified: geanylua/glspi_app.c 12 lines changed, 5 insertions(+), 7 deletions(-) =================================================================== @@ -77,13 +77,11 @@ static const gchar *glspi_script_dir = NULL;
static gint glspi_appinfo(lua_State* L) { - GeanyApp *app = geany->app; - lua_newtable(L); - SetTableBool("debug", app->debug_mode); - SetTableStr("configdir", app->configdir); - SetTableStr("datadir", app->datadir); - SetTableStr("docdir", app->docdir); + SetTableBool("debug", geany->app->debug_mode); + SetTableStr("configdir", geany->app->configdir); + SetTableStr("datadir", geany->app->datadir); + SetTableStr("docdir", geany->app->docdir); SetTableStr("scriptdir", glspi_script_dir); lua_pushstring(L,"template"); glspi_template(L); @@ -93,7 +91,7 @@ static gint glspi_appinfo(lua_State* L) glspi_tools(L); lua_rawset(L,1);
- if (app->project) { + if (geany->app->project) { lua_pushstring(L,"project"); glspi_project(L); lua_rawset(L,1);
Modified: geanylua/glspi_init.c 35 lines changed, 17 insertions(+), 18 deletions(-) =================================================================== @@ -264,7 +264,8 @@ static void menu_item_activate(GtkMenuItem * menuitem, gpointer gdata) }
-#define isblank(c) ( (c==32) || (c==9) ) +#define is_blank(c) ( (c==32) || (c==9) ) +
/* Check if the script file begins with a special comment in the form: @@ -282,15 +283,15 @@ static void assign_accel(GtkWidget*w, char*fn) if (len>0) { gchar*p1=buf; buf[len]='\0'; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if ( strncmp(p1,"--", 2) == 0 ) { p1+=2; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if ( strncmp(p1,"@ACCEL@", 7) == 0 ) { guint key=0; GdkModifierType mods=0; p1+=7; - while (*p1 && isblank(*p1)) p1++; + while (*p1 && is_blank(*p1)) p1++; if (*p1) { gchar*p2=p1; while ( (*p2) && (!isspace(*p2)) ) { p2++; } @@ -408,14 +409,12 @@ static gchar *get_data_dir(void) PLUGIN_EXPORT void glspi_init (GeanyData *data, GeanyFunctions *functions, GeanyPlugin *plugin) { - GeanyApp *app = data->app; - glspi_geany_data = data; glspi_geany_functions = functions; glspi_geany_plugin = plugin;
local_data.script_dir = - g_strconcat(app->configdir, USER_SCRIPT_FOLDER, NULL); + g_strconcat(geany->app->configdir, USER_SCRIPT_FOLDER, NULL);
if (!g_file_test(local_data.script_dir, G_FILE_TEST_IS_DIR)) { gchar *datadir = get_data_dir(); @@ -424,30 +423,30 @@ void glspi_init (GeanyData *data, GeanyFunctions *functions, GeanyPlugin *plugin g_build_path(G_DIR_SEPARATOR_S, datadir, "geany-plugins", "geanylua", NULL); g_free(datadir); } - if (app->debug_mode) { + if (geany->app->debug_mode) { g_printerr(_(" ==>> %s: Building menu from '%s'\n"), PLUGIN_NAME, local_data.script_dir); } local_data.on_saved_script = - g_strconcat(app->configdir, ON_SAVED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_SAVED_SCRIPT, NULL); local_data.on_opened_script = - g_strconcat(app->configdir, ON_OPENED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_OPENED_SCRIPT, NULL); local_data.on_created_script = - g_strconcat(app->configdir, ON_CREATED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CREATED_SCRIPT, NULL); local_data.on_activated_script = - g_strconcat(app->configdir, ON_ACTIVATED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_ACTIVATED_SCRIPT, NULL); local_data.on_init_script = - g_strconcat(app->configdir, ON_INIT_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_INIT_SCRIPT, NULL); local_data.on_cleanup_script = - g_strconcat(app->configdir, ON_CLEANUP_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CLEANUP_SCRIPT, NULL); local_data.on_configure_script = - g_strconcat(app->configdir, ON_CONFIGURE_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_CONFIGURE_SCRIPT, NULL); local_data.on_proj_opened_script = - g_strconcat(app->configdir, ON_PROJ_OPENED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_OPENED_SCRIPT, NULL); local_data.on_proj_saved_script = - g_strconcat(app->configdir, ON_PROJ_SAVED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_SAVED_SCRIPT, NULL); local_data.on_proj_closed_script = - g_strconcat(app->configdir, ON_PROJ_CLOSED_SCRIPT, NULL); + g_strconcat(geany->app->configdir, ON_PROJ_CLOSED_SCRIPT, NULL);
glspi_set_sci_cmd_hash(TRUE); glspi_set_key_cmd_hash(TRUE);
Modified: geanylua/glspi_sci.c 8 lines changed, 5 insertions(+), 3 deletions(-) =================================================================== @@ -758,6 +758,7 @@ static gint glspi_find(lua_State* L)
gint flags=0; gint i,n; + gchar *text; DOC_REQUIRED switch (lua_gettop(L)) { case 0:return FAIL_STRING_ARG(1); @@ -771,7 +772,8 @@ static gint glspi_find(lua_State* L) if (!lua_isnumber(L,3)) { return FAIL_NUMERIC_ARG(3); } if (!lua_istable(L,4)) { return FAIL_TABLE_ARG(4); }
- ttf.lpstrText=g_strdup(lua_tostring(L,1)); + text=g_strdup(lua_tostring(L,1)); + ttf.lpstrText=text; ttf.chrg.cpMin=lua_tonumber(L,2); ttf.chrg.cpMax=lua_tonumber(L,3);
@@ -805,10 +807,10 @@ static gint glspi_find(lua_State* L) if (scintilla_send_message(doc->editor->sci,SCI_FINDTEXT,flags,(sptr_t)&ttf)!=-1) { push_number(L,ttf.chrgText.cpMin); push_number(L,ttf.chrgText.cpMax); - g_free(ttf.lpstrText); + g_free(text); return 2; } else { - g_free(ttf.lpstrText); + g_free(text); return 0; } }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org