~ubuntu-branches/ubuntu/jaunty/ekiga/jaunty

« back to all changes in this revision

Viewing changes to lib/druid/gnome-druid.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2008-12-07 10:30:45 UTC
  • mfrom: (1.2.3 experimental)
  • Revision ID: james.westby@ubuntu.com-20081207103045-iaurrjo4p7d1nngo
Tags: 3.0.1-1ubuntu1
* Merge to Debian experimental, to get Ekiga 3. (LP: #274085) Remaining
  Ubuntu changes:
  - Launchpad Integration: (Ubuntu specific)
    + debian/control.in: Add liblaunchpad-integration-dev build dependency.
    + Add ubuntu_lpi.patch: Call launchpad_integration_add_items() in main() and
      check for the launchpad-integration pkg-config module.
    + Add autoconf.patch: autoconf changes from above patch.
  - Add ubuntu_desktop-file-onlyshowin.patch: Show ekiga in Mobile, too.
    (Ubuntu specific).
  - debian/control.in: Add missing fdupes build dependency for identical
    GNOME help file symlinking. (Debian #505536)
* Drop 42_change_pixmaps.dpatch: Many of the old icons do not exist any
  more, some have been replaced, and keeping the remaining three would make
  them look very inconsistent.
* Convert our dpatches to quilt patches and rewrite them for new upstream
  version.
* Add migrate_2.0_settings.patch: Properly migrate settings from
  2.0. Taken from upstream SVN, thanks to Damien Sandras!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* gnome-druid.c
2
 
 * Copyright (C) 1999 Red Hat, Inc.
3
 
 * All rights reserved.
4
 
 *
5
 
 * This library is free software; you can redistribute it and/or
6
 
 * modify it under the terms of the GNU Library General Public
7
 
 * License as published by the Free Software Foundation; either
8
 
 * version 2 of the License, or (at your option) any later version.
9
 
 *
10
 
 * This library is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
 * Library General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU Library General Public
16
 
 * License along with this library; if not, write to the
17
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
 
 * Boston, MA 02111-1307, USA.
19
 
 */
20
 
/*
21
 
  @NOTATION@
22
 
*/
23
 
 
24
 
#include "gnome-druid.h"
25
 
 
26
 
struct _GnomeDruidPrivate
27
 
{
28
 
        GnomeDruidPage *current;
29
 
        GList *children;
30
 
 
31
 
        GtkWidget *bbox;
32
 
 
33
 
        gboolean show_finish : 1; /* if TRUE, then we are showing the finish button instead of the next button */
34
 
        gboolean show_help : 1;
35
 
};
36
 
 
37
 
enum {
38
 
        CANCEL,
39
 
        HELP,
40
 
        LAST_SIGNAL
41
 
};
42
 
enum {
43
 
  PROP_0,
44
 
  PROP_SHOW_FINISH,
45
 
  PROP_SHOW_HELP,
46
 
};
47
 
 
48
 
 
49
 
static void    gnome_druid_destroy         (GtkObject       *object);
50
 
static void    gnome_druid_finalize        (GObject         *object);
51
 
static void    gnome_druid_set_property    (GObject         *object,
52
 
                                            guint            prop_id,
53
 
                                            const GValue    *value,
54
 
                                            GParamSpec      *pspec);
55
 
static void    gnome_druid_get_property    (GObject         *object,
56
 
                                            guint            prop_id,
57
 
                                            GValue          *value,
58
 
                                            GParamSpec      *pspec);
59
 
static void    gnome_druid_size_request    (GtkWidget       *widget,
60
 
                                            GtkRequisition  *requisition);
61
 
static void    gnome_druid_size_allocate   (GtkWidget       *widget,
62
 
                                            GtkAllocation   *allocation);
63
 
static gint    gnome_druid_expose          (GtkWidget       *widget,
64
 
                                            GdkEventExpose  *event);
65
 
static void    gnome_druid_map             (GtkWidget       *widget);
66
 
static void    gnome_druid_unmap           (GtkWidget       *widget);
67
 
static GtkType gnome_druid_child_type      (GtkContainer    *container);
68
 
static void    gnome_druid_add             (GtkContainer    *widget,
69
 
                                            GtkWidget       *page);
70
 
static void    gnome_druid_remove          (GtkContainer    *widget,
71
 
                                            GtkWidget       *child);
72
 
static void    gnome_druid_forall          (GtkContainer    *container,
73
 
                                            gboolean         include_internals,
74
 
                                            GtkCallback      callback,
75
 
                                            gpointer         callback_data);
76
 
static void    gnome_druid_back_callback   (GtkWidget       *button,
77
 
                                            GnomeDruid      *druid);
78
 
static void    gnome_druid_next_callback   (GtkWidget       *button,
79
 
                                            GnomeDruid      *druid);
80
 
static void    gnome_druid_cancel_callback (GtkWidget       *button,
81
 
                                            GtkWidget       *druid);
82
 
static void    gnome_druid_help_callback   (GtkWidget       *button,
83
 
                                            GnomeDruid      *druid);
84
 
 
85
 
 
86
 
static guint druid_signals[LAST_SIGNAL] = { 0 };
87
 
 
88
 
/* define the _get_type method and parent_class */
89
 
GNOME_CLASS_BOILERPLATE(GnomeDruid, gnome_druid, 
90
 
                        GtkContainer, GTK_TYPE_CONTAINER, GNOME_REGISTER_TYPE)
91
 
 
92
 
static void
93
 
gnome_druid_class_init (GnomeDruidClass *klass)
94
 
{
95
 
        GtkObjectClass *object_class;
96
 
        GObjectClass *gobject_class;
97
 
        GtkWidgetClass *widget_class;
98
 
        GtkContainerClass *container_class;
99
 
 
100
 
        object_class = (GtkObjectClass*) klass;
101
 
        gobject_class = (GObjectClass*) klass;
102
 
        widget_class = (GtkWidgetClass*) klass;
103
 
        container_class = (GtkContainerClass*) klass;
104
 
 
105
 
        druid_signals[CANCEL] =
106
 
                g_signal_new ("cancel",
107
 
                              G_TYPE_FROM_CLASS (gobject_class),
108
 
                              G_SIGNAL_RUN_LAST,
109
 
                              G_STRUCT_OFFSET (GnomeDruidClass, cancel),
110
 
                              NULL, NULL,
111
 
                              g_cclosure_marshal_VOID__VOID,
112
 
                              G_TYPE_NONE, 0);
113
 
 
114
 
        druid_signals[HELP] =
115
 
                g_signal_new ("help",
116
 
                              G_TYPE_FROM_CLASS (gobject_class),
117
 
                              G_SIGNAL_RUN_LAST,
118
 
                              G_STRUCT_OFFSET (GnomeDruidClass, help),
119
 
                              NULL, NULL,
120
 
                              g_cclosure_marshal_VOID__VOID,
121
 
                              G_TYPE_NONE, 0);
122
 
 
123
 
        object_class->destroy = gnome_druid_destroy;
124
 
        gobject_class->set_property = gnome_druid_set_property;
125
 
        gobject_class->get_property = gnome_druid_get_property;
126
 
        gobject_class->finalize = gnome_druid_finalize;
127
 
        widget_class->size_request = gnome_druid_size_request;
128
 
        widget_class->size_allocate = gnome_druid_size_allocate;
129
 
        widget_class->map = gnome_druid_map;
130
 
        widget_class->unmap = gnome_druid_unmap;
131
 
        widget_class->expose_event = gnome_druid_expose;
132
 
 
133
 
        container_class->forall = gnome_druid_forall;
134
 
        container_class->add = gnome_druid_add;
135
 
        container_class->remove = gnome_druid_remove;
136
 
        container_class->child_type = gnome_druid_child_type;
137
 
 
138
 
 
139
 
        g_object_class_install_property (gobject_class,
140
 
                                         PROP_SHOW_FINISH,
141
 
                                         g_param_spec_boolean ("show_finish",
142
 
                                                               "Show Finish",
143
 
                                                               "Show the 'Finish' button instead of the 'Next' button",
144
 
                                                               FALSE,
145
 
                                                               G_PARAM_READWRITE));
146
 
 
147
 
        g_object_class_install_property (gobject_class,
148
 
                                         PROP_SHOW_HELP,
149
 
                                         g_param_spec_boolean ("show_help",
150
 
                                                               "Show Help",
151
 
                                                               "Show the 'Help' button",
152
 
                                                               FALSE,
153
 
                                                               G_PARAM_READWRITE));
154
 
}
155
 
 
156
 
static void
157
 
gnome_druid_instance_init (GnomeDruid *druid)
158
 
{
159
 
        druid->_priv = g_new0(GnomeDruidPrivate, 1);
160
 
 
161
 
        /* set the default border width */
162
 
        GTK_CONTAINER (druid)->border_width = GNOME_PAD_SMALL;
163
 
 
164
 
        /* set up the buttons */
165
 
        GTK_WIDGET_SET_FLAGS (GTK_WIDGET (druid), GTK_NO_WINDOW);
166
 
        druid->back = gtk_button_new_from_stock (GTK_STOCK_GO_BACK);
167
 
        GTK_WIDGET_SET_FLAGS (druid->back, GTK_CAN_DEFAULT);
168
 
        druid->next = gtk_button_new_from_stock (GTK_STOCK_GO_FORWARD);
169
 
        GTK_WIDGET_SET_FLAGS (druid->next, GTK_CAN_DEFAULT);
170
 
        druid->cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
171
 
        GTK_WIDGET_SET_FLAGS (druid->cancel, GTK_CAN_DEFAULT);
172
 
        druid->finish = gtk_button_new_from_stock (GTK_STOCK_APPLY);
173
 
        GTK_WIDGET_SET_FLAGS (druid->finish, GTK_CAN_DEFAULT);
174
 
        druid->help = gtk_button_new_from_stock (GTK_STOCK_HELP);
175
 
        GTK_WIDGET_SET_FLAGS (druid->help, GTK_CAN_DEFAULT);
176
 
        gtk_widget_show (druid->back);
177
 
        gtk_widget_show (druid->next);
178
 
        gtk_widget_show (druid->cancel);
179
 
 
180
 
        druid->_priv->bbox = gtk_hbutton_box_new ();
181
 
        gtk_button_box_set_layout (GTK_BUTTON_BOX (druid->_priv->bbox),
182
 
                                   GTK_BUTTONBOX_END);
183
 
        /* FIXME: use a style property for these */
184
 
        gtk_box_set_spacing (GTK_BOX (druid->_priv->bbox), 10);
185
 
        gtk_container_set_border_width (GTK_CONTAINER (druid->_priv->bbox), 5);
186
 
        gtk_widget_set_parent (druid->_priv->bbox, GTK_WIDGET (druid));
187
 
        gtk_widget_show (druid->_priv->bbox);
188
 
 
189
 
        gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->help,
190
 
                          FALSE, TRUE, 0);
191
 
        gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (druid->_priv->bbox),
192
 
                                            druid->help, TRUE);
193
 
 
194
 
        gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->cancel,
195
 
                          FALSE, TRUE, 0);
