Initial German translation of the build tutorial
[anjuta.git] / plugins / am-project / amp-root.c
blob5278f7f91c770ff2859ca8ff1805663ad3852a2b
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4; coding: utf-8 -*- */
2 /* am-root.c
4 * Copyright (C) 2010 Sébastien Granjoux
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
27 #include "amp-root.h"
29 #include "amp-node.h"
30 #include "am-scanner.h"
31 #include "am-properties.h"
34 #include <libanjuta/interfaces/ianjuta-project.h>
36 #include <libanjuta/anjuta-debug.h>
38 #include <glib/gi18n.h>
40 #include <memory.h>
41 #include <string.h>
42 #include <ctype.h>
44 /* Types
45 *---------------------------------------------------------------------------*/
51 /* Root object
52 *---------------------------------------------------------------------------*/
54 gboolean
55 amp_root_node_set_file (AmpRootNode *root, GFile *new_file)
57 return amp_group_node_set_file (&root->base, new_file);
60 AnjutaProjectNode*
61 amp_root_node_new (GFile *file)
63 gchar *name = g_file_get_basename (file);
64 AnjutaProjectNode *node;
66 node = (AnjutaProjectNode *)amp_group_node_new (file, name, FALSE);
67 g_free (name);
69 return node;
72 AnjutaProjectNode*
73 amp_root_node_new_valid (GFile *file, GError **error)
75 gchar *name = g_file_get_basename (file);
76 AnjutaProjectNode *node;
78 node = (AnjutaProjectNode *)amp_group_node_new_valid (file, name, FALSE, error);
79 g_free (name);
81 return node;
84 void
85 amp_root_node_free (AmpRootNode *node)
87 g_object_unref (G_OBJECT (node));
91 /* GObjet implementation
92 *---------------------------------------------------------------------------*/
94 G_DEFINE_DYNAMIC_TYPE (AmpRootNode, amp_root_node, AMP_TYPE_GROUP_NODE);
96 static void
97 amp_root_node_init (AmpRootNode *node)
99 node->base.base.type = ANJUTA_PROJECT_GROUP | ANJUTA_PROJECT_ROOT_GROUP;
100 node->base.base.properties_info = amp_get_project_property_list();
101 node->base.base.state = ANJUTA_PROJECT_CAN_ADD_GROUP |
102 ANJUTA_PROJECT_CAN_ADD_TARGET |
103 ANJUTA_PROJECT_CAN_ADD_PACKAGE,
104 ANJUTA_PROJECT_CAN_SAVE;
107 static void
108 amp_root_node_finalize (GObject *object)
110 G_OBJECT_CLASS (amp_root_node_parent_class)->finalize (object);
113 static void
114 amp_root_node_class_init (AmpRootNodeClass *klass)
116 GObjectClass* object_class = G_OBJECT_CLASS (klass);
118 object_class->finalize = amp_root_node_finalize;
121 static void
122 amp_root_node_class_finalize (AmpRootNodeClass *klass)
126 void
127 amp_root_node_register (GTypeModule *module)
129 amp_root_node_register_type (module);