comparison 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
comparison
equal deleted inserted replaced
29800:fa8a25b46252 29804:93876452633b
227 { 227 {
228 purple_request_field_bool_set_value(field, 228 purple_request_field_bool_set_value(field,
229 gtk_toggle_button_get_active(button)); 229 gtk_toggle_button_get_active(button));
230 } 230 }
231 231
232 #if GTK_CHECK_VERSION(2,4,0)
233 static void
234 field_choice_menu_cb(GtkComboBox *menu, PurpleRequestField *field)
235 {
236 purple_request_field_choice_set_value(field,
237 gtk_combo_box_get_active(menu));
238 }
239 #else
232 static void 240 static void
233 field_choice_menu_cb(GtkOptionMenu *menu, PurpleRequestField *field) 241 field_choice_menu_cb(GtkOptionMenu *menu, PurpleRequestField *field)
234 { 242 {
235 purple_request_field_choice_set_value(field, 243 purple_request_field_choice_set_value(field,
236 gtk_option_menu_get_history(menu)); 244 gtk_option_menu_get_history(menu));
237 } 245 }
246 #endif
238 247
239 static void 248 static void
240 field_choice_option_cb(GtkRadioButton *button, PurpleRequestField *field) 249 field_choice_option_cb(GtkRadioButton *button, PurpleRequestField *field)
241 { 250 {
242 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) 251 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
926 int num_labels = g_list_length(labels); 935 int num_labels = g_list_length(labels);
927 GList *l; 936 GList *l;
928 937
929 if (num_labels > 5) 938 if (num_labels > 5)
930 { 939 {
940 #if GTK_CHECK_VERSION(2,4,0)
941 widget = gtk_combo_box_new_text();
942
943 for (l = labels; l != NULL; l = l->next)
944 {
945 const char *text = l->data;
946 gtk_combo_box_append_text(GTK_COMBO_BOX(widget), text);
947 }
948
949 gtk_combo_box_set_active(GTK_COMBO_BOX(widget),
950 purple_request_field_choice_get_default_value(field));
951
952 g_signal_connect(G_OBJECT(widget), "changed",
953 G_CALLBACK(field_choice_menu_cb), field);
954 #else
931 GtkWidget *menu; 955 GtkWidget *menu;
932 GtkWidget *item; 956 GtkWidget *item;
933 957
934 widget = gtk_option_menu_new(); 958 widget = gtk_option_menu_new();
935 959
950 gtk_option_menu_set_history(GTK_OPTION_MENU(widget), 974 gtk_option_menu_set_history(GTK_OPTION_MENU(widget),
951 purple_request_field_choice_get_default_value(field)); 975 purple_request_field_choice_get_default_value(field));
952 976
953 g_signal_connect(G_OBJECT(widget), "changed", 977 g_signal_connect(G_OBJECT(widget), "changed",
954 G_CALLBACK(field_choice_menu_cb), field); 978 G_CALLBACK(field_choice_menu_cb), field);
979 #endif
955 } 980 }
956 else 981 else
957 { 982 {
958 GtkWidget *box; 983 GtkWidget *box;
959 GtkWidget *first_radio = NULL; 984 GtkWidget *first_radio = NULL;