196
 
 
197
 
        gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->back,
198
 
                          FALSE, TRUE, 0);
199
 
 
200
 
        gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->next,
201
 
                          FALSE, TRUE, 0);
202
 
 
203
 
        gtk_box_pack_end (GTK_BOX (druid->_priv->bbox), druid->finish,
204
 
                          FALSE, TRUE, 0);
205
 
 
206
 
        /* other flags */
207
 
        druid->_priv->current = NULL;
208
 
        druid->_priv->children = NULL;
209
 
        druid->_priv->show_finish = FALSE;
210
 
        druid->_priv->show_help = FALSE;
211
 
 
212
 
        g_signal_connect (druid->back, "clicked",
213
 
                          G_CALLBACK (gnome_druid_back_callback), druid);
214
 
        g_signal_connect (druid->next, "clicked",
215
 
                          G_CALLBACK (gnome_druid_next_callback), druid);
216
 
        g_signal_connect (druid->cancel, "clicked",
217
 
                          G_CALLBACK (gnome_druid_cancel_callback), druid);
218
 
        g_signal_connect (druid->finish, "clicked",
219
 
                          G_CALLBACK (gnome_druid_next_callback), druid);
220
 
        g_signal_connect (druid->help, "clicked",
221
 
                          G_CALLBACK (gnome_druid_help_callback), druid);
222
 
 
223
 
        gtk_widget_grab_focus (druid->next);
224
 
}
225
 
 
226
 
 
227
 
 
228
 
static void
229
 
gnome_druid_destroy (GtkObject *object)
230
 
{
231
 
        GnomeDruid *druid;
232
 
 
233
 
        /* remember, destroy can be run multiple times! */
234
 
 
235
 
        g_return_if_fail (object != NULL);
236
 
        g_return_if_fail (GNOME_IS_DRUID (object));
237
 
 
238
 
        druid = GNOME_DRUID (object);
239
 
 
240
 
        if(druid->_priv->bbox) {
241
 
                gtk_widget_destroy (druid->_priv->bbox);
242
 
                druid->_priv->bbox = NULL;
243
 
                druid->back = NULL;
244
 
                druid->next = NULL;
245
 
                druid->cancel = NULL;
246
 
                druid->finish = NULL;
247
 
                druid->help = NULL;
248
 
        }
249
 
 
250
 
        /* Remove all children, we set current to NULL so
251
 
         * that the remove code doesn't try to do anything funny */
252
 
        druid->_priv->current = NULL;
253
 
        while (druid->_priv->children != NULL) {
254
 
                GnomeDruidPage *child = druid->_priv->children->data;
255
 
                gtk_container_remove (GTK_CONTAINER (druid), GTK_WIDGET(child));
256
 
        }
257
 
 
258
 
        GNOME_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object));
259
 
}
260
 
 
261
 
static void
262
 
gnome_druid_finalize (GObject *object)
263
 
{
264
 
        GnomeDruid *druid;
265
 
 
266
 
        g_return_if_fail (object != NULL);
267
 
        g_return_if_fail (GNOME_IS_DRUID (object));
268
 
 
269
 
        druid = GNOME_DRUID (object);
270
 
 
271
 
        g_free(druid->_priv);
272
 
        druid->_priv = NULL;
273
 
 
274
 
        GNOME_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
275
 
}
276
 
 
277
 
static void
278
 
gnome_druid_set_property (GObject      *object,
279
 
                          guint         prop_id,
280
 
                          const GValue *value,
281
 
                          GParamSpec   *pspec)
282
 
{
283
 
  switch (prop_id)
284
 
    {
285
 
    case PROP_SHOW_FINISH:
286
 
      gnome_druid_set_show_finish (GNOME_DRUID (object), g_value_get_boolean (value));
287
 
      break;
288
 
    case PROP_SHOW_HELP:
289
 
      gnome_druid_set_show_help (GNOME_DRUID (object), g_value_get_boolean (value));
290
 
      break;
291
 
    default:
292
 
      break;
293
 
    }
294
 
}
295
 
 
296
 
static void
297
 
gnome_druid_get_property (GObject    *object,
298
 
                          guint       prop_id,
299
 
                          GValue     *value,
300
 
                          GParamSpec *pspec)
301
 
{
302
 
        switch (prop_id)
303
 
        {
304
 
        case PROP_SHOW_FINISH:
305
 
                g_value_set_boolean (value, GNOME_DRUID (object)->_priv->show_finish);
306
 
                break;
307
 
        case PROP_SHOW_HELP:
308
 
                g_value_set_boolean (value, GNOME_DRUID (object)->_priv->show_help);
309
 
                break;
310
 
        default:
311
 
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
312
 
                break;
313
 
        }
314
 
}
315
 
 
316
 
static void
317
 
gnome_druid_size_request (GtkWidget *widget,
318
 
                          GtkRequisition *requisition)
319
 
{
320
 
        guint16 temp_width, temp_height;
321
 
        GList *list;
322
 
        GnomeDruid *druid;
323
 
        GtkRequisition child_requisition;
324
 
        GnomeDruidPage *child;
325
 
        int border;
326
 
 
327
 
        g_return_if_fail (widget != NULL);
328
 
        g_return_if_fail (GNOME_IS_DRUID (widget));
329
 
 
330
 
        druid = GNOME_DRUID (widget);
331
 
        temp_height = temp_width = 0;
332
 
 
333
 
        border = GTK_CONTAINER(widget)->border_width;
334
 
 
335
 
        /* We find the maximum size of all children widgets */
336
 
        for (list = druid->_priv->children; list; list = list->next) {
337
 
                child = GNOME_DRUID_PAGE (list->data);
338
 
                if (GTK_WIDGET_VISIBLE (child)) {
339
 
                        gtk_widget_size_request (GTK_WIDGET (child), &child_requisition);
340
 
                        temp_width = MAX (temp_width, child_requisition.width);
341
 
                        temp_height = MAX (temp_height, child_requisition.height);
342
 
                        if (GTK_WIDGET_MAPPED (child) && child != druid->_priv->current)
343
 
                                gtk_widget_unmap (GTK_WIDGET(child));
344
 
                }
345
 
        }
346
 
 
347
 
        requisition->width = temp_width + 2 * border;
348
 
        requisition->height = temp_height + 2 * border;
349
 
 
350
 
#if 0
351
 
        /* In an Attempt to show how the widgets are packed,
352
 
         * here's a little diagram.
353
 
         *
354
 
         * [  Help  ] ------------- [  Back  ] [  Next  ]    [ Cancel ]
355
 
         *             /
356
 
         *     This part needs to be at least 1 button width.
357
 
         *     In addition, there is 1/4 X Button width between Cancel and Next,
358
 
         *     and a GNOME_PAD_SMALL between Next and Back.
359
 
         */
360
 
        /* our_button width is temp_width and temp_height */
361
 
        temp_height = 0;
362
 
        temp_width = 0;
363
 
 
364
 
        gtk_widget_size_request (druid->back, &child_requisition);
365
 
        temp_width = MAX (temp_width, child_requisition.width);
366
 
        temp_height = MAX (temp_height, child_requisition.height);
367
 
 
368
 
        gtk_widget_size_request (druid->next, &child_requisition);
369
 
        temp_width = MAX (temp_width, child_requisition.width);
370
 
        temp_height = MAX (temp_height, child_requisition.height);
371
 
 
372
 
        gtk_widget_size_request (druid->cancel, &child_requisition);
373
 
        temp_width = MAX (temp_width, child_requisition.width);
374
 
        temp_height = MAX (temp_height, child_requisition.height);
375
 
 
376
 
        gtk_widget_size_request (druid->finish, &child_requisition);
377
 
        temp_width = MAX (temp_width, child_requisition.width);
378
 
        temp_height = MAX (temp_height, child_requisition.height);
379
 
 
380
 
        gtk_widget_size_request (druid->help, &child_requisition);
381
 
        temp_width = MAX (temp_width, child_requisition.width);
382
 
        temp_height = MAX (temp_height, child_requisition.height);
383
 
 
384
 
        temp_width += border * 2;
385
 
        temp_height += GNOME_PAD_SMALL;
386
 
 
387
 
        temp_width = temp_width * 21/4  + GNOME_PAD_SMALL * 3;
388
 
#endif
389
 
 
390
 
        gtk_widget_size_request (druid->_priv->bbox, &child_requisition);
391
 
 
392
 
        /* pick which is bigger, the buttons, or the GnomeDruidPages */
393
 
        requisition->width = MAX (child_requisition.width, requisition->width);
394
 
        requisition->height += child_requisition.height + GNOME_PAD_SMALL * 2;
395
 
}
396
 
 
397
 
