1 /*
2  * Nautilus-Actions
3  * A Nautilus extension which offers configurable context menu actions.
4  *
5  * Copyright (C) 2005 The GNOME Foundation
6  * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
7  * Copyright (C) 2009-2014 Pierre Wieser and others (see AUTHORS)
8  *
9  * Nautilus-Actions is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  * Nautilus-Actions is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with Nautilus-Actions; see the file COPYING. If not, see
21  * <http://www.gnu.org/licenses/>.
22  *
23  * Authors:
24  *   Frederic Ruaudel <grumz@grumz.net>
25  *   Rodrigo Moya <rodrigo@gnome-db.org>
26  *   Pierre Wieser <pwieser@trychlos.org>
27  *   ... and many others (see AUTHORS)
28  */
29 
30 /**
31  * SECTION: nact_tree_model
32  * @short_description: #NactTreeModel class definition.
33  * @include: nact/nact-tree-model.h
34  *
35  * NactTreeModel is derived from GtkTreeModelFilter in order to be able
36  * to selectively display profiles, whether an action has one or more
37  * profiles.
38  *
39  * NactTreeModel implements EggTreeMultiDragSource and GtkTreeDragDest
40  * interfaces.
41  *
42  * The GtkTreeModelFilter base class embeds a GtkTreeStore.
43  */
44 #ifndef __NACT_TREE_MODEL_H__
45 #define __NACT_TREE_MODEL_H__
46 
47 #include <api/na-object.h>
48 
49 #include "nact-tree-view.h"
50 
51 G_BEGIN_DECLS
52 
53 #define NACT_TYPE_TREE_MODEL                ( nact_tree_model_get_type())
54 #define NACT_TREE_MODEL( object )           ( G_TYPE_CHECK_INSTANCE_CAST(( object ), NACT_TYPE_TREE_MODEL, NactTreeModel ))
55 #define NACT_TREE_MODEL_CLASS( klass )      ( G_TYPE_CHECK_CLASS_CAST(( klass ), NACT_TYPE_TREE_MODEL, NactTreeModelClass ))
56 #define NACT_IS_TREE_MODEL( object )        ( G_TYPE_CHECK_INSTANCE_TYPE(( object ), NACT_TYPE_TREE_MODEL ))
57 #define NACT_IS_TREE_MODEL_CLASS( klass )   ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_TYPE_TREE_MODEL ))
58 #define NACT_TREE_MODEL_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_TYPE_TREE_MODEL, NactTreeModelClass ))
59 
60 typedef struct _NactTreeModelPrivate        NactTreeModelPrivate;
61 
62 typedef struct {
63 	/*< private >*/
64 	GtkTreeModelFilter    parent;
65 	NactTreeModelPrivate *private;
66 }
67 	NactTreeModel;
68 
69 typedef struct _NactTreeModelClassPrivate   NactTreeModelClassPrivate;
70 
71 typedef struct {
72 	/*< private >*/
73 	GtkTreeModelFilterClass    parent;
74 	NactTreeModelClassPrivate *private;
75 }
76 	NactTreeModelClass;
77 
78 /**
79  * Column ordering in the tree view
80  */
81 enum {
82 	TREE_COLUMN_ICON = 0,
83 	TREE_COLUMN_LABEL,
84 	TREE_COLUMN_NAOBJECT,
85 	TREE_N_COLUMN
86 };
87 
88 GType          nact_tree_model_get_type( void );
89 
90 NactTreeModel *nact_tree_model_new( BaseWindow *window, GtkTreeView *view, NactTreeMode mode );
91 
92 GtkTreePath   *nact_tree_model_delete       ( NactTreeModel *model, NAObject *object );
93 void           nact_tree_model_fill         ( NactTreeModel *model, GList *items );
94 GtkTreePath   *nact_tree_model_insert_before( NactTreeModel *model, const NAObject *object, GtkTreePath *path );
95 GtkTreePath   *nact_tree_model_insert_into  ( NactTreeModel *model, const NAObject *object, GtkTreePath *path );
96 
97 NAObjectItem  *nact_tree_model_get_item_by_id( const NactTreeModel *model, const gchar *id );
98 GList         *nact_tree_model_get_items     ( const NactTreeModel *model, guint mode );
99 NAObject      *nact_tree_model_object_at_path( const NactTreeModel *model, GtkTreePath *path );
100 GtkTreePath   *nact_tree_model_object_to_path( const NactTreeModel *model, const NAObject *object );
101 
102 G_END_DECLS
103 
104 #endif /* __NACT_TREE_MODEL_H__ */
105