~ubuntu-branches/ubuntu/hardy/evolution-data-server/hardy-updates

« back to all changes in this revision

Viewing changes to libedataserverui/e-source-combo-box.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-11-13 10:59:20 UTC
  • mfrom: (1.1.38 upstream)
  • Revision ID: james.westby@ubuntu.com-20071113105920-nb6w14udvgx0ghi3
Tags: 2.21.2-0ubuntu1
* New upstream version:
  Bug Fixes:
  - #318842: Task lists should be sorted (LP: #23912)
  - #345135: Disable SSLv2 compatible HELLO on SSL stream when 
    SSLv2 is disabled
  - #359267: Not all memos are showed in calendar view
  - #430420: Returned size <= 0 is an error
  - #460649: Meeting UI Needs To Show Color Of Selected Calendar Source
  - #487229: Use GKeyFile instead of gnome-config to access stored passwords
  - #488156: Minimize use of the WITH_GNOME_KEYRING macro
  - #492130: ESourceSelector uses pointers to ESource
  - #494304: Fix leak
  Updated Translations
  New in 2.21.1:
  - Support for Google Calendar
  Bug Fixes:
  - #203480: (Novell Bugzilla) Compiler warning fix 
    for usage ofunintialized variable
  - #231178: New symbol 'set-label' defined and added corresponding callback
  - #271777: Keep character's case as user types
  - #417999: Don't use deprecated GTK+ symbols
  - #420167: e-d-s now exits with gnome-session
  - #469657: Better use of GHashTable
  - #474000: Use GLib's Base64 API instead of Camel's
  - #475487: When creating the default contact, print errors to the console
  - #475493: Use G_DEFINE_TYPE
  - #475494: Use G_LOCK instead of a static mutex for clearer code
  - #478404: Reset the id to zero
  - #483301: Remove an unused variable
  - #487270: Fix typo in documentation
  - #488173: Remove __FUNCTION__, which is a gcc-ism
  - #488351: Fix an addressbook error on a fresh install
  Other Contributors:
  - Protect against a NULL subject string. 
* debian/*.preinst:
  - On upgrades from Gutsy, remove the symlinks introduced in Gutsy. They
    break upgrades all over, and current cdbs just symlinks individual files.
* Sync with Debian
* debian/control:
  - evolution-data-server Breaks evolution (<< 2.9), 
    evolution-exchange (<= 2.8.1-0ubuntu1),
    evolution-jescs (<= 2.8.2-0ubuntu3), 
    evolution-scalix (<= 10.0.0.357-0ubuntu6)
  - updated maintainer to desktop team
* debian/rules:
  - don't specify the paths for nspr and nss since the package is built 
    with firefox
  - don't build documentation, it's distributed in the upstream tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
 
2
/* e-source-option-menu.c
 
3
 *
 
4
 * Copyright (C) 2007 Novell, Inc.
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of version 2 of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation.
 
9
 *
 
10
 * This program 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
 * General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Lesser General Public
 
16
 * License along with this program; if not, write to the
 
17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
 * Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
#ifdef HAVE_CONFIG_H
 
22
#include <config.h>
 
23
#endif
 
24
 
 
25
#include "e-source-combo-box.h"
 
26
#include "e-cell-renderer-color.h"
 
27
 
 
28
#define E_SOURCE_COMBO_BOX_GET_PRIVATE(obj) \
 
29
        (G_TYPE_INSTANCE_GET_PRIVATE \
 
30
        ((obj), E_TYPE_SOURCE_COMBO_BOX, ESourceComboBoxPrivate))
 
31
 
 
32
struct _ESourceComboBoxPrivate {
 
33
        ESourceList *source_list;
 
34
        GHashTable *uid_index;
 
35
        gulong handler_id;
 
36
};
 
37
 
 
38
enum {
 
39
        PROP_0,
 
40
        PROP_SOURCE_LIST
 
41
};
 
42
 
 
43
enum {
 
44
        COLUMN_COLOR,           /* GDK_TYPE_COLOR */
 
45
        COLUMN_NAME,            /* G_TYPE_STRING */
 
