Kaydet (Commit) 38185ff6 authored tarafından Enrico Tröger's avatar Enrico Tröger

Don't let the tagmanager automatically reparse files if they seem to be changed…

Don't let the tagmanager automatically reparse files if they seem to be changed on disk (affects all files in the current session, not the current one). This should speed up file saving a little bit, especially with remote files.
Remove now unnecessary calls to tm_workspace_update().

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3598 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 2a086b3b
...@@ -11,6 +11,15 @@ ...@@ -11,6 +11,15 @@
path at startup to avoid unwanted directory locking(closes #2626124). path at startup to avoid unwanted directory locking(closes #2626124).
* src/encoding.c: * src/encoding.c:
Fix broken selection of "Document->Set Encoding" menu items. Fix broken selection of "Document->Set Encoding" menu items.
* src/document.c, tagmanager/include/tm_source_file.h,
tagmanager/include/tm_work_object.h, tagmanager/tm_project.c,
tagmanager/tm_source_file.c, tagmanager/tm_tag.c,
tagmanager/tm_work_object.c, tagmanager/tm_workspace.c:
Don't let the tagmanager automatically reparse files if they
seem to be changed on disk (affects all files in the current session,
not the current one). This should speed up file saving a little bit,
especially with remote files.
Remove now unnecessary calls to tm_workspace_update().
2009-02-20 Frank Lanitz <frank(at)frank(dot)uvena(dot)de> 2009-02-20 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
......
...@@ -1784,8 +1784,6 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force) ...@@ -1784,8 +1784,6 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
/* update filetype-related things */ /* update filetype-related things */
document_set_filetype(doc, doc->file_type); document_set_filetype(doc, doc->file_type);
tm_workspace_update(TM_WORK_OBJECT(app->tm_workspace), TRUE, TRUE, FALSE);
document_update_tab_label(doc); document_update_tab_label(doc);
msgwin_status_add(_("File %s saved."), doc->file_name); msgwin_status_add(_("File %s saved."), doc->file_name);
...@@ -2814,7 +2812,6 @@ gboolean document_close_all(void) ...@@ -2814,7 +2812,6 @@ gboolean document_close_all(void)
force_close_all(); force_close_all();
tm_workspace_update(TM_WORK_OBJECT(app->tm_workspace), TRUE, TRUE, FALSE);
return TRUE; return TRUE;
} }
......
...@@ -68,7 +68,7 @@ void tm_source_file_free(gpointer source_file); ...@@ -68,7 +68,7 @@ void tm_source_file_free(gpointer source_file);
also lost. The language parameter is automatically set the first time the file also lost. The language parameter is automatically set the first time the file
is parsed. is parsed.
\param source_file The source file to update. \param source_file The source file to update.
\param force Whether the cache is to be ignored. \param force Ignored. The source file is always updated.
\param recurse This parameter is ignored for source files and is only there for consistency. \param recurse This parameter is ignored for source files and is only there for consistency.
\param update_parent If set to TRUE, sends an update signal to parent if required. You should \param update_parent If set to TRUE, sends an update signal to parent if required. You should
always set this to TRUE if you are calling this function directly. always set this to TRUE if you are calling this function directly.
......
...@@ -37,7 +37,7 @@ typedef struct _TMWorkObject ...@@ -37,7 +37,7 @@ typedef struct _TMWorkObject
char *file_name; /*!< Full file name (inc. path) of the work object */ char *file_name; /*!< Full file name (inc. path) of the work object */
char *short_name; /*!< Just the name of the file (without the path) */ char *short_name; /*!< Just the name of the file (without the path) */
struct _TMWorkObject *parent; struct _TMWorkObject *parent;
time_t analyze_time; /*!< Time when the object was last analyzed */ time_t analyze_time; /*!< UNUSED Time when the object was last analyzed */
GPtrArray *tags_array; /*!< Tags obtained by parsing the object */ GPtrArray *tags_array; /*!< Tags obtained by parsing the object */
} TMWorkObject; } TMWorkObject;
...@@ -116,15 +116,6 @@ TMWorkObject *tm_work_object_new(guint type, const char *file_name, gboolean cre ...@@ -116,15 +116,6 @@ TMWorkObject *tm_work_object_new(guint type, const char *file_name, gboolean cre
*/ */
time_t tm_get_file_timestamp(const char *file_name); time_t tm_get_file_timestamp(const char *file_name);
/*
Checks if the work object has been modified since the last update by comparing
the timestamp stored in the work object structure with the modification time
of the physical file.
\param work_object Pointer to the work object.
\return TRUE if the file has changed since last update, FALSE otherwise.
*/
gboolean tm_work_object_is_changed(TMWorkObject *work_object);
/* /*
Destroys a work object's data without freeing the structure itself. It should Destroys a work object's data without freeing the structure itself. It should
be called by the deallocator function of classes derived from TMWorkObject. The be called by the deallocator function of classes derived from TMWorkObject. The
......
...@@ -350,7 +350,7 @@ gboolean tm_project_update(TMWorkObject *work_object, gboolean force ...@@ -350,7 +350,7 @@ gboolean tm_project_update(TMWorkObject *work_object, gboolean force
tm_project_recreate_tags_array(project); tm_project_recreate_tags_array(project);
} }
} }
work_object->analyze_time = time(NULL); /* work_object->analyze_time = time(NULL); */
if ((work_object->parent) && (update_parent)) if ((work_object->parent) && (update_parent))
tm_workspace_update(work_object->parent, TRUE, FALSE, FALSE); tm_workspace_update(work_object->parent, TRUE, FALSE, FALSE);
return update_tags; return update_tags;
...@@ -407,7 +407,6 @@ gboolean tm_project_open(TMProject *project, gboolean force) ...@@ -407,7 +407,6 @@ gboolean tm_project_open(TMProject *project, gboolean force)
else else
{ {
source_file->work_object.parent = TM_WORK_OBJECT(project); source_file->work_object.parent = TM_WORK_OBJECT(project);
source_file->work_object.analyze_time = tag->atts.file.timestamp;
source_file->lang = tag->atts.file.lang; source_file->lang = tag->atts.file.lang;
source_file->inactive = tag->atts.file.inactive; source_file->inactive = tag->atts.file.inactive;
if (!project->file_list) if (!project->file_list)
......
...@@ -239,11 +239,11 @@ int tm_source_file_tags(const tagEntryInfo *tag) ...@@ -239,11 +239,11 @@ int tm_source_file_tags(const tagEntryInfo *tag)
gboolean tm_source_file_update(TMWorkObject *source_file, gboolean force gboolean tm_source_file_update(TMWorkObject *source_file, gboolean force
, gboolean __unused__ recurse, gboolean update_parent) , gboolean __unused__ recurse, gboolean update_parent)
{ {
if (force || (tm_work_object_is_changed(source_file))) if (force)
{ {
tm_source_file_parse(TM_SOURCE_FILE(source_file)); tm_source_file_parse(TM_SOURCE_FILE(source_file));
tm_tags_sort(source_file->tags_array, NULL, FALSE); tm_tags_sort(source_file->tags_array, NULL, FALSE);
source_file->analyze_time = time(NULL); /* source_file->analyze_time = tm_get_file_timestamp(source_file->file_name); */
if ((source_file->parent) && update_parent) if ((source_file->parent) && update_parent)
{ {
tm_work_object_update(source_file->parent, TRUE, FALSE, TRUE); tm_work_object_update(source_file->parent, TRUE, FALSE, TRUE);
...@@ -268,7 +268,7 @@ gboolean tm_source_file_buffer_update(TMWorkObject *source_file, guchar* text_bu ...@@ -268,7 +268,7 @@ gboolean tm_source_file_buffer_update(TMWorkObject *source_file, guchar* text_bu
tm_source_file_buffer_parse (TM_SOURCE_FILE(source_file), text_buf, buf_size); tm_source_file_buffer_parse (TM_SOURCE_FILE(source_file), text_buf, buf_size);
tm_tags_sort(source_file->tags_array, NULL, FALSE); tm_tags_sort(source_file->tags_array, NULL, FALSE);
source_file->analyze_time = time(NULL); /* source_file->analyze_time = time(NULL); */
if ((source_file->parent) && update_parent) if ((source_file->parent) && update_parent)
{ {
#ifdef TM_DEBUG #ifdef TM_DEBUG
......
...@@ -135,7 +135,7 @@ gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag_ent ...@@ -135,7 +135,7 @@ gboolean tm_tag_init(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag_ent
{ {
tag->name = g_strdup(file->work_object.file_name); tag->name = g_strdup(file->work_object.file_name);
tag->type = tm_tag_file_t; tag->type = tm_tag_file_t;
tag->atts.file.timestamp = file->work_object.analyze_time; /* tag->atts.file.timestamp = file->work_object.analyze_time; */
tag->atts.file.lang = file->lang; tag->atts.file.lang = file->lang;
tag->atts.file.inactive = FALSE; tag->atts.file.inactive = FALSE;
return TRUE; return TRUE;
......
...@@ -158,6 +158,7 @@ gboolean tm_work_object_init(TMWorkObject *work_object, guint type, const char * ...@@ -158,6 +158,7 @@ gboolean tm_work_object_init(TMWorkObject *work_object, guint type, const char *
return TRUE; return TRUE;
} }
/*
time_t tm_get_file_timestamp(const char *file_name) time_t tm_get_file_timestamp(const char *file_name)
{ {
struct stat s; struct stat s;
...@@ -166,7 +167,6 @@ time_t tm_get_file_timestamp(const char *file_name) ...@@ -166,7 +167,6 @@ time_t tm_get_file_timestamp(const char *file_name)
if (0 != g_stat(file_name, &s)) if (0 != g_stat(file_name, &s))
{ {
/*g_warning("Unable to stat %s", file_name);*/
return (time_t) 0; return (time_t) 0;
} }
else else
...@@ -177,6 +177,7 @@ gboolean tm_work_object_is_changed(TMWorkObject *work_object) ...@@ -177,6 +177,7 @@ gboolean tm_work_object_is_changed(TMWorkObject *work_object)
{ {
return (gboolean) (work_object->analyze_time < tm_get_file_timestamp(work_object->file_name)); return (gboolean) (work_object->analyze_time < tm_get_file_timestamp(work_object->file_name));
} }
*/
TMWorkObject *tm_work_object_new(guint type, const char *file_name, gboolean create) TMWorkObject *tm_work_object_new(guint type, const char *file_name, gboolean create)
{ {
......
...@@ -533,7 +533,7 @@ gboolean tm_workspace_update(TMWorkObject *workspace, gboolean force ...@@ -533,7 +533,7 @@ gboolean tm_workspace_update(TMWorkObject *workspace, gboolean force
} }
if (update_tags) if (update_tags)
tm_workspace_recreate_tags_array(); tm_workspace_recreate_tags_array();
workspace->analyze_time = time(NULL); /* workspace->analyze_time = time(NULL); */
return update_tags; return update_tags;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment