cpw.qulogic.gtk3: c27b04bb: Use GtkComboBox instead of GtkOptionMenu...
qulogic at pidgin.im
qulogic at pidgin.im
Fri Apr 10 03:36:00 EDT 2009
-----------------------------------------------------------------
Revision: c27b04bb38032682dfa343b38090df1c6eea4edd
Ancestor: a59c150cbb9987c4d280a53fab7b29132bd23fff
Author: qulogic at pidgin.im
Date: 2009-04-09T04:11:01
Branch: im.pidgin.cpw.qulogic.gtk3
URL: http://d.pidgin.im/viewmtn/revision/info/c27b04bb38032682dfa343b38090df1c6eea4edd
Modified files:
pidgin/gtkrequest.c
ChangeLog:
Use GtkComboBox instead of GtkOptionMenu in the choice request field for
GTK+ 2.4 and up.
-------------- next part --------------
============================================================
--- pidgin/gtkrequest.c 7fea788d48c6cf310240672883771ca712fb3d4b
+++ pidgin/gtkrequest.c 912ad0379e31b4e962dbf9546734a2ccaafddeae
@@ -202,12 +202,21 @@ field_bool_cb(GtkToggleButton *button, P
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 @@ create_choice_field(PurpleRequestField *
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 @@ create_choice_field(PurpleRequestField *
g_signal_connect(G_OBJECT(widget), "changed",
G_CALLBACK(field_choice_menu_cb), field);
+#endif
}
else
{
More information about the Commits
mailing list