lists.geany.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
List overview
Plugins-Commits
November 2014
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
plugins-commits@lists.geany.org
1 participants
13 discussions
Start a n
N
ew thread
[geany/geany-plugins] 7de826: geanyprj: Update to the latest Geany tagmanager API
by Jiří Techet
08 Nov '14
08 Nov '14
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Sat, 08 Nov 2014 19:09:09 UTC Commit: 7de8265bf2eb0c663c0838c77c63242fc02dc1d8
https://github.com/geany/geany-plugins/commit/7de8265bf2eb0c663c0838c77c632…
Log Message: ----------- geanyprj: Update to the latest Geany tagmanager API Modified Paths: -------------- geanyprj/src/geanyprj.c geanyprj/src/project.c geanyprj/src/xproject.c Modified: geanyprj/src/geanyprj.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -34,7 +34,7 @@ #include "geanyprj.h" -PLUGIN_VERSION_CHECK(147) +PLUGIN_VERSION_CHECK(221) PLUGIN_SET_INFO(_("Project"), _("Alternative project support."), VERSION, "Yura Siamashka <yurand2(a)gmail.com>") Modified: geanyprj/src/project.c 68 lines changed, 45 insertions(+), 23 deletions(-) =================================================================== @@ -83,7 +83,11 @@ gboolean (*project_type_filter[NEW_PROJECT_TYPE_SIZE]) (const gchar *) = { static void free_tag_object(gpointer obj) { - tm_workspace_remove_object((TMWorkObject *) obj, TRUE, FALSE); + if (obj != NULL) + { + tm_workspace_remove_source_file((TMSourceFile *) obj); + tm_source_file_free((TMSourceFile *) obj); + } } @@ -101,7 +105,7 @@ struct GeanyPrj *geany_project_new(void) struct GeanyPrj *geany_project_load(const gchar *path) { struct GeanyPrj *ret; - TMWorkObject *tm_obj = NULL; + TMSourceFile *tm_obj = NULL; GKeyFile *config; gint i = 0; gchar *file; @@ -153,6 +157,8 @@ struct GeanyPrj *geany_project_load(const gchar *path) } else { + GPtrArray *to_add = g_ptr_array_new(); + /* Create tag files */ key = g_strdup_printf("file%d", i); while ((file = g_key_file_get_string(config, "files", key, NULL))) @@ -160,13 +166,13 @@ struct GeanyPrj *geany_project_load(const gchar *path) filename = get_full_path(path, file); locale_filename = utils_get_locale_from_utf8(filename); - tm_obj = tm_source_file_new(locale_filename, FALSE, + tm_obj = tm_source_file_new(locale_filename, filetypes_detect_from_file(filename)->name); g_free(locale_filename); if (tm_obj) { g_hash_table_insert(ret->tags, filename, tm_obj); - tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); + g_ptr_array_add(to_add, tm_obj); } else g_free(filename); @@ -175,6 +181,8 @@ struct GeanyPrj *geany_project_load(const gchar *path) g_free(file); key = g_strdup_printf("file%d", i); } + tm_workspace_add_source_files(to_add); + g_ptr_array_free(to_add, TRUE); g_free(key); } g_key_file_free(config); @@ -182,18 +190,28 @@ struct GeanyPrj *geany_project_load(const gchar *path) } -#if !GLIB_CHECK_VERSION(2, 12, 0) -static gboolean get_true(gpointer key, gpointer value, gpointer user_data) -{ - return TRUE; -} - - -static void g_hash_table_remove_all(GHashTable *hash_table) +static void remove_all_tags(struct GeanyPrj *prj) { - g_hash_table_foreach_remove(hash_table, get_true, NULL); + GPtrArray *to_remove, *keys; + GHashTableIter iter; + gpointer key, value; + + /* instead of relatively slow removal of source files by one from the tag manager, + * use the bulk operations - this requires that the normal destroy function + * of GHashTable is skipped - steal the keys and values and handle them manually */ + to_remove = g_ptr_array_new_with_free_func((GFreeFunc)tm_source_file_free); + keys = g_ptr_array_new_with_free_func(g_free); + g_hash_table_iter_init(&iter, prj->tags); + while (g_hash_table_iter_next(&iter, &key, &value)) + { + g_ptr_array_add(to_remove, value); + g_ptr_array_add(keys, key); + } + tm_workspace_remove_source_files(to_remove); + g_hash_table_steal_all(prj->tags); + g_ptr_array_free(to_remove, TRUE); + g_ptr_array_free(keys, TRUE); } -#endif void geany_project_regenerate_file_list(struct GeanyPrj *prj) @@ -201,7 +219,7 @@ void geany_project_regenerate_file_list(struct GeanyPrj *prj) GSList *lst; debug("%s path=%s\n", __FUNCTION__, prj->base_path); - g_hash_table_remove_all(prj->tags); + remove_all_tags(prj); lst = get_file_list(prj->base_path, NULL, project_type_filter[prj->type], NULL); geany_project_set_tags_from_list(prj, lst); @@ -298,24 +316,25 @@ void geany_project_set_tags_from_list(struct GeanyPrj *prj, GSList *files) { GSList *tmp; gchar *locale_filename; - TMWorkObject *tm_obj = NULL; + TMSourceFile *tm_obj = NULL; + GPtrArray *to_add = g_ptr_array_new(); - if (prj->tags) - g_hash_table_destroy(prj->tags); prj->tags = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_tag_object); for (tmp = files; tmp != NULL; tmp = g_slist_next(tmp)) { locale_filename = utils_get_locale_from_utf8(tmp->data); - tm_obj = tm_source_file_new(locale_filename, FALSE, + tm_obj = tm_source_file_new(locale_filename, filetypes_detect_from_file(tmp->data)->name); g_free(locale_filename); if (tm_obj) { g_hash_table_insert(prj->tags, g_strdup(tmp->data), tm_obj); - tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); + g_ptr_array_add(to_add, tm_obj); } } + tm_workspace_add_source_files(to_add); + g_ptr_array_free(to_add, TRUE); } @@ -335,7 +354,10 @@ void geany_project_free(struct GeanyPrj *prj) if (prj->run_cmd) g_free(prj->run_cmd); if (prj->tags) + { + remove_all_tags(prj); g_hash_table_destroy(prj->tags); + } g_free(prj); } @@ -344,7 +366,7 @@ void geany_project_free(struct GeanyPrj *prj) gboolean geany_project_add_file(struct GeanyPrj *prj, const gchar *path) { gchar *filename; - TMWorkObject *tm_obj = NULL; + TMSourceFile *tm_obj = NULL; GKeyFile *config; @@ -363,12 +385,12 @@ gboolean geany_project_add_file(struct GeanyPrj *prj, const gchar *path) g_key_file_free(config); filename = utils_get_locale_from_utf8(path); - tm_obj = tm_source_file_new(filename, FALSE, filetypes_detect_from_file(path)->name); + tm_obj = tm_source_file_new(filename, filetypes_detect_from_file(path)->name); g_free(filename); if (tm_obj) { g_hash_table_insert(prj->tags, g_strdup(path), tm_obj); - tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); + tm_workspace_add_source_file(tm_obj); } geany_project_save(prj); return TRUE; Modified: geanyprj/src/xproject.c 49 lines changed, 24 insertions(+), 25 deletions(-) =================================================================== @@ -35,17 +35,15 @@ struct GeanyPrj *g_current_project = NULL; static GPtrArray *g_projects = NULL; -static void add_tag(G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpointer user_data) +static void collect_tags(G_GNUC_UNUSED gpointer key, gpointer value, gpointer user_data) { + GPtrArray *array = user_data; + debug("%s file=%s\n", __FUNCTION__, (const gchar *)key); - tm_workspace_add_object((TMWorkObject *)value); -} - - -static void remove_tag(G_GNUC_UNUSED gpointer key, gpointer value, G_GNUC_UNUSED gpointer user_data) -{ - debug("%s file=%s\n", __FUNCTION__, (const gchar *)key); - tm_workspace_remove_object((TMWorkObject *)value, FALSE, FALSE); + if (value != NULL) + { + g_ptr_array_add(array, value); + } } @@ -59,7 +57,6 @@ void xproject_close(gboolean cache) if (cache) { - g_hash_table_foreach(g_current_project->tags, remove_tag, NULL); g_ptr_array_add(g_projects, g_current_project); } else @@ -76,6 +73,7 @@ void xproject_open(const gchar *path) { guint i; struct GeanyPrj *p = NULL; + GPtrArray *to_reload; debug("%s\n", __FUNCTION__); for (i = 0; i < g_projects->len; i++) @@ -94,7 +92,11 @@ void xproject_open(const gchar *path) return; ui_set_statusbar(TRUE, _("Project \"%s\" opened."), p->name); - g_hash_table_foreach(p->tags, add_tag, NULL); + to_reload = g_ptr_array_new(); + g_hash_table_foreach(p->tags, collect_tags, to_reload); + tm_workspace_remove_source_files(to_reload); + tm_workspace_add_source_files(to_reload); + g_ptr_array_free(to_reload, TRUE); g_current_project = p; sidebar_refresh(); @@ -104,23 +106,27 @@ void xproject_open(const gchar *path) void xproject_update_tag(const gchar *filename) { guint i; - TMWorkObject *tm_obj; + TMSourceFile *tm_obj; if (g_current_project) { tm_obj = g_hash_table_lookup(g_current_project->tags, filename); if (tm_obj) { - tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); + /* force tag update */ + tm_workspace_remove_source_file(tm_obj); + tm_workspace_add_source_file(tm_obj); } } for (i = 0; i < g_projects->len; i++) { - tm_obj = (TMWorkObject *)g_hash_table_lookup(((struct GeanyPrj *)(g_projects->pdata[i]))->tags, filename); + tm_obj = (TMSourceFile *)g_hash_table_lookup(((struct GeanyPrj *)(g_projects->pdata[i]))->tags, filename); if (tm_obj) { - tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); + /* force tag update */ + tm_workspace_remove_source_file(tm_obj); + tm_workspace_add_source_file(tm_obj); } } } @@ -128,8 +134,6 @@ void xproject_update_tag(const gchar *filename) gboolean xproject_add_file(const gchar *path) { - TMWorkObject *tm_obj; - debug("%s path=%s\n", __FUNCTION__, path); if (!g_current_project) @@ -137,11 +141,6 @@ gboolean xproject_add_file(const gchar *path) if (geany_project_add_file(g_current_project, path)) { - tm_obj = (TMWorkObject *) g_hash_table_lookup(g_current_project->tags, path); - if (tm_obj) - { - tm_workspace_add_object((TMWorkObject *) tm_obj); - } sidebar_refresh(); return TRUE; } @@ -151,17 +150,17 @@ gboolean xproject_add_file(const gchar *path) gboolean xproject_remove_file(const gchar *path) { - TMWorkObject *tm_obj; + TMSourceFile *tm_obj; debug("%s path=%s\n", __FUNCTION__, path); if (!g_current_project) return FALSE; - tm_obj = (TMWorkObject *) g_hash_table_lookup(g_current_project->tags, path); + tm_obj = (TMSourceFile *) g_hash_table_lookup(g_current_project->tags, path); if (tm_obj) { - tm_workspace_remove_object(tm_obj, FALSE, FALSE); + tm_workspace_remove_source_file(tm_obj); } if (geany_project_remove_file(g_current_project, path)) -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] b6c068: geanygendoc: Update to the latest Geany tagmanager API
by Jiří Techet
08 Nov '14
08 Nov '14
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Sat, 08 Nov 2014 19:09:09 UTC Commit: b6c068f56b65d16670836127e1524c4c960b923f
https://github.com/geany/geany-plugins/commit/b6c068f56b65d16670836127e1524…
Log Message: ----------- geanygendoc: Update to the latest Geany tagmanager API Modified Paths: -------------- geanygendoc/src/ggd-plugin.c geanygendoc/src/ggd-tag-utils.c geanygendoc/src/ggd.c Modified: geanygendoc/src/ggd-plugin.c 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -50,7 +50,7 @@ GeanyData *geany_data; GeanyFunctions *geany_functions; /* TODO check minimum requierment */ -PLUGIN_VERSION_CHECK (188) +PLUGIN_VERSION_CHECK (221) PLUGIN_SET_TRANSLATABLE_INFO ( LOCALEDIR, GETTEXT_PACKAGE, @@ -114,7 +114,7 @@ ggd_plugin_get_doctype (filetype_id id) /* FIXME: tm_source_file_buffer_update() is not found in symbols table */ /* (tries to) refresh the tag list to the file's current state */ static void -refresh_tag_list (TMWorkObject *tm_wo, +refresh_tag_list (TMSourceFile *tm_wo, ScintillaObject *sci, GeanyDocument *doc) { Modified: geanygendoc/src/ggd-tag-utils.c 22 lines changed, 11 insertions(+), 11 deletions(-) =================================================================== @@ -59,9 +59,9 @@ tag_cmp_by_line (gconstpointer a, if (t1->type & tm_tag_file_t || t2->type & tm_tag_file_t) { rv = 0; } else { - if (t1->atts.entry.line > t2->atts.entry.line) { + if (t1->line > t2->line) { rv = +direction; - } else if (t1->atts.entry.line < t2->atts.entry.line) { + } else if (t1->line < t2->line) { rv = -direction; } else { rv = 0; @@ -159,8 +159,8 @@ ggd_tag_find_from_line (const GPtrArray *tags, GGD_PTR_ARRAY_FOR (tags, i, el) { if (! (el->type & tm_tag_file_t)) { - if (el->atts.entry.line <= line && - (! tag || el->atts.entry.line > tag->atts.entry.line)) { + if (el->line <= line && + (! tag || el->line > tag->line)) { tag = el; } } @@ -211,7 +211,7 @@ ggd_tag_find_parent (const GPtrArray *tags, g_return_val_if_fail (tags != NULL, NULL); g_return_val_if_fail (child != NULL, NULL); - if (! child->atts.entry.scope) { + if (! child->scope) { /* tag has no parent, we're done */ } else { gchar *parent_scope = NULL; @@ -223,17 +223,17 @@ ggd_tag_find_parent (const GPtrArray *tags, gsize separator_len; /* scope is of the form a<sep>b<sep>c */ - parent_name = child->atts.entry.scope; + parent_name = child->scope; separator = symbols_get_context_separator (geany_ft); separator_len = strlen (separator); while ((tmp = strstr (parent_name, separator)) != NULL) { parent_name = &tmp[separator_len]; } /* if parent have scope */ - if (parent_name != child->atts.entry.scope) { + if (parent_name != child->scope) { /* the parent scope is the "dirname" of the child's scope */ - parent_scope = g_strndup (child->atts.entry.scope, - parent_name - child->atts.entry.scope - + parent_scope = g_strndup (child->scope, + parent_name - child->scope - separator_len); } /*g_debug ("%s: parent_name = %s", G_STRFUNC, parent_name); @@ -241,8 +241,8 @@ ggd_tag_find_parent (const GPtrArray *tags, GGD_PTR_ARRAY_FOR (tags, i, el) { if (! (el->type & tm_tag_file_t) && (utils_str_equal (el->name, parent_name) && - utils_str_equal (el->atts.entry.scope, parent_scope) && - el->atts.entry.line <= child->atts.entry.line)) { + utils_str_equal (el->scope, parent_scope) && + el->line <= child->line)) { tag = el; } } Modified: geanygendoc/src/ggd.c 14 lines changed, 7 insertions(+), 7 deletions(-) =================================================================== @@ -162,10 +162,10 @@ get_env_for_tag (GgdFileType *ft, ctpl_environ_push_string (env, "cursor", GGD_CURSOR_IDENTIFIER); ctpl_environ_push_string (env, "symbol", tag->name); /* get argument list it it exists */ - if (tag->atts.entry.arglist) { + if (tag->arglist) { CtplValue *v; - v = get_arg_list_from_string (ft, tag->atts.entry.arglist); + v = get_arg_list_from_string (ft, tag->arglist); if (v) { ctpl_environ_push (env, "argument_list", v); ctpl_value_free (v); @@ -173,9 +173,9 @@ get_env_for_tag (GgdFileType *ft, } /* get return type -- no matter if the return concept is pointless for that * particular tag, it's up to the rule to use it when it makes sense */ - returns = ! (tag->atts.entry.var_type != NULL && + returns = ! (tag->var_type != NULL && /* C-style none return type hack */ - strcmp ("void", tag->atts.entry.var_type) == 0); + strcmp ("void", tag->var_type) == 0); ctpl_environ_push_int (env, "returns", returns); /* get direct children tags */ children = ggd_tag_find_children (tag_array, tag, @@ -344,13 +344,13 @@ do_insert_comment (GeanyDocument *doc, switch (setting->position) { case GGD_POS_AFTER: - pos = sci_get_line_end_position (sci, tag->atts.entry.line - 1); + pos = sci_get_line_end_position (sci, tag->line - 1); break; case GGD_POS_BEFORE: { gint line; - line = tag->atts.entry.line - 1; + line = tag->line - 1; line = adjust_start_line (sci, tag_array, tag, line); pos = sci_get_position_from_line (sci, line); if (GGD_OPT_indent) { @@ -487,7 +487,7 @@ insert_multiple_comments (GeanyDocument *doc, msgwin_status_add (_("No setting applies to symbol \"%s\" of type \"%s\" " "at line %lu."), tag->name, ggd_tag_get_type_name (tag), - tag->atts.entry.line); + tag->line); } } sci_end_undo_action (sci); -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
[geany/geany-plugins] c466fb: gproject: Update to the latest Geany tagmanager API
by Jiří Techet
08 Nov '14
08 Nov '14
Branch: refs/heads/master Author: Jiří Techet <techet(a)gmail.com> Committer: Jiří Techet <techet(a)gmail.com> Date: Sat, 08 Nov 2014 19:09:09 UTC Commit: c466fba9c1ce79ee8812292393ffb8f3bc32a2fa
https://github.com/geany/geany-plugins/commit/c466fba9c1ce79ee8812292393ffb…
Log Message: ----------- gproject: Update to the latest Geany tagmanager API Modified Paths: -------------- gproject/src/gproject-main.c gproject/src/gproject-project.c gproject/src/gproject-project.h Modified: gproject/src/gproject-main.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -32,7 +32,7 @@ #include "gproject-sidebar.h" #include "gproject-menu.h" -PLUGIN_VERSION_CHECK(214) +PLUGIN_VERSION_CHECK(221) PLUGIN_SET_INFO(_("GProject"), _("Glob-pattern-based project management plugin for Geany."), VERSION, Modified: gproject/src/gproject-project.c 115 lines changed, 76 insertions(+), 39 deletions(-) =================================================================== @@ -72,48 +72,29 @@ static void deferred_op_queue_clean(void) } -static void workspace_add_tag(gchar *filename, TagObject *obj, gpointer foo) -{ - TMWorkObject *tm_obj = NULL; - - if (!document_find_by_filename(filename)) - { - gchar *locale_filename; - - locale_filename = utils_get_locale_from_utf8(filename); - tm_obj = tm_source_file_new(locale_filename, FALSE, filetypes_detect_from_file(filename)->name); - g_free(locale_filename); - - if (tm_obj) - { - tm_workspace_add_object(tm_obj); - tm_source_file_update(tm_obj, TRUE, FALSE, TRUE); - } - } - - if (obj->tag) - tm_workspace_remove_object(obj->tag, TRUE, TRUE); - - obj->tag = tm_obj; -} - - static void workspace_add_file_tag(gchar *filename) { TagObject *obj; obj = g_hash_table_lookup(g_prj->file_tag_table, filename); if (obj) - workspace_add_tag(filename, obj, NULL); -} + { + TMSourceFile *tm_obj = NULL; + + if (!document_find_by_filename(filename)) + { + tm_obj = tm_source_file_new(filename, filetypes_detect_from_file(filename)->name); + if (tm_obj) + tm_workspace_add_source_file(tm_obj); + } + if (obj->tag) + { + tm_workspace_remove_source_file(obj->tag); + tm_source_file_free(obj->tag); + } -static void workspace_remove_tag(gchar *filename, TagObject *obj, gpointer foo) -{ - if (obj->tag) - { - tm_workspace_remove_object(obj->tag, TRUE, TRUE); - obj->tag = NULL; + obj->tag = tm_obj; } } @@ -123,8 +104,12 @@ static void workspace_remove_file_tag(gchar *filename) TagObject *obj; obj = g_hash_table_lookup(g_prj->file_tag_table, filename); - if (obj) - workspace_remove_tag(filename, obj, NULL); + if (obj && obj->tag) + { + tm_workspace_remove_source_file(obj->tag); + tm_source_file_free(obj->tag); + obj->tag = NULL; + } } @@ -217,6 +202,58 @@ static GSList *get_file_list(const gchar * path, GSList *patterns, GSList *ignor } +static void remove_all_tags() +{ + GPtrArray *to_update; + GHashTableIter iter; + gpointer key, value; + + g_hash_table_iter_init (&iter, g_prj->file_tag_table); + to_update = g_ptr_array_new(); + while (g_hash_table_iter_next (&iter, &key, &value)) + { + TagObject *obj = value; + + g_ptr_array_add(to_update, obj->tag); + obj->tag = NULL; + } + + tm_workspace_remove_source_files(to_update); + g_ptr_array_foreach(to_update, (GFunc)tm_source_file_free, NULL); + g_ptr_array_free(to_update, TRUE); +} + + +static void add_all_tags() +{ + GPtrArray *to_update; + GHashTableIter iter; + gpointer key, value; + + g_hash_table_iter_init (&iter, g_prj->file_tag_table); + to_update = g_ptr_array_new(); + while (g_hash_table_iter_next (&iter, &key, &value)) + { + TagObject *obj = value; + gchar *filename = key; + TMSourceFile *tm_obj = NULL; + + if (!document_find_by_filename(filename)) + { + tm_obj = tm_source_file_new(filename, filetypes_detect_from_file(filename)->name); + + if (tm_obj) + g_ptr_array_add(to_update, tm_obj); + } + + obj->tag = tm_obj; + } + + tm_workspace_add_source_files(to_update); + g_ptr_array_free(to_update, TRUE); +} + + void gprj_project_rescan(void) { GSList *pattern_list = NULL; @@ -228,7 +265,7 @@ void gprj_project_rescan(void) return; if (g_prj->generate_tags) - g_hash_table_foreach(g_prj->file_tag_table, (GHFunc)workspace_remove_tag, NULL); + remove_all_tags(); g_hash_table_destroy(g_prj->file_tag_table); g_prj->file_tag_table = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); @@ -257,7 +294,7 @@ void gprj_project_rescan(void) } if (g_prj->generate_tags) - g_hash_table_foreach(g_prj->file_tag_table, (GHFunc)workspace_add_tag, NULL); + add_all_tags(); g_slist_foreach(lst, (GFunc) g_free, NULL); g_slist_free(lst); @@ -470,7 +507,7 @@ void gprj_project_close(void) return; /* can happen on plugin reload */ if (g_prj->generate_tags) - g_hash_table_foreach(g_prj->file_tag_table, (GHFunc)workspace_remove_tag, NULL); + remove_all_tags(); deferred_op_queue_clean(); Modified: gproject/src/gproject-project.h 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -22,7 +22,7 @@ typedef struct { - TMWorkObject *tag; + TMSourceFile *tag; } TagObject; -------------- This E-Mail was brought to you by github_commit_mail.py (Source:
https://github.com/geany/infrastructure
).
1
0
0
0
← Newer
1
2
Older →
Jump to page:
1
2
Results per page:
10
25
50
100
200