[anjuta] document-manager: Update project chooser in search-files correctly when project is changed



commit f42755df362db37a8e15bb0531ab2f15206b1364
Author: Johannes Schmid <jhs gnome org>
Date:   Fri Feb 17 13:51:40 2012 +0100

    document-manager: Update project chooser in search-files correctly when project is changed

 plugins/document-manager/plugin.c       |    7 +++++++
 plugins/document-manager/search-files.c |   25 ++++++++++---------------
 plugins/document-manager/search-files.h |    1 +
 3 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/plugins/document-manager/plugin.c b/plugins/document-manager/plugin.c
index ec0fe8a..c35ca46 100644
--- a/plugins/document-manager/plugin.c
+++ b/plugins/document-manager/plugin.c
@@ -537,6 +537,9 @@ value_added_project_root_uri (AnjutaPlugin *plugin, const gchar *name,
 	g_free (doc_plugin->project_path);
 	doc_plugin->project_name = NULL;
 
+	if (doc_plugin->search_files)
+		search_files_update_project (SEARCH_FILES(doc_plugin->search_files));
+	
 	root_uri = g_value_get_string (value);
 	if (root_uri)
 	{
@@ -567,6 +570,10 @@ value_removed_project_root_uri (AnjutaPlugin *plugin, const gchar *name,
 	g_free (doc_plugin->project_name);
 	doc_plugin->project_name = NULL;
 
+	if (doc_plugin->search_files)
+		search_files_update_project (SEARCH_FILES(doc_plugin->search_files));
+
+	
 	update_title(doc_plugin);
 }
 
diff --git a/plugins/document-manager/search-files.c b/plugins/document-manager/search-files.c
index 6974969..031eca3 100644
--- a/plugins/document-manager/search-files.c
+++ b/plugins/document-manager/search-files.c
@@ -823,16 +823,16 @@ search_files_class_init (SearchFilesClass* klass)
 	g_type_class_add_private(klass, sizeof(SearchFilesPrivate));
 }
 
-static void
-search_files_project_loaded (SearchFiles* sf, IAnjutaProjectManager *pm, GError* e)
+void 
+search_files_update_project (SearchFiles* sf)
 {
-	if (!e)
-	{
-		ianjuta_project_chooser_set_project_model(IANJUTA_PROJECT_CHOOSER(sf->priv->project_combo),
-		                                          pm,
-		                                          ANJUTA_PROJECT_GROUP,
-		                                          NULL);
-	}
+	IAnjutaProjectManager* pm = anjuta_shell_get_interface(sf->priv->docman->shell,
+	                                                       IAnjutaProjectManager,
+	                                                       NULL);
+	ianjuta_project_chooser_set_project_model(IANJUTA_PROJECT_CHOOSER(sf->priv->project_combo),
+	                                          pm,
+	                                          ANJUTA_PROJECT_GROUP,
+	                                          NULL);
 }
 
 SearchFiles*
@@ -841,12 +841,6 @@ search_files_new (AnjutaDocman* docman, SearchBox* search_box)
 	AnjutaShell* shell = docman->shell;
 	GObject* obj = g_object_new (SEARCH_TYPE_FILES, NULL);
 	SearchFiles* sf = SEARCH_FILES(obj);
-	IAnjutaProjectManager* pm = anjuta_shell_get_interface(shell,
-	                                                       IAnjutaProjectManager,
-	                                                       NULL);
-	search_files_project_loaded(sf, pm, NULL);
-	g_signal_connect_swapped (pm, "project-loaded",
-	                          G_CALLBACK (search_files_project_loaded), NULL);
 
 	anjuta_shell_add_widget(shell, sf->priv->main_box,
 	                        "search_files",
@@ -861,6 +855,7 @@ search_files_new (AnjutaDocman* docman, SearchBox* search_box)
 
 	search_files_type_combo_init(sf);
 	search_files_update_ui(sf);
+	search_files_update_project (sf);
 
 	return sf;
 }
diff --git a/plugins/document-manager/search-files.h b/plugins/document-manager/search-files.h
index fd7c58f..c9ef0d9 100644
--- a/plugins/document-manager/search-files.h
+++ b/plugins/document-manager/search-files.h
@@ -52,6 +52,7 @@ GType search_files_get_type (void) G_GNUC_CONST;
 SearchFiles* search_files_new (AnjutaDocman* docman, SearchBox* search_box);
 
 void search_files_present (SearchFiles* files);
+void search_files_update_project (SearchFiles* files);
 
 G_END_DECLS
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]