applet.h 2 KB
Newer Older
1 2 3 4
#ifndef APPLET_H
#define APPLET_H

#include <glib.h>
5
#include <gdk/gdk.h>
6

7
#include "panel-enums.h"
8
#include "panel-widget.h"
9

10
G_BEGIN_DECLS
11

12 13 14 15
#define APPLET_EVENT_MASK (GDK_BUTTON_PRESS_MASK |		\
			   GDK_BUTTON_RELEASE_MASK |		\
			   GDK_POINTER_MOTION_MASK |		\
			   GDK_POINTER_MOTION_HINT_MASK)
16
typedef struct {
17 18
	PanelObjectType  type;
	GtkWidget       *widget;
19
	GSettings       *settings;
20

21
	GtkWidget       *menu;
22
	GtkWidget       *edit_menu;
23
	GList           *user_menu;
24

25 26
	gpointer         data;
	GDestroyNotify   data_destroy;
27

28
	char            *id;
29 30
} AppletInfo;

31 32
typedef gboolean (* CallbackEnabledFunc) (void);

33
typedef struct {
34 35 36 37
	char                *name;
	char                *text;

	CallbackEnabledFunc  is_enabled_func;
38

39 40
	int                  sensitive;
	AppletInfo          *info;
41

42 43
	GtkWidget           *menuitem;
	GtkWidget           *submenu;
44 45
} AppletUserMenu;

46 47 48
AppletInfo *panel_applet_register    (GtkWidget       *applet,
				      PanelWidget     *panel,
				      PanelObjectType  type,
49 50 51 52
				      const char      *id,
				      GSettings       *settings,
				      gpointer         data,
				      GDestroyNotify   data_destroy);
53

54
const char *panel_applet_get_id           (AppletInfo      *info);
55

56 57
gboolean    panel_applet_activate_main_menu (guint32 activate_time);

58
GSList     *panel_applet_list_applets (void);
59

60 61
void        panel_applet_clean        (AppletInfo    *info);

62 63 64 65
void            panel_applet_add_callback    (AppletInfo          *info,
					      const gchar         *callback_name,
					      const gchar         *menuitem_text,
					      CallbackEnabledFunc  is_enabled_func);
66 67 68 69

AppletUserMenu *panel_applet_get_callback    (GList       *user_menu,
					      const gchar *name);

70
void        panel_applet_save_position           (AppletInfo *applet_info,
71
						  const char *id,
72
						  gboolean    immediate);
73

74 75 76 77
/* True if all the keys relevant to moving are writable
   (position, toplevel_id, panel_right_stick) */
gboolean    panel_applet_can_freely_move (AppletInfo *applet);

78
G_END_DECLS
79 80

#endif