~ubuntu-branches/debian/sid/link-monitor-applet/sid

« back to all changes in this revision

Viewing changes to src/lm-applet.c

  • Committer: Bazaar Package Importer
  • Author(s): Adriaan Peeters
  • Date: 2008-03-30 22:26:13 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080330222613-5aubcuo9mgg2n7st
Tags: upstream-3.0
ImportĀ upstreamĀ versionĀ 3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Generated by GOB (v2.0.14)   (do not edit directly) */
2
 
 
3
 
/* End world hunger, donate to the World Food Programme, http://www.wfp.org */
4
 
 
5
 
#define GOB_VERSION_MAJOR 2
6
 
#define GOB_VERSION_MINOR 0
7
 
#define GOB_VERSION_PATCHLEVEL 14
8
 
 
9
 
#define selfp (self->_priv)
10
 
 
11
 
#include "lm-applet.h"
12
 
 
13
 
#include "lm-applet-private.h"
14
 
 
15
 
#ifdef G_LIKELY
16
 
#define ___GOB_LIKELY(expr) G_LIKELY(expr)
17
 
#define ___GOB_UNLIKELY(expr) G_UNLIKELY(expr)
18
 
#else /* ! G_LIKELY */
19
 
#define ___GOB_LIKELY(expr) (expr)
20
 
#define ___GOB_UNLIKELY(expr) (expr)
21
 
#endif /* G_LIKELY */
22
 
 
23
 
#line 32 "lm-applet.gob"
24
 
 
25
 
#include "config.h"
26
 
#include <string.h>
27
 
#include <panel-applet-gconf.h>
28
 
#include <eel/eel.h>
29
 
#include "lm-util.h"
30
 
#include "lm-preferences-dialog.h"
31
 
#include "lm-about-dialog.h"
32
 
#include "lm-icmp.h"
33
 
#include "lm-host-frontend.h"
34
 
 
35
 
#define ICON_PADDING                    1
36
 
 
37
 
#define BAR_SPACING                     3
38
 
 
39
 
#define CONF_HOSTS                      "hosts"
40
 
#define CONF_DELAY                      "delay"
41
 
#define CONF_TIMEOUT                    "timeout"
42
 
#define CONF_SCALE                      "scale"
43
 
#define CONF_PREFERENCES_WIDTH          "preferences_width"
44
 
#define CONF_PREFERENCES_HEIGHT         "preferences_height"
45
 
 
46
 
/* keep in sync with link-monitor-applet.schemas */
47
 
#define DEFAULT_PREFERENCES_WIDTH       -1
48
 
#define DEFAULT_PREFERENCES_HEIGHT      387
49
 
 
50
 
/* keep in sync with preferences.glade */
51
 
#define MIN_DELAY                       1000
52
 
#define MIN_TIMEOUT                     100
53
 
#define MIN_SCALE                       1
54
 
 
55
 
#line 56 "lm-applet.c"
56
 
/* self casting macros */
57
 
#define SELF(x) LM_APPLET(x)
58
 
#define SELF_CONST(x) LM_APPLET_CONST(x)
59
 
#define IS_SELF(x) LM_IS_APPLET(x)
60
 
#define TYPE_SELF LM_TYPE_APPLET
61
 
#define SELF_CLASS(x) LM_APPLET_CLASS(x)
62
 
 
63
 
#define SELF_GET_CLASS(x) LM_APPLET_GET_CLASS(x)
64
 
 
65
 
/* self typedefs */
66
 
typedef LMApplet Self;
67
 
typedef LMAppletClass SelfClass;
68
 
 
69
 
/* here are local prototypes */
70
 
static void ___object_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
71
 
static void ___object_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
72
 
static void lm_applet_init (LMApplet * o) G_GNUC_UNUSED;
73
 
static void ___real_lm_applet_activate (LMApplet * self);
74
 
static void lm_applet_activate (LMApplet * self) G_GNUC_UNUSED;
75
 
static void ___real_lm_applet_activate_preferences (LMApplet * self);
76
 
static void lm_applet_activate_preferences (LMApplet * self) G_GNUC_UNUSED;
77
 
static void lm_applet_class_init (LMAppletClass * class) G_GNUC_UNUSED;
78
 
static gboolean lm_applet_factory_cb (PanelApplet * applet, const char * iid, gpointer data) G_GNUC_UNUSED;
79
 
static void lm_applet_destroy_h (GtkObject * object, gpointer user_data) G_GNUC_UNUSED;
80
 
static void lm_applet_reconfigure (LMApplet * self) G_GNUC_UNUSED;
81
 
static gboolean lm_applet_reconfigure_timeout_cb (gpointer data) G_GNUC_UNUSED;
82
 
static void lm_applet_change_background_h (PanelApplet * applet, PanelAppletBackgroundType type, GdkColor * color, GdkPixmap * pixmap, gpointer user_data) G_GNUC_UNUSED;
83
 
static gboolean lm_applet_button_press_event_h (GtkWidget * widget, GdkEventButton * event, gpointer user_data) G_GNUC_UNUSED;
84
 
static void lm_applet_preferences_cb (BonoboUIComponent * component, gpointer user_data, const char * cname) G_GNUC_UNUSED;
85
 
static void lm_applet_help_cb (BonoboUIComponent * component, gpointer user_data, const char * cname) G_GNUC_UNUSED;
86
 
static void lm_applet_about_cb (BonoboUIComponent * component, gpointer user_data, const char * cname) G_GNUC_UNUSED;
87
 
static void lm_applet_display_preferences_dialog (LMApplet * self) G_GNUC_UNUSED;
88
 
static void lm_applet_display_window (LMApplet * self, GType type, GtkWidget ** ptr) G_GNUC_UNUSED;
89
 
static void lm_applet_update (LMApplet * self) G_GNUC_UNUSED;
90
 
static void lm_applet_update_applet (LMApplet * self) G_GNUC_UNUSED;
91
 
static void lm_applet_update_tooltip (LMApplet * self) G_GNUC_UNUSED;
92
 
static void lm_applet_sync_gconf_hosts (LMApplet * self) G_GNUC_UNUSED;
93
 
static LMHost * lm_applet_host_new (LMApplet * self, const char * name) G_GNUC_UNUSED;
94
 
static LMHost * lm_applet_add_host_internal (LMApplet * self, const char * name) G_GNUC_UNUSED;
95
 
static LMHost * lm_applet_replace_host_internal (LMApplet * self, LMHost * old, const char * new) G_GNUC_UNUSED;
96
 
static void lm_applet_reorder_hosts_internal (LMApplet * self, GSList * new_hosts) G_GNUC_UNUSED;
97
 
static void lm_applet_remove_host_internal (LMApplet * self, LMHost * host) G_GNUC_UNUSED;
98
 
 
99
 
/*
100
 
 * Signal connection wrapper macro shortcuts
101
 
 */
102
 
#define self_connect__activate(object,func,data)        lm_applet_connect__activate((object),(func),(data))
103
 
#define self_connect_after__activate(object,func,data)  lm_applet_connect_after__activate((object),(func),(data))
104
 
#define self_connect_data__activate(object,func,data,destroy_data,flags)        lm_applet_connect_data__activate((object),(func),(data),(destroy_data),(flags))
105
 
#define self_connect__activate_preferences(object,func,data)    lm_applet_connect__activate_preferences((object),(func),(data))
106
 
#define self_connect_after__activate_preferences(object,func,data)      lm_applet_connect_after__activate_preferences((object),(func),(data))
107
 
#define self_connect_data__activate_preferences(object,func,data,destroy_data,flags)    lm_applet_connect_data__activate_preferences((object),(func),(data),(destroy_data),(flags))
108
 
 
109
 
enum {
110
 
        ACTIVATE_SIGNAL,
111
 
        ACTIVATE_PREFERENCES_SIGNAL,
112
 
        LAST_SIGNAL
113
 
};
114
 
 
115
 
enum {
116
 
        PROP_0,
117
 
        PROP_DELAY,
118
 
        PROP_TIMEOUT,
119
 
        PROP_SCALE,
120
 
        PROP_PREFERENCES_WIDTH,
121
 
        PROP_PREFERENCES_HEIGHT
122
 
};
123
 
 
124
 
static guint object_signals[LAST_SIGNAL] = {0};
125
 
 
126
 
/* pointer to the class of our parent */
127
 
static PanelAppletClass *parent_class = NULL;
128
 
 
129
 
/* Short form macros */
130
 
#define self_get_delay lm_applet_get_delay
131
 
#define self_set_delay lm_applet_set_delay
132
 
#define self_get_timeout lm_applet_get_timeout
133
 
#define self_set_timeout lm_applet_set_timeout
134
 
#define self_get_scale lm_applet_get_scale
135
 
