You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

83 lines
3.5 KiB

  1. /*
  2. * Copyright (C) 2008-2010 Nick Schermer <nick@xfce.org>
  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.1 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 Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef __PANEL_PRIVATE_H__
  19. #define __PANEL_PRIVATE_H__
  20. /* support macros for debugging (improved macro for better position indication) */
  21. /*#ifndef NDEBUG*/
  22. #define panel_assert(expr) g_assert (expr)
  23. #define panel_assert_not_reached() g_assert_not_reached ()
  24. #define panel_return_if_fail(expr) G_STMT_START { \
  25. if (G_UNLIKELY (!(expr))) \
  26. { \
  27. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
  28. "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
  29. #expr); \
  30. return; \
  31. }; }G_STMT_END
  32. #define panel_return_val_if_fail(expr,val) G_STMT_START { \
  33. if (G_UNLIKELY (!(expr))) \
  34. { \
  35. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
  36. "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
  37. #expr); \
  38. return (val); \
  39. }; }G_STMT_END
  40. /*#else
  41. #define panel_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
  42. #define panel_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
  43. #define panel_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
  44. #define panel_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END
  45. #endif*/
  46. /* handling flags */
  47. #define PANEL_SET_FLAG(flags,flag) G_STMT_START{ ((flags) |= (flag)); }G_STMT_END
  48. #define PANEL_UNSET_FLAG(flags,flag) G_STMT_START{ ((flags) &= ~(flag)); }G_STMT_END
  49. #define PANEL_HAS_FLAG(flags,flag) (((flags) & (flag)) != 0)
  50. /* relative path to the plugin directory */
  51. #define PANEL_PLUGIN_RELATIVE_PATH "xfce4" G_DIR_SEPARATOR_S "panel"
  52. /* relative plugin's rc filename (printf format) */
  53. #define PANEL_PLUGIN_RC_RELATIVE_PATH PANEL_PLUGIN_RELATIVE_PATH G_DIR_SEPARATOR_S "%s-%d.rc"
  54. /* xfconf property base (printf format) */
  55. #define PANEL_PLUGIN_PROPERTY_BASE "/plugins/plugin-%d"
  56. /* minimum time in seconds between automatic restarts of panel plugins
  57. * without asking the user what to do */
  58. #define PANEL_PLUGIN_AUTO_RESTART (60)
  59. /* integer swap functions */
  60. #define SWAP_INTEGER(a,b) G_STMT_START { gint swp = a; a = b; b = swp; } G_STMT_END
  61. #define TRANSPOSE_AREA(area) G_STMT_START { SWAP_INTEGER (area.width, area.height); \
  62. SWAP_INTEGER (area.x, area.y); } G_STMT_END
  63. /* quick GList and GSList counting without traversing */
  64. #define LIST_HAS_ONE_ENTRY(l) ((l) != NULL && (l)->next == NULL)
  65. #define LIST_HAS_ONE_OR_NO_ENTRIES(l) ((l) == NULL || (l)->next == NULL)
  66. #define LIST_HAS_TWO_OR_MORE_ENTRIES(l) ((l) != NULL && (l)->next != NULL)
  67. /* make this easier to read */
  68. #define PANEL_GDKCOLOR_TO_DOUBLE(gdk_color) gdk_color->red / 65535.00, \
  69. gdk_color->green / 65535.00, \
  70. gdk_color->blue / 65535.00
  71. #endif /* !__PANEL_PRIVATE_H__ */