~ubuntu-branches/ubuntu/maverick/evolution-data-server/maverick-proposed

« back to all changes in this revision

Viewing changes to libedataserverui/e-name-selector-dialog.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
        GList *category_list, *iter;
107
107
 
108
108
        /* "Any Category" is preloaded. */
109
 
        combo_box = glade_xml_get_widget (
110
 
                name_selector_dialog->gui, "combobox-category");
 
109
        combo_box = GTK_WIDGET (gtk_builder_get_object (
 
110
                name_selector_dialog->gui, "combobox-category"));
111
111
        if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)) == -1)
112
112
                gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
113
113
 
136
136
        GtkWidget         *parent;
137
137
        GtkTreeSelection  *selection;
138
138
        ESourceList       *source_list;
139
 
        gchar              *gladefile;
 
139
        gchar             *uifile;
140
140
        GConfClient *gconf_client;
141
141
        gchar *uid;
 
142
        GError *error = NULL;
142
143
 
143
144
        ENameSelectorDialogPrivate *priv = E_NAME_SELECTOR_DIALOG_GET_PRIVATE (name_selector_dialog);
144
145
        priv->destination_index = 0;
145
146
        priv->user_query_fields = NULL;
146
147
 
147
 
        /* Get Glade GUI */
148
 
        gladefile = g_build_filename (E_DATA_SERVER_UI_GLADEDIR,
149
 
                                      "e-name-selector-dialog.glade",
150
 
                                      NULL);
151
 
        name_selector_dialog->gui = glade_xml_new (gladefile, NULL, GETTEXT_PACKAGE);
152
 
        g_free (gladefile);
153
 
 
154
 
        widget = glade_xml_get_widget (name_selector_dialog->gui, "name-selector-box");
 
148
        /* Get GtkBuilder GUI */
 
149
        uifile = g_build_filename (E_DATA_SERVER_UI_UIDIR,
 
150
                                "e-name-selector-dialog.ui",
 
151
                                NULL);
 
152
        name_selector_dialog->gui = gtk_builder_new ();
 
153
        gtk_builder_set_translation_domain (name_selector_dialog->gui, GETTEXT_PACKAGE);
 
154
 
 
155
        if (!gtk_builder_add_from_file (name_selector_dialog->gui, uifile, &error)) {
 
156
                g_free (uifile);
 
157
                g_object_unref (name_selector_dialog->gui);
 
158
                name_selector_dialog->gui = NULL;
 
159
 
 
160
                g_warning ("%s: Cannot load e-name-selector-dialog.ui file, %s", G_STRFUNC, error ? error->message : "Unknown error");
 
161
 
 
162
                if (error)
 
163
                        g_error_free (error);
 
164
 
 
165
                return;
 
166
        }
 
167
 
 
168
        g_free (uifile);
 
169
 
 
170
        widget = GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "name-selector-box"));
155
171
        if (!widget) {
156
 
                g_warning ("ENameSelectorDialog can't load Glade interface!");
 
172
                g_warning ("%s: Cannot load e-name-selector-dialog.ui file", G_STRFUNC);
157
173
                g_object_unref (name_selector_dialog->gui);
158
174
                name_selector_dialog->gui = NULL;
159
175
                return;
181
197
        /* Store pointers to relevant widgets */
182
198
 
183
199
        name_selector_dialog->contact_view = GTK_TREE_VIEW (
184
 
                glade_xml_get_widget (name_selector_dialog->gui, "source-tree-view"));
 
200
                gtk_builder_get_object (name_selector_dialog->gui, "source-tree-view"));
185
201
        name_selector_dialog->status_label = GTK_LABEL (
186
 
                glade_xml_get_widget (name_selector_dialog->gui, "status-message"));
 
202
                gtk_builder_get_object (name_selector_dialog->gui, "status-message"));
187
203
        name_selector_dialog->destination_box = GTK_BOX (
188
 
                glade_xml_get_widget (name_selector_dialog->gui, "destination-box"));
 
204
                gtk_builder_get_object (name_selector_dialog->gui, "destination-box"));
189
205
        name_selector_dialog->search_entry = GTK_ENTRY (
190
 
                glade_xml_get_widget (name_selector_dialog->gui, "search"));
 
206
                gtk_builder_get_object (name_selector_dialog->gui, "search"));
191
207
 
192
208
        /* Create size group for transfer buttons */
193
209
 
242
258
                g_free (uid);
243
259
        }
244
260
 
245
 
        label = glade_xml_get_widget (name_selector_dialog->gui, "AddressBookLabel");
 
261
        label = GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "AddressBookLabel"));
246
262
        gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
247
263
 
248
264
        gtk_widget_show (widget);
249
265
 
250
 
        container = glade_xml_get_widget (name_selector_dialog->gui, "source-menu-box");
 
266
        container = GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "source-menu-box"));
251
267
        gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0);
252
268
 
253
269
        e_name_selector_dialog_populate_categories (name_selector_dialog);
254
270
 
255
271
        /* Set up search-as-you-type signal */
256
272
 
257
 
        widget = glade_xml_get_widget (name_selector_dialog->gui, "search");
 
