1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
3 * Copyright (C) 2003 Gustavo Giráldez
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
20 * Author: Gustavo Giráldez <gustavo.giraldez@gmx.net>
30 #include <glib/gi18n.h>
33 #include "project-util.h"
36 gbf_project_util_node_all (AnjutaProjectNode
*parent
, AnjutaProjectNodeType type
)
38 AnjutaProjectNode
*node
;
44 type_type
= type
& ANJUTA_PROJECT_TYPE_MASK
;
45 type_flag
= type
& ANJUTA_PROJECT_FLAG_MASK
;
46 type_id
= type
& ANJUTA_PROJECT_ID_MASK
;
48 for (node
= anjuta_project_node_first_child (parent
); node
!= NULL
; node
= anjuta_project_node_next_sibling (node
))
52 if ((type_type
== 0) || (anjuta_project_node_get_node_type (node
) == type_type
))
56 type
= anjuta_project_node_get_full_type (node
);
57 if (((type_id
== 0) || (type_id
== (type
& ANJUTA_PROJECT_ID_MASK
))) &&
58 ((type_flag
== 0) || ((type
& type_flag
) != 0)))
60 list
= g_list_prepend (list
, node
);
64 child_list
= gbf_project_util_node_all (node
, type
);
65 child_list
= g_list_reverse (child_list
);
66 list
= g_list_concat (child_list
, list
);
69 list
= g_list_reverse (list
);
75 gbf_project_util_replace_by_file (GList
* list
)
79 for (link
= g_list_first (list
); link
!= NULL
; link
= g_list_next (link
))
81 AnjutaProjectNode
*node
= (AnjutaProjectNode
*)link
->data
;
83 link
->data
= g_object_ref (anjuta_project_node_get_file (node
));