#define self_set_scale lm_applet_set_scale
136
 
#define self_get_preferences_width lm_applet_get_preferences_width
137
 
#define self_set_preferences_width lm_applet_set_preferences_width
138
 
#define self_get_preferences_height lm_applet_get_preferences_height
139
 
#define self_set_preferences_height lm_applet_set_preferences_height
140
 
#define self_activate lm_applet_activate
141
 
#define self_activate_preferences lm_applet_activate_preferences
142
 
#define self_factory_cb lm_applet_factory_cb
143
 
#define self_destroy_h lm_applet_destroy_h
144
 
#define self_reconfigure lm_applet_reconfigure
145
 
#define self_reconfigure_timeout_cb lm_applet_reconfigure_timeout_cb
146
 
#define self_change_background_h lm_applet_change_background_h
147
 
#define self_button_press_event_h lm_applet_button_press_event_h
148
 
#define self_preferences_cb lm_applet_preferences_cb
149
 
#define self_help_cb lm_applet_help_cb
150
 
#define self_about_cb lm_applet_about_cb
151
 
#define self_display_preferences_dialog lm_applet_display_preferences_dialog
152
 
#define self_display_window lm_applet_display_window
153
 
#define self_update lm_applet_update
154
 
#define self_update_applet lm_applet_update_applet
155
 
#define self_update_tooltip lm_applet_update_tooltip
156
 
#define self_factory_main lm_applet_factory_main
157
 
#define self_sync_gconf_hosts lm_applet_sync_gconf_hosts
158
 
#define self_host_new lm_applet_host_new
159
 
#define self_add_host_internal lm_applet_add_host_internal
160
 
#define self_replace_host_internal lm_applet_replace_host_internal
161
 
#define self_reorder_hosts_internal lm_applet_reorder_hosts_internal
162
 
#define self_remove_host_internal lm_applet_remove_host_internal
163
 
#define self_add_host lm_applet_add_host
164
 
#define self_replace_host lm_applet_replace_host
165
 
#define self_reorder_hosts lm_applet_reorder_hosts
166
 
#define self_remove_host lm_applet_remove_host
167
 
GType
168
 
lm_applet_get_type (void)
169
 
{
170
 
        static GType type = 0;
171
 
 
172
 
        if ___GOB_UNLIKELY(type == 0) {
173
 
                static const GTypeInfo info = {
174
 
                        sizeof (LMAppletClass),
175
 
                        (GBaseInitFunc) NULL,
176
 
                        (GBaseFinalizeFunc) NULL,
177
 
                        (GClassInitFunc) lm_applet_class_init,
178
 
                        (GClassFinalizeFunc) NULL,
179
 
                        NULL /* class_data */,
180
 
                        sizeof (LMApplet),
181
 
                        0 /* n_preallocs */,
182
 
                        (GInstanceInitFunc) lm_applet_init,
183
 
                        NULL
184
 
                };
185
 
 
186
 
                type = g_type_register_static (PANEL_TYPE_APPLET, "LMApplet", &info, (GTypeFlags)0);
187
 
        }
188
 
 
189
 
        return type;
190
 
}
191
 
 
192
 
/* a macro for creating a new object of our type */
193
 
#define GET_NEW ((LMApplet *)g_object_new(lm_applet_get_type(), NULL))
194
 
 
195
 
/* a function for creating a new object of our type */
196
 
#include <stdarg.h>
197
 
static LMApplet * GET_NEW_VARG (const char *first, ...) G_GNUC_UNUSED;
198
 
static LMApplet *
199
 
GET_NEW_VARG (const char *first, ...)
200
 
{
201
 
        LMApplet *ret;
202
 
        va_list ap;
203
 
        va_start (ap, first);
204
 
        ret = (LMApplet *)g_object_new_valist (lm_applet_get_type (), first, ap);
205
 
        va_end (ap);
206
 
        return ret;
207
 
}
208
 
 
209
 
 
210
 
static void
211
 
___finalize(GObject *obj_self)
212
 
{
213
 
#define __GOB_FUNCTION__ "LM:Applet::finalize"
214
 
        LMApplet *self G_GNUC_UNUSED = LM_APPLET (obj_self);
215
 
        gpointer priv G_GNUC_UNUSED = self->_priv;
216
 
        if(G_OBJECT_CLASS(parent_class)->finalize) \
217
 
                (* G_OBJECT_CLASS(parent_class)->finalize)(obj_self);
218
 
}
219
 
#undef __GOB_FUNCTION__
220
 
 
221
 
static void 
222
 
lm_applet_init (LMApplet * o G_GNUC_UNUSED)
223
 
{
224
 
#define __GOB_FUNCTION__ "LM:Applet::init"
225
 
        o->_priv = G_TYPE_INSTANCE_GET_PRIVATE(o,LM_TYPE_APPLET,LMAppletPrivate);
226
 
}
227
 
#undef __GOB_FUNCTION__
228
 
#line 143 "lm-applet.gob"
229
 
static void 
230
 
lm_applet_class_init (LMAppletClass * class G_GNUC_UNUSED)
231
 
#line 232 "lm-applet.c"
232
 