46
        COLUMN_SENSITIVE,       /* G_TYPE_BOOLEAN */
 
47
        COLUMN_SOURCE,          /* G_TYPE_OBJECT */
 
48
        COLUMN_VISIBLE,         /* G_TYPE_BOOLEAN */
 
49
        NUM_COLUMNS
 
50
};
 
51
 
 
52
static gpointer parent_class = NULL;
 
53
 
 
54
/**
 
55
 * compare_source_names
 
56
 * Compares sources by name.
 
57
 **/
 
58
static gint
 
59
compare_source_names (gconstpointer a, gconstpointer b)
 
60
{
 
61
        g_return_val_if_fail (E_IS_SOURCE (a), -1);
 
62
        g_return_val_if_fail (E_IS_SOURCE (b),  1);
 
63
 
 
64
        return g_utf8_collate (e_source_peek_name (E_SOURCE (a)), e_source_peek_name (E_SOURCE (b)));
 
65
}
 
66
 
 
67
/**
 
68
 * get_sorted_sources
 
69
 * Creates copy of GSList of sources (do not increase reference count for data members),
 
70
 * and sorts this list alphabetically by source names.
 
71
 *
 
72
 * @param sources List of sources.
 
73
 * @return New GSList of sorted sources, should be freed by g_slist_free,
 
74
 *         but do not unref data members.
 
75
 **/
 
76
static GSList *
 
77
get_sorted_sources (GSList *sources)
 
78
{
 
79
        GSList *res = NULL, *p;
 
80
 
 
81
        if (!sources)
 
82
                return NULL;
 
83
 
 
84
        for (p = sources; p != NULL; p = p->next)
 
85
                res = g_slist_prepend (res, p->data);
 
86
 
 
87
        res = g_slist_sort (res, compare_source_names);
 
88
 
 
89
        return res;
 
90
}
 
91
 
 
92
static void
 
93
source_list_changed_cb (ESourceList *source_list,
 
94
                        ESourceComboBox *source_combo_box)
 
95
{
 
96
        ESourceComboBoxPrivate *priv;
 
97
        GtkComboBox *combo_box;
 
98
        GtkTreeModel *model;
 
99
        GtkListStore *store;
 
100
        GtkTreeIter iter;
 
101
        GtkTreePath *path;
 
102
        GSList *groups;
 
103
        GSList *sources, *s;
 
104
        const gchar *name;
 
105
        const gchar *uid;
 
106
        gchar *indented_name;
 
107
        gboolean visible = FALSE;
 
108
        gboolean iter_valid;
 
109
 
 
110
        priv = source_combo_box->priv;
 
111
        g_hash_table_remove_all (priv->uid_index);
 
112
 
 
113
        combo_box = GTK_COMBO_BOX (source_combo_box);
 
114
        gtk_combo_box_set_active (combo_box, -1);
 
115
 
 
116
        model = gtk_combo_box_get_model (combo_box);
 
117
        store = GTK_LIST_STORE (model);
 
118
        gtk_list_store_clear (store);
 
119
 
 
120
        for (groups = e_source_list_peek_groups (source_list);
 
121
                groups != NULL; groups = groups->next) {
 
122
 
 
123
                /* Only show source groups that have sources. */
 
124
                if (e_source_group_peek_sources (groups->data) == NULL)
 
125
                        continue;
 
126
 
 
127
                name = e_source_group_peek_name (groups->data);
 
128
                gtk_list_store_append (store, &iter);
 
129
                gtk_list_store_set (
 
130
                        store, &iter,
 
131
                        COLUMN_COLOR, NULL,
 
132
                        COLUMN_NAME, name,
 
133
                        COLUMN_SENSITIVE, FALSE,
 
134
                        COLUMN_SOURCE, groups->data,
 
135
                        -1);
 
136
 
 
137
                sources = get_sorted_sources (e_source_group_peek_sources (groups->data));
 
138
                for (s = sources; s != NULL; s = s->next) {
 
139
                        const gchar *color_spec;
 
140
                        GdkColor color;
 
141
 
 
142
                        name = e_source_peek_name (s->data);
 
143
                        indented_name = g_strconcat ("    ", name, NULL);
 
144
 
 
145
                        color_spec = e_source_peek_color_spec (s->data);
 
146
                        if (color_spec != NULL) {
 
147
                                gdk_color_parse (color_spec, &color);
 
148
                                visible = TRUE;
 
149
                        }
 
150
 
 
151
                        gtk_list_store_append (store, &iter);
 
152
                        gtk_list_store_set (
 
153
                                store, &iter,
 
154
                                COLUMN_COLOR, color_spec ? &color : NULL,
 
155
                                COLUMN_NAME, indented_name,
 
156
                                COLUMN_SENSITIVE, TRUE,
 
157
                                COLUMN_SOURCE, s->data,
 
158
                                -1);
 
159
 
 
160
                        uid = e_source_peek_uid (s->data);
 
161
                        path = gtk_tree_model_get_path (model, &iter);
 
162
                        g_hash_table_insert (
 
163
                                priv->uid_index, g_strdup (uid),
 
164
                                gtk_tree_row_reference_new (model, path));
 
165
                        gtk_tree_path_free (path);
 
166
 
 
167
                        g_free (indented_name);
 
168
                }
 
169
                g_slist_free (sources);
 
170
        }
 
171
 
 
172
        /* Set the visible column based on whether we've seen a color. */
 
173
        iter_valid = gtk_tree_model_get_iter_first (model, &iter);
 
174
        while (iter_valid) {
 
175
                gtk_list_store_set (
 
176
                        store, &iter, COLUMN_VISIBLE, visible, -1);
 
177
                iter_valid = gtk_tree_model_iter_next (model, &iter);
 
178
        }
 
179
}
 