static void
398
 
gnome_druid_size_allocate (GtkWidget *widget,
399
 
                           GtkAllocation *allocation)
400
 
{
401
 
        GnomeDruid *druid;
402
 
        GtkAllocation child_allocation;
403
 
        gint button_height;
404
 
        GList *list;
405
 
        int border;
406
 
 
407
 
        g_return_if_fail (widget != NULL);
408
 
        g_return_if_fail (GNOME_IS_DRUID (widget));
409
 
 
410
 
        druid = GNOME_DRUID (widget);
411
 
        widget->allocation = *allocation;
412
 
 
413
 
        border = GTK_CONTAINER(widget)->border_width;
414
 
 
415
 
#if 0
416
 
        /* deal with the buttons */
417
 
        child_allocation.width = child_allocation.height = 0;
418
 
        child_allocation.width = druid->back->requisition.width;
419
 
        child_allocation.height = druid->back->requisition.height;
420
 
        child_allocation.width = MAX (child_allocation.width,
421
 
                                      druid->next->requisition.width);
422
 
        child_allocation.height = MAX (child_allocation.height,
423
 
                                       druid->next->requisition.height);
424
 
        child_allocation.width = MAX (child_allocation.width,
425
 
                                      druid->cancel->requisition.width);
426
 
        child_allocation.height = MAX (child_allocation.height,
427
 
                                       druid->cancel->requisition.height);
428
 
        child_allocation.width = MAX (child_allocation.width,
429
 
                                      druid->help->requisition.width);
430
 
        child_allocation.height = MAX (child_allocation.height,
431
 
                                       druid->help->requisition.height);
432
 
 
433
 
        child_allocation.height += GNOME_PAD_SMALL;
434
 
        button_height = child_allocation.height;
435
 
        child_allocation.width += 2 * GNOME_PAD_SMALL;
436
 
        child_allocation.x = allocation->x + allocation->width - GNOME_PAD_SMALL - child_allocation.width;
437
 
        child_allocation.y = allocation->y + allocation->height - GNOME_PAD_SMALL - child_allocation.height;
438
 
        gtk_widget_size_allocate (druid->cancel, &child_allocation);
439
 
        child_allocation.x -= (child_allocation.width * 5 / 4);
440
 
        gtk_widget_size_allocate (druid->next, &child_allocation);
441
 
        gtk_widget_size_allocate (druid->finish, &child_allocation);
442
 
        child_allocation.x -= (GNOME_PAD_SMALL + child_allocation.width);
443
 
        gtk_widget_size_allocate (druid->back, &child_allocation);
444
 
        child_allocation.x = allocation->x + border;
445
 
        gtk_widget_size_allocate (druid->help, &child_allocation);
446
 
#endif
447
 
        button_height = druid->_priv->bbox->requisition.height;
448
 
        child_allocation.x = allocation->x;
449
 
        child_allocation.y = allocation->y + allocation->height - button_height;
450
 
        child_allocation.height = button_height;
451
 
        child_allocation.width = allocation->width;
452
 
        gtk_widget_size_allocate (druid->_priv->bbox, &child_allocation);
453
 
 
454
 
        /* Put up the GnomeDruidPage */
455
 
        child_allocation.x = allocation->x + border;
456
 
        child_allocation.y = allocation->y + border;
457
 
        child_allocation.width =
458
 
                ((allocation->width - 2 * border) > 0) ?
459
 
                (allocation->width - 2 * border):0;
460
 
        child_allocation.height =
461
 
                ((allocation->height - 2 * border - GNOME_PAD_SMALL - button_height) > 0) ?
462
 
                (allocation->height - 2 * border - GNOME_PAD_SMALL - button_height):0;
463
 
        for (list = druid->_priv->children; list; list=list->next) {
464
 
                GtkWidget *widget = GTK_WIDGET (list->data);
465
 
                if (GTK_WIDGET_VISIBLE (widget)) {
466
 
                        gtk_widget_size_allocate (widget, &child_allocation);
467
 
                }
468
 
        }
469
 
}
470
 
 
471
 
static GtkType
472
 
gnome_druid_child_type (GtkContainer *container)
473
 
{
474
 
        return GNOME_TYPE_DRUID_PAGE;
475
 
}
476
 
 
477
 
static void
478
 
gnome_druid_map (GtkWidget *widget)
479
 
{
480
 
        GnomeDruid *druid;
481
 
 
482
 
        g_return_if_fail (widget != NULL);
483
 
        g_return_if_fail (GNOME_IS_DRUID (widget));
484
 
 
485
 
        druid = GNOME_DRUID (widget);
486
 
        GTK_WIDGET_SET_FLAGS (druid, GTK_MAPPED);
487
 
 
488
 
#if 0
489
 
        gtk_widget_map (druid->back);
490
 
        if (druid->_priv->show_finish)
491
 
                gtk_widget_map (druid->finish);
492
 
        else
493
 
                gtk_widget_map (druid->next);
494
 
        if (druid->_priv->show_help)
495
 
                gtk_widget_map (druid->help);
496
 
        gtk_widget_map (druid->cancel);
497
 
#endif
498
 
        gtk_widget_map (druid->_priv->bbox);
499
 
        if (druid->_priv->current &&
500
 
            GTK_WIDGET_VISIBLE (druid->_priv->current) &&
501
 
            !GTK_WIDGET_MAPPED (druid->_priv->current)) {
502
 
                gtk_widget_map (GTK_WIDGET (druid->_priv->current));
503
 
        }
504
 
}
505
 
 
506
 
