1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4; coding: utf-8 -*- */
2 /* am-object.c
3  *
4  * Copyright (C) 2011  Sébastien Granjoux
5  *
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.
10  *
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.
15  *
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.
20  *
21  */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include "amp-object.h"
28 
29 #include "amp-node.h"
30 #include "am-scanner.h"
31 #include "am-properties.h"
32 #include "am-writer.h"
33 
34 
35 #include <libanjuta/interfaces/ianjuta-project.h>
36 
37 #include <libanjuta/anjuta-debug.h>
38 
39 #include <glib/gi18n.h>
40 
41 #include <memory.h>
42 #include <string.h>
43 #include <ctype.h>
44 
45 /* Types
46  *---------------------------------------------------------------------------*/
47 
48 struct _AmpObjectNode {
49 	AnjutaProjectNode base;
50 };
51 
52 
53 
54 
55 /* Object object
56  *---------------------------------------------------------------------------*/
57 
58 AnjutaProjectNode*
amp_object_node_new(GFile * file,AnjutaProjectNodeType type)59 amp_object_node_new (GFile *file, AnjutaProjectNodeType type)
60 {
61 	AmpObjectNode *node = NULL;
62 
63 	node = g_object_new (AMP_TYPE_OBJECT_NODE, NULL);
64 	node->base.file = g_object_ref (file);
65 	node->base.type = ANJUTA_PROJECT_OBJECT | type;
66 
67 	return ANJUTA_PROJECT_NODE (node);
68 }
69 
70 AnjutaProjectNode*
amp_object_node_new_valid(GFile * file,AnjutaProjectNodeType type,GError ** error)71 amp_object_node_new_valid (GFile *file, AnjutaProjectNodeType type, GError **error)
72 {
73 	return amp_object_node_new (file, type);
74 }
75 
76 void
amp_object_node_free(AmpObjectNode * node)77 amp_object_node_free (AmpObjectNode *node)
78 {
79 	g_object_unref (G_OBJECT (node));
80 }
81 
82 /* AmpNode implementation
83  *---------------------------------------------------------------------------*/
84 
85 static gboolean
amp_object_node_update(AmpNode * node,AmpNode * new_node)86 amp_object_node_update (AmpNode *node, AmpNode *new_node)
87 {
88 
89 	return TRUE;
90 }
91 
92 static gboolean
amp_object_node_write(AmpNode * node,AmpNode * parent,AmpProject * project,GError ** error)93 amp_object_node_write (AmpNode *node, AmpNode *parent, AmpProject *project, GError **error)
94 {
95 	return TRUE;
96 }
97 
98 static gboolean
amp_object_node_erase(AmpNode * node,AmpNode * parent,AmpProject * project,GError ** error)99 amp_object_node_erase (AmpNode *node, AmpNode *parent, AmpProject *project, GError **error)
100 {
101 	return TRUE;
102 }
103 
104 
105 
106 
107 /* GObjet implementation
108  *---------------------------------------------------------------------------*/
109 
110 typedef struct _AmpObjectNodeClass AmpObjectNodeClass;
111 
112 struct _AmpObjectNodeClass {
113 	AmpNodeClass parent_class;
114 };
115 
116 G_DEFINE_DYNAMIC_TYPE (AmpObjectNode, amp_object_node, AMP_TYPE_NODE);
117 
118 static void
amp_object_node_init(AmpObjectNode * node)119 amp_object_node_init (AmpObjectNode *node)
120 {
121 	node->base.type = ANJUTA_PROJECT_OBJECT;
122 	node->base.properties_info = NULL;
123 	node->base.state = 0;
124 }
125 
126 static void
amp_object_node_finalize(GObject * object)127 amp_object_node_finalize (GObject *object)
128 {
129 	AmpObjectNode *node = AMP_OBJECT_NODE (object);
130 
131 	G_OBJECT_CLASS (amp_object_node_parent_class)->finalize (object);
132 }
133 
134 static void
amp_object_node_class_init(AmpObjectNodeClass * klass)135 amp_object_node_class_init (AmpObjectNodeClass *klass)
136 {
137 	GObjectClass* object_class = G_OBJECT_CLASS (klass);
138 	AmpNodeClass* node_class;
139 
140 	object_class->finalize = amp_object_node_finalize;
141 
142 	node_class = AMP_NODE_CLASS (klass);
143 	node_class->update = amp_object_node_update;
144 	node_class->write = amp_object_node_write;
145 	node_class->erase = amp_object_node_erase;
146 }
147 
148 static void
amp_object_node_class_finalize(AmpObjectNodeClass * klass)149 amp_object_node_class_finalize (AmpObjectNodeClass *klass)
150 {
151 }
152 
153 void
amp_object_node_register(GTypeModule * module)154 amp_object_node_register (GTypeModule *module)
155 {
156 	amp_object_node_register_type (module);
157 }
158 
159