[anjuta/newproject: 188/189] Fix some critical warnings



commit 0e8390b408e8b9da6b5c2fe8d56c2131e14be0eb
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sat Apr 24 09:48:49 2010 +0200

    Fix some critical warnings

 plugins/project-manager/project-model.c |    4 +-
 plugins/project-manager/project-view.c  |   46 +++++++++++++++++--------------
 2 files changed, 27 insertions(+), 23 deletions(-)
---
diff --git a/plugins/project-manager/project-model.c b/plugins/project-manager/project-model.c
index a1b916e..686d5b0 100644
--- a/plugins/project-manager/project-model.c
+++ b/plugins/project-manager/project-model.c
@@ -884,11 +884,11 @@ void
 gbf_project_model_set_project (GbfProjectModel *model, AnjutaPmProject *project)
 {
 	g_return_if_fail (model != NULL && GBF_IS_PROJECT_MODEL (model));
-	g_return_if_fail (project != NULL);
 	
 	if (model->priv->proj)
 		unload_project (model);
-	
+
+	/* project can be NULL */
 	if (project)
 		load_project (model, project);
 }
diff --git a/plugins/project-manager/project-view.c b/plugins/project-manager/project-view.c
index 110a38b..58eddce 100644
--- a/plugins/project-manager/project-view.c
+++ b/plugins/project-manager/project-view.c
@@ -22,6 +22,8 @@
  *          Gustavo Giráldez <gustavo giraldez gmx net>
  */
 
+
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -537,34 +539,36 @@ gbf_project_view_get_shortcut_list (GbfProjectView *view)
 	GtkTreeIter iter;
 
 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (view));
-	
-	for (valid = gtk_tree_model_iter_children (GTK_TREE_MODEL (model), &iter, NULL);
-		valid == TRUE;
-		valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter))
+	if (model != NULL)
 	{
-		GbfTreeData *data;
-		gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, 
-		    GBF_PROJECT_MODEL_COLUMN_DATA, &data,
-		    -1);
-
-		if ((data->type == GBF_TREE_NODE_SHORTCUT) && (data->shortcut != NULL))
+		for (valid = gtk_tree_model_iter_children (GTK_TREE_MODEL (model), &iter, NULL);
+			valid == TRUE;
+			valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter))
 		{
-			gchar *uri;
-			GtkTreePath *path;
-			gboolean expand;
-
-			uri = gbf_tree_data_get_path (data);
-			path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
-			expand = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), path);
-			gtk_tree_path_free (path);
+			GbfTreeData *data;
+			gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, 
+				GBF_PROJECT_MODEL_COLUMN_DATA, &data,
+				-1);
 
-			if (uri != NULL)
+			if ((data->type == GBF_TREE_NODE_SHORTCUT) && (data->shortcut != NULL))
 			{
-				list = g_list_prepend (list, g_strconcat (expand ? "E " : "C ", uri, NULL));
+				gchar *uri;
+				GtkTreePath *path;
+				gboolean expand;
+
+				uri = gbf_tree_data_get_path (data);
+				path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+				expand = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), path);
+				gtk_tree_path_free (path);
+
+				if (uri != NULL)
+				{
+					list = g_list_prepend (list, g_strconcat (expand ? "E " : "C ", uri, NULL));
+				}
 			}
 		}
+		list = g_list_reverse (list);
 	}
-	list = g_list_reverse (list);
 	
 	return list;
 }



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