180
 
 
181
static GObject *
 
182
e_source_combo_box_constructor (GType type, guint n_construct_properties,
 
183
                                GObjectConstructParam *construct_properties)
 
184
{
 
185
        GtkCellRenderer *renderer;
 
186
        GtkListStore *store;
 
187
        GObject *object;
 
188
 
 
189
        /* Chain up to parent's "constructor" method. */
 
190
        object = G_OBJECT_CLASS (parent_class)->constructor (
 
191
                type, n_construct_properties, construct_properties);
 
192
 
 
193
        store = gtk_list_store_new (
 
194
                NUM_COLUMNS,
 
195
                GDK_TYPE_COLOR,         /* COLUMN_COLOR */
 
196
                G_TYPE_STRING,          /* COLUMN_NAME */
 
197
                G_TYPE_BOOLEAN,         /* COLUMN_SENSITIVE */
 
198
                G_TYPE_OBJECT,          /* COLUMN_SOURCE */
 
199
                G_TYPE_BOOLEAN);        /* COLUMN_VISIBLE */
 
200
        gtk_combo_box_set_model (
 
201
                GTK_COMBO_BOX (object), GTK_TREE_MODEL (store));
 
202
 
 
203
        renderer = e_cell_renderer_color_new ();
 
204
        gtk_cell_layout_pack_start (
 
205
                GTK_CELL_LAYOUT (object), renderer, FALSE);
 
206
        gtk_cell_layout_set_attributes (
 
207
                GTK_CELL_LAYOUT (object), renderer,
 
208
                "color", COLUMN_COLOR,
 
209
                "sensitive", COLUMN_SENSITIVE,
 
210
                "visible", COLUMN_VISIBLE,
 
211
                NULL);
 
212
 
 
213
        renderer = gtk_cell_renderer_text_new ();
 
214
        gtk_cell_layout_pack_start (
 
215
                GTK_CELL_LAYOUT (object), renderer, TRUE);
 
216
        gtk_cell_layout_set_attributes (
 
217
                GTK_CELL_LAYOUT (object), renderer,
 
218
                "text", COLUMN_NAME,
 
219
                "sensitive", COLUMN_SENSITIVE,
 
220
                NULL);
 
221
 
 
222
        return object;
 
223
}
 
224
 
 
225
static void
 
226
e_source_combo_box_set_property (GObject *object,
 
227
                                 guint property_id,
 
228
                                 const GValue *value,
 
229
                                 GParamSpec *pspec)
 