static void
507
 
gnome_druid_unmap (GtkWidget *widget)
508
 
{
509
 
        GnomeDruid *druid;
510
 
 
511
 
        g_return_if_fail (widget != NULL);
512
 
        g_return_if_fail (GNOME_IS_DRUID (widget));
513
 
 
514
 
        druid = GNOME_DRUID (widget);
515
 
        GTK_WIDGET_UNSET_FLAGS (druid, GTK_MAPPED);
516
 
#if 0
517
 
        gtk_widget_unmap (druid->back);
518
 
        if (druid->_priv->show_finish)
519
 
                gtk_widget_unmap (druid->finish);
520
 
        else
521
 
                gtk_widget_unmap (druid->next);
522
 
        gtk_widget_unmap (druid->cancel);
523
 
        if (druid->_priv->show_help)
524
 
                gtk_widget_unmap (druid->help);
525
 
#endif
526
 
        gtk_widget_unmap (druid->_priv->bbox);
527
 
        if (druid->_priv->current &&
528
 
            GTK_WIDGET_VISIBLE (druid->_priv->current) &&
529
 
            GTK_WIDGET_MAPPED (druid->_priv->current))
530
 
                gtk_widget_unmap (GTK_WIDGET (druid->_priv->current));
531
 
}
532
 
static void
533
 
gnome_druid_add (GtkContainer *widget,
534
 
                 GtkWidget *page)
535
 
{
536
 
        g_return_if_fail (widget != NULL);
537
 
        g_return_if_fail (GNOME_IS_DRUID (widget));
538
 
        g_return_if_fail (page != NULL);
539
 
        g_return_if_fail (GNOME_IS_DRUID_PAGE (page));
540
 
 
541
 
        gnome_druid_append_page (GNOME_DRUID (widget), GNOME_DRUID_PAGE (page));
542
 
}
543
 
static void
544
 
gnome_druid_remove (GtkContainer *widget,
545
 
                    GtkWidget *child)
546
 
{
547
 
        GnomeDruid *druid;
548
 
        GList *list;
549
 
 
550
 
        g_return_if_fail (widget != NULL);
551
 
        g_return_if_fail (GNOME_IS_DRUID (widget));
552
 
        g_return_if_fail (child != NULL);
553
 
 
554
 
        druid = GNOME_DRUID (widget);
555
 
 
556
 
        list = g_list_find (druid->_priv->children, child);
557
 
        /* Is it a page? */
558
 
        if (list != NULL) {
559
 
                /* If we are mapped and visible, we want to deal with changing the page. */
560
 
                if ((GTK_WIDGET_MAPPED (GTK_WIDGET (widget))) &&
561
 
                    (list->data == (gpointer) druid->_priv->current) &&
562
 
                    (list->next != NULL)) {
563
 
                        gnome_druid_set_page (druid, GNOME_DRUID_PAGE (list->next->data));
564
 
                }
565
 
        }
566
 
        druid->_priv->children = g_list_remove (druid->_priv->children, child);
567
 
        gtk_widget_unparent (child);
568
 
}
569
 
 
570
 
static void
571
 
gnome_druid_forall (GtkContainer *container,
572
 
                    gboolean      include_internals,
573
 
                    GtkCallback   callback,
574
 
                    gpointer      callback_data)
575
 
{
576
 
        GnomeDruid *druid;
577
 
        GnomeDruidPage *child;
578
 
        GList *children;
579
 
 
580
 
        g_return_if_fail (container != NULL);
581
 
        g_return_if_fail (GNOME_IS_DRUID (container));
582
 
        g_return_if_fail (callback != NULL);
583
 
 
584
 
        druid = GNOME_DRUID (container);
585
 
 
586
 
        children = druid->_priv->children;
587
 
        while (children) {
588
 
                child = children->data;
589
 
                children = children->next;
590
 
 
591
 
                (* callback) (GTK_WIDGET (child), callback_data);
592
 
        }
593
 
        if (include_internals) {
594
 
                /* FIXME: should this be gtk_contianer_forall() ? */
595
 
                (* callback) (druid->_priv->bbox, callback_data);
596
 
#if 0
597
 
                (* callback) (druid->back, callback_data);
598
 
                (* callback) (druid->next, callback_data);
599
 
                (* callback) (druid->cancel, callback_data);
600
 
                (* callback) (druid->finish, callback_data);
601
 
                (* callback) (druid->help, callback_data);
602
 
#endif
603
 
        }
604
 
}
605
 
 
606
 
static gint
607
 
gnome_druid_expose (GtkWidget      *widget,
608
 
                    GdkEventExpose *event)
609
 
{
610
 
        GnomeDruid *druid;
611
 
        GtkWidget *child;
612
 
        GList *children;
613
 
 
614
 
        g_return_val_if_fail (widget != NULL, FALSE);
615
 
        g_return_val_if_fail (GNOME_IS_DRUID (widget), FALSE);
616
 
        g_return_val_if_fail (event != NULL, FALSE);
617
 
 
618
 
        if (GTK_WIDGET_DRAWABLE (widget)) {
619
 
                druid = GNOME_DRUID (widget);
620
 
                children = druid->_priv->children;
621
 
 
622
 
                while (children) {
623
 
                        child = GTK_WIDGET (children->data);
624
 
                        children = children->next;
625
 
 
626
 
                        gtk_container_propagate_expose (GTK_CONTAINER (widget),
627
 
                                                        child, event);
628
 
                }
629
 
                gtk_container_propagate_expose (GTK_CONTAINER (widget),
630
 
                                                druid->_priv->bbox, event);
631
 
#if 0
632
 
                gtk_container_propagate_expose (GTK_CONTAINER (widget),
633
 
                                                druid->back, event);
634
 
                gtk_container_propagate_expose (GTK_CONTAINER (widget),
635
 
                                                druid->next, event);
636
 
                gtk_container_propagate_expose (GTK_CONTAINER (widget),
637
 
                                                druid->cancel, event);
638
 
                gtk_container_propagate_expose (GTK_CONTAINER (widget),
639
 
                                                druid->finish, event);
640
 
                gtk_container_propagate_expose (GTK_CONTAINER (widget),
641
 
                                                druid->help, event);
642
 
#endif
643
 
        }
644
 
        return FALSE;
645
 
}
646
 
 
647
 
