Mercurial > pidgin
changeset 32567:f08acd4299d5
Use GtkComboBox instead of GtkOptionMenu in the choice request field for
GTK+ 2.4 and up.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Thu, 09 Apr 2009 04:11:01 +0000 |
parents | e84bdaa9d227 |
children | 6ab5ab8fc294 |
files | pidgin/gtkrequest.c |
diffstat | 1 files changed, 25 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkrequest.c Wed Apr 08 05:46:20 2009 +0000 +++ b/pidgin/gtkrequest.c Thu Apr 09 04:11:01 2009 +0000 @@ -202,12 +202,21 @@ gtk_toggle_button_get_active(button)); } +#if GTK_CHECK_VERSION(2,4,0) +static void +field_choice_menu_cb(GtkComboBox *menu, PurpleRequestField *field) +{ + purple_request_field_choice_set_value(field, + gtk_combo_box_get_active(menu)); +} +#else static void field_choice_menu_cb(GtkOptionMenu *menu, PurpleRequestField *field) { purple_request_field_choice_set_value(field, gtk_option_menu_get_history(menu)); } +#endif static void field_choice_option_cb(GtkRadioButton *button, PurpleRequestField *field) @@ -870,6 +879,21 @@ if (num_labels > 5) { +#if GTK_CHECK_VERSION(2,4,0) + widget = gtk_combo_box_new_text(); + + for (l = labels; l != NULL; l = l->next) + { + const char *text = l->data; + gtk_combo_box_append_text(GTK_COMBO_BOX(widget), text); + } + + gtk_combo_box_set_active(GTK_COMBO_BOX(widget), + purple_request_field_choice_get_default_value(field)); + + g_signal_connect(G_OBJECT(widget), "changed", + G_CALLBACK(field_choice_menu_cb), field); +#else GtkWidget *menu; GtkWidget *item; @@ -894,6 +918,7 @@ g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(field_choice_menu_cb), field); +#endif } else {