230
{
 
231
        ESourceComboBoxPrivate *priv;
 
232
 
 
233
        priv = E_SOURCE_COMBO_BOX_GET_PRIVATE (object);
 
234
 
 
235
        switch (property_id) {
 
236
                case PROP_SOURCE_LIST:
 
237
 
 
238
                        if (priv->source_list != NULL) {
 
239
                                g_signal_handler_disconnect (
 
240
                                        priv->source_list, priv->handler_id);
 
241
                                g_object_unref (priv->source_list);
 
242
                        }
 
243
 
 
244
                        priv->source_list = g_value_dup_object (value);
 
245
 
 
246
                        /* Reset the tree store. */
 
247
                        source_list_changed_cb (
 
248
                                priv->source_list,
 
249
                                E_SOURCE_COMBO_BOX (object));
 
250
 
 
251
                        /* Watch for source list changes. */
 
252
                        priv->handler_id = g_signal_connect_object (
 
253
                                priv->source_list, "changed",
 
254
                                G_CALLBACK (source_list_changed_cb),
 
255
                                object, 0);
 
256
 
 
257
                        return;
 
258
        }
 
259
 
 
260
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
261
}
 
262
 
 
263
static void
 
264
e_source_combo_box_get_property (GObject *object,
 
265
                                 guint property_id,
 
266
                                 GValue *value,
 
267
                                 GParamSpec *pspec)
 
268
{
 
269
        ESourceComboBoxPrivate *priv;
 
270
 
 
271
        priv = E_SOURCE_COMBO_BOX_GET_PRIVATE (object);
 
272
 
 
273
        switch (property_id) {
 
274
                case PROP_SOURCE_LIST:
 
275
                        g_value_set_object (value, priv->source_list);
 
276
                        return;
 
277
        }
 
278
 
 
279
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
280
}
 
281
 
 
282
static void
 
283
e_source_combo_box_dispose (GObject *object)
 
284
{
 
285
        ESourceComboBoxPrivate *priv;
 
286
 
 
287
        priv = E_SOURCE_COMBO_BOX_GET_PRIVATE (object);
 
288
 
 
289
        if (priv->source_list != NULL) {
 
290
                g_object_unref (priv->source_list);
 
291
                priv->source_list = NULL;
 
292
        }
 
293
 
 
294
        g_hash_table_remove_all (priv->uid_index);
 
295
 
 
296
        /* Chain up to parent's "dispose" method. */
 
297
        G_OBJECT_CLASS (parent_class)->dispose (object);
 
298
}
 
299
 
 
300
static void
 
301
e_source_combo_box_finalize (GObject *object)
 
302
{
 
303
        ESourceComboBoxPrivate *priv;
 
304
 
 
305
        priv = E_SOURCE_COMBO_BOX_GET_PRIVATE (object);
 
306
 
 
307
        g_hash_table_destroy (priv->uid_index);
 
308
 
 
309
        /* Chain up to parent's "finalize" method. */
 
310
        G_OBJECT_CLASS (parent_class)->finalize (object);
 
311
}
 
312
 
 
313
static void
 
314
e_source_combo_box_class_init (ESourceComboBoxClass *class)
 
315
{
 
316
        GObjectClass *object_class = G_OBJECT_CLASS (class);
 
317
 
 
318
        parent_class = g_type_class_peek_parent (class);
 
319
 
 
320
        g_type_class_add_private (class, sizeof (ESourceComboBox));
 
321
 
 
322
        object_class->constructor = e_source_combo_box_constructor;
 
323
        object_class->set_property = e_source_combo_box_set_property;
 
324
        object_class->get_property = e_source_combo_box_get_property;
 
325
        object_class->dispose = e_source_combo_box_dispose;
 
326
        object_class->finalize = e_source_combo_box_finalize;
 
327
 
 
328
        g_object_class_install_property (
 
329
                object_class,
 
330
                PROP_SOURCE_LIST,
 
331
                g_param_spec_object (
 
332
                        "source-list",
 
333
                        "source-list",
 
334
                        "List of sources to choose from",
 
335
                        E_TYPE_SOURCE_LIST,
 
336
                        G_PARAM_READWRITE));
 
337
}
 
