1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 /* tree-data.h
3  *
4  * Copyright (C) 2010  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 #ifndef _TREE_DATA_H_
23 #define _TREE_DATA_H_
24 
25 #include <glib-object.h>
26 #include <gtk/gtk.h>
27 #include <libanjuta/anjuta-project.h>
28 
29 G_BEGIN_DECLS
30 
31 typedef struct _GbfTreeData GbfTreeData;
32 
33 typedef enum {
34 	GBF_TREE_NODE_UNKNOWN,
35 	GBF_TREE_NODE_STRING,
36 	GBF_TREE_NODE_GROUP,
37 	GBF_TREE_NODE_TARGET,
38 	GBF_TREE_NODE_MODULE,
39 	GBF_TREE_NODE_PACKAGE,
40 	GBF_TREE_NODE_OBJECT,
41 	GBF_TREE_NODE_SOURCE,
42 	GBF_TREE_NODE_ROOT,
43 	GBF_TREE_NODE_SHORTCUT,
44 	GBF_TREE_NODE_INVALID
45 } GbfTreeNodeType;
46 
47 struct _GbfTreeData
48 {
49 	GbfTreeNodeType	type;
50 	AnjutaProjectNode *node;
51 	gchar           *name;
52 	GFile			*group;
53 	gchar			*target;
54 	GFile			*source;
55 	gboolean		is_shortcut;
56 	gboolean		expanded;
57 	gboolean		has_shortcut;
58 	GbfTreeData		*shortcut;
59 	GtkWidget		*properties_dialog;
60 };
61 
62 gchar	      *gbf_tree_data_get_uri		    (GbfTreeData           *data);
63 GFile	      *gbf_tree_data_get_file		    (GbfTreeData           *data);
64 const gchar   *gbf_tree_data_get_name		    (GbfTreeData           *data);
65 AnjutaProjectNode *gbf_tree_data_get_node		(GbfTreeData           *data);
66 
67 gchar		  *gbf_tree_data_get_path		    (GbfTreeData           *data);
68 
69 gboolean       gbf_tree_data_equal              (GbfTreeData           *data_a,
70                                                  GbfTreeData           *data_b);
71 gboolean       gbf_tree_data_equal_file         (GbfTreeData           *data,
72                                                   GbfTreeNodeType type,
73                                                  GFile                 *file);
74 gboolean       gbf_tree_data_equal_name         (GbfTreeData           *data,
75                                                  const gchar           *name);
76 GbfTreeNodeType gbf_tree_node_type_from_project (AnjutaProjectNodeType type);
77 
78 GbfTreeData   *gbf_tree_data_new_string         (const gchar           *string);
79 GbfTreeData   *gbf_tree_data_new_shortcut       (GbfTreeData		   *src);
80 GbfTreeData   *gbf_tree_data_new_proxy   		(const gchar           *name, gboolean expanded);
81 GbfTreeData   *gbf_tree_data_new_group          (AnjutaProjectNode     *group);
82 GbfTreeData   *gbf_tree_data_new_target         (AnjutaProjectNode     *target);
83 GbfTreeData   *gbf_tree_data_new_object         (AnjutaProjectNode     *object);
84 GbfTreeData   *gbf_tree_data_new_source         (AnjutaProjectNode     *source);
85 GbfTreeData   *gbf_tree_data_new_module         (AnjutaProjectNode     *module);
86 GbfTreeData   *gbf_tree_data_new_root           (AnjutaProjectNode     *root);
87 GbfTreeData   *gbf_tree_data_new_package        (AnjutaProjectNode     *package);
88 GbfTreeData	  *gbf_tree_data_new_node			(AnjutaProjectNode     *node);
89 void				gbf_tree_data_invalidate (GbfTreeData *data);
90 void           gbf_tree_data_free               (GbfTreeData           *data);
91 
92 
93 G_END_DECLS
94 
95 #endif /* _TREE_DATA_H_ */
96