NAIDuplicable: rewrite modification check stack
[nautilus-actions.git] / src / api / na-object-item.h
blob99b5cad09a74ce96f2b910596ed6e3cfcad2f262
1 /*
2 * Nautilus-Actions
3 * A Nautilus extension which offers configurable context menu actions.
5 * Copyright (C) 2005 The GNOME Foundation
6 * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
7 * Copyright (C) 2009, 2010, 2011 Pierre Wieser and others (see AUTHORS)
9 * This Program 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.
14 * This Program 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
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public
20 * License along with this Library; see the file COPYING. If not,
21 * write to the Free Software Foundation, Inc., 59 Temple Place,
22 * Suite 330, Boston, MA 02111-1307, USA.
24 * Authors:
25 * Frederic Ruaudel <grumz@grumz.net>
26 * Rodrigo Moya <rodrigo@gnome-db.org>
27 * Pierre Wieser <pwieser@trychlos.org>
28 * ... and many others (see AUTHORS)
31 #ifndef __NAUTILUS_ACTIONS_API_NA_OBJECT_ITEM_H__
32 #define __NAUTILUS_ACTIONS_API_NA_OBJECT_ITEM_H__
34 /**
35 * SECTION: object-item
36 * @title: NAObjectItem
37 * @short_description: The Object Item Base Class Definition
38 * @include: nautilus-actions/na-object-item.h
40 * This is a pure virtual class, i.e. not an instantiatable one, but
41 * serves as the base class for #NAObjectAction and #NAObjectMenu.
44 #include "na-object-id.h"
46 G_BEGIN_DECLS
48 #define NA_OBJECT_ITEM_TYPE ( na_object_item_get_type())
49 #define NA_OBJECT_ITEM( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_OBJECT_ITEM_TYPE, NAObjectItem ))
50 #define NA_OBJECT_ITEM_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NA_OBJECT_ITEM_TYPE, NAObjectItemClass ))
51 #define NA_IS_OBJECT_ITEM( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_OBJECT_ITEM_TYPE ))
52 #define NA_IS_OBJECT_ITEM_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_OBJECT_ITEM_TYPE ))
53 #define NA_OBJECT_ITEM_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_OBJECT_ITEM_TYPE, NAObjectItemClass ))
55 typedef struct _NAObjectItemPrivate NAObjectItemPrivate;
57 typedef struct {
58 /*< private >*/
59 NAObjectId parent;
60 NAObjectItemPrivate *private;
62 NAObjectItem;
64 typedef struct _NAObjectItemClassPrivate NAObjectItemClassPrivate;
66 typedef struct {
67 /*< private >*/
68 NAObjectIdClass parent;
69 NAObjectItemClassPrivate *private;
71 NAObjectItemClass;
73 /**
74 * NAItemTarget:
75 * @ITEM_TARGET_SELECTION: when targeting the selection context menu.
76 * @ITEM_TARGET_LOCATION: when targeting the background context menu.
77 * @ITEM_TARGET_TOOLBAR: when targeting the toolbar.
78 * @ITEM_TARGET_ANY: a wilcard target defined in order to be able
79 * to activate an action from a keyboard shortcut,
80 * while keeping this same action hidden from the UI.
82 * The #NAItemTarget mode is Nautilus-driven. It determines in which part
83 * of the Nautilus UI our actions will be displayed.
85 typedef enum {
86 ITEM_TARGET_SELECTION = 1,
87 ITEM_TARGET_LOCATION,
88 ITEM_TARGET_TOOLBAR,
89 ITEM_TARGET_ANY
91 NAItemTarget;
93 GType na_object_item_get_type( void );
95 NAObjectId *na_object_item_get_item ( const NAObjectItem *item, const gchar *id );
96 gint na_object_item_get_position( const NAObjectItem *item, const NAObjectId *child );
97 void na_object_item_append_item ( NAObjectItem *item, const NAObjectId *child );
98 void na_object_item_insert_at ( NAObjectItem *item, const NAObjectId *child, gint pos );
99 void na_object_item_insert_item ( NAObjectItem *item, const NAObjectId *child, const NAObjectId *before );
100 void na_object_item_remove_item ( NAObjectItem *item, const NAObjectId *child );
102 guint na_object_item_get_items_count( const NAObjectItem *item );
104 void na_object_item_count_items ( GList *items, gint *menus, gint *actions, gint *profiles, gboolean recurse );
105 GList *na_object_item_copyref_items( GList *items );
106 GList *na_object_item_free_items ( GList *items );
108 void na_object_item_deals_with_version ( NAObjectItem *item );
109 void na_object_item_rebuild_children_slist( NAObjectItem *item );
111 gboolean na_object_item_is_finally_writable ( const NAObjectItem *item, guint *reason );
112 void na_object_item_set_writability_status( NAObjectItem *item, gboolean writable, guint reason );
114 G_END_DECLS
116 #endif /* __NAUTILUS_ACTIONS_API_NA_OBJECT_ITEM_H__ */