~ubuntu-branches/ubuntu/precise/nautilus-actions/precise

« back to all changes in this revision

Viewing changes to src/common/na-object.h

  • Committer: Bazaar Package Importer
  • Author(s): Christine Spang
  • Date: 2009-08-12 14:04:00 UTC
  • mfrom: (1.1.6 upstream) (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090812140400-ufe3o3jvr62lf0sf
Tags: 1.12.0-1
* New upstream stable release.
  - Actions can now be enabled/disabled: disabled actions will
    never show up in the nautilus context menu
  - Gnome Bugzilla bugs fixed:
    - #325519 asked by Frederic Ruaudel (enabled property)
    - #590398 reported by Pierre Wieser (install doc)
    - #590399 reported by Pierre Wieser (gtk_image_menu_item_set_image)
    - #590709 reported by Claude Paroz (markup in translatable strings)
    - #590711 reported by Claude Paroz (pipe char is ambiguous to translate)
 - Do not install GConf schemas if --disable-schemas-install option has
   been specified
 - New/updated es and fr translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
 
7
 * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
 
8
 *
 
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.
 
13
 *
 
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.
 
18
 *
 
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.
 
23
 *
 
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)
 
29
 */
 
30
 
 
31
#ifndef __NA_OBJECT_H__
 
32
#define __NA_OBJECT_H__
 
33
 
 
34
/*
 
35
 * SECTION: na_object
 
36
 * @short_description: #NAObject class definition.
 
37
 * @include: common/na-object.h
 
38
 *
 
39
 * This is the base class for NAAction and NActionProfile.
 
40
 *
 
41
 * It implements the NAIDuplicable interface in order to have easily
 
42
 * duplicable derived objects.
 
43
 *
 
44
 * A #NAObject object is characterized by :
 
45
 * - an internal identifiant (ASCII, case insensitive)
 
46
 * - a libelle (UTF8, localizable).
 
47
 *
 
48
 * The #NAObject class is a pure virtual class.
 
49
 */
 
50
 
 
51
#include <glib-object.h>
 
52
 
 
53
G_BEGIN_DECLS
 
54
 
 
55
#define NA_OBJECT_TYPE                                  ( na_object_get_type())
 
56
#define NA_OBJECT( object )                             ( G_TYPE_CHECK_INSTANCE_CAST( object, NA_OBJECT_TYPE, NAObject ))
 
57
#define NA_OBJECT_CLASS( klass )                ( G_TYPE_CHECK_CLASS_CAST( klass, NA_OBJECT_TYPE, NAObjectClass ))
 
58
#define NA_IS_OBJECT( object )                  ( G_TYPE_CHECK_INSTANCE_TYPE( object, NA_OBJECT_TYPE ))
 
59
#define NA_IS_OBJECT_CLASS( klass )             ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NA_OBJECT_TYPE ))
 
60
#define NA_OBJECT_GET_CLASS( object )   ( G_TYPE_INSTANCE_GET_CLASS(( object ), NA_OBJECT_TYPE, NAObjectClass ))
 
61
 
 
62
typedef struct NAObjectPrivate NAObjectPrivate;
 
63
 
 
64
typedef struct {
 
65
        GObject          parent;
 
66
        NAObjectPrivate *private;
 
67
}
 
68
        NAObject;
 
69
 
 
70
typedef struct NAObjectClassPrivate NAObjectClassPrivate;
 