static void
648
 
gnome_druid_back_callback (GtkWidget *button, GnomeDruid *druid)
649
 
{
650
 
        GList *list;
651
 
        g_return_if_fail (druid->_priv->current != NULL);
652
 
 
653
 
        if (gnome_druid_page_back (druid->_priv->current))
654
 
                return;
655
 
 
656
 
        /* Make sure that we have a next list item */
657
 
        list = g_list_find (druid->_priv->children, druid->_priv->current);
658
 
        g_return_if_fail (list->prev != NULL);
659
 
        gnome_druid_set_page (druid, GNOME_DRUID_PAGE (list->prev->data));
660
 
}
661
 
static void
662
 
gnome_druid_next_callback (GtkWidget *button, GnomeDruid *druid)
663
 
{
664
 
        GList *list;
665
 
        g_return_if_fail (druid->_priv->current != NULL);
666
 
 
667
 
        if (druid->_priv->show_finish == FALSE) {
668
 
                if (gnome_druid_page_next (druid->_priv->current))
669
 
                        return;
670
 
 
671
 
                /* Make sure that we have a next list item */
672
 
                list = g_list_find (druid->_priv->children,
673
 
                                    druid->_priv->current);
674
 
                /* this would be a bug */
675
 
                g_assert (list != NULL);
676
 
 
677
 
                list = list->next;
678
 
                while (list != NULL &&
679
 
                        ! GTK_WIDGET_VISIBLE (list->data))
680
 
                        list = list->next;
681
 
 
682
 
                if ( ! list)
683
 
                        return;
684
 
 
685
 
                gnome_druid_set_page (druid, GNOME_DRUID_PAGE (list->data));
686
 
        } else {
687
 
                gnome_druid_page_finish (druid->_priv->current);
688
 
        }
689
 
}
690
 
static void
691
 
gnome_druid_cancel_callback (GtkWidget *button, GtkWidget *druid)
692
 
{
693
 
     if (GNOME_DRUID (druid)->_priv->current) {
694
 
             if (gnome_druid_page_cancel (GNOME_DRUID (druid)->_priv->current))
695
 
                     return;
696
 
 
697
 
             g_signal_emit (druid, druid_signals [CANCEL], 0);
698
 
     }
699
 
}
700
 
 
701
 
static void
702
 
gnome_druid_help_callback (GtkWidget  *button,
703
 
                           GnomeDruid *druid)
704
 
{
705
 
        g_signal_emit (druid, druid_signals [HELP], 0);
706
 
}
707
 
 
708
 
/* Public Functions */
709
 
/**
710
 
 * gnome_druid_new:
711
 
 *
712
 
 * Description: Creates a new #GnomeDruid widget.  You need to add this
713
 
 * to a dialog yourself, it is not a dialog.
714
 
 *
715
 
 * Returns:  A new #GnomeDruid widget
716
 
 **/
717
 
GtkWidget *
718
 
gnome_druid_new (void)
719
 
{
720
 
        return g_object_new (GNOME_TYPE_DRUID, NULL);
721
 
}
722
 
 
723
 
/**
724
 
 * gnome_druid_new_with_window:
725
 
 * @title: A title of the window.
726
 
 * @parent: The parent of this window (transient_for).
727
 
 * @close_on_cancel: %TRUE if the window should be closed when cancel is
728
 
 * pressed.
729
 
 * @window: Optional return of the #GtkWindow created.
730
 
 *
731
 
 * Description: Creates a new #GnomeDruid widget. It also creates a new
732
 
 * toplevel window with the title of @title (which can be %NULL) and a parent
733
 
 * of @parent (which also can be %NULL). The window and the druid will both be
734
 
 * shown.  If you need the window widget pointer you can optionally get it
735
 
 * through the last argument.  When the druid gets destroyed, so will the
736
 
 * window that is created here.
737
 
 *
738
 
 * Returns:  A new #GnomeDruid widget.
739
 
 **/
740
 
GtkWidget *
741
 
gnome_druid_new_with_window (const char *title,
742
 
                             GtkWindow *parent,
743
 
                             gboolean close_on_cancel,
744
 
                             GtkWidget **window)
745
 
{
746
 
        GtkWidget *druid = g_object_new (GNOME_TYPE_DRUID, NULL);
747
 
 
748
 
        /* make sure we always set window to NULL, even in
749
 
         * case of precondition errors */
750
 
        if (window != NULL)
751
 
                *window = NULL;
752
 
 
753
 
        g_return_val_if_fail (parent == NULL ||
754
 
                              GTK_IS_WINDOW (parent),
755
 
                              NULL);
756
 
 
757
 
        gnome_druid_construct_with_window (GNOME_DRUID (druid),
758
 
                                           title,
759
 
                                           parent,
760
 
                                           close_on_cancel,
761
 
                                           window);
762
 
 
763
 
        return druid;
764
 
}
765
 
 
766
 
/**
767
 
 * gnome_druid_construct_with_window:
768
 
 * @druid: The #GnomeDruid.
769
 
 * @title: A title of the window.
770
 
 * @parent: The parent of this window (transient_for).
771
 
 * @close_on_cancel: %TRUE if the window should be closed when cancel is
772
 
 * pressed.
773
 
 * @window: Optional return of the #GtkWindow created.
774
 
 *
775
 
 * Description: Creates a new toplevel window with the title of @title (which
776
 
 * can be %NULL) and a parent of @parent (which also can be %NULL).  The @druid
777
 
 * will be placed inside this window. The window and the druid will both be
778
 
 * shown. If you need the window widget pointer you can optionally get it
779
 
 * through the last argument. When the druid gets destroyed, so will the
780
 
 * window that is created here.
781
 
 *
782
 
 * See also gnome_druid_new_with_window().
783
 
 **/
784
 
void
785
 
