3
* Copyright (c) 2006-2007 Nick Schermer <nick@xfce.org>
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
21
#ifndef __XFCE_PANEL_MACROS_H__
22
#define __XFCE_PANEL_MACROS_H__
26
/* Support macro's for the slice allocator */
27
#if GLIB_CHECK_VERSION(2,10,0)
28
#define panel_slice_alloc(block_size) (g_slice_alloc ((block_size)))
29
#define panel_slice_alloc0(block_size) (g_slice_alloc0 ((block_size)))
30
#define panel_slice_free1(block_size, mem_block) G_STMT_START{ g_slice_free1 ((block_size), (mem_block)); }G_STMT_END
31
#define panel_slice_new(type) (g_slice_new (type))
32
#define panel_slice_new0(type) (g_slice_new0 (type))
33
#define panel_slice_free(type, ptr) G_STMT_START{ g_slice_free (type, (ptr)); }G_STMT_END
35
#define panel_slice_alloc(block_size) (g_malloc ((block_size)))
36
#define panel_slice_alloc0(block_size) (g_malloc0 ((block_size)))
37
#define panel_slice_free1(block_size, mem_block) G_STMT_START{ g_free ((mem_block)); }G_STMT_END
38
#define panel_slice_new(type) (g_new (type, 1))
39
#define panel_slice_new0(type) (g_new0 (type, 1))
40
#define panel_slice_free(type, ptr) G_STMT_START{ g_free ((ptr)); }G_STMT_END
45
/* Canonical Strings */
46
#if GLIB_CHECK_VERSION(2,10,0)
47
#define I_(string) (g_intern_static_string ((string)))
49
#define I_(string) (g_quark_to_string (g_quark_from_static_string ((string))))
54
#if GLIB_CHECK_VERSION(2,7,0)
55
#define PANEL_PARAM_READABLE (G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
56
#define PANEL_PARAM_WRITABLE (G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
57
#define PANEL_PARAM_READWRITE (G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
59
#define PANEL_PARAM_READABLE (G_PARAM_READABLE)
60
#define PANEL_PARAM_WRITABLE (G_PARAM_WRITABLE)
61
#define PANEL_PARAM_READWRITE (G_PARAM_READWRITE)
66
/* support macros for debugging */
68
#define _panel_assert(expr) g_assert (expr)
69
#define _panel_assert_not_reached() g_assert_not_reached ()
70
#define _panel_return_if_fail(expr) g_return_if_fail (expr)
71
#define _panel_return_val_if_fail(expr, val) g_return_val_if_fail (expr, (val))
73
#define _panel_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
74
#define _panel_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
75
#define _panel_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
76
#define _panel_return_val_if_fail(expr, val) G_STMT_START{ (void)0; }G_STMT_END
81
/* avoid trivial g_value_get_*() function calls */
83
#define g_value_get_boolean(v) (((const GValue *) (v))->data[0].v_int)
84
#define g_value_get_char(v) (((const GValue *) (v))->data[0].v_int)
85
#define g_value_get_uchar(v) (((const GValue *) (v))->data[0].v_uint)
86
#define g_value_get_int(v) (((const GValue *) (v))->data[0].v_int)
87
#define g_value_get_uint(v) (((const GValue *) (v))->data[0].v_uint)
88
#define g_value_get_long(v) (((const GValue *) (v))->data[0].v_long)
89
#define g_value_get_ulong(v) (((const GValue *) (v))->data[0].v_ulong)
90
#define g_value_get_int64(v) (((const GValue *) (v))->data[0].v_int64)
91
#define g_value_get_uint64(v) (((const GValue *) (v))->data[0].v_uint64)
92
#define g_value_get_enum(v) (((const GValue *) (v))->data[0].v_long)
93
#define g_value_get_flags(v) (((const GValue *) (v))->data[0].v_ulong)
94
#define g_value_get_float(v) (((const GValue *) (v))->data[0].v_float)
95
#define g_value_get_double(v) (((const GValue *) (v))->data[0].v_double)
96
#define g_value_get_string(v) (((const GValue *) (v))->data[0].v_pointer)
97
#define g_value_get_param(v) (((const GValue *) (v))->data[0].v_pointer)
98
#define g_value_get_boxed(v) (((const GValue *) (v))->data[0].v_pointer)
99
#define g_value_get_pointer(v) (((const GValue *) (v))->data[0].v_pointer)
100
#define g_value_get_object(v) (((const GValue *) (v))->data[0].v_pointer)
105
/* don't use the invalid property warning since testing in debug builds is enough */
106
#ifndef G_ENABLE_DEBUG
107
#undef G_OBJECT_WARN_INVALID_PROPERTY_ID
108
#define G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec) G_STMT_START{ (void)0; }G_STMT_END
112
GType _panel_g_type_register_simple (GType type_parent,
113
const gchar *type_name_static,
117
gpointer instance_init);
121
#endif /* !__XFCE_PANEL_MACROS_H__ */