2
* Copyright (C) 2008-2009 Nick Schermer <nick@xfce.org>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program 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
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
#ifndef __PANEL_PRIVATE_H__
20
#define __PANEL_PRIVATE_H__
22
/* support macros for debugging (improved macro for better position indication) */
24
#define panel_assert(expr) g_assert (expr)
25
#define panel_assert_not_reached() g_assert_not_reached ()
26
#define panel_return_if_fail(expr) G_STMT_START { \
27
if (G_UNLIKELY (!(expr))) \
29
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
30
"%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
34
#define panel_return_val_if_fail(expr,val) G_STMT_START { \
35
if (G_UNLIKELY (!(expr))) \
37
g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
38
"%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
43
#define panel_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
44
#define panel_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
45
#define panel_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
46
#define panel_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END
50
#define PANEL_SET_FLAG(flags,flag) G_STMT_START{ ((flags) |= (flag)); }G_STMT_END
51
#define PANEL_UNSET_FLAG(flags,flag) G_STMT_START{ ((flags) &= ~(flag)); }G_STMT_END
52
#define PANEL_HAS_FLAG(flags,flag) (((flags) & (flag)) != 0)
54
/* relative path to the plugin directory */
55
#define PANEL_PLUGIN_RELATIVE_PATH "xfce4" G_DIR_SEPARATOR_S "panel"
57
/* relative plugin's rc filename (printf format) */
58
#define PANEL_PLUGIN_RC_RELATIVE_PATH PANEL_PLUGIN_RELATIVE_PATH G_DIR_SEPARATOR_S "%s-%d.rc"
60
/* xfconf property base (printf format) */
61
#define PANEL_PLUGIN_PROPERTY_BASE "/plugins/plugin-%d"
63
/* minimum time in seconds between automatic restarts of panel plugins
64
* without asking the user what to do */
65
#define PANEL_PLUGIN_AUTO_RESTART (60)
67
/* integer swap functions */
68
#define SWAP_INTEGER(a,b) G_STMT_START { gint swp = a; a = b; b = swp; } G_STMT_END
69
#define TRANSPOSE_AREA(area) G_STMT_START { SWAP_INTEGER (area.width, area.height); \
70
SWAP_INTEGER (area.x, area.y); } G_STMT_END
72
/* quick GList and GSList counting without traversing */
73
#define LIST_HAS_ONE_ENTRY(l) ((l) != NULL && (l)->next == NULL)
74
#define LIST_HAS_ONE_OR_NO_ENTRIES(l) ((l) == NULL || (l)->next == NULL)
75
#define LIST_HAS_TWO_OR_MORE_ENTRIES(l) ((l) != NULL && (l)->next != NULL)
77
/* make this easier to read */
78
#define PANEL_GDKCOLOR_TO_DOUBLE(gdk_color) gdk_color->red / 65535.00, \
79
gdk_color->green / 65535.00, \
80
gdk_color->blue / 65535.00
82
#endif /* !__PANEL_PRIVATE_H__ */