~ubuntu-branches/ubuntu/natty/xfce4-panel/natty

« back to all changes in this revision

Viewing changes to common/panel-private.h

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2010-12-04 15:45:53 UTC
  • mfrom: (1.1.25 upstream)
  • Revision ID: james.westby@ubuntu.com-20101204154553-c1k0n2p2j83chld0
Tags: 4.7.5-0ubuntu1
Upload to natty (pkg-xfce svn r4611).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2008-2009 Nick Schermer <nick@xfce.org>
 
3
 *
 
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.
 
8
 *
 
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.
 
13
 *
 
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.
 
17
 */
 
18
 
 
19
#ifndef __PANEL_PRIVATE_H__
 
20
#define __PANEL_PRIVATE_H__
 
21
 
 
22
/* support macros for debugging (improved macro for better position indication) */
 
23
/*#ifndef NDEBUG*/
 
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))) \
 
28
    { \
 
29
      g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
 
30
             "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
 
31
             #expr); \
 
32
      return; \
 
33
    }; }G_STMT_END
 
34
#define panel_return_val_if_fail(expr,val) G_STMT_START { \
 
35
  if (G_UNLIKELY (!(expr))) \
 
36
    { \
 
37
      g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
 
38
             "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
 
39
             #expr); \
 
40
      return (val); \
 
41
    }; }G_STMT_END
 
42
/*#else
 
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
 
47
#endif*/
 
48
 
 
49
/* handling flags */
 
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)
 
53
 
 
54
/* relative path to the plugin directory */
 
55
#define PANEL_PLUGIN_RELATIVE_PATH "xfce4" G_DIR_SEPARATOR_S "panel"
 
56
 
 
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"
 
59
 
 
60
/* xfconf property base (printf format) */
 
61
#define PANEL_PLUGIN_PROPERTY_BASE "/plugins/plugin-%d"
 
62
 
 
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)
 
66
 
 
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
 
71
 
 
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)
 
76
 
 
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
 
81
 
 
82
#endif /* !__PANEL_PRIVATE_H__ */