71
 
 
72
typedef struct {
 
73
        GObjectClass          parent;
 
74
        NAObjectClassPrivate *private;
 
75
 
 
76
        /**
 
77
         * dump:
 
78
         * @object: the #NAObject-derived object to be dumped.
 
79
         *
 
80
         * Dumps via g_debug the content of the object.
 
81
         *
 
82
         * In order to get a down-to-top display, the derived class
 
83
         * implementation should call its parent class before actually
 
84
         * dumping its own data and properties.
 
85
         */
 
86
        void       ( *dump )               ( const NAObject *object );
 
87
 
 
88
        /**
 
89
         * check_edited_status:
 
90
         * @object: the #NAObject-derived object to be checked.
 
91
         *
 
92
         * Checks a #NAObject-derived object for modification and validity
 
93
         * status.
 
94
         */
 
95
        void       ( *check_edited_status )( const NAObject *object );
 
96
 
 
97
        /**
 
98
         * duplicate:
 
99
         * @object: the #NAObject-derived object to be dumped.
 
100
         *
 
101
         * Duplicates a #NAObject-derived object.
 
102
         *
 
103
         * As the most-derived class will actually allocate the new object
 
104
         * with the right class, it shouldn't call its parent class.
 
105
         *
 
106
         * Copying data and properties should then be done via the
 
107
         * na_object_copy() function.
 
108
         *
 
109
         * Returns: a newly allocated object, which is an exact copy of
 
110
         * @object.
 
111
         */
 
112
        NAObject * ( *duplicate )          ( const NAObject *object );
 
113
 
 
114
        /**
 
115
         * copy:
 
116
         * @target: the #NAObject-derived object which will receive data.
 
117
         * @source: the #NAObject-derived object which will provide data.
 
118
         *
 
119
         * Copies data and properties from @source to @target.
 
120
         *
 
121
         * Each derived class should take care of calling its parent class
 
122
         * to complete the copy.
 
123
         */
 
124
        void       ( *copy )               ( NAObject *target, const NAObject *source );
 
125
 
 
126
        /**
 
127
         * are_equal:
 
128
         * @a: a first #NAObject object.
 
129
         * @b: a second #NAObject object to be compared to the first one.
 
130
         *
 
131
         * Compares the two objects.
 
132
         *
 
133
         * At least when it finds that @a and @b are equal, each derived
 
134
         * class should call its parent class to give it an opportunity to
 
135
         * detect a difference.
 
136
         *
 
137
         * Returns: %TRUE if @a and @b are identical, %FALSE else.
 
138
         */
 
139
        gboolean   ( *are_equal )          ( const NAObject *a, const NAObject *b );
 
140
 
 
141
        /**
 
142
         * is_valid:
 
143
         * @object: the #NAObject object to be checked.
 
144
         *
 
145
         * Checks @object for validity.
 
146
         *
 
147
         * At least when it finds that @object is valid, each derived class
 
148
         * should call its parent class to give it an opportunity to detect
 
149
         * an error.
 
150
         *
 
151
         * A #NAObject is valid if its internal identifiant is set.
 
152
         *
 
153
         * Returns: %TRUE if @object is valid, %FALSE else.
 
154
         */
 
155
        gboolean   ( *is_valid )           ( const NAObject *object );
 
156
}
 
157
        NAObjectClass;
 
158
 
 
159
/* object properties
 
160
 * used in derived classes to access to the properties
 
161
 */
 
162
enum {
 
163
        PROP_NAOBJECT_ID = 1,
 
164
        PROP_NAOBJECT_LABEL
 
165
};
 
166
 
 
167
GType     na_object_get_type( void );
 
168
 
 
169
void      na_object_dump( const NAObject *object );
 
170
NAObject *na_object_duplicate( const NAObject *object );
 
171
void      na_object_copy( NAObject *target, const NAObject *source );
 
172
 
 
173
void      na_object_check_edited_status( const NAObject *object );
 
174
gboolean  na_object_are_equal( const NAObject *a, const NAObject *b );
 
175
gboolean  na_object_is_valid( const NAObject *object );
 
176
 
 
177
NAObject *na_object_get_origin( const NAObject *object );
 
178
gboolean  na_object_get_modified_status( const NAObject *object );
 
179
gboolean  na_object_get_valid_status( const NAObject *object );
 
180
 
 
181
void      na_object_set_origin( NAObject *object, const NAObject *origin );
 
182
 
 
183
gchar    *na_object_get_id( const NAObject *object );
 
184
gchar    *na_object_get_label( const NAObject *object );
 
185
 
 
186
void      na_object_set_id( NAObject *object, const gchar *id );
 
187
void      na_object_set_label( NAObject *object, const gchar *label );
 
188
 
 
189
G_END_DECLS
 
190
 
 
191
#endif /* __NA_OBJECT_H__ */