1 | /* status-docket: the interface for generating a small docklets into the panel |
---|
2 | * status dock applet, THIS IS NOT A WIDGET, it's an object for the purpose of handeling |
---|
3 | * panel restarts or a panel that hasn't started yet etc ... |
---|
4 | * (C) 1999 the Free Software Foundation |
---|
5 | * |
---|
6 | * Author: George Lebl |
---|
7 | */ |
---|
8 | #ifndef __STATUS_DOCKLET_H__ |
---|
9 | #define __STATUS_DOCKLET_H__ |
---|
10 | |
---|
11 | #include <gtk/gtk.h> |
---|
12 | #include <gnome.h> |
---|
13 | #include <libgnorba/gnorba.h> |
---|
14 | |
---|
15 | #include <gnome-panel.h> |
---|
16 | |
---|
17 | BEGIN_GNOME_DECLS |
---|
18 | |
---|
19 | #define TYPE_STATUS_DOCKLET (status_docklet_get_type ()) |
---|
20 | #define STATUS_DOCKLET(obj) GTK_CHECK_CAST (obj, status_docklet_get_type (), StatusDocklet) |
---|
21 | #define STATUS_DOCKLET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, status_docklet_get_type (), StatusDockletClass) |
---|
22 | #define IS_STATUS_DOCKLET(obj) GTK_CHECK_TYPE (obj, status_docklet_get_type ()) |
---|
23 | |
---|
24 | typedef struct _StatusDocklet StatusDocklet; |
---|
25 | typedef struct _StatusDockletClass StatusDockletClass; |
---|
26 | |
---|
27 | /*infinite retries just sets the maximum_retries to INT_MAX*/ |
---|
28 | #define STATUS_DOCKLET_INFINITE INT_MAX |
---|
29 | /*retry every n seconds*/ |
---|
30 | #define STATUS_DOCKLET_RETRY_EVERY 15 |
---|
31 | /*default number of retries to find the server*/ |
---|
32 | #define STATUS_DOCKLET_DEFAULT_RETRIES 20 /*retry for 5 minutes before giving up*/ |
---|
33 | |
---|
34 | struct _StatusDocklet |
---|
35 | { |
---|
36 | GtkObject object; |
---|
37 | |
---|
38 | /*< public >*/ |
---|
39 | GtkWidget *plug; /* a pointer to the current GtkPlug |
---|
40 | holding the docklet */ |
---|
41 | |
---|
42 | /*< private >*/ |
---|
43 | GNOME_StatusSpot sspot; |
---|
44 | |
---|
45 | int tries; /*if we are set to trying to find the panel, |
---|
46 | here is the count of our failed tries, we |
---|
47 | try every 15 seconds*/ |
---|
48 | int maximum_retries; /*the maximum retries, default is*/ |
---|
49 | guint handle_restarts:1; /*handle panel restarts, by just looking |
---|
50 | for the panel again for some time*/ |
---|
51 | int timeout_handle; /*handle for the retry timeout*/ |
---|
52 | }; |
---|
53 | |
---|
54 | struct _StatusDockletClass |
---|
55 | { |
---|
56 | GtkObjectClass parent_class; |
---|
57 | |
---|
58 | /* called when we build the plug itself (meaning we did find a panel, |
---|
59 | or after the panel was killed, we found it again after it's restart) */ |
---|
60 | void (* build_plug) (StatusDocklet *docklet, |
---|
61 | GtkWidget *plug); |
---|
62 | }; |
---|
63 | |
---|
64 | guint status_docklet_get_type (void) G_GNUC_CONST; |
---|
65 | |
---|
66 | /*just creates a new object, but doesn't yet try to connect to a panel, you |
---|
67 | need to bind the build_plug signal which will make your widget, and then |
---|
68 | call status_docklet_run, which actually starts looking for the panel and |
---|
69 | all those things*/ |
---|
70 | GtkObject* status_docklet_new (void); |
---|
71 | GtkObject* status_docklet_new_full (int maximum_retries, |
---|
72 | gboolean handle_restarts); |
---|
73 | |
---|
74 | /* this function will actually start looking for the panel and if it finds it |
---|
75 | calls the build_plug signal with the plug that it has added */ |
---|
76 | void status_docklet_run (StatusDocklet *docklet); |
---|
77 | |
---|
78 | END_GNOME_DECLS |
---|
79 | |
---|
80 | #endif /* __STATUS_DOCKLET_H__ */ |
---|