gnome_druid_construct_with_window (GnomeDruid *druid,
786
 
                                   const char *title,
787
 
                                   GtkWindow *parent,
788
 
                                   gboolean close_on_cancel,
789
 
                                   GtkWidget **window)
790
 
{
791
 
        GtkWidget *win;
792
 
 
793
 
        /* make sure we always set window to NULL, even in
794
 
         * case of precondition errors */
795
 
        if (window != NULL)
796
 
                *window = NULL;
797
 
 
798
 
        g_return_if_fail (druid != NULL);
799
 
        g_return_if_fail (GNOME_IS_DRUID (druid));
800
 
        g_return_if_fail (parent == NULL ||
801
 
                          GTK_IS_WINDOW (parent));
802
 
 
803
 
        win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
804
 
 
805
 
        if (title != NULL)
806
 
                gtk_window_set_title (GTK_WINDOW (win), title);
807
 
        if (parent != NULL)
808
 
                gtk_window_set_transient_for (GTK_WINDOW (win),
809
 
                                              parent);
810
 
 
811
 
        gtk_widget_show (GTK_WIDGET (druid));
812
 
 
813
 
        gtk_container_add (GTK_CONTAINER (win), GTK_WIDGET (druid));
814
 
 
815
 
        gtk_widget_show (win);
816
 
 
817
 
        if (close_on_cancel) {
818
 
                g_signal_connect_object (druid, "cancel",
819
 
                                         G_CALLBACK (gtk_widget_destroy),
820
 
                                         win,
821
 
                                         G_CONNECT_SWAPPED);
822
 
        }
823
 
 
824
 
        /* When the druid gets destroyed so does the window */
825
 
        g_signal_connect_object (druid, "destroy",
826
 
                                 G_CALLBACK (gtk_widget_destroy),
827
 
                                 win,
828
 
                                 G_CONNECT_SWAPPED);
829
 
 
830
 
        /* return the window */
831
 
        if (window != NULL)
832
 
                *window = win;
833
 
}
834
 
 
835
 
 
836
 
/**
837
 
 * gnome_druid_set_buttons_sensitive
838
 
 * @druid: A Druid.
839
 
 * @back_sensitive: %TRUE if the back button is sensitive.
840
 
 * @next_sensitive: %TRUE if the next button is sensitive.
841
 
 * @cancel_sensitive: %TRUE if the cancel button is sensitive.
842
 
 * @help_sensitive: %TRUE if the help button is sensitive.
843
 
 *
844
 
 * Description: Sets the sensitivity of @druid's control-buttons.  If the
845
 
 * variables are %TRUE, then they will be clickable. This function is used
846
 
 * primarily by the actual GnomeDruidPage widgets.
847
 
 **/
848
 
 
849
 
void
850
 
gnome_druid_set_buttons_sensitive (GnomeDruid *druid,
851
 
                                   gboolean back_sensitive,
852
 
                                   gboolean next_sensitive,
853
 
                                   gboolean cancel_sensitive,
854
 
                                   gboolean help_sensitive)
855
 
{
856
 
        g_return_if_fail (druid != NULL);
857
 
        g_return_if_fail (GNOME_IS_DRUID (druid));
858
 
 
859
 
        gtk_widget_set_sensitive (druid->back, back_sensitive);
860
 
        gtk_widget_set_sensitive (druid->next, next_sensitive);
861
 
        gtk_widget_set_sensitive (druid->cancel, cancel_sensitive);
862
 
        gtk_widget_set_sensitive (druid->help, help_sensitive);
863
 
}
864
 
 
865
 
/**
866
 
 * gnome_druid_set_show_finish
867
 
 * @druid: A #GnomeDruid widget.
868
 
 * @show_finish: If %TRUE, then the "Next" button is changed to be "Finish"
869
 
 *
870
 
 * Used to specify if @druid is currently showing the last page of the sequence
871
 
 * (and hence should display "Finish", rather than "Next").
872
 
 **/
873
 
void
874
 
gnome_druid_set_show_finish (GnomeDruid *druid,
875
 
                             gboolean    show_finish)
876
 
{
877
 
        g_return_if_fail (GNOME_IS_DRUID (druid));
878
 
 
879
 
        if ((show_finish?TRUE:FALSE) == druid->_priv->show_finish)
880
 
                return;
881
 
 
882
 
        if (show_finish) {
883
 
                gtk_widget_hide (druid->next);
884
 
                gtk_widget_show (druid->finish);
885
 
        } else {
886
 
                gtk_widget_hide (druid->finish);
887
 
                gtk_widget_show (druid->next);
888
 
        }
889
 
        druid->_priv->show_finish = show_finish?TRUE:FALSE;
890
 
}
891
 
 
892
 
/**
893
 
 * gnome_druid_set_show_help
894
 
 * @druid: A #GnomeDruid.
895
 
 * @show_help: %TRUE, if the "Help" button is to be shown, %FALSE otherwise.
896
 
 *
897
 
 * Sets the "Help" button on the druid to be visible in the lower left corner of
898
 
 * the widget, if @show_help is %TRUE.
899
 
 **/
900
 
void
901
 
gnome_druid_set_show_help (GnomeDruid *druid,
902
 
                           gboolean    show_help)
903
 
{
904
 
        g_return_if_fail (GNOME_IS_DRUID (druid));
905
 
 
906
 
        if ((show_help?TRUE:FALSE) == druid->_priv->show_help)
907
 
                return;
908
 
 
909
 
        if (show_help) {
910
 
                gtk_widget_show (druid->help);
911
 
        } else {
912
 
                gtk_widget_hide (druid->help);
913
 
        }
914
 
        druid->_priv->show_help = show_help?TRUE:FALSE;
915
 
}
916
 
 
917
 
 
918
 
/**
919
 
 * gnome_druid_prepend_page:
920
 
 * @druid: A Druid widget.
921
 
 * @page: The page to be inserted.
922
 
 *
923
 
 * Description: This will prepend a GnomeDruidPage into the internal list of
924
 
 * pages that the @druid has. Since #GnomeDruid is just a container, you will
925
 
 * need to also call gtk_widget_show() on the page, otherwise the page will not
926
 
 * be shown.
927
 
 **/
928
 
void
929
 
gnome_druid_prepend_page (GnomeDruid *druid,
930
 
                          GnomeDruidPage *page)
