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.
 
 
 
 
 

97 lines
4.2 KiB

  1. /* $Id$ */
  2. /*
  3. * Copyright (C) 2008 Nick Schermer <nick@xfce.org>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  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. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  18. */
  19. #if !defined(LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H) && !defined(LIBXFCE4PANEL_COMPILATION)
  20. #error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
  21. #endif
  22. #ifndef __XFCE_PANEL_MACROS_H__
  23. #define __XFCE_PANEL_MACROS_H__
  24. #include <glib.h>
  25. G_BEGIN_DECLS
  26. /* support macros for debugging (improved macro for better position indication) */
  27. #ifndef NDEBUG
  28. #define panel_assert(expr) g_assert (expr)
  29. #define panel_assert_not_reached() g_assert_not_reached ()
  30. #define panel_return_if_fail(expr) panel_return_val_if_fail(expr,{})
  31. #define panel_return_val_if_fail(expr,val) G_STMT_START { \
  32. if (G_UNLIKELY (!(expr))) \
  33. { \
  34. g_log (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, \
  35. "%s (%s): expression '%s' failed.", G_STRLOC, G_STRFUNC, \
  36. #expr); \
  37. return (val); \
  38. }; }G_STMT_END
  39. #else
  40. #define panel_assert(expr) G_STMT_START{ (void)0; }G_STMT_END
  41. #define panel_assert_not_reached() G_STMT_START{ (void)0; }G_STMT_END
  42. #define panel_return_if_fail(expr) G_STMT_START{ (void)0; }G_STMT_END
  43. #define panel_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END
  44. #endif
  45. /* canonical representation for static strings */
  46. #define I_(string) (g_intern_static_string ((string)))
  47. /* this is defined in glib 2.13.0 */
  48. #ifndef G_PARAM_STATIC_STRINGS
  49. #define G_PARAM_STATIC_STRINGS (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)
  50. #endif
  51. /* make api compatible with 4.4 panel */
  52. #ifndef XFCE_DISABLE_DEPRECATED
  53. /* convenience functions (deprecated) */
  54. #define xfce_create_panel_button xfce_panel_create_button
  55. #define xfce_create_panel_toggle_button xfce_panel_create_toggle_button
  56. #define xfce_allow_panel_customization xfce_panel_allow_customization
  57. /* register definitions (deprecated) */
  58. #define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL XFCE_PANEL_PLUGIN_REGISTER
  59. #define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
  60. #define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL XFCE_PANEL_PLUGIN_REGISTER
  61. #define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK
  62. /* parameter flags (deprecated) */
  63. #define PANEL_PARAM_READABLE G_PARAM_READABLE | PANEL_PARAM_STATIC_STRINGS
  64. #define PANEL_PARAM_READWRITE G_PARAM_READWRITE | PANEL_PARAM_STATIC_STRINGS
  65. #define PANEL_PARAM_WRITABLE G_PARAM_WRITABLE | PANEL_PARAM_STATIC_STRINGS
  66. /* slice allocator (deprecated) */
  67. #define panel_slice_alloc(block_size) (g_slice_alloc ((block_size)))
  68. #define panel_slice_alloc0(block_size) (g_slice_alloc0 ((block_size)))
  69. #define panel_slice_free1(block_size, mem_block) G_STMT_START{ g_slice_free1 ((block_size), (mem_block)); }G_STMT_END
  70. #define panel_slice_new(type) (g_slice_new (type))
  71. #define panel_slice_new0(type) (g_slice_new0 (type))
  72. #define panel_slice_free(type, ptr) G_STMT_START{ g_slice_free (type, (ptr)); }G_STMT_END
  73. /* debug macros (deprecated) */
  74. #define _panel_assert(expr) panel_assert (expr)
  75. #define _panel_assert_not_reached() panel_assert_not_reached ()
  76. #define _panel_return_if_fail(expr) panel_return_if_fail (expr)
  77. #define _panel_return_val_if_fail(expr, val) panel_return_val_if_fail (expr, (val))
  78. #endif /* !XFCE_DISABLE_DEPRECATED */
  79. G_END_DECLS
  80. #endif /* !__XFCE_PANEL_MACROS_H__ */