summaryrefslogtreecommitdiff
path: root/mate-panel/applet.h
blob: 50205c8f7fd297cc956195c2a606ab743e197112 (plain)
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
#ifndef APPLET_H
#define APPLET_H

#include <glib.h>
#include <gdk/gdk.h>
#include <gio/gio.h>
#include "panel-widget.h"
#include "panel-enums.h"

#ifdef __cplusplus
extern "C" {
#endif


#define APPLET_EVENT_MASK (GDK_BUTTON_PRESS_MASK |		\
			   GDK_BUTTON_RELEASE_MASK |		\
			   GDK_POINTER_MOTION_MASK |		\
			   GDK_POINTER_MOTION_HINT_MASK)
typedef struct {
	PanelObjectType  type;
	GtkWidget       *widget;

	GtkWidget       *menu;
	GtkWidget       *move_item;
	GList           *user_menu;

	gpointer         data;
	GDestroyNotify   data_destroy;

	GSettings       *settings;

	char            *id;
} AppletInfo;

typedef gboolean (* CallbackEnabledFunc) (void);

typedef struct {
	char                *name;
	GIcon               *gicon;
	char                *text;

	CallbackEnabledFunc  is_enabled_func;

	int                  sensitive;
	AppletInfo          *info;

	GtkWidget           *menuitem;
	GtkWidget           *submenu;
} AppletUserMenu;

AppletInfo *mate_panel_applet_register    (GtkWidget       *applet,
				      gpointer         data,
				      GDestroyNotify   data_destroy,
				      PanelWidget     *panel,
				      gboolean         locked,
				      gint             pos,
				      gboolean         exactpos,
				      PanelObjectType  type,
				      const char      *id);
void mate_panel_applet_stop_loading (const char *id);

const char *mate_panel_applet_get_id           (AppletInfo      *info);
const char *mate_panel_applet_get_id_by_widget (GtkWidget       *widget);
AppletInfo *mate_panel_applet_get_by_id        (const char      *id);
AppletInfo *mate_panel_applet_get_by_type      (PanelObjectType  object_type, GdkScreen *screen);

GSList     *mate_panel_applet_list_applets (void);

void        mate_panel_applet_clean        (AppletInfo    *info);

void mate_panel_applet_queue_applet_to_load (const char      *id,
					PanelObjectType  type,
					const char      *toplevel_id,
					int              position,
					gboolean         right_stick,
					gboolean         locked);
void mate_panel_applet_load_queued_applets  (gboolean initial_load);
gboolean mate_panel_applet_on_load_queue    (const char *id);


void            mate_panel_applet_add_callback    (AppletInfo          *info,
					      const gchar         *callback_name,
					      const gchar         *stock_item,
					      const gchar         *menuitem_text,
					      CallbackEnabledFunc  is_enabled_func);

void mate_panel_applet_clear_user_menu (AppletInfo *info);

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


void        mate_panel_applet_save_position           (AppletInfo *applet_info,
						  const char *id,
						  gboolean    immediate);

int         mate_panel_applet_get_position    (AppletInfo *applet);

/* True if all the keys relevant to moving are writable
   (position, toplevel_id, panel_right_stick) */
gboolean    mate_panel_applet_can_freely_move (AppletInfo *applet);

/* True if the locked flag is writable */
gboolean    mate_panel_applet_lockable (AppletInfo *applet);

GtkWidget  *mate_panel_applet_create_menu (AppletInfo *info);

void        mate_panel_applet_menu_set_recurse (GtkMenu     *menu,
					   const gchar *key,
					   gpointer     data);

gboolean    mate_panel_applet_toggle_locked  (AppletInfo *info);

void mate_panel_applet_position_menu (GtkMenu   *menu,
				 int       *x,
				 int       *y,
				 gboolean  *push_in,
				 GtkWidget *applet);
#ifdef __cplusplus
}
#endif

#endif