/usr/include/xfce4/libxfce4panel-2.0/libxfce4panel/xfce-panel-macros.h is in libxfce4panel-2.0-dev 4.12.0-3ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | /*
* Copyright (C) 2008-2010 Nick Schermer <nick@xfce.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* #if !defined(LIBXFCE4PANEL_INSIDE_LIBXFCE4PANEL_H) && !defined(LIBXFCE4PANEL_COMPILATION)
#error "Only <libxfce4panel/libxfce4panel.h> can be included directly, this file may disappear or change contents"
#endif */
#ifndef __XFCE_PANEL_MACROS_H__
#define __XFCE_PANEL_MACROS_H__
#include <glib.h>
#include <glib-object.h>
#include <libxfce4panel/xfce-panel-plugin.h>
#include <libxfce4panel/xfce-panel-macros-46.h>
G_BEGIN_DECLS
/**
* SECTION: macros
* @title: Commonly used plugin macros
* @short_description: Various macros to make life easier for plugin developers.
* @include: libxfce4panel/libxfce4panel.h
*
* Some commonly used macros in panel plugins.
**/
/**
* SECTION: register-plugins
* @title: Panel Plugin Register Macros
* @short_description: Register panel plugins that are compiled as modules.
* @include: libxfce4panel/libxfce4panel.h
*
* Macros to register panel plugins that are compiled as modules. Internal or
* external is defined by the boolean key <varname>X-XFCE-Internal</varname>
* in the plugin's .desktop file.
**/
/**
* SECTION: register-gobject-plugins
* @title: GObject Oriented Panel Plugin Registers Macros
* @short_description: Macros to register panel plugins, written as GObjects.
* @include: libxfce4panel/libxfce4panel.h
*
* Macros to register panel plugin types and custom types inside panel plugins.
**/
/**
* XfcePanelTypeModule:
*
* Typedef for GTypeModule for possible future expansion.
*
* Since: 4.8
**/
typedef GTypeModule XfcePanelTypeModule;
/**
* XFCE_PANEL_CHANNEL_NAME:
*
* Macro to return the value of xfce_panel_get_channel_name().
*
* See also: xfce_panel_plugin_xfconf_channel_new,
* xfce_panel_plugin_get_property_base
*
* Since: 4.8
**/
#define XFCE_PANEL_CHANNEL_NAME (xfce_panel_get_channel_name ())
/**
* xfce_panel_plugin_xfconf_channel_new:
* @plugin : An #XfcePanelPlugin.
*
* Convienient function for opening an XfconfChannel for a plugin. The
* channel's property base will be propery returned from
* xfce_panel_plugin_get_property_base().
*
* See also: xfce_panel_plugin_get_property_base,
* XFCE_PANEL_PLUGIN_CHANNEL_NAME and
* xfce_panel_get_channel_name
*
* Since: 4.8
**/
#define xfce_panel_plugin_xfconf_channel_new(plugin) \
xfconf_channel_new_with_property_base (XFCE_PANEL_CHANNEL_NAME, \
xfce_panel_plugin_get_property_base (XFCE_PANEL_PLUGIN (plugin)))
/**
* XFCE_PANEL_DEFINE_PLUGIN:
* @TypeName : The name of the new type, in Camel case.
* @type_name : The name of the new type, in lowercase, with words separated by '_'.
* @args... : Optional list of *_register_type() function from other
* objects in the plugin created with #XFCE_PANEL_DEFINE_TYPE.
*
* Define a new (resident) GObject panel plugin, the parent type of the object
* should be XFCE_TYPE_PANEL_PLUGIN.
*
* Since: 4.8
**/
#define XFCE_PANEL_DEFINE_PLUGIN(TypeName, type_name, args...) \
_XPP_DEFINE_PLUGIN (TypeName, type_name, FALSE, args)
/**
* XFCE_PANEL_DEFINE_PLUGIN_RESIDENT:
* @TypeName : The name of the new type, in Camel case.
* @type_name : The name of the new type, in lowercase, with words separated by '_'.
* @args... : Optional list of *_register_type() function from other
* objects in the plugin created with #XFCE_PANEL_DEFINE_TYPE.
*
* Same as #XFCE_PANEL_DEFINE_PLUGIN, but if you use special libraries or objects,
* it is possible the plugin will give problems when unloading the library,
* a resident plugin will never be unloaded after the first load, avoiding
* those issues.
*
* Since: 4.8
**/
#define XFCE_PANEL_DEFINE_PLUGIN_RESIDENT(TypeName, type_name, args...) \
_XPP_DEFINE_PLUGIN (TypeName, type_name, TRUE, args)
/**
* XFCE_PANEL_DEFINE_TYPE:
* @TypeName : The name of the new type, in Camel case.
* @type_name : The name of the new type, in lowercase, with words separated by '_'.
* @TYPE_PARENT : The GType of the parent type.
*
* A convenient macro of #G_DEFINE_DYNAMIC_TYPE for panel plugins. Only
* difference with #G_DEFINE_DYNAMIC_TYPE is that the type name send to
* g_type_module_register_type() is prefixed with "Xfce". This allows you
* use use shorted structure names in the code, while the real name of the
* object is a full "Xfce" name.
*
* The _register_type function should be added to the args in
* #XFCE_PANEL_DEFINE_PLUGIN.
*
* Since: 4.8
**/
#define XFCE_PANEL_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) \
static gpointer type_name##_parent_class = NULL; \
static GType type_name##_type = 0; \
\
static void type_name##_init (TypeName *self); \
static void type_name##_class_init (TypeName##Class *klass); \
static void type_name##_class_intern_init (gpointer klass) \
{ \
type_name##_parent_class = g_type_class_peek_parent (klass); \
type_name##_class_init ((TypeName##Class*) klass); \
} \
\
GType \
type_name##_get_type (void) \
{ \
return type_name##_type; \
} \
\
void \
type_name##_register_type (XfcePanelTypeModule *type_module) \
{ \
GType plugin_define_type_id; \
static const GTypeInfo plugin_define_type_info = \
{ \
sizeof (TypeName##Class), \
NULL, \
NULL, \
(GClassInitFunc) type_name##_class_intern_init, \
NULL, \
NULL, \
sizeof (TypeName), \
0, \
(GInstanceInitFunc) type_name##_init, \
NULL, \
}; \
\
plugin_define_type_id = \
g_type_module_register_type (G_TYPE_MODULE (type_module), TYPE_PARENT, \
"Xfce" #TypeName, &plugin_define_type_info, 0); \
\
type_name##_type = plugin_define_type_id; \
}
/* <private> */
#define _XPP_DEFINE_PLUGIN(TypeName, type_name, resident, args...) \
GType xfce_panel_module_init (GTypeModule *type_module, gboolean *make_resident); \
\
XFCE_PANEL_DEFINE_TYPE (TypeName, type_name, XFCE_TYPE_PANEL_PLUGIN) \
\
G_MODULE_EXPORT GType \
xfce_panel_module_init (GTypeModule *type_module, \
gboolean *make_resident) \
{ \
typedef void (*XppRegFunc) (XfcePanelTypeModule *module); \
XppRegFunc reg_funcs[] = { type_name##_register_type, args }; \
guint i; \
\
/* whether to make this plugin resident */ \
if (make_resident != NULL) \
*make_resident = resident; \
\
/* register the plugin types */ \
for (i = 0; i < G_N_ELEMENTS (reg_funcs); i++) \
(* reg_funcs[i]) (type_module); \
\
return type_name##_get_type (); \
}
/**
* XFCE_PANEL_DEFINE_PREINIT_FUNC:
* @preinit_func: name of the function that points to an
* #XfcePanelPluginPreInit function.
*
* Registers a pre-init function in the plugin module. This function
* is called before gtk_init() and can be used to initialize
* special libaries.
* Downside of this that the plugin cannot run internal. Even if you
* set X-XFCE-Interal=TRUE in the desktop file, the panel will force
* the plugin to run inside a wrapper (this because the panel called
* gtk_init() long before it starts to load the plugins).
*
* Note that you can only use this once and it only works in
* combination with the plugins register/define functions added
* in 4.8.
*
* Since: 4.8
**/
#define XFCE_PANEL_DEFINE_PREINIT_FUNC(preinit_func) \
G_MODULE_EXPORT gboolean xfce_panel_module_preinit (gint argc, gchar **argv); \
\
G_MODULE_EXPORT gboolean \
xfce_panel_module_preinit (gint argc, \
gchar **argv) \
{ \
return (*preinit_func) (argc, argv); \
}
/**
* XFCE_PANEL_PLUGIN_REGISTER:
* @construct_func : name of the function that points to an
* #XfcePanelPluginFunc function.
*
* Register a panel plugin using a construct function. This is the
* simplest way to register a panel plugin.
* The @construct_func is called everytime a plugin is created.
*
* Since: 4.8
**/
#define XFCE_PANEL_PLUGIN_REGISTER(construct_func) \
_XFCE_PANEL_PLUGIN_REGISTER_EXTENDED (construct_func, /* foo */, /* foo */)
/**
* XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK:
* @construct_func : name of the function that points to an
* #XfcePanelPluginFunc function.
* @check_func : name of the function that points to an
* #XfcePanelPluginCheck function.
*
* Register a panel plugin using a construct function. The @check_func
* will be called before the plugin is created. If this function returns
* %FALSE, the plugin won't be added to the panel. For proper feedback,
* you are responsible for showing a dialog why the plugin is not added
* to the panel.
*
* Since: 4.8
**/
#define XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK(construct_func, check_func) \
_XFCE_PANEL_PLUGIN_REGISTER_EXTENDED (construct_func, /* foo */, \
if (G_LIKELY ((*check_func) (xpp_screen) == TRUE)))
/**
* XFCE_PANEL_PLUGIN_REGISTER_FULL:
* @construct_func : name of the function that points to an
* #XfcePanelPluginFunc function.
* @preinit_func : name of the function that points to an
* #XfcePanelPluginPreInit function.
* @check_func : name of the function that points to an
* #XfcePanelPluginCheck function.
*
* Same as calling #XFCE_PANEL_DEFINE_PREINIT_FUNC and
* #XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK. See those macros
* for more information.
*
* Since: 4.8
**/
#define XFCE_PANEL_PLUGIN_REGISTER_FULL(construct_func, preinit_func, check_func) \
XFCE_PANEL_DEFINE_PREINIT_FUNC (preinit_func) \
XFCE_PANEL_PLUGIN_REGISTER_WITH_CHECK (construct_func, check_func)
/* <private> */
#define _XFCE_PANEL_PLUGIN_REGISTER_EXTENDED(construct_func, PREINIT_CODE, CHECK_CODE) \
static void \
xfce_panel_module_realize (XfcePanelPlugin *xpp) \
{ \
g_return_if_fail (XFCE_IS_PANEL_PLUGIN (xpp)); \
\
g_signal_handlers_disconnect_by_func (G_OBJECT (xpp), \
G_CALLBACK (xfce_panel_module_realize), NULL); \
\
(*construct_func) (xpp); \
} \
\
PREINIT_CODE \
\
G_MODULE_EXPORT XfcePanelPlugin * \
xfce_panel_module_construct (const gchar *xpp_name, \
gint xpp_unique_id, \
const gchar *xpp_display_name, \
const gchar *xpp_comment, \
gchar **xpp_arguments, \
GdkScreen *xpp_screen); \
G_MODULE_EXPORT XfcePanelPlugin * \
xfce_panel_module_construct (const gchar *xpp_name, \
gint xpp_unique_id, \
const gchar *xpp_display_name, \
const gchar *xpp_comment, \
gchar **xpp_arguments, \
GdkScreen *xpp_screen) \
{ \
XfcePanelPlugin *xpp = NULL; \
\
g_return_val_if_fail (GDK_IS_SCREEN (xpp_screen), NULL); \
g_return_val_if_fail (xpp_name != NULL && xpp_unique_id != -1, NULL); \
\
CHECK_CODE \
{ \
xpp = g_object_new (XFCE_TYPE_PANEL_PLUGIN, \
"name", xpp_name, \
"unique-id", xpp_unique_id, \
"display-name", xpp_display_name, \
"comment", xpp_comment, \
"arguments", xpp_arguments, NULL); \
\
g_signal_connect_after (G_OBJECT (xpp), "realize", \
G_CALLBACK (xfce_panel_module_realize), NULL); \
} \
\
return xpp; \
}
G_END_DECLS
#endif /* !__XFCE_PANEL_MACROS_H__ */
|