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

#include <glib.h>
5
#include <gdk/gdktypes.h>
6 7
#include "panel-widget.h"

8
G_BEGIN_DECLS
9

10 11 12 13 14
#define EMPTY_ID    "Empty"
#define MENU_ID     "Menu"
#define DRAWER_ID   "Drawer"
#define LOGOUT_ID   "Logout"
#define SWALLOW_ID  "Swallow"
15
#define LAUNCHER_ID "Launcher"
16 17 18
#define LOCK_ID     "Lock"
#define STATUS_ID   "Status"
#define RUN_ID      "Run"
19
#define BONOBO_ID   "Bonobo"
20 21 22 23 24 25 26

typedef enum {
	APPLET_DRAWER,
	APPLET_MENU,
	APPLET_LOGOUT,
	APPLET_SWALLOW,
	APPLET_LAUNCHER,
27 28
	APPLET_EMPTY,
	APPLET_LOCK,
29
	APPLET_STATUS,
30 31
	APPLET_RUN,
	APPLET_BONOBO
32 33
} AppletType;

34 35 36 37
#define APPLET_EVENT_MASK (GDK_BUTTON_PRESS_MASK |		\
			   GDK_BUTTON_RELEASE_MASK |		\
			   GDK_POINTER_MOTION_MASK |		\
			   GDK_POINTER_MOTION_HINT_MASK)
38 39 40 41
typedef struct {
	AppletType      type;
	int             applet_id;
	GtkWidget      *widget;
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
	GtkWidget      *menu;
	int             menu_age;
	GList          *user_menu;

	gpointer        data;
	GDestroyNotify  data_destroy;
} AppletInfo;

typedef struct {
	gchar        *name;
	gchar        *stock_item;
	gchar        *text;

	gint          sensitive;
	AppletInfo   *info;

	GtkWidget    *menuitem;
	GtkWidget    *submenu;
} AppletUserMenu;

AppletInfo *panel_applet_register    (GtkWidget      *applet,
				      gpointer        data,
				      GDestroyNotify  data_destroy,
				      PanelWidget    *panel,
				      gint            pos,
				      gboolean        exactpos,
				      AppletType      type);

void        panel_applet_clean       (AppletInfo *info);

void        panel_applet_create_menu (AppletInfo *info,
				      gboolean    is_basep);


void            panel_applet_add_callback    (AppletInfo  *info,
					      const gchar *callback_name,
					      const gchar *stock_item,
					      const gchar *menuitem_text);

void            panel_applet_remove_callback (AppletInfo *info,
					      const char *callback_name);

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


void        panel_applet_callback_set_sensitive (AppletInfo *info,
						 const char *callback_name,
						 gint        sensitive);
92

93
G_END_DECLS
94 95

#endif