1
/* vim: set expandtab ts=8 sw=4: */
3
/* $Id: xfce-panel-plugin.h 25735 2007-05-20 17:48:28Z jasper $
5
* Copyright © 2005 Jasper Huijsmans <jasper@xfce.org>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU Library General Public License as published
9
* by the Free Software Foundation; either version 2 of the License, or
10
* (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
#ifndef _XFCE_PANEL_PLUGIN_H
23
#define _XFCE_PANEL_PLUGIN_H
26
#include <libxfce4panel/xfce-panel-enums.h>
27
#include <libxfce4panel/xfce-panel-macros.h>
28
#include <libxfce4panel/xfce-panel-plugin-iface.h>
29
#include <libxfce4panel/xfce-panel-internal-plugin.h>
30
#include <libxfce4panel/xfce-panel-external-plugin.h>
33
* XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL
34
* @construct : name of a function that can be cast to an #XfcePanelPluginFunc
36
* Registers and initializes the plugin. This is the only thing that is
37
* required to create a panel plugin.
39
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
41
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(construct) \
42
XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,NULL,NULL)
45
* XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK
46
* @construct : name of a function that can be cast to an
47
* #XfcePanelPluginFunc
48
* @check : name of a function that can be cast to an
49
* #XfcePanelPluginCheck
51
* Registers and initializes the plugin. This is the only thing that is
52
* required to create a panel plugin. The @check functions is run before
53
* creating the plugin, and should return FALSE if plugin creation is not
56
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
58
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_WITH_CHECK(construct,check) \
59
XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,NULL,check)
62
* XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL
63
* @construct : name of a function that can be cast to #XfcePanelPluginFunc
64
* @init : name of a function that can be case to #XfcePanelPluginPreInit
66
* @check : name of a function that can be cast to #XfcePanelPluginCheck
69
* Registers and initializes the plugin. This is the only thing that is
70
* required to create a panel plugin.
72
* The @init argument should be a function that takes two parameters:
74
* gboolean init( int argc, char **argv );
76
* The @check functions is run aftern gtk_init() and before creating the
77
* plugin; it takes one argument and should return FALSE if plugin creation
80
* gboolean check( GdkScreen *screen );
82
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
84
#define XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL_FULL(construct,init,check) \
86
main (gint argc, gchar **argv) \
89
XfcePanelPluginFunc create = (XfcePanelPluginFunc)construct; \
90
XfcePanelPluginPreInit preinit = (XfcePanelPluginPreInit)init; \
91
XfcePanelPluginCheck test = (XfcePanelPluginCheck)check; \
95
if (G_UNLIKELY (preinit(argc,argv) == FALSE)) \
99
gtk_init (&argc, &argv); \
103
if (G_UNLIKELY (test(gdk_screen_get_default()) == FALSE)) \
107
plugin = xfce_external_panel_plugin_new (argc, argv, create); \
109
if (G_UNLIKELY (plugin == NULL)) \
112
g_signal_connect_after (G_OBJECT (plugin), "destroy", \
113
G_CALLBACK (gtk_main_quit), NULL); \
115
gtk_widget_show (plugin); \
122
* XFCE_PANEL_PLUGIN_REGISTER_INTERNAL
123
* @construct : name of a function that can be cast to an #XfcePanelPluginFunc
125
* Registers and initializes the plugin. This is the only thing that is
126
* required to create a panel plugin.
128
* This macro is for plugins implemented as a loadable module. Generally it is
129
* preferred to create an external plugin, for which you have to use
130
* XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL() .
132
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
134
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL(construct) \
135
XfcePanelPluginFunc \
136
xfce_panel_plugin_get_construct (void) \
138
return (XfcePanelPluginFunc)construct; \
142
* XFCE_PANEL_PLUGIN_REGISTER_INTERNAL_WITH_CHECK
143
* @construct : name of a function that can be cast to an #XfcePanelPluginFunc
144
* @check : name of a function that can be cast to an
145
* #XfcePanelPluginCheck
147
* Registers and initializes the plugin. This is the only thing that is
148
* required to create a panel plugin. The @check function is run before
149
* creating the plugin, and should return FALSE if plugin creation is not
152
* This macro is for plugins implemented as a loadable module. Generally it is
153
* preferred to create an external plugin, for which you have to use
154
* XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL() .
156
* See also: <link linkend="XfcePanelPlugin">Panel Plugin interface</link>
158
#define XFCE_PANEL_PLUGIN_REGISTER_INTERNAL_WITH_CHECK(construct,check) \
159
XfcePanelPluginFunc \
160
xfce_panel_plugin_get_construct (void) \
162
return (XfcePanelPluginFunc)construct; \
164
XfcePanelPluginCheck \
165
xfce_panel_plugin_get_check (void) \
167
return (XfcePanelPluginCheck)check; \
170
#endif /* _XFCE_PANEL_PLUGIN_H */