From 94a974b31e106526ae9e626425580560221cb7a7 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 27 Jan 2009 13:14:24 -0500 Subject: Encapsulate cec_store so it's not global. --- src/lua_interface.c | 9 +++++---- src/textadept.c | 2 +- src/textadept.h | 3 +-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/lua_interface.c b/src/lua_interface.c index 745ce368..69033bf3 100644 --- a/src/lua_interface.c +++ b/src/lua_interface.c @@ -826,18 +826,19 @@ bool l_cec_get_completions_for(const char *entry_text) { /** * Populates the Command Entry Completion with the contents of a Lua table at * the stack top. + * @param store The GtkListStore to populate. * @see l_cec_get_completions_for */ -void l_cec_populate() { +void l_cec_populate(GtkListStore *store) { GtkTreeIter iter; if (!lua_istable(lua, -1)) return warn("command_entry.get_completions_for return not a table."); - gtk_list_store_clear(cec_store); + gtk_list_store_clear(store); lua_pushnil(lua); while (lua_next(lua, -2)) { if (lua_type(lua, -1) == LUA_TSTRING) { - gtk_list_store_append(cec_store, &iter); - gtk_list_store_set(cec_store, &iter, 0, lua_tostring(lua, -1), -1); + gtk_list_store_append(store, &iter); + gtk_list_store_set(store, &iter, 0, lua_tostring(lua, -1), -1); } else warn("command_entry.get_completions_for: string value expected."); lua_pop(lua, 1); // value } diff --git a/src/textadept.c b/src/textadept.c index 6d9c98e7..ceaec6d8 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -996,7 +996,7 @@ static gbool c_keypress(GtkWidget *widget, GdkEventKey *event, gpointer) { return TRUE; case 0xff09: if (l_cec_get_completions_for(gtk_entry_get_text(GTK_ENTRY(widget)))) { - l_cec_populate(); + l_cec_populate(cec_store); gtk_entry_completion_complete(command_entry_completion); } return TRUE; diff --git a/src/textadept.h b/src/textadept.h index b6d3f1cf..303c3ddf 100644 --- a/src/textadept.h +++ b/src/textadept.h @@ -34,7 +34,6 @@ extern GtkWidget *window, *focused_editor, *command_entry, *pm_container, *pm_entry, *pm_view, *findbox, *find_entry, *replace_entry, *fnext_button, *fprev_button, *r_button, *ra_button, *match_case_opt, *whole_word_opt, *lua_opt, *in_files_opt; -extern GtkListStore *cec_store; extern GtkTreeStore *pm_store; extern lua_State *lua; #if !(WIN32 || MAC) @@ -91,7 +90,7 @@ void l_handle_scnnotification(SCNotification *n); void l_ta_command(const char *command); bool l_cec_get_completions_for(const char *entry_text); -void l_cec_populate(); +void l_cec_populate(GtkListStore *store); bool l_pm_get_contents_for(const char *entry_text, bool expanding); void l_pm_populate(GtkTreeIter *initial_iter); -- cgit v1.2.3