338
 
 
339
static void
 
340
e_source_combo_box_init (ESourceComboBox *source_combo_box)
 
341
{
 
342
        source_combo_box->priv =
 
343
                E_SOURCE_COMBO_BOX_GET_PRIVATE (source_combo_box);
 
344
 
 
345
        source_combo_box->priv->uid_index =
 
346
                g_hash_table_new_full (
 
347
                        g_str_hash, g_str_equal,
 
348
                        (GDestroyNotify) g_free,
 
349
                        (GDestroyNotify) gtk_tree_row_reference_free);
 
350
}
 
351
 
 
352
GType
 
353
e_source_combo_box_get_type (void)
 
354
{
 
355
        static GType type = 0;
 
356
 
 
357
        if (G_UNLIKELY (type == 0)) {
 
358
                static const GTypeInfo type_info = {
 
359
                        sizeof (ESourceComboBoxClass),
 
360
                        (GBaseInitFunc) NULL,
 
361
                        (GBaseFinalizeFunc) NULL,
 
362
                        (GClassInitFunc) e_source_combo_box_class_init,
 
363
                        (GClassFinalizeFunc) NULL,
 
364
                        NULL,  /* class_data */
 
365
                        sizeof (ESourceComboBox),
 
366
                        0,     /* n_preallocs */
 
367
                        (GInstanceInitFunc) e_source_combo_box_init,
 
368
                        NULL   /* value_table */
 
369
                };
 
370
 
 
371
                type = g_type_register_static (
 
372
                        GTK_TYPE_COMBO_BOX, "ESourceComboBox", &type_info, 0);
 
373
        }
 
374
 
 
375
        return type;
 
376
}
 
377
 
 
378
/**
 
379
 * e_source_combo_box_new:
 
380
 * @source_list: an #ESourceList
 
381
 *
 
382
 * Creates a new #ESourceComboBox widget that lets the user pick an #ESource
 
383
 * from the provided #ESourceList.
 
384
 *
 
385
 * Returns: a new #ESourceComboBox
 
386
 **/
 
387
GtkWidget *
 
388
e_source_combo_box_new (ESourceList *source_list)
 
389
{
 
390
        g_return_val_if_fail (E_IS_SOURCE_LIST (source_list), NULL);
 
391
 
 
392
        return g_object_new (
 
393
                E_TYPE_SOURCE_COMBO_BOX,
 
394
                "source-list", source_list, NULL);
 
395
}
 
396
 
 
397
/**
 
398
 * e_source_combo_box_get_source_list:
 
399
 * @source_combo_box: an #ESourceComboBox
 
400
 *
 
401
 * Returns the #ESourceList which is acting as a data source for
 
402
 * @source_combo_box.
 
403
 *
 
404
 * Returns: an #ESourceList
 
405
 **/
 
406
ESourceList *
 
407
e_source_combo_box_get_source_list (ESourceComboBox *source_combo_box)
 
408
{
 
409
        ESourceList *source_list;
 
410
 
 
411
        g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box), NULL);
 
412
 
 
413
        g_object_get (source_combo_box, "source-list", &source_list, NULL);
 
414
 
 
415
        return source_list;
 
416
}
 
417
 
 
418
/**
 
419
 * e_source_combo_box_set_source_list:
 
420
 * @source_combo_box: an #ESourceComboBox
 
421
 * @source_list: an #ESourceList
 
422
 *
 
423
 * Sets the source list used by @source_combo_box to be @source_list.  This
 
424
 * causes the contents of @source_combo_box to be regenerated.
 
425
 **/
 
426
void
 
427
e_source_combo_box_set_source_list (ESourceComboBox *source_combo_box,
 
428
                                    ESourceList *source_list)
 
429
{
 
430
        g_return_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box));
 
431
        g_return_if_fail (E_IS_SOURCE_LIST (source_list));
 
432
 
 
433
        g_object_set (source_combo_box, "source-list", source_list, NULL);
 
434
}
 
435
 
 
436
/**
 
437
 * e_source_combo_box_get_active:
 
438
 * @source_combo_box: an #ESourceComboBox
 
439
 *
 
440
 * Returns the #ESource corresponding to the currently active item, or %NULL
 
441
 * if there is no active item.
 
442
 *
 
443
 * Returns: an #ESource or %NULL
 
444
 **/
 
445
ESource *
 
446
e_source_combo_box_get_active (ESourceComboBox *source_combo_box)
 
447
{
 
448
        GtkComboBox *combo_box;
 
449
        GtkTreeIter iter;
 
450
        ESource *source;
 
451
 
 
452
        g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box), NULL);
 
453
 
 
454
        combo_box = GTK_COMBO_BOX (source_combo_box);
 
455
 
 
456
        if (!gtk_combo_box_get_active_iter (combo_box, &iter))
 
457
                return NULL;
 
458
 
 
459
        gtk_tree_model_get (
 
460
                gtk_combo_box_get_model (combo_box),
 
461
                &iter, COLUMN_SOURCE, &source, -1);
 
462
 
 
463
        return source;
 
464
}
 
465
 
 
466
/**
 
467
 * e_source_combo_box_set_active:
 
468
 * @source_combo_box: an #ESourceComboBox
 
469
 * @source: an #ESource
 
470
 *
 
471
 * Sets the active item to the one corresponding to @source.
 
472
 **/
 
473
void
 
474
e_source_combo_box_set_active (ESourceComboBox *source_combo_box,
 
475
                               ESource *source)
 
476
{
 
477
        g_return_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box));
 
478
        g_return_if_fail (E_IS_SOURCE (source));
 
479
 
 
480
        e_source_combo_box_set_active_uid (
 
481
                source_combo_box, e_source_peek_uid (source));
 
482
}
 
483
 
 
484
/**
 
485
 * e_source_combo_box_get_active_uid:
 
486
 * @source_combo_box: an #ESourceComboBox
 
487
 *
 
488
 * Returns the unique ID of the #ESource corresponding to the currently
 
489
 * active item, or %NULL if there is no active item.
 
490
 *
 
491
 * Returns: a unique ID string or %NULL
 
492
 **/
 
493
const gchar *
 
494
e_source_combo_box_get_active_uid (ESourceComboBox *source_combo_box)
 
495
{
 
496
        ESource *source;
 
497
 
 
498
        g_return_val_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box), NULL);
 
499
 
 
500
        source = e_source_combo_box_get_active (source_combo_box);
 
501
        if (source == NULL)
 
502
                return NULL;
 
503
 
 
504
        return e_source_peek_uid (source);
 
505
}
 
506
 
 
507
/**
 
508
 * e_source_combo_box_set_active_uid:
 
509
 * @source_combo_box: an #ESourceComboBox
 
510
 * @uid: a unique ID of an #ESource
 
511
 *
 
512
 * Sets the active item to the one corresponding to @uid.
 
513
 **/
 
514
void
 
515
e_source_combo_box_set_active_uid (ESourceComboBox *source_combo_box,
 
516
                                   const gchar *uid)
 
517
{
 
518
        ESourceComboBoxPrivate *priv;
 
519
        GtkTreeRowReference *reference;
 
520
        GtkComboBox *combo_box;
 
521
        GtkTreeIter iter;
 
522
        gboolean iter_was_set;
 
523
 
 
524
        g_return_if_fail (E_IS_SOURCE_COMBO_BOX (source_combo_box));
 
525
        g_return_if_fail (uid != NULL);
 
526
 
 
527
        priv = source_combo_box->priv;
 
528
        combo_box = GTK_COMBO_BOX (source_combo_box);
 
529
 
 
530
        reference = g_hash_table_lookup (priv->uid_index, uid);
 
531
        g_return_if_fail (gtk_tree_row_reference_valid (reference));
 
532
 
 
533
        iter_was_set = gtk_tree_model_get_iter (
 
534
                gtk_combo_box_get_model (combo_box), &iter,
 
535
                gtk_tree_row_reference_get_path (reference));
 
536
        g_return_if_fail (iter_was_set);
 
537
 
 
538
        gtk_combo_box_set_active_iter (combo_box, &iter);
 
539
}