shared: add nm_g_object_set_property()
[NetworkManager.git] / shared / nm-shared-utils.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* NetworkManager -- Network link manager
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301 USA.
18  *
19  * (C) Copyright 2016 Red Hat, Inc.
20  */
21
22 #ifndef __NM_SHARED_UTILS_H__
23 #define __NM_SHARED_UTILS_H__
24
25 /******************************************************************************/
26
27 gint64 _nm_utils_ascii_str_to_int64 (const char *str, guint base, gint64 min, gint64 max, gint64 fallback);
28
29 /******************************************************************************/
30
31 /**
32  * NMUtilsError:
33  * @NM_UTILS_ERROR_UNKNOWN: unknown or unclassified error
34  * @NM_UTILS_ERROR_CANCELLED_DISPOSING: when disposing an object that has
35  *   pending aynchronous operations, the operation is cancelled with this
36  *   error reason. Depending on the usage, this might indicate a bug because
37  *   usually the target object should stay alive as long as there are pending
38  *   operations.
39  */
40 typedef enum {
41         NM_UTILS_ERROR_UNKNOWN = 0,                 /*< nick=Unknown >*/
42         NM_UTILS_ERROR_CANCELLED_DISPOSING,         /*< nick=CancelledDisposing >*/
43 } NMUtilsError;
44
45 #define NM_UTILS_ERROR (nm_utils_error_quark ())
46 GQuark nm_utils_error_quark (void);
47
48 void nm_utils_error_set_cancelled (GError **error,
49                                    gboolean is_disposing,
50                                    const char *instance_name);
51 gboolean nm_utils_error_is_cancelled (GError *error,
52                                       gboolean consider_is_disposing);
53
54 /******************************************************************************/
55
56 gboolean nm_g_object_set_property (GObject *object,
57                                    const gchar  *property_name,
58                                    const GValue *value,
59                                    GError **error);
60
61 /******************************************************************************/
62
63 #endif /* __NM_SHARED_UTILS_H__ */