diff pidgin/plugins/crazychat/cc_features.c @ 20028:a2b4eac83902

Part of #1332 to introduce pidgin_text_combo_box_new_entry and accessor functions. I made some changes to: * Not leak * Popup the dropdown when up/down arrows are pressed, to imitate the old behaviour to some extent. * Change the accessor defines to accessor functions. I think this all works OK now. Yell at me if things don't work, and then fix it. :-P
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Fri, 14 Sep 2007 08:27:26 +0000
parents 5fe8042783c1
children a8cc50c2279f
line wrap: on
line diff
--- a/pidgin/plugins/crazychat/cc_features.c	Fri Sep 14 06:00:03 2007 +0000
+++ b/pidgin/plugins/crazychat/cc_features.c	Fri Sep 14 08:27:26 2007 +0000
@@ -155,20 +155,16 @@
 	gtk_box_pack_start(GTK_BOX(ret.vbox), hbox, FALSE, FALSE, 0);
 	gtk_widget_show(hbox);
 
-	GtkWidget *model_combo = gtk_combo_new();
 	GList *glist = NULL;
-
 	glist = g_list_append(glist, "Dog");
 	glist = g_list_append(glist, "Shark");
-	gtk_combo_set_popdown_strings(GTK_COMBO(model_combo), glist);
+	instance->model = pidgin_text_combo_box_entry_new(NULL, glist);
 	g_list_free(glist);
 	//gtk_combo_box_set_column_span_column(GTK_COMBO(model_combo),
 	//		10);
-	gtk_box_pack_start(GTK_BOX(hbox), model_combo, TRUE, TRUE, 0);
-	gtk_widget_show(model_combo);
-	instance->model = model_combo;
+	gtk_box_pack_start(GTK_BOX(hbox), instance->model, TRUE, TRUE, 0);
+	gtk_widget_show(instance->model);
 
-	GtkWidget *head_material_combo = gtk_combo_new();
 	glist = NULL;
 	glist = g_list_append(glist, "Red");
 	glist = g_list_append(glist, "Dark Brown");
@@ -176,15 +172,13 @@
 	glist = g_list_append(glist, "White");
 	glist = g_list_append(glist, "Green");
 	glist = g_list_append(glist, "Black");
-	gtk_combo_set_popdown_strings(GTK_COMBO(head_material_combo), glist);
+	instance->head = pidgin_text_combo_box_entry_new(NULL, glist);
 	g_list_free(glist);
 	//gtk_combo_box_set_column_span_column(GTK_COMBO(head_material_combo),
 	//		10);
-	gtk_box_pack_start(GTK_BOX(hbox), head_material_combo, TRUE, TRUE, 0);
-	gtk_widget_show(head_material_combo);
-	instance->head = head_material_combo;
+	gtk_box_pack_start(GTK_BOX(hbox), instance->head, TRUE, TRUE, 0);
+	gtk_widget_show(instance->head);
 
-	GtkWidget *appendage_material_combo = gtk_combo_new();
 	glist = NULL;
 	glist = g_list_append(glist, "Red");
 	glist = g_list_append(glist, "Dark Brown");
@@ -192,20 +186,17 @@
 	glist = g_list_append(glist, "White");
 	glist = g_list_append(glist, "Green");
 	glist = g_list_append(glist, "Black");
-	gtk_combo_set_popdown_strings(GTK_COMBO(appendage_material_combo),
-			glist);
+	instance->appendage = pidgin_text_combo_box_entry_new(NULL, glist);
 	g_list_free(glist);
 	//gtk_combo_box_set_column_span_column(GTK_COMBO(appendage_material_combo), 10);
