From 644a56884a2be9d1d6390a4c7d49df0bbdef2450 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 2 Jan 2012 15:34:06 +0000 Subject: Replace deprecated combo box API (bzr r10822) --- src/dialogs/spellcheck.cpp | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/dialogs/spellcheck.cpp') diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 847f5b877..41732330e 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -983,18 +983,33 @@ sp_spellcheck_dialog (void) GtkWidget *hb = gtk_hbox_new (FALSE, 0); sp_spellcheck_new_button (dlg, hb, _("A_dd to dictionary:"), _("Add this word to the chosen dictionary"), sp_spellcheck_add, "b_add"); - GtkComboBox *cbox = GTK_COMBO_BOX (gtk_combo_box_new_text()); - gtk_combo_box_append_text (cbox, _lang); + +// Backward compatibility fix: The GtkComboBoxText API was introduced with +// GTK+ 2.24. This check should eventually be dropped when we bump our +// GTK dependency. +#if GTK_CHECK_VERSION(2, 24, 0) + GtkWidget *cbox = gtk_combo_box_text_new(); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cbox), _lang); if (_lang2) { - gtk_combo_box_append_text (cbox, _lang2); + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cbox), _lang2); + } + if (_lang3) { + gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (cbox), _lang3); + } +#else + GtkWidget *cbox = gtk_combo_box_new_text(); + gtk_combo_box_append_text (GTK_COMBO_BOX (cbox), _lang); + if (_lang2) { + gtk_combo_box_append_text (GTK_COMBO_BOX (cbox), _lang2); } if (_lang3) { - gtk_combo_box_append_text (cbox, _lang3); + gtk_combo_box_append_text (GTK_COMBO_BOX (cbox), _lang3); } - gtk_combo_box_set_active (cbox, 0); - gtk_widget_show_all (GTK_WIDGET(cbox)); +#endif + gtk_combo_box_set_active (GTK_COMBO_BOX (cbox), 0); + gtk_widget_show_all (cbox); g_object_set_data (G_OBJECT (dlg), "addto_langs", cbox); - gtk_box_pack_start (GTK_BOX (hb), GTK_WIDGET(cbox), TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (hb), cbox, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); } -- cgit v1.2.3