{
233
 
#define __GOB_FUNCTION__ "LM:Applet::class_init"
234
 
        GObjectClass *g_object_class G_GNUC_UNUSED = (GObjectClass*) class;
235
 
 
236
 
        g_type_class_add_private(class,sizeof(LMAppletPrivate));
237
 
 
238
 
        parent_class = g_type_class_ref (PANEL_TYPE_APPLET);
239
 
 
240
 
        object_signals[ACTIVATE_SIGNAL] =
241
 
                g_signal_new ("activate",
242
 
                        G_TYPE_FROM_CLASS (g_object_class),
243
 
                        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
244
 
                        G_STRUCT_OFFSET (LMAppletClass, activate),
245
 
                        NULL, NULL,
246
 
                        g_cclosure_marshal_VOID__VOID,
247
 
                        G_TYPE_NONE, 0);
248
 
        object_signals[ACTIVATE_PREFERENCES_SIGNAL] =
249
 
                g_signal_new ("activate_preferences",
250
 
                        G_TYPE_FROM_CLASS (g_object_class),
251
 
                        (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
252
 
                        G_STRUCT_OFFSET (LMAppletClass, activate_preferences),
253
 
                        NULL, NULL,
254
 
                        g_cclosure_marshal_VOID__VOID,
255
 
                        G_TYPE_NONE, 0);
256
 
 
257
 
#line 131 "lm-applet.gob"
258
 
        class->activate = ___real_lm_applet_activate;
259
 
#line 137 "lm-applet.gob"
260
 
        class->activate_preferences = ___real_lm_applet_activate_preferences;
261
 
#line 262 "lm-applet.c"
262
 
        g_object_class->finalize = ___finalize;
263
 
        g_object_class->get_property = ___object_get_property;
264
 
        g_object_class->set_property = ___object_set_property;
265
 
    {
266
 
        GParamSpec   *param_spec;
267
 
 
268
 
        param_spec = g_param_spec_uint
269
 
                ("delay" /* name */,
270
 
                 NULL /* nick */,
271
 
                 NULL /* blurb */,
272
 
                 MIN_DELAY /* minimum */,
273
 
                 G_MAXUINT /* maximum */,
274
 
                 MIN_DELAY /* default_value */,
275
 
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
276
 
        g_object_class_install_property (g_object_class,
277
 
                PROP_DELAY,
278
 
                param_spec);
279
 
        param_spec = g_param_spec_uint
280
 
                ("timeout" /* name */,
281
 
                 NULL /* nick */,
282
 
                 NULL /* blurb */,
283
 
                 MIN_TIMEOUT /* minimum */,
284
 
                 G_MAXUINT /* maximum */,
285
 
                 MIN_TIMEOUT /* default_value */,
286
 
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
287
 
        g_object_class_install_property (g_object_class,
288
 
                PROP_TIMEOUT,
289
 
                param_spec);
290
 
        param_spec = g_param_spec_uint
291
 
                ("scale" /* name */,
292
 
                 NULL /* nick */,
293
 
                 NULL /* blurb */,
294
 
                 MIN_SCALE /* minimum */,
295
 
                 G_MAXUINT /* maximum */,
296
 
                 MIN_SCALE /* default_value */,
297
 
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
298
 
        g_object_class_install_property (g_object_class,
299
 
                PROP_SCALE,
300
 
                param_spec);
301
 
        param_spec = g_param_spec_int
302
 
                ("preferences_width" /* name */,
303
 
                 NULL /* nick */,
304
 
                 NULL /* blurb */,
305
 
                 -1 /* minimum */,
306
 
                 G_MAXINT /* maximum */,
307
 
                 DEFAULT_PREFERENCES_WIDTH /* default_value */,
308
 
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
309
 
        g_object_class_install_property (g_object_class,
310
 
                PROP_PREFERENCES_WIDTH,
311
 
                param_spec);
312
 
        param_spec = g_param_spec_int
313
 
                ("preferences_height" /* name */,
314
 
                 NULL /* nick */,
315
 
                 NULL /* blurb */,
316
 
                 -1 /* minimum */,
317
 
                 G_MAXINT /* maximum */,
318
 
                 DEFAULT_PREFERENCES_HEIGHT /* default_value */,
319
 
                 (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE));
320
 
        g_object_class_install_property (g_object_class,
321
 
                PROP_PREFERENCES_HEIGHT,
322
 
                param_spec);
323
 
    }
324
 
 {
325
 
#line 144 "lm-applet.gob"
326
 
 
327
 
    GtkBindingSet *binding_set;
328
 
 
329
 
    binding_set = gtk_binding_set_by_class(class);
330
 
 
331
 
    gtk_binding_entry_add_signal(binding_set, GDK_Return, 0, "activate", 0);
332
 
    gtk_binding_entry_add_signal(binding_set, GDK_ISO_Enter, 0, "activate", 0);
333
 
    gtk_binding_entry_add_signal(binding_set, GDK_KP_Enter, 0, "activate", 0);
334
 
 
335
 
    gtk_binding_entry_add_signal(binding_set, GDK_Return, GDK_MOD1_MASK, "activate-preferences", 0);
336
 
    gtk_binding_entry_add_signal(binding_set, GDK_ISO_Enter, GDK_MOD1_MASK, "activate-preferences", 0);
337
 
    gtk_binding_entry_add_signal(binding_set, GDK_KP_Enter, GDK_MOD1_MASK, "activate-preferences", 0);
338
 
  
339
 
#line 340 "lm-applet.c"
340
 
 }
341
 
}
342
 
#undef __GOB_FUNCTION__
343
 
 
344
 
static void
345
 
___object_set_property (GObject *object,
346
 
        guint property_id,
347
 
        const GValue *VAL G_GNUC_UNUSED,
348
 
        GParamSpec *pspec G_GNUC_UNUSED)
349
 
#define __GOB_FUNCTION__ "LM:Applet::set_property"
350
 
{
351
 
        LMApplet *self G_GNUC_UNUSED;
352
 
 
353
 
        self = LM_APPLET (object);
354
 
 
355
 
        switch (property_id) {
356
 
        case PROP_DELAY:
357
 
                {
358
 
#line 71 "lm-applet.gob"
359
 
 
360
 
      panel_applet_gconf_set_int(PANEL_APPLET(self), CONF_DELAY, self->delay = g_value_get_uint(VAL), NULL);
361
 
    
362
 
#line 363 "lm-applet.c"
363
 
                }
364
 
                break;
365
 
        case PROP_TIMEOUT:
366
 
                {
367
 
#line 82 "lm-applet.gob"
368
 
 
369
 
      panel_applet_gconf_set_int(PANEL_APPLET(self), CONF_TIMEOUT, self->timeout = g_value_get_uint(VAL), NULL);
370
 
    
371
 
#line 372 "lm-applet.c"
372
 
                }
373
 
                break;
374
 
        case PROP_SCALE:
375
 
                {
376
 
#line 93 "lm-applet.gob"
377
 
 
378
 
      panel_applet_gconf_set_int(PANEL_APPLET(self), CONF_SCALE, self->scale = g_value_get_uint(VAL), NULL);
379
 
    
380
 
#line 381 "lm-applet.c"
381
 
                }
382
 
                break;
383
 
        case PROP_PREFERENCES_WIDTH:
384
 
                {
385
 
#line 104 "lm-applet.gob"
386
 
 
387
 
      panel_applet_gconf_set_int(PANEL_APPLET(self), CONF_PREFERENCES_WIDTH, self->preferences_width = g_value_get_int(VAL), NULL);
388
 
    
389
 
#line 390 "lm-applet.c"
390
 
                }
391
 
                break;
392
 
        case PROP_PREFERENCES_HEIGHT:
393
 
                {
394
 
#line 115 "lm-applet.gob"
395
 
 
396
 
      panel_applet_gconf_set_int(PANEL_APPLET(self), CONF_PREFERENCES_HEIGHT, self->preferences_height = g_value_get_int(VAL), NULL);
397
 
    
398
 
#line 399 "lm-applet.c"
399
 
                }
400
 
                break;
401
 
        default:
402
 
/* Apparently in g++ this is needed, glib is b0rk */
403
 
#ifndef __PRETTY_FUNCTION__
404
 
#  undef G_STRLOC
405
 
#  define G_STRLOC      __FILE__ ":" G_STRINGIFY (__LINE__)
406
 
#endif
407
 
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
408
 
                break;
409
 
        }
410
 
}
411
 
#undef __GOB_FUNCTION__
412
 
 
413
 
static void
414
 
___object_get_property (GObject *object,
415
 
        guint property_id,
416
 
        GValue *VAL G_GNUC_UNUSED,
417
 
        GParamSpec *pspec G_GNUC_UNUSED)
418
 
#define __GOB_FUNCTION__ "LM:Applet::get_property"
419
 
{
420
 
        LMApplet *self G_GNUC_UNUSED;
421
 
 
422
 
        self = LM_APPLET (object);
423
 
 
424
 
        switch (property_id) {
425
 
        case PROP_DELAY:
426
 
                {
427
 
#line 75 "lm-applet.gob"
428
 
 
429
 
      g_value_set_uint(VAL, self->delay);
430
 
    
431
 
#line 432 "lm-applet.c"
432
 
                }
433
 
                break;
434
 
        case PROP_TIMEOUT:
435
 
                {
436
 
#line 86 "lm-applet.gob"
437
 
 
438
 
      g_value_set_uint(VAL, self->timeout);
439
 
    
440
 
#line 441 "lm-applet.c"
441
 
                }
442
 
                break;
443
 
        case PROP_SCALE:
444
 
                {
445
 
#line 97 "lm-applet.gob"
446
 
 
447
 
      g_value_set_uint(VAL, self->scale);
448
 
    
449
 
#line 450 "lm-applet.c"
450
 
                }
451
 
                break;
452
 
        case PROP_PREFERENCES_WIDTH:
453
 
                {
454
 
#line 108 "lm-applet.gob"
455
 
 
456
 
      g_value_set_int(VAL, self->preferences_width);
457
 
    
458
 
#line 459 "lm-applet.c"
459
 
                }
460
 
                break;
461
 
        case PROP_PREFERENCES_HEIGHT:
462
 
                {
463
 
#line 119 "lm-applet.gob"
464
 
 
465
 
      g_value_set_int(VAL, self->preferences_height);
466
 
    
467
 
#line 468 "lm-applet.c"
468
 
                }
469
 
                break;
470
 
        default:
471
 
/* Apparently in g++ this is needed, glib is b0rk */
472
 
#ifndef __PRETTY_FUNCTION__
473
 
#  undef G_STRLOC
474
 
#  define G_STRLOC      __FILE__ ":" G_STRINGIFY (__LINE__)
475
 
#endif
476
 
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
477
 
                break;
478
 
        }
479
 
}
480
 
#undef __GOB_FUNCTION__
481
 
 
482
 
 
483
 
#line 75 "lm-applet.gob"
484
 
guint 
485
 
lm_applet_get_delay (LMApplet * self)
486
 
#line 487 "lm-applet.c"
487
 
{
488
 
#define __GOB_FUNCTION__ "LM:Applet::get_delay"
489
 
{
490
 
#line 69 "lm-applet.gob"
491
 
                guint val; g_object_get (G_OBJECT (self), "delay", &val, NULL); return val;
492
 
}}
493
 
#line 494 "lm-applet.c"
494
 
#undef __GOB_FUNCTION__
495
 
 
496
 
#line 71 "lm-applet.gob"
497
 
void 
498
 
lm_applet_set_delay (LMApplet * self, guint val)
499
 
#line 500 "lm-applet.c"
500
 
{
501
 
#define __GOB_FUNCTION__ "LM:Applet::set_delay"
502
 
{
503
 
#line 69 "lm-applet.gob"
504
 
                g_object_set (G_OBJECT (self), "delay", val, NULL);
505
 
}}
506
 
#line 507 "lm-applet.c"
507
 
#undef __GOB_FUNCTION__
508
 
 
509
 
#line 86 "lm-applet.gob"
510
 
guint 
511
 
lm_applet_get_timeout (LMApplet * self)
512
 
#line 513 "lm-applet.c"
513
 
{
514
 
#define __GOB_FUNCTION__ "LM:Applet::get_timeout"
515
 
{
516
 
#line 80 "lm-applet.gob"
517
 
                guint val; g_object_get (G_OBJECT (self), "timeout", &val, NULL); return val;
518
 
}}
519
 
#line 520 "lm-applet.c"
520
 
#undef __GOB_FUNCTION__
521
 
 
522
 
#line 82 "lm-applet.gob"
523
 
void 
524
 
lm_applet_set_timeout (LMApplet * self, guint val)
525
 
#line 526 "lm-applet.c"
526
 
{
527
 
#define __GOB_FUNCTION__ "LM:Applet::set_timeout"
528
 
{
529
 
#line 80 "lm-applet.gob"
530
 
                g_object_set (G_OBJECT (self), "timeout", val, NULL);
531
 
}}
532
 
#line 533 "lm-applet.c"
533
 
#undef __GOB_FUNCTION__
534
 
 
535
 
#line 97 "lm-applet.gob"
536
 
guint 
537
 
lm_applet_get_scale (LMApplet * self)
538
 
#line 539 "lm-applet.c"
539
 
{
540
 
#define __GOB_FUNCTION__ "LM:Applet::get_scale"
541
 
{
542
 
#line 91 "lm-applet.gob"
543
 
                guint val; g_object_get (G_OBJECT (self), "scale", &val, NULL); return val;
544
 
}}
545
 
#line 546 "lm-applet.c"
546
 
#undef __GOB_FUNCTION__
547
 
 
548
 
#line 93 "lm-applet.gob"
549
 
void 
550
 
lm_applet_set_scale (LMApplet * self, guint val)
551
 
#line 552 "lm-applet.c"
552
 
{
553
 
#define __GOB_FUNCTION__ "LM:Applet::set_scale"
554
 
{
555
 
#line 91 "lm-applet.gob"
556
 
                g_object_set (G_OBJECT (self), "scale", val, NULL);
557
 
}}
558
 
#line 559 "lm-applet.c"
559
 
#undef __GOB_FUNCTION__
560
 
 
561
 
#line 108 "lm-applet.gob"
562
 
gint 
563
 
lm_applet_get_preferences_width (LMApplet * self)
564
 
#line 565 "lm-applet.c"
565
 
{
566
 
#define __GOB_FUNCTION__ "LM:Applet::get_preferences_width"
567
 
{
568
 
#line 102 "lm-applet.gob"
569
 
                gint val; g_object_get (G_OBJECT (self), "preferences_width", &val, NULL); return val;
570
 
}}
571
 
#line 572 "lm-applet.c"
572
 
#undef __GOB_FUNCTION__
573
 
 
574
 
#line 104 "lm-applet.gob"
575
 
void 
576
 
lm_applet_set_preferences_width (LMApplet * self, gint val)
577
 
#line 578 "lm-applet.c"
578
 
{
579
 
#define __GOB_FUNCTION__ "LM:Applet::set_preferences_width"
580
 
{
581
 
#line 102 "lm-applet.gob"
582
 
                g_object_set (G_OBJECT (self), "preferences_width", val, NULL);
583
 
}}
584
 
#line 585 "lm-applet.c"
585
 
#undef __GOB_FUNCTION__
586
 
 
587
 
#line 119 "lm-applet.gob"
588
 
gint 
589
 
lm_applet_get_preferences_height (LMApplet * self)
590
 
#line 591 "lm-applet.c"
591
 
{
592
 
#define __GOB_FUNCTION__ "LM:Applet::get_preferences_height"
593
 
{
594
 
#line 113 "lm-applet.gob"
595
 
                gint val; g_object_get (G_OBJECT (self), "preferences_height", &val, NULL); return val;
596
 
}}
597
 
#line 598 "lm-applet.c"
598
 
#undef __GOB_FUNCTION__
599
 
 
600
 
#line 115 "lm-applet.gob"
601
 
void 
602
 
lm_applet_set_preferences_height (LMApplet * self, gint val)
603
 
#line 604 "lm-applet.c"
604
 
{
605
 
#define __GOB_FUNCTION__ "LM:Applet::set_preferences_height"
606
 
{
607
 
#line 113 "lm-applet.gob"
608
 
                g_object_set (G_OBJECT (self), "preferences_height", val, NULL);
609
 
}}
610
 
#line 611 "lm-applet.c"
611
 
#undef __GOB_FUNCTION__
612
 
 
613
 
#line 131 "lm-applet.gob"
614
 
static void 
615
 
lm_applet_activate (LMApplet * self)
616
 
#line 617 "lm-applet.c"
617
 
{
618
 
        GValue ___param_values[1];
619
 
        GValue ___return_val;
620
 
 
621
 
memset (&___return_val, 0, sizeof (___return_val));
622
 
memset (&___param_values, 0, sizeof (___param_values));
623
 
 
624
 
#line 131 "lm-applet.gob"
625
 
        g_return_if_fail (self != NULL);
626
 
#line 131 "lm-applet.gob"
627
 
        g_return_if_fail (LM_IS_APPLET (self));
628
 
#line 629 "lm-applet.c"
629
 
 
630
 
        ___param_values[0].g_type = 0;
631
 
        g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
632
 
        g_value_set_instance (&___param_values[0], (gpointer) self);
633
 
 
634
 
        g_signal_emitv (___param_values,
635
 
                object_signals[ACTIVATE_SIGNAL],
636
 
                0 /* detail */,
637
 
                &___return_val);
638
 
 
639
 
        g_value_unset (&___param_values[0]);
640
 
}
641
 
#line 131 "lm-applet.gob"
642
 
static void 
643
 
___real_lm_applet_activate (LMApplet * self G_GNUC_UNUSED)
644
 
#line 645 "lm-applet.c"
645
 
{
646
 
#define __GOB_FUNCTION__ "LM:Applet::activate"
647
 
{
648
 
#line 133 "lm-applet.gob"
649
 
        
650
 
    self_display_preferences_dialog(self);
651
 
  }}
652
 
#line 653 "lm-applet.c"
653
 
#undef __GOB_FUNCTION__
654
 
 
655
 
#line 137 "lm-applet.gob"
656
 
static void 
657
 
lm_applet_activate_preferences (LMApplet * self)
658
 
#line 659 "lm-applet.c"
659
 
{
660
 
        GValue ___param_values[1];
661
 
        GValue ___return_val;
662
 
 
663
 
memset (&___return_val, 0, sizeof (___return_val));
664
 
memset (&___param_values, 0, sizeof (___param_values));
665
 
 
666
 
#line 137 "lm-applet.gob"
667
 
        g_return_if_fail (self != NULL);
668
 
#line 137 "lm-applet.gob"
669
 
        g_return_if_fail (LM_IS_APPLET (self));
670
 
#line 671 "lm-applet.c"
671
 
 
672
 
        ___param_values[0].g_type = 0;
673
 
        g_value_init (&___param_values[0], G_TYPE_FROM_INSTANCE (self));
674
 
        g_value_set_instance (&___param_values[0], (gpointer) self);
675
 
 
676
 
        g_signal_emitv (___param_values,
677
 
                object_signals[ACTIVATE_PREFERENCES_SIGNAL],
678
 
                0 /* detail */,
679
 
                &___return_val);
680
 
 
681
 
        g_value_unset (&___param_values[0]);
682
 
}
683
 
#line 137 "lm-applet.gob"
684
 
static void 
685
 
___real_lm_applet_activate_preferences (LMApplet * self G_GNUC_UNUSED)
686
 
#line 687 "lm-applet.c"
687
 
{
688
 
#define __GOB_FUNCTION__ "LM:Applet::activate_preferences"
689
 
{
690
 
#line 139 "lm-applet.gob"
691
 
        
692
 
    self_display_preferences_dialog(self);
693
 
  }}
694
 
#line 695 "lm-applet.c"
695
 
#undef __GOB_FUNCTION__
696
 
 
697
 
 
698
 
#line 158 "lm-applet.gob"
699
 
static gboolean 
700
 
lm_applet_factory_cb (PanelApplet * applet, const char * iid, gpointer data)
701
 
#line 702 "lm-applet.c"
702
 
{
703
 
#define __GOB_FUNCTION__ "LM:Applet::factory_cb"
704
 
{
705
 
#line 160 "lm-applet.gob"
706
 
        
707
 
    Self *self = SELF(applet);
708
 
    static const BonoboUIVerb menu_verbs[] = {
709
 
      BONOBO_UI_VERB("LinkMonitorPreferences", self_preferences_cb),
710
 
      BONOBO_UI_VERB("LinkMonitorHelp", self_help_cb),
711
 
      BONOBO_UI_VERB("LinkMonitorAbout", self_about_cb),
712
 
      BONOBO_UI_VERB_END
713
 
    };
714
 
    GSList *gconf_hosts;
715
 
    GSList *l;
716
 
 
717
 
    if (strcmp(iid, "OAFIID:GNOME_LinkMonitorApplet"))
718
 
      return FALSE;
719
 
 
720
 
    GDK_THREADS_ENTER();
721
 
 
722
 
    lm_shell->applets = g_slist_append(lm_shell->applets, self);
723
 
 
724
 
    panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR);
725
 
    panel_applet_add_preferences(applet, "/schemas/apps/link-monitor-applet/prefs", NULL);
726
 
    panel_applet_setup_menu_from_file(applet, DATADIR, "GNOME_LinkMonitorApplet.xml", NULL, menu_verbs, applet);
727
 
 
728
 
    self->delay = panel_applet_gconf_get_int(applet, CONF_DELAY, NULL);
729
 
    if (self->delay < MIN_DELAY)
730
 
      self->delay = MIN_DELAY;
731
 
 
732
 
    self->timeout = panel_applet_gconf_get_int(applet, CONF_TIMEOUT, NULL);
733
 
    if (self->timeout < MIN_TIMEOUT)
734
 
      self->timeout = MIN_TIMEOUT;
735
 
 
736
 
    self->scale = panel_applet_gconf_get_int(applet, CONF_SCALE, NULL);
737
 
    if (self->scale < MIN_SCALE)
738
 
      self->scale = MIN_SCALE;
739
 
 
740
 
    self->preferences_width = panel_applet_gconf_get_int(applet, CONF_PREFERENCES_WIDTH, NULL);
741
 
    if (! self->preferences_width)
742
 
      self->preferences_width = DEFAULT_PREFERENCES_WIDTH;
743
 
 
744
 
    self->preferences_height = panel_applet_gconf_get_int(applet, CONF_PREFERENCES_HEIGHT, NULL);
745
 
    if (! self->preferences_height)
746
 
      self->preferences_height = DEFAULT_PREFERENCES_HEIGHT;
747
 
 
748
 
    selfp->tooltip_status_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
749
 
    selfp->tooltip_flag_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
750
 
 
751
 
    gconf_hosts = panel_applet_gconf_get_list(applet, CONF_HOSTS, GCONF_VALUE_STRING, NULL);
752
 
    LM_LIST_FOREACH(l, gconf_hosts)
753
 
      self_add_host_internal(self, l->data);
754
 
    eel_g_slist_free_deep(gconf_hosts);
755
 
 
756
 
    self_update(self);
757
 
 
758
 
    g_object_connect(self,
759
 
                     "signal::destroy", self_destroy_h, NULL,
760
 
                     "signal::button-press-event", self_button_press_event_h, NULL,
761
 
                     "signal::change-orient", self_reconfigure, NULL,
762
 
                     "signal::change-size", self_reconfigure, NULL,
763
 
                     "signal::change-background", self_change_background_h, NULL,
764
 
                     NULL);
765
 
 
766
 
    gtk_widget_show(GTK_WIDGET(self));
767
 
 
768
 
    GDK_THREADS_LEAVE();
769
 
 
770
 
    return TRUE;
771
 
  }}
772
 
#line 773 "lm-applet.c"
773
 
#undef __GOB_FUNCTION__
774
 
 
775
 
#line 232 "lm-applet.gob"
776
 
static void 
777
 
lm_applet_destroy_h (GtkObject * object, gpointer user_data)
778
 
#line 779 "lm-applet.c"
779
 
{
780
 
#define __GOB_FUNCTION__ "LM:Applet::destroy_h"
781
 
{
782
 
#line 234 "lm-applet.gob"
783
 
        
784
 
    Self *self = SELF(object);
785
 
 
786
 
    lm_shell->applets = g_slist_remove(lm_shell->applets, self);
787
 
 
788
 
    if (selfp->reconfigure_timeout_id)
789
 
      g_source_remove(selfp->reconfigure_timeout_id);
790
 
 
791
 
    lm_g_object_slist_free(self->hosts);
792
 
 
793
 
    g_object_unref(selfp->tooltip_status_size_group);
794
 
    g_object_unref(selfp->tooltip_flag_size_group);
795
 
 
796
 
    if (selfp->preferences_dialog)
797
 
      gtk_widget_destroy(selfp->preferences_dialog);
798
 
    if (selfp->about_dialog)
799
 
      gtk_widget_destroy(selfp->about_dialog);
800
 
 
801
 
    gtk_widget_destroy(GTK_WIDGET(object));
802
 
  }}
803
 
#line 804 "lm-applet.c"
804
 
#undef __GOB_FUNCTION__
805
 
 
806
 
#line 255 "lm-applet.gob"
807
 
static void 
808
 
lm_applet_reconfigure (LMApplet * self)
809
 
#line 810 "lm-applet.c"
810
 
{
811
 
#define __GOB_FUNCTION__ "LM:Applet::reconfigure"
812
 
#line 255 "lm-applet.gob"
813
 
        g_return_if_fail (self != NULL);
814
 
#line 255 "lm-applet.gob"
815
 
        g_return_if_fail (LM_IS_APPLET (self));
816
 
#line 817 "lm-applet.c"
817
 
{
818
 
#line 257 "lm-applet.gob"
819
 
        
820
 
    if (selfp->reconfigure_timeout_id)
821
 
      /* cancel the previously queued reconfigure */
822
 
      g_source_remove(selfp->reconfigure_timeout_id);
823
 
 
824
 
    /* do not flood the panel with reconfigures, queue it */
825
 
    selfp->reconfigure_timeout_id = g_timeout_add(10, self_reconfigure_timeout_cb, self);
826
 
  }}
827
 
#line 828 "lm-applet.c"
828
 
#undef __GOB_FUNCTION__
829
 
 
830
 
#line 266 "lm-applet.gob"
831
 
static gboolean 
832
 
lm_applet_reconfigure_timeout_cb (gpointer data)
833
 
#line 834 "lm-applet.c"
834
 
{
835
 
#define __GOB_FUNCTION__ "LM:Applet::reconfigure_timeout_cb"
836
 
{
837
 
#line 268 "lm-applet.gob"
838
 
        
839
 
    Self *self = data;
840
 
    GSList *l;
841
 
 
842
 
    GDK_THREADS_ENTER();
843
 
 
844
 
    self_update_applet(self);
845
 
    LM_LIST_FOREACH(l, self->hosts)
846
 
      {
847
 
        LMHostFrontend *host = l->data;
848
 
        lm_host_frontend_configure_applet_progress_bar(host);
849
 
      }
850
 
 
851
 
    GDK_THREADS_LEAVE();
852
 
 
853
 
    return FALSE;               /* remove source */
854
 
  }}
855
 
#line 856 "lm-applet.c"
856
 
#undef __GOB_FUNCTION__
857
 
 
858
 
#line 287 "lm-applet.gob"
859
 
static void 
860
 
lm_applet_change_background_h (PanelApplet * applet, PanelAppletBackgroundType type, GdkColor * color, GdkPixmap * pixmap, gpointer user_data)
861
 
#line 862 "lm-applet.c"
862
 
{
863
 
#define __GOB_FUNCTION__ "LM:Applet::change_background_h"
864
 
{
865
 
#line 293 "lm-applet.gob"
866
 
        
867
 
    GtkRcStyle *rc_style;
868
 
 
869
 
    /* reset style */
870
 
    gtk_widget_set_style(GTK_WIDGET(applet), NULL);
871
 
    rc_style = gtk_rc_style_new();
872
 
    gtk_widget_modify_style(GTK_WIDGET(applet), rc_style);
873
 
    gtk_rc_style_unref(rc_style);
874
 
 
875
 
    switch (type)
876
 
      {
877
 
      case PANEL_NO_BACKGROUND:
878
 
        break;
879
 
 
880
 
      case PANEL_COLOR_BACKGROUND:
881
 
        gtk_widget_modify_bg(GTK_WIDGET(applet), GTK_STATE_NORMAL, color);
882
 
        break;
883
 
 
884
 
      case PANEL_PIXMAP_BACKGROUND:
885
 
        {
886
 
          GtkStyle *style;
887
 
 
888
 
          style = gtk_style_copy(GTK_WIDGET(applet)->style);
889
 
          if (style->bg_pixmap[GTK_STATE_NORMAL])
890
 
            g_object_unref(style->bg_pixmap[GTK_STATE_NORMAL]);
891
 
          style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref(pixmap);
892
 
          gtk_widget_set_style(GTK_WIDGET(applet), style);
893
 
          g_object_unref(style);
894
 
        }
895
 
        break;
896
 
      }
897
 
  }}
898
 
#line 899 "lm-applet.c"
899
 
#undef __GOB_FUNCTION__
900
 
 
901
 
#line 326 "lm-applet.gob"
902
 
static gboolean 
903
 
lm_applet_button_press_event_h (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
904
 
#line 905 "lm-applet.c"
905
 
{
906
 
#define __GOB_FUNCTION__ "LM:Applet::button_press_event_h"
907
 
{
908
 
#line 330 "lm-applet.gob"
909
 
        
910
 
    if (event->button == 1)
911
 
      {
912
 
        self_activate(SELF(widget));
913
 
        return TRUE;            /* do not propagate event */
914
 
      }
915
 
 
916
 
    return FALSE;               /* propagate event */
917
 
  }}
918
 
#line 919 "lm-applet.c"
919
 
#undef __GOB_FUNCTION__
920
 
 
921
 
#line 340 "lm-applet.gob"
922
 
static void 
923
 
lm_applet_preferences_cb (BonoboUIComponent * component, gpointer user_data, const char * cname)
924
 
#line 925 "lm-applet.c"
925
 
{
926
 
#define __GOB_FUNCTION__ "LM:Applet::preferences_cb"
927
 
{
928
 
#line 344 "lm-applet.gob"
929
 
        
930
 
    Self *self = user_data;
931
 
 
932
 
    self_activate_preferences(self);
933
 
  }}
934
 
#line 935 "lm-applet.c"
935
 
#undef __GOB_FUNCTION__
936
 
 
937
 
#line 350 "lm-applet.gob"
938
 
static void 
939
 
lm_applet_help_cb (BonoboUIComponent * component, gpointer user_data, const char * cname)
940
 
#line 941 "lm-applet.c"
941
 
{
942
 
#define __GOB_FUNCTION__ "LM:Applet::help_cb"
943
 
{
944
 
#line 354 "lm-applet.gob"
945
 
        
946
 
    lm_display_help(NULL);
947
 
  }}
948
 
#line 949 "lm-applet.c"
949
 
#undef __GOB_FUNCTION__
950
 
 
951
 
#line 358 "lm-applet.gob"
952
 
static void 
953
 
lm_applet_about_cb (BonoboUIComponent * component, gpointer user_data, const char * cname)
954
 
#line 955 "lm-applet.c"
955
 
{
956
 
#define __GOB_FUNCTION__ "LM:Applet::about_cb"
957
 
{
958
 
#line 362 "lm-applet.gob"
959
 
        
960
 
    Self *self = user_data;
961
 
 
962
 
    self_display_window(self, LM_TYPE_ABOUT_DIALOG, &selfp->about_dialog);
963
 
  }}
964
 
#line 965 "lm-applet.c"
965
 
#undef __GOB_FUNCTION__
966
 
 
967
 
#line 368 "lm-applet.gob"
968
 
static void 
969
 
lm_applet_display_preferences_dialog (LMApplet * self)
970
 
#line 971 "lm-applet.c"
971
 
{
972
 
#define __GOB_FUNCTION__ "LM:Applet::display_preferences_dialog"
973
 
#line 368 "lm-applet.gob"
974
 
        g_return_if_fail (self != NULL);
975
 
#line 368 "lm-applet.gob"
976
 
        g_return_if_fail (LM_IS_APPLET (self));
977
 
#line 978 "lm-applet.c"
978
 
{
979
 
#line 370 "lm-applet.gob"
980
 
        
981
 
    self_display_window(self, LM_TYPE_PREFERENCES_DIALOG, &selfp->preferences_dialog);
982
 
  }}
983
 
#line 984 "lm-applet.c"
984
 
#undef __GOB_FUNCTION__
985
 
 
986
 
#line 374 "lm-applet.gob"
987
 
static void 
988
 
lm_applet_display_window (LMApplet * self, GType type, GtkWidget ** ptr)
989
 
#line 990 "lm-applet.c"
990
 
{
991
 
#define __GOB_FUNCTION__ "LM:Applet::display_window"
992
 
#line 374 "lm-applet.gob"
993
 
        g_return_if_fail (self != NULL);
994
 
#line 374 "lm-applet.gob"
995
 
        g_return_if_fail (LM_IS_APPLET (self));
996
 
#line 374 "lm-applet.gob"
997
 
        g_return_if_fail (type != 0);
998
 
#line 374 "lm-applet.gob"
999
 
        g_return_if_fail (ptr != NULL);
1000
 
#line 1001 "lm-applet.c"
1001
 
{
1002
 
#line 378 "lm-applet.gob"
1003
 
        
1004
 
    GObjectClass *class;
1005
 
 
1006
 
    if (*ptr)
1007
 
      {
1008
 
        gtk_window_present(GTK_WINDOW(*ptr));
1009
 
        return;
1010
 
      }
1011
 
 
1012
 
    class = g_type_class_ref(type);
1013
 
    if (g_object_class_find_property(class, "applet"))
1014
 
      *ptr = g_object_new(type, "applet", self, NULL);
1015
 
    else
1016
 
      *ptr = g_object_new(type, NULL);
1017
 
    g_type_class_unref(class);
1018
 
 
1019
 
    eel_add_weak_pointer(ptr);
1020
 
    gtk_widget_show(*ptr);
1021
 
  }}
1022
 
#line 1023 "lm-applet.c"
1023
 
#undef __GOB_FUNCTION__
1024
 
 
1025
 
#line 398 "lm-applet.gob"
1026
 
static void 
1027
 
lm_applet_update (LMApplet * self)
1028
 
#line 1029 "lm-applet.c"
1029
 
{
1030
 
#define __GOB_FUNCTION__ "LM:Applet::update"
1031
 
#line 398 "lm-applet.gob"
1032
 
        g_return_if_fail (self != NULL);
1033
 
#line 398 "lm-applet.gob"
1034
 
        g_return_if_fail (LM_IS_APPLET (self));
1035
 
#line 1036 "lm-applet.c"
1036
 
{
1037
 
#line 400 "lm-applet.gob"
1038
 
        
1039
 
    self_update_applet(self);
1040
 
    self_update_tooltip(self);
1041
 
  }}
1042
 
#line 1043 "lm-applet.c"
1043
 
#undef __GOB_FUNCTION__
1044
 
 
1045
 
#line 405 "lm-applet.gob"
1046
 
static void 
1047
 
lm_applet_update_applet (LMApplet * self)
1048
 
#line 1049 "lm-applet.c"
1049
 
{
1050
 
#define __GOB_FUNCTION__ "LM:Applet::update_applet"
1051
 
#line 405 "lm-applet.gob"
1052
 
        g_return_if_fail (self != NULL);
1053
 
#line 405 "lm-applet.gob"
1054
 
        g_return_if_fail (LM_IS_APPLET (self));
1055
 
#line 1056 "lm-applet.c"
1056
 
{
1057
 
#line 407 "lm-applet.gob"
1058
 
        
1059
 
    GSList *l;
1060
 
    GtkWidget *child;
1061
 
    GtkWidget *old_child;
1062
 
 
1063
 
    if (self->hosts)
1064
 
      {
1065
 
        switch (panel_applet_get_orient(PANEL_APPLET(self)))
1066
 
          {
1067
 
          case PANEL_APPLET_ORIENT_UP:
1068
 
          case PANEL_APPLET_ORIENT_DOWN:
1069
 
            child = gtk_hbox_new(FALSE, BAR_SPACING);
1070
 
            break;
1071
 
 
1072
 
          case PANEL_APPLET_ORIENT_LEFT:
1073
 
          case PANEL_APPLET_ORIENT_RIGHT:
1074
 
            child = gtk_vbox_new(FALSE, BAR_SPACING);
1075
 
            break;
1076
 
 
1077
 
          default:
1078
 
            g_assert_not_reached();
1079
 
            break;
1080
 
          }
1081
 
 
1082
 
        LM_LIST_FOREACH(l, self->hosts)
1083
 
          {
1084
 
            LMHostFrontend *host = l->data;
1085
 
            GtkWidget *parent;
1086
 
 
1087
 
            parent = gtk_widget_get_parent(host->applet_progress_bar);
1088
 
            if (parent)
1089
 
              gtk_container_remove(GTK_CONTAINER(parent), host->applet_progress_bar);
1090
 
 
1091
 
            gtk_box_pack_start(GTK_BOX(child), host->applet_progress_bar, FALSE, FALSE, 0);
1092
 
            gtk_widget_show(host->applet_progress_bar);
1093
 
          }
1094
 
      }
1095
 
    else
1096
 
      {
1097
 
        GdkPixbuf *pixbuf;
1098
 
 
1099
 
        pixbuf = lm_pixbuf_new(GNOMEPIXMAPSDIR G_DIR_SEPARATOR_S "link-monitor-applet.png");
1100
 
        if (pixbuf)
1101
 
          {
1102
 
            int size;
1103
 
            GdkPixbuf *scaled;
1104
 
 
1105
 
            size = panel_applet_get_size(PANEL_APPLET(self)) - (ICON_PADDING * 2);
1106
 
            scaled = gdk_pixbuf_scale_simple(pixbuf, size, size, GDK_INTERP_BILINEAR);
1107
 
            g_object_unref(pixbuf);
1108
 
 
1109
 
            child = gtk_image_new_from_pixbuf(scaled);
1110
 
            g_object_unref(scaled);
1111
 
          }
1112
 
        else                    /* use label as fallback */
1113
 
          {
1114
 
            /* translators: header capitalization */
1115
 
            child = gtk_label_new(_("<span size=\"small\">Link Monitor</span>"));
1116
 
            gtk_label_set_use_markup(GTK_LABEL(child), TRUE);
1117
 
          }
1118
 
      }
1119
 
 
1120
 
    old_child = gtk_bin_get_child(GTK_BIN(self));
1121
 
    if (old_child)
1122
 
      gtk_container_remove(GTK_CONTAINER(self), old_child);
1123
 
 
1124
 
    gtk_container_add(GTK_CONTAINER(self), child);
1125
 
    gtk_widget_show(child);
1126
 
  }}
1127
 
#line 1128 "lm-applet.c"
1128
 
#undef __GOB_FUNCTION__
1129
 
 
1130
 
#line 477 "lm-applet.gob"
1131
 
static void 
1132
 
lm_applet_update_tooltip (LMApplet * self)
1133
 
#line 1134 "lm-applet.c"
1134
 
{
1135
 
#define __GOB_FUNCTION__ "LM:Applet::update_tooltip"
1136
 
#line 477 "lm-applet.gob"
1137
 
        g_return_if_fail (self != NULL);
1138
 
#line 477 "lm-applet.gob"
1139
 
        g_return_if_fail (LM_IS_APPLET (self));
1140
 
#line 1141 "lm-applet.c"
1141
 
{
1142
 
#line 479 "lm-applet.gob"
1143
 
        
1144
 
    GSList *l;
1145
 
 
1146
 
    if (self->hosts)
1147
 
      {
1148
 
        GtkWidget *vbox;
1149
 
 
1150
 
        vbox = gtk_vbox_new(TRUE, 6);
1151
 
 
1152
 
        LM_LIST_FOREACH(l, self->hosts)
1153
 
          {
1154
 
            LMHostFrontend *host = l->data;
1155
 
            GtkWidget *parent;
1156
 
 
1157
 
            parent = gtk_widget_get_parent(host->tooltip);
1158
 
            if (parent)
1159
 
              gtk_container_remove(GTK_CONTAINER(parent), host->tooltip);
1160
 
 
1161
 
            gtk_box_pack_start(GTK_BOX(vbox), host->tooltip, TRUE, TRUE, 0);
1162
 
            gtk_widget_show(host->tooltip);
1163
 
          }
1164
 
 
1165
 
        lm_tooltips_set_tip_widget(lm_shell->tooltips, GTK_WIDGET(self), vbox);
1166
 
        gtk_widget_show(vbox);
1167
 
      }
1168
 
    else
1169
 
      lm_tooltips_set_tip(lm_shell->tooltips, GTK_WIDGET(self), _("No host is being monitored."));
1170
 
  }}
1171
 
#line 1172 "lm-applet.c"
1172
 
#undef __GOB_FUNCTION__
1173
 
 
1174
 
#line 508 "lm-applet.gob"
1175
 
int 
1176
 
lm_applet_factory_main (void)
1177
 
#line 1178 "lm-applet.c"
1178
 
{
1179
 
#define __GOB_FUNCTION__ "LM:Applet::factory_main"
1180
 
{
1181
 
#line 510 "lm-applet.gob"
1182
 
        
1183
 
    return panel_applet_factory_main("OAFIID:GNOME_LinkMonitorApplet_Factory",
1184
 
                                     TYPE_SELF,
1185
 
                                     self_factory_cb,
1186
 
                                     NULL);
1187
 
  }}
1188
 
#line 1189 "lm-applet.c"
1189
 
#undef __GOB_FUNCTION__
1190
 
 
1191
 
#line 517 "lm-applet.gob"
1192
 
static void 
1193
 
lm_applet_sync_gconf_hosts (LMApplet * self)
1194
 
#line 1195 "lm-applet.c"
1195
 
{
1196
 
#define __GOB_FUNCTION__ "LM:Applet::sync_gconf_hosts"
1197
 
#line 517 "lm-applet.gob"
1198
 
        g_return_if_fail (self != NULL);
1199
 
#line 517 "lm-applet.gob"
1200
 
        g_return_if_fail (LM_IS_APPLET (self));
1201
 
#line 1202 "lm-applet.c"
1202
 
{
1203
 
#line 519 "lm-applet.gob"
1204
 
        
1205
 
    GSList *gconf_hosts = NULL;
1206
 
    GSList *l;
1207
 
 
1208
 
    LM_LIST_FOREACH(l, self->hosts)
1209
 
      gconf_hosts = g_slist_append(gconf_hosts, LM_HOST(l->data)->name);
1210
 
 
1211
 
    panel_applet_gconf_set_list(PANEL_APPLET(self),
1212
 
                                CONF_HOSTS,
1213
 
                                GCONF_VALUE_STRING,
1214
 
                                gconf_hosts,
1215
 
                                NULL);
1216
 
 
1217
 
    g_slist_free(gconf_hosts);
1218
 
  }}
1219
 
#line 1220 "lm-applet.c"
1220
 
#undef __GOB_FUNCTION__
1221
 
 
1222
 
#line 535 "lm-applet.gob"
1223
 
static LMHost * 
1224
 
lm_applet_host_new (LMApplet * self, const char * name)
1225
 
#line 1226 "lm-applet.c"
1226
 
{
1227
 
#define __GOB_FUNCTION__ "LM:Applet::host_new"
1228
 
#line 535 "lm-applet.gob"
1229
 
        g_return_val_if_fail (self != NULL, (LMHost * )0);
1230
 
#line 535 "lm-applet.gob"
1231
 
        g_return_val_if_fail (LM_IS_APPLET (self), (LMHost * )0);
1232
 
#line 535 "lm-applet.gob"
1233
 
        g_return_val_if_fail (name != NULL, (LMHost * )0);
1234
 
#line 1235 "lm-applet.c"
1235
 
{
1236
 
#line 537 "lm-applet.gob"
1237
 
        
1238
 
    LMHostFrontend *host;
1239
 
 
1240
 
    host = lm_host_frontend_new(self, name, lm_shell_get_unique_host_id(lm_shell));
1241
 
    gtk_size_group_add_widget(selfp->tooltip_status_size_group, host->tooltip_status_box);
1242
 
    gtk_size_group_add_widget(selfp->tooltip_flag_size_group, host->tooltip_flag);
1243
 
 
1244
 
    return LM_HOST(host);
1245
 
  }}
1246
 
#line 1247 "lm-applet.c"
1247
 
#undef __GOB_FUNCTION__
1248
 
 
1249
 
#line 547 "lm-applet.gob"
1250
 
static LMHost * 
1251
 
lm_applet_add_host_internal (LMApplet * self, const char * name)
1252
 
#line 1253 "lm-applet.c"
1253
 
{
1254
 
#define __GOB_FUNCTION__ "LM:Applet::add_host_internal"
1255
 
#line 547 "lm-applet.gob"
1256
 
        g_return_val_if_fail (self != NULL, (LMHost * )0);
1257
 
#line 547 "lm-applet.gob"
1258
 
        g_return_val_if_fail (LM_IS_APPLET (self), (LMHost * )0);
1259
 
#line 547 "lm-applet.gob"
1260
 
        g_return_val_if_fail (name != NULL, (LMHost * )0);
1261
 
#line 1262 "lm-applet.c"
1262
 
{
1263
 
#line 549 "lm-applet.gob"
1264
 
        
1265
 
    LMHost *host;
1266
 
 
1267
 
    host = self_host_new(self, name);
1268
 
    self->hosts = g_slist_append(self->hosts, host);
1269
 
 
1270
 
    self_update(self);
1271
 
 
1272
 
    return host;
1273
 
  }}
1274
 
#line 1275 "lm-applet.c"
1275
 
#undef __GOB_FUNCTION__
1276
 
 
1277
 
#line 560 "lm-applet.gob"
1278
 
static LMHost * 
1279
 
lm_applet_replace_host_internal (LMApplet * self, LMHost * old, const char * new)
1280
 
#line 1281 "lm-applet.c"
1281
 
{
1282
 
#define __GOB_FUNCTION__ "LM:Applet::replace_host_internal"
1283
 
#line 560 "lm-applet.gob"
1284
 
        g_return_val_if_fail (self != NULL, (LMHost * )0);
1285
 
#line 560 "lm-applet.gob"
1286
 
        g_return_val_if_fail (LM_IS_APPLET (self), (LMHost * )0);
1287
 
#line 560 "lm-applet.gob"
1288
 
        g_return_val_if_fail (old != NULL, (LMHost * )0);
1289
 
#line 560 "lm-applet.gob"
1290
 
        g_return_val_if_fail (LM_IS_HOST (old), (LMHost * )0);
1291
 
#line 560 "lm-applet.gob"
1292
 
        g_return_val_if_fail (new != NULL, (LMHost * )0);
1293
 
#line 1294 "lm-applet.c"
1294
 
{
1295
 
#line 564 "lm-applet.gob"
1296
 
        
1297
 
    GSList *elem;
1298
 
    LMHost *new_host;
1299
 
 
1300
 
    elem = g_slist_find(self->hosts, old);
1301
 
    g_assert(elem != NULL);
1302
 
 
1303
 
    new_host = self_host_new(self, new);
1304
 
 
1305
 
    g_object_unref(old);
1306
 
    elem->data = new_host;
1307
 
 
1308
 
    self_update(self);
1309
 
 
1310
 
    return new_host;
1311
 
  }}
1312
 
#line 1313 "lm-applet.c"
1313
 
#undef __GOB_FUNCTION__
1314
 
 
1315
 
#line 581 "lm-applet.gob"
1316
 
static void 
1317
 
lm_applet_reorder_hosts_internal (LMApplet * self, GSList * new_hosts)
1318
 
#line 1319 "lm-applet.c"
1319
 
{
1320
 
#define __GOB_FUNCTION__ "LM:Applet::reorder_hosts_internal"
1321
 
#line 581 "lm-applet.gob"
1322
 
        g_return_if_fail (self != NULL);
1323
 
#line 581 "lm-applet.gob"
1324
 
        g_return_if_fail (LM_IS_APPLET (self));
1325
 
#line 1326 "lm-applet.c"
1326
 
{
1327
 
#line 583 "lm-applet.gob"
1328
 
        
1329
 
    lm_g_object_slist_free(self->hosts);
1330
 
    self->hosts = lm_g_object_slist_copy(new_hosts);
1331
 
 
1332
 
    self_update(self);
1333
 
  }}
1334
 
#line 1335 "lm-applet.c"
1335
 
#undef __GOB_FUNCTION__
1336
 
 
1337
 
#line 590 "lm-applet.gob"
1338
 
static void 
1339
 
lm_applet_remove_host_internal (LMApplet * self, LMHost * host)
1340
 
#line 1341 "lm-applet.c"
1341
 
{
1342
 
#define __GOB_FUNCTION__ "LM:Applet::remove_host_internal"
1343
 
#line 590 "lm-applet.gob"
1344
 
        g_return_if_fail (self != NULL);
1345
 
#line 590 "lm-applet.gob"
1346
 
        g_return_if_fail (LM_IS_APPLET (self));
1347
 
#line 590 "lm-applet.gob"
1348
 
        g_return_if_fail (host != NULL);
1349
 
#line 590 "lm-applet.gob"
1350
 
        g_return_if_fail (LM_IS_HOST (host));
1351
 
#line 1352 "lm-applet.c"
1352
 
{
1353
 
#line 592 "lm-applet.gob"
1354
 
        
1355
 
    GSList *elem;
1356
 
 
1357
 
    elem = g_slist_find(self->hosts, host);
1358
 
    g_assert(elem != NULL);
1359
 
 
1360
 
    self->hosts = g_slist_delete_link(self->hosts, elem);
1361
 
    g_object_unref(host);
1362
 
 
1363
 
    self_update(self);
1364
 
  }}
1365
 
#line 1366 "lm-applet.c"
1366
 
#undef __GOB_FUNCTION__
1367
 
 
1368
 
#line 604 "lm-applet.gob"
1369
 
LMHost * 
1370
 
lm_applet_add_host (LMApplet * self, const char * name)
1371
 
#line 1372 "lm-applet.c"
1372
 
{
1373
 
#define __GOB_FUNCTION__ "LM:Applet::add_host"
1374
 
#line 604 "lm-applet.gob"
1375
 
        g_return_val_if_fail (self != NULL, (LMHost * )0);
1376
 
#line 604 "lm-applet.gob"
1377
 
        g_return_val_if_fail (LM_IS_APPLET (self), (LMHost * )0);
1378
 
#line 604 "lm-applet.gob"
1379
 
        g_return_val_if_fail (name != NULL, (LMHost * )0);
1380
 
#line 1381 "lm-applet.c"
1381
 
{
1382
 
#line 606 "lm-applet.gob"
1383
 
        
1384
 
    LMHost *host;
1385
 
 
1386
 
    host = self_add_host_internal(self, name);
1387
 
    self_sync_gconf_hosts(self);
1388
 
 
1389
 
    return host;
1390
 
  }}
1391
 
#line 1392 "lm-applet.c"
1392
 
#undef __GOB_FUNCTION__
1393
 
 
1394
 
#line 615 "lm-applet.gob"
1395
 
LMHost * 
1396
 
lm_applet_replace_host (LMApplet * self, LMHost * old, const char * new)
1397
 
#line 1398 "lm-applet.c"
1398
 
{
1399
 
#define __GOB_FUNCTION__ "LM:Applet::replace_host"
1400
 
#line 615 "lm-applet.gob"
1401
 
        g_return_val_if_fail (self != NULL, (LMHost * )0);
1402
 
#line 615 "lm-applet.gob"
1403
 
        g_return_val_if_fail (LM_IS_APPLET (self), (LMHost * )0);
1404
 
#line 615 "lm-applet.gob"
1405
 
        g_return_val_if_fail (old != NULL, (LMHost * )0);
1406
 
#line 615 "lm-applet.gob"
1407
 
        g_return_val_if_fail (LM_IS_HOST (old), (LMHost * )0);
1408
 
#line 615 "lm-applet.gob"
1409
 
        g_return_val_if_fail (new != NULL, (LMHost * )0);
1410
 
#line 1411 "lm-applet.c"
1411
 
{
1412
 
#line 619 "lm-applet.gob"
1413
 
        
1414
 
    LMHost *new_host;
1415
 
 
1416
 
    new_host = self_replace_host_internal(self, old, new);
1417
 
    self_sync_gconf_hosts(self);
1418
 
 
1419
 
    return new_host;
1420
 
  }}
1421
 
#line 1422 "lm-applet.c"
1422
 
#undef __GOB_FUNCTION__
1423
 
 
1424
 
#line 628 "lm-applet.gob"
1425
 
void 
1426
 
lm_applet_reorder_hosts (LMApplet * self, GSList * new_hosts)
1427
 
#line 1428 "lm-applet.c"
1428
 
{
1429
 
#define __GOB_FUNCTION__ "LM:Applet::reorder_hosts"
1430
 
#line 628 "lm-applet.gob"
1431
 
        g_return_if_fail (self != NULL);
1432
 
#line 628 "lm-applet.gob"
1433
 
        g_return_if_fail (LM_IS_APPLET (self));
1434
 
#line 1435 "lm-applet.c"
1435
 
{
1436
 
#line 630 "lm-applet.gob"
1437
 
        
1438
 
    self_reorder_hosts_internal(self, new_hosts);
1439
 
    self_sync_gconf_hosts(self);
1440
 
  }}
1441
 
#line 1442 "lm-applet.c"
1442
 
#undef __GOB_FUNCTION__
1443
 
 
1444
 
#line 635 "lm-applet.gob"
1445
 
void 
1446
 
lm_applet_remove_host (LMApplet * self, LMHost * host)
1447
 
#line 1448 "lm-applet.c"
1448
 
{
1449
 
#define __GOB_FUNCTION__ "LM:Applet::remove_host"
1450
 
#line 635 "lm-applet.gob"
1451
 
        g_return_if_fail (self != NULL);
1452
 
#line 635 "lm-applet.gob"
1453
 
        g_return_if_fail (LM_IS_APPLET (self));
1454
 
#line 635 "lm-applet.gob"
1455
 
        g_return_if_fail (host != NULL);
1456
 
#line 635 "lm-applet.gob"
1457
 
        g_return_if_fail (LM_IS_HOST (host));
1458
 
#line 1459 "lm-applet.c"
1459
 
{
1460
 
#line 637 "lm-applet.gob"
1461
 
        
1462
 
    self_remove_host_internal(self, host);
1463
 
    self_sync_gconf_hosts(self);
1464
 
  }}
1465
 
#line 1466 "lm-applet.c"
1466
 
#undef __GOB_FUNCTION__