-	gtk_box_pack_start(GTK_BOX(hbox), appendage_material_combo,
+	gtk_box_pack_start(GTK_BOX(hbox), instance->appendage,
 			TRUE, TRUE, 0);
-	gtk_widget_show(appendage_material_combo);
-	instance->appendage = appendage_material_combo;
+	gtk_widget_show(instance->appendage);
 
 	hbox = gtk_hbox_new(TRUE, 0);
 	gtk_box_pack_start(GTK_BOX(ret.vbox), hbox, FALSE, FALSE, 0);
 	gtk_widget_show(hbox);
 	
-	GtkWidget *lids_material_combo = gtk_combo_new();
 	glist = NULL;
 	glist = g_list_append(glist, "Red");
 	glist = g_list_append(glist, "Dark Brown");
@@ -213,14 +204,12 @@
 	glist = g_list_append(glist, "White");
 	glist = g_list_append(glist, "Green");
 	glist = g_list_append(glist, "Black");
-	gtk_combo_set_popdown_strings(GTK_COMBO(lids_material_combo), glist);
+	instance->lid = pidgin_text_combo_box_entry_new(NULL, glist);
 	g_list_free(glist);
 	//gtk_combo_box_set_column_span_column(GTK_COMBO(lids_material_combo), 10);
-	gtk_box_pack_start(GTK_BOX(hbox), lids_material_combo, TRUE, TRUE, 0);
-	gtk_widget_show(lids_material_combo);
-	instance->lid = lids_material_combo;
+	gtk_box_pack_start(GTK_BOX(hbox), instance->lid, TRUE, TRUE, 0);
+	gtk_widget_show(instance->lid);
 
-	GtkWidget *left_iris_material_combo = gtk_combo_new();
 	glist = NULL;
 	glist = g_list_append(glist, "Red");
 	glist = g_list_append(glist, "Dark Brown");
@@ -228,17 +217,13 @@
 	glist = g_list_append(glist, "White");
 	glist = g_list_append(glist, "Green");
 	glist = g_list_append(glist, "Black");
-	gtk_combo_set_popdown_strings(GTK_COMBO(left_iris_material_combo),
-			glist);
+	instance->left_iris = pidgin_text_combo_box_entry_new(NULL, glist);
 	g_list_free(glist);
 	//gtk_combo_box_set_column_span_column(GTK_COMBO(left_iris_material_combo), 10);
-	gtk_box_pack_start(GTK_BOX(hbox), left_iris_material_combo,
-			TRUE, TRUE, 0);
-	gtk_widget_show(left_iris_material_combo);
-	instance->left_iris = left_iris_material_combo;
+	gtk_box_pack_start(GTK_BOX(hbox), instance->left_iris, TRUE, TRUE, 0);
+	gtk_widget_show(instance->left_iris);
 
 	/*
-	GtkWidget *right_iris_material_combo = gtk_combo_new();
 	glist = NULL;
 	glist = g_list_append(glist, "Red");
 	glist = g_list_append(glist, "Dark Brown");
@@ -246,14 +231,11 @@
 	glist = g_list_append(glist, "White");
 	glist = g_list_append(glist, "Green");
 	glist = g_list_append(glist, "Black");
-	gtk_combo_set_popdown_strings(GTK_COMBO(right_iris_material_combo),
-			glist);
+	instance->right_iris = pidgin_text_combo_box_entry_new(NULL, glist);
 	g_list_free(glist);
 	//gtk_combo_box_set_column_span_column(GTK_COMBO(right_iris_material_combo), 10);
-	gtk_box_pack_start(GTK_BOX(hbox), right_iris_material_combo,
-			TRUE, TRUE, 0);
-	gtk_widget_show(right_iris_material_combo);
-	instance->right_iris = right_iris_material_combo;
+	gtk_box_pack_start(GTK_BOX(hbox), instance->right_iris, TRUE, TRUE, 0);
+	gtk_widget_show(instance->right_iris);
 */
 	gtk_widget_add_events(ret.draw_area, GDK_BUTTON_PRESS_MASK);
 	g_signal_connect(G_OBJECT(ret.draw_area), "button_press_event",