931
 
{
932
 
        g_return_if_fail (druid != NULL);
933
 
        g_return_if_fail (GNOME_IS_DRUID (druid));
934
 
        g_return_if_fail (page != NULL);
935
 
        g_return_if_fail (GNOME_IS_DRUID_PAGE (page));
936
 
 
937
 
        gnome_druid_insert_page (druid, NULL, page);
938
 
}
939
 
/**
940
 
 * gnome_druid_insert_page:
941
 
 * @druid: A #GnomeDruid widget.
942
 
 * @back_page: The page prior to the page to be inserted.
943
 
 * @page: The page to insert.
944
 
 *
945
 
 * Description: This will insert @page after @back_page into the list of
946
 
 * internal pages that the @druid has.  If @back_page is not present in the
947
 
 * list or %NULL, @page will be prepended to the list.  Since #GnomeDruid is
948
 
 * just a container, you will need to also call gtk_widget_show() on the page,
949
 
 * otherwise the page will not be shown.
950
 
 **/
951
 
void
952
 
gnome_druid_insert_page (GnomeDruid *druid,
953
 
                         GnomeDruidPage *back_page,
954
 
                         GnomeDruidPage *page)
955
 
{
956
 
        GList *list;
957
 
 
958
 
        g_return_if_fail (druid != NULL);
959
 
        g_return_if_fail (GNOME_IS_DRUID (druid));
960
 
        g_return_if_fail (page != NULL);
961
 
        g_return_if_fail (GNOME_IS_DRUID_PAGE (page));
962
 
 
963
 
        list = g_list_find (druid->_priv->children, back_page);
964
 
        if (list == NULL) {
965
 
                druid->_priv->children = g_list_prepend (druid->_priv->children, page);
966
 
        } else {
967
 
                GList *new_el = g_list_alloc ();
968
 
                new_el->next = list->next;
969
 
                new_el->prev = list;
970
 
                if (new_el->next)
971
 
                        new_el->next->prev = new_el;
972
 
                new_el->prev->next = new_el;
973
 
                new_el->data = (gpointer) page;
974
 
        }
975
 
        gtk_widget_set_parent (GTK_WIDGET (page), GTK_WIDGET (druid));
976
 
 
977
 
        if (GTK_WIDGET_REALIZED (GTK_WIDGET (druid)))
978
 
                gtk_widget_realize (GTK_WIDGET (page));
979
 
 
980
 
        if (GTK_WIDGET_VISIBLE (GTK_WIDGET (druid)) && GTK_WIDGET_VISIBLE (GTK_WIDGET (page))) {
981
 
                if (GTK_WIDGET_MAPPED (GTK_WIDGET (page)))
982
 
                        gtk_widget_unmap (GTK_WIDGET (page));
983
 
                gtk_widget_queue_resize (GTK_WIDGET (druid));
984
 
        }
985
 
 
986
 
        /* if it's the first and only page, we want to bring it to the foreground. */
987
 
        if (druid->_priv->children->next == NULL)
988
 
                gnome_druid_set_page (druid, page);
989
 
}
990
 
 
991
 
/**
992
 
 * gnome_druid_append_page:
993
 
 * @druid: A #GnomeDruid widget.
994
 
 * @page: The #GnomeDruidPage to be appended.
995
 
 *
996
 
 * Description: This will append @page onto the end of the internal list.
997
 
 * Since #GnomeDruid is just a container, you will need to also call
998
 
 * gtk_widget_show() on the page, otherwise the page will not be shown.
999
 
 **/
1000
 
void
1001
 
gnome_druid_append_page (GnomeDruid *druid,
1002
 
                         GnomeDruidPage *page)
1003
 
{
1004
 
        GList *list;
1005
 
        g_return_if_fail (druid != NULL);
1006
 
        g_return_if_fail (GNOME_IS_DRUID (druid));
1007
 
        g_return_if_fail (page != NULL);
1008
 
        g_return_if_fail (GNOME_IS_DRUID_PAGE (page));
1009
 
 
1010
 
        list = g_list_last (druid->_priv->children);
1011
 
        if (list) {
1012
 
                gnome_druid_insert_page (druid, GNOME_DRUID_PAGE (list->data), page);
1013
 
        } else {
1014
 
                gnome_druid_insert_page (druid, NULL, page);
1015
 
        }
1016
 
}
1017
 
/**
1018
 
 * gnome_druid_set_page:
1019
 
 * @druid: A #GnomeDruid widget.
1020
 
 * @page: The #GnomeDruidPage to be brought to the foreground.
1021
 
 *
1022
 
 * Description: This will make @page the currently showing page in the druid.
1023
 
 * @page must already be in the druid.
1024
 
 **/
1025
 
void
1026
 
gnome_druid_set_page (GnomeDruid *druid,
1027
 
                      GnomeDruidPage *page)
1028
 
{
1029
 
        GList *list;
1030
 
        GtkWidget *old = NULL;
1031
 
        g_return_if_fail (druid != NULL);
1032
 
        g_return_if_fail (GNOME_IS_DRUID (druid));
1033
 
        g_return_if_fail (page != NULL);
1034
 
        g_return_if_fail (GNOME_IS_DRUID_PAGE (page));
1035
 
 
1036
 
        if (druid->_priv->current == page)
1037
 
             return;
1038
 
        list = g_list_find (druid->_priv->children, page);
1039
 
        g_return_if_fail (list != NULL);
1040
 
 
1041
 
        if ((druid->_priv->current) && (GTK_WIDGET_VISIBLE (druid->_priv->current)) && (GTK_WIDGET_MAPPED (druid))) {
1042
 
                old = GTK_WIDGET (druid->_priv->current);
1043
 
        }
1044
 
        druid->_priv->current = GNOME_DRUID_PAGE (list->data);
1045
 
        gnome_druid_page_prepare (druid->_priv->current);
1046
 
        if (GTK_WIDGET_VISIBLE (druid->_priv->current) && (GTK_WIDGET_MAPPED (druid))) {
1047
 
                gtk_widget_map (GTK_WIDGET (druid->_priv->current));
1048
 
        }
1049
 
        if (old && GTK_WIDGET_MAPPED (old))
1050
 
          gtk_widget_unmap (old);
1051
 
}