diff pidgin/gtkrequest.c @ 29804:93876452633b

Pull in GtkComboBox changes from GTK+3 branch. Refs #1332, since I seem to have just found it. *** Plucked rev c27b04bb38032682dfa343b38090df1c6eea4edd (qulogic@pidgin.im): Use GtkComboBox instead of GtkOptionMenu in the choice request field for GTK+ 2.4 and up. *** Plucked rev d440cb6510a85d0451248d51de56b02a3a60afd2 (qulogic@pidgin.im): Replace the GtkOptionMenu with a GtkComboBox for the privacy options list on GTK+ 2.4 and up. *** Plucked rev c32e5afffcda0d82fe8b69752ae91ce3dc3bcc61 (qulogic@pidgin.im): Replace GtkOptionMenu with GtkComboBox in the saved status editor for GTK+ 2.4 and up. *** Plucked rev fbe77efc06ba98af604ef878b97fd55924daa018 (qulogic@pidgin.im): Replace GtkOptionMenu with GtkComboBox in the gestures plugin for GTK+ 2.4 and up. But that code's commented out, so this is totally untested. *** Plucked rev 9d8f789a57f4477db7d3cfbb9752b7842ff790dd (qulogic@pidgin.im): Add an enumeration to replace a couple hardcoded numbers in the combo box code for saved statuses. *** Plucked rev c27b04bb38032682dfa343b38090df1c6eea4edd (qulogic@pidgin.im): Use GtkComboBox instead of GtkOptionMenu in the choice request field for GTK+ 2.4 and up. *** Plucked rev d440cb6510a85d0451248d51de56b02a3a60afd2 (qulogic@pidgin.im): Replace the GtkOptionMenu with a GtkComboBox for the privacy options list on GTK+ 2.4 and up. *** Plucked rev c32e5afffcda0d82fe8b69752ae91ce3dc3bcc61 (qulogic@pidgin.im): Replace GtkOptionMenu with GtkComboBox in the saved status editor for GTK+ 2.4 and up. *** Plucked rev fbe77efc06ba98af604ef878b97fd55924daa018 (qulogic@pidgin.im): Replace GtkOptionMenu with GtkComboBox in the gestures plugin for GTK+ 2.4 and up. But that code's commented out, so this is totally untested. *** Plucked rev 9d8f789a57f4477db7d3cfbb9752b7842ff790dd (qulogic@pidgin.im): Add an enumeration to replace a couple hardcoded numbers in the combo box code for saved statuses.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 19 Feb 2010 07:29:30 +0000
parents 422889fb57e0
children ded4c63c39a9
line wrap: on
line diff
--- a/pidgin/gtkrequest.c	Fri Feb 19 05:26:00 2010 +0000
+++ b/pidgin/gtkrequest.c	Fri Feb 19 07:29:30 2010 +0000
@@ -229,12 +229,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)
@@ -928,6 +937,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;
 
@@ -952,6 +976,7 @@
 
 		g_signal_connect(G_OBJECT(widget), "changed",
 						 G_CALLBACK(field_choice_menu_cb), field);
+#endif
 	}
 	else
 	{