[anjuta] dir-project, am-project: Implement new ianjuta_project_is_loaded function
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] dir-project, am-project: Implement new ianjuta_project_is_loaded function
- Date: Sun, 19 Dec 2010 21:48:10 +0000 (UTC)
commit dafa91b9cbf49b379aa3f0d00811c6f2a48dbe8a
Author: Sébastien Granjoux <seb sfo free fr>
Date: Sun Dec 19 13:04:02 2010 +0100
dir-project, am-project: Implement new ianjuta_project_is_loaded function
libanjuta/interfaces/libanjuta.idl | 15 +++++++++++++--
plugins/am-project/am-project-private.h | 3 +++
plugins/am-project/am-project.c | 16 ++++++++++++++++
plugins/am-project/am-project.h | 2 ++
plugins/dir-project/dir-project.c | 23 +++++++++++++++++++++++
plugins/project-manager/project.c | 3 ++-
6 files changed, 59 insertions(+), 3 deletions(-)
---
diff --git a/libanjuta/interfaces/libanjuta.idl b/libanjuta/interfaces/libanjuta.idl
index ebfe08f..65bc6db 100644
--- a/libanjuta/interfaces/libanjuta.idl
+++ b/libanjuta/interfaces/libanjuta.idl
@@ -3270,10 +3270,21 @@ interface IAnjutaProject
*
* Return a list of possible node;
*
- * Return value: (element-type Anjuta.ProjectNodeInfo) (transfer none): TRUE if the property has been successfully removed
- * else FALSE
+ * Return value: (element-type Anjuta.ProjectNodeInfo) (transfer none): A list
+ * containing information on all node supported by the project.
*/
const List<AnjutaProjectNodeInfo *> get_node_info();
+
+ /**
+ * ianjuta_project_is_loaded:
+ * @obj: Self
+ * @err: Error propagation and reporting
+ *
+ * Return TRUE if the project is loaded;
+ *
+ * Return value: TRUE if the project is completely loaded.
+ */
+ gboolean is_loaded ();
}
/**
diff --git a/plugins/am-project/am-project-private.h b/plugins/am-project/am-project-private.h
index 35b3be7..45bd643 100644
--- a/plugins/am-project/am-project-private.h
+++ b/plugins/am-project/am-project-private.h
@@ -62,6 +62,9 @@ struct _AmpProject {
/* shortcut hash tables, mapping id -> GNode from the tree above */
GHashTable *groups;
GHashTable *configs; /* Config file from configure_file */
+
+ /* Number of not loaded node */
+ gint loading;
/* Keep list style */
AnjutaTokenStyle *ac_space_list;
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index acdfdfd..64afd4d 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -2070,6 +2070,12 @@ amp_project_unload (AmpProject *project)
if (project->arg_list) anjuta_token_style_free (project->arg_list);
}
+gboolean
+amp_project_is_loaded (AmpProject *project)
+{
+ return project->loading == 0;
+}
+
gint
amp_project_probe (GFile *file,
GError **error)
@@ -2503,6 +2509,7 @@ amp_load_complete (PmJob *job)
g_hash_table_destroy (map);
g_object_unref (job->proxy);
job->proxy = NULL;
+ AMP_PROJECT (job->user_data)->loading--;
g_signal_emit_by_name (AMP_PROJECT (job->user_data), "node-loaded", job->node, job->error);
//g_timer_stop (timer);
//g_message ("amp_load_complete completed in %g", g_timer_elapsed (timer, NULL));
@@ -2871,6 +2878,7 @@ iproject_load_node (IAnjutaProject *obj, AnjutaProjectNode *node, GError **error
if (node == NULL) node = ANJUTA_PROJECT_NODE (obj);
if (AMP_PROJECT (obj)->queue == NULL) AMP_PROJECT (obj)->queue = pm_command_queue_new ();
+ AMP_PROJECT (obj)->loading++;
load_job = pm_job_new (&_load_job, node, NULL, NULL, ANJUTA_PROJECT_UNKNOWN, NULL, NULL, obj);
pm_command_queue_push (AMP_PROJECT (obj)->queue, load_job);
@@ -3050,6 +3058,12 @@ iproject_get_node_info (IAnjutaProject *obj, GError **err)
return amp_project_get_node_info (AMP_PROJECT (obj), err);
}
+static gboolean
+iproject_is_loaded (IAnjutaProject *obj, GError **err)
+{
+ return amp_project_is_loaded (AMP_PROJECT (obj));
+}
+
static void
iproject_iface_init(IAnjutaProjectIface* iface)
{
@@ -3062,6 +3076,7 @@ iproject_iface_init(IAnjutaProjectIface* iface)
iface->remove_property = iproject_remove_property;
iface->get_root = iproject_get_root;
iface->get_node_info = iproject_get_node_info;
+ iface->is_loaded = iproject_is_loaded;
}
/* Group access functions
@@ -3219,6 +3234,7 @@ amp_project_init (AmpProject *project)
project->arg_list = NULL;
project->queue = NULL;
+ project->loading = 0;
}
static void
diff --git a/plugins/am-project/am-project.h b/plugins/am-project/am-project.h
index dccb3d5..1960474 100644
--- a/plugins/am-project/am-project.h
+++ b/plugins/am-project/am-project.h
@@ -63,6 +63,8 @@ gint amp_project_probe (GFile *directory, GError **error);
gboolean amp_project_load (AmpProject *project, GFile *directory, GError **error);
AnjutaProjectNode *amp_project_load_node (AmpProject *project, AnjutaProjectNode *node, AnjutaProjectNode *parent, GError **error);
void amp_project_unload (AmpProject *project);
+gboolean amp_project_is_loaded (AmpProject *project);
+
void amp_project_load_config (AmpProject *project, AnjutaToken *arg_list);
void amp_project_load_properties (AmpProject *project, AnjutaToken *macro, AnjutaToken *list);
diff --git a/plugins/dir-project/dir-project.c b/plugins/dir-project/dir-project.c
index ec9a801..aae7611 100644
--- a/plugins/dir-project/dir-project.c
+++ b/plugins/dir-project/dir-project.c
@@ -795,6 +795,22 @@ dir_project_get_node_info (DirProject *project, GError **error)
return info_list;
}
+static gboolean
+find_not_loaded_node (gpointer key, gpointer value, gpointer user_data)
+{
+ AnjutaProjectNode *node = (AnjutaProjectNode *)value;
+ gboolean found;
+
+ found = anjuta_project_node_get_state (node) & (ANJUTA_PROJECT_LOADING | ANJUTA_PROJECT_INCOMPLETE);
+
+ return found;
+}
+
+static gboolean
+dir_project_is_loaded (DirProject *project)
+{
+ return g_hash_table_find (project->groups, find_not_loaded_node, NULL) == NULL;
+}
/* Public functions
*---------------------------------------------------------------------------*/
@@ -901,6 +917,12 @@ iproject_get_node_info (IAnjutaProject *obj, GError **err)
return dir_project_get_node_info (DIR_PROJECT (obj), err);
}
+static gboolean
+iproject_is_loaded (IAnjutaProject *obj, GError **err)
+{
+ return dir_project_is_loaded (DIR_PROJECT (obj));
+}
+
static void
iproject_iface_init(IAnjutaProjectIface* iface)
{
@@ -913,6 +935,7 @@ iproject_iface_init(IAnjutaProjectIface* iface)
iface->remove_property = iproject_remove_property;
iface->get_root = iproject_get_root;
iface->get_node_info = iproject_get_node_info;
+ iface->is_loaded = iproject_is_loaded;
}
/* GbfProject implementation
diff --git a/plugins/project-manager/project.c b/plugins/project-manager/project.c
index 09c1758..a291b08 100644
--- a/plugins/project-manager/project.c
+++ b/plugins/project-manager/project.c
@@ -65,9 +65,9 @@ on_pm_project_load_incomplete (AnjutaProjectNode *node, AnjutaPmProject *project
static gboolean
pm_command_load_complete (AnjutaPmProject *project, AnjutaProjectNode *node, GError *error)
{
- // g_message ("pm_command_load_complete %p", node);
gboolean complete = FALSE;
+ //g_message ("pm_command_load_complete %p", node);
if (error == NULL)
{
if (project->root == node)
@@ -88,6 +88,7 @@ pm_command_load_complete (AnjutaPmProject *project, AnjutaProjectNode *node, GEr
if (complete) project->loaded = TRUE;
}
+ //g_message ("pm_command_load_complete %d is loaded %d", complete, ianjuta_project_is_loaded (project->project, NULL));
g_signal_emit (G_OBJECT (project), signals[LOADED], 0, node, complete, error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]