273
        widget = GTK_WIDGET (gtk_builder_get_object (name_selector_dialog->gui, "search"));
258
274
        g_signal_connect_swapped (widget, "changed", G_CALLBACK (search_changed), name_selector_dialog);
259
275
 
260
276
        /* Display initial source */
333
349
 *
334
350
 * Creates a new #ENameSelectorDialog.
335
351
 *
336
 
 * Return value: A new #ENameSelectorDialog.
 
352
 * Returns: A new #ENameSelectorDialog.
337
353
 **/
338
354
ENameSelectorDialog *
339
355
e_name_selector_dialog_new (void)
379
395
}
380
396
 
381
397
static void
382
 
add_destination (EDestinationStore *destination_store, EContact *contact, gint email_n)
 
398
add_destination (ENameSelectorModel *name_selector_model, EDestinationStore *destination_store, EContact *contact, gint email_n)
383
399
{
384
400
        EDestination *destination;
 
401
        GList *email_list, *nth;
 
402
 
 
403
        /* get the correct index of an email in the contact */
 
404
        email_list = e_name_selector_model_get_contact_emails_without_used (name_selector_model, contact, FALSE);
 
405
        while (nth = g_list_nth (email_list, email_n), nth && nth->data == NULL) {
 
406
                email_n++;
 
407
        }
 
408
        e_name_selector_model_free_emails_list (email_list);
385
409
 
386
410
        /* Transfer (actually, copy into a destination and let the model filter out the
387
411
         * source automatically) */
749
773
        gchar         *category_escaped;
750
774
        gchar         *user_fields_str;
751
775
 
752
 
        combo_box = glade_xml_get_widget (
753
 
                name_selector_dialog->gui, "combobox-category");
 
776
        combo_box = GTK_WIDGET (gtk_builder_get_object (
 
777
                name_selector_dialog->gui, "combobox-category"));
754
778
        if (gtk_combo_box_get_active (GTK_COMBO_BOX (combo_box)) == -1)
755
779
                gtk_combo_box_set_active (GTK_COMBO_BOX (combo_box), 0);
756
780
 
857
881
                return;
858
882
        }
859
883
 
860
 
        add_destination (destination_store, contact, email_n);
 
884
        add_destination (name_selector_dialog->name_selector_model, destination_store, contact, email_n);
861
885
}
862
886
 
863
887
static void
1028
1052
                        return;
1029
1053
                }
1030
1054
 
1031
 
                add_destination (destination_store, contact, email_n);
 
1055
                add_destination (name_selector_dialog->name_selector_model, destination_store, contact, email_n);
1032
1056
        }
1033
1057
        g_list_free (rows);
1034
1058
}
1126
1150
}
1127
1151
 
1128
1152
static void
1129
 
deep_free_list (GList *list)
1130
 
{
1131
 
        GList *l;
1132
 
 
1133
 
        for (l = list; l; l = g_list_next (l))
1134
 
                g_free (l->data);
1135
 
 
1136
 
        g_list_free (list);
1137
 
}
1138
 
 
1139
 
static void
1140
1153
contact_column_formatter (GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model,
1141
1154
                          GtkTreeIter *iter, ENameSelectorDialog *name_selector_dialog)
1142
1155
{
1154
1167
 
1155
1168
        contact_store = e_name_selector_model_peek_contact_store (name_selector_dialog->name_selector_model);
1156
1169
        contact = e_contact_store_get_contact (contact_store, &contact_store_iter);
1157
 
        email_list = e_contact_get (contact, E_CONTACT_EMAIL);
 
1170
        email_list = e_name_selector_model_get_contact_emails_without_used (name_selector_dialog->name_selector_model, contact, TRUE);
1158
1171
        email_str = g_list_nth_data (email_list, email_n);
1159
1172
        full_name_str = e_contact_get (contact, E_CONTACT_FULL_NAME);
1160
1173
 
1169
1182
        }
1170
1183
 
1171
1184
        g_free (full_name_str);
1172
 
        deep_free_list (email_list);
 
1185
        e_name_selector_model_free_emails_list (email_list);
1173
1186
 
1174
1187
        g_object_set (cell, "text", string, NULL);
1175
1188
        g_free (string);
1211
1224
 *
1212
1225
 * Gets the #ENameSelectorModel used by @name_selector_model.
1213
1226
 *
1214
 
 * Return value: The #ENameSelectorModel being used.
 
1227
 * Returns: The #ENameSelectorModel being used.
1215
1228
 **/
1216
1229
ENameSelectorModel *
1217
1230
e_name_selector_dialog_peek_model (ENameSelectorDialog *name_selector_dialog)
1265
1278
        priv->destination_index = index;
1266
1279
}
1267
1280
 
1268
 
/* ----------------------------------- *
1269
 
 * Widget creation functions for Glade *
1270
 
 * ----------------------------------- */
 
1281
/* ---------------------------------------- *
 
1282
 * Widget creation functions for GtkBuilder *
 
1283
 * ---------------------------------------- */
1271
1284
 
1272
1285
#ifdef CATEGORIES_COMPONENTS_MOVED
1273
1286