35
* @PANEL_APPLET_ORIENT_UP: The #PanelApplet is on a horizontal panel, at the
36
* bottom of the screen. It is oriented towards the top of the screen.
37
* @PANEL_APPLET_ORIENT_DOWN: The #PanelApplet is on a horizontal panel, at the
38
* top of the screen. It is oriented towards the bottom of the screen.
39
* @PANEL_APPLET_ORIENT_LEFT: The #PanelApplet is on a vertical panel, at the
40
* right of the screen. It is oriented towards the left of the screen.
41
* @PANEL_APPLET_ORIENT_RIGHT: The #PanelApplet is on a vertical panel, at the
42
* left of the screen. It is oriented towards the right of the screen.
44
* Type defining the orientation of the applet. The values may seem backward
45
* (e.g. %PANEL_APPLET_ORIENT_RIGHT means the panel is on the left side), but
46
* this represents the direction the applet is oriented to.
34
49
PANEL_APPLET_ORIENT_UP,
35
50
PANEL_APPLET_ORIENT_DOWN,
37
52
PANEL_APPLET_ORIENT_RIGHT
38
53
} PanelAppletOrient;
55
#define PANEL_APPLET_ORIENT_FIRST PANEL_APPLET_ORIENT_UP
56
#define PANEL_APPLET_ORIENT_LAST PANEL_APPLET_ORIENT_RIGHT
40
58
#define PANEL_TYPE_APPLET (panel_applet_get_type ())
41
59
#define PANEL_APPLET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PANEL_TYPE_APPLET, PanelApplet))
42
60
#define PANEL_APPLET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PANEL_TYPE_APPLET, PanelAppletClass))
44
62
#define PANEL_IS_APPLET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PANEL_TYPE_APPLET))
45
63
#define PANEL_APPLET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PANEL_TYPE_APPLET, PanelAppletClass))
49
PANEL_COLOR_BACKGROUND,
50
PANEL_PIXMAP_BACKGROUND
51
} PanelAppletBackgroundType;
67
* @PANEL_APPLET_FLAGS_NONE: No flags set.
68
* @PANEL_APPLET_EXPAND_MAJOR: On horizontal panels, the #PanelApplet will be
69
* allocated as much width as possible. On vertical panels, it will be
70
* allocated as much height as possible.
71
* @PANEL_APPLET_EXPAND_MINOR: On horizontal panels, the #PanelApplet will be
72
* allocated the full height of the panel. On vertical panels, it will be
73
* allocated the full width. Most applets should set this flag in order to use
74
* the full panel size and allow the applet to be Fitt's Law compliant.
75
* @PANEL_APPLET_HAS_HANDLE: The panel will draw a handle for the
76
* #PanelApplet. This handle will be usable to move the applet, and to open the
77
* context menu of the applet.
79
* Flags to be used with panel_applet_get_flags()/panel_applet_set_flags(), to
80
* indicate to the panel a specific behavior requested by the #PanelApplet.
54
83
PANEL_APPLET_FLAGS_NONE = 0,
55
84
PANEL_APPLET_EXPAND_MAJOR = 1 << 0,
57
86
PANEL_APPLET_HAS_HANDLE = 1 << 2
58
87
} PanelAppletFlags;
89
#define PANEL_APPLET_FLAGS_ALL (PANEL_APPLET_EXPAND_MAJOR|PANEL_APPLET_EXPAND_MINOR|PANEL_APPLET_HAS_HANDLE)
60
91
typedef struct _PanelApplet PanelApplet;
61
92
typedef struct _PanelAppletClass PanelAppletClass;
62
93
typedef struct _PanelAppletPrivate PanelAppletPrivate;
96
* PanelAppletFactoryCallback:
97
* @applet: a newly-created #PanelApplet.
98
* @iid: identifier of the requested applet type.
99
* @user_data: user data.
101
* The type used for callbacks after. The callback will usually check that @iid
102
* is a valid applet type identifier for the applet factory, and will then fill
103
* @applet with widgets, connect to signals, etc.
105
* Returns: %TRUE if @iid is a valid applet type identifier for the applet
106
* factory and if the creation of @applet was successfully completed, %FALSE
64
109
typedef gboolean (*PanelAppletFactoryCallback) (PanelApplet *applet,
66
111
gpointer user_data);
80
126
void (*change_size) (PanelApplet *applet,
83
void (*change_background) (PanelApplet *applet,
84
PanelAppletBackgroundType type,
129
void (*change_background) (PanelApplet *applet,
130
cairo_pattern_t *pattern);
87
131
void (*move_focus_out_of_applet) (PanelApplet *frame,
88
132
GtkDirectionType direction);
91
135
GType panel_applet_get_type (void) G_GNUC_CONST;
93
GtkWidget *panel_applet_new (void);
95
137
PanelAppletOrient panel_applet_get_orient (PanelApplet *applet);
96
138
guint panel_applet_get_size (PanelApplet *applet);
97
PanelAppletBackgroundType
98
panel_applet_get_background (PanelApplet *applet,
139
cairo_pattern_t *panel_applet_get_background (PanelApplet *applet);
103
141
void panel_applet_set_background_widget (PanelApplet *applet,
104
142
GtkWidget *widget);
144
GSettings *panel_applet_settings_new (PanelApplet *applet,
106
147
gchar *panel_applet_get_preferences_key (PanelApplet *applet);
108
149
void panel_applet_add_preferences (PanelApplet *applet,
109
150
const gchar *schema_dir,
112
153
PanelAppletFlags panel_applet_get_flags (PanelApplet *applet);
113
154
void panel_applet_set_flags (PanelApplet *applet,
131
172
GtkActionGroup *action_group);
133
174
int panel_applet_factory_main (const gchar *factory_id,
134
gboolean out_process,
135
175
GType applet_type,
136
176
PanelAppletFactoryCallback callback,
138
gboolean _panel_applet_shlib_factory (void);
179
int panel_applet_factory_setup_in_process (const gchar *factory_id,
181
PanelAppletFactoryCallback callback,
161
205
#endif /* !defined(ENABLE_NLS) */
163
#define PANEL_APPLET_OUT_PROCESS_FACTORY(id, type, name, callback, data) \
208
* PANEL_APPLET_OUT_PROCESS_FACTORY:
209
* @id: identifier of an applet factory.
210
* @type: GType of the applet this factory creates.
211
* @callback: (scope call): callback to be called when a new applet is created.
212
* @data: (closure): callback data.
214
* Convenience macro providing a main() function for an out-of-process applet.
215
* Internally, it will call panel_applet_factory_main() to create the
216
* @factory_id applet factory.
218
* Applet instances created by the applet factory will use @applet_type as
219
* GType. Unless you subclass #PanelApplet, you should use %PANEL_TYPE_APPLET
222
* On creation of the applet instances, @callback is called to setup the
223
* applet. If @callback returns %FALSE, the creation of the applet instance is
226
* It can only be used once, and is incompatible with the use of
227
* %PANEL_APPLET_IN_PROCESS_FACTORY and panel_applet_factory_main().
229
#define PANEL_APPLET_OUT_PROCESS_FACTORY(id, type, callback, data) \
164
230
int main (int argc, char *argv []) \
166
232
GOptionContext *context; \
187
253
gtk_init (&argc, &argv); \
189
retval = panel_applet_factory_main (id, TRUE, type, callback, data); \
255
retval = panel_applet_factory_main (id, type, callback, data); \
190
256
g_option_context_free (context); \
195
#define PANEL_APPLET_IN_PROCESS_FACTORY(id, type, descr, callback, data) \
262
* PANEL_APPLET_IN_PROCESS_FACTORY:
263
* @id: identifier of an applet factory.
264
* @type: GType of the applet this factory creates.
265
* @callback: (scope call): callback to be called when a new applet is created.
266
* @data: (closure): callback data.
268
* Convenience macro providing the symbol needed to automatically register the
269
* @factory_id applet factory for an in-process applet.
271
* Applet instances created by the applet factory will use @applet_type as
272
* GType. Unless you subclass #PanelApplet, you should use %PANEL_TYPE_APPLET
275
* On creation of the applet instances, @callback is called to setup the
276
* applet. If @callback returns %FALSE, the creation of the applet instance is
279
* It can only be used once, and is incompatible with the use of
280
* %PANEL_APPLET_OUT_PROCESS_FACTORY and panel_applet_factory_main().
282
#define PANEL_APPLET_IN_PROCESS_FACTORY(id, type, callback, data) \
283
gboolean _panel_applet_shlib_factory (void); \
196
284
G_MODULE_EXPORT gint \
197
285
_panel_applet_shlib_factory (void) \
199
287
_PANEL_APPLET_SETUP_GETTEXT (FALSE); \
200
return panel_applet_factory_main (id, FALSE, type, callback, data); \
288
return panel_applet_factory_setup_in_process (id, type, \