+ dp->flags |= FLAG_UPDATING_COMBO_LIST;
+
+#if !GTK_CHECK_VERSION(2,4,0)
+ if (uc->menu) {
+ /*
+ * List item in a drop-down (but non-combo) list. Tabs are
+ * ignored; we just provide a standard menu item with the
+ * text.
+ */
+ GtkWidget *menuitem = gtk_menu_item_new_with_label(text);
+
+ gtk_container_add(GTK_CONTAINER(uc->menu), menuitem);
+ gtk_widget_show(menuitem);
+
+ gtk_object_set_data(GTK_OBJECT(menuitem), "user-data",
+ GINT_TO_POINTER(id));
+ gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
+ GTK_SIGNAL_FUNC(menuitem_activate), dp);
+ goto done;
+ }
+ if (uc->list && uc->entry) {
+ /*
+ * List item in a combo-box list, which means the sensible
+ * thing to do is make it a perfectly normal label. Hence
+ * tabs are disregarded.
+ */
+ GtkWidget *listitem = gtk_list_item_new_with_label(text);
+
+ gtk_container_add(GTK_CONTAINER(uc->list), listitem);
+ gtk_widget_show(listitem);
+
+ gtk_object_set_data(GTK_OBJECT(listitem), "user-data",
+ GINT_TO_POINTER(id));
+ goto done;
+ }
+#endif
+#if !GTK_CHECK_VERSION(2,0,0)
+ if (uc->list) {
+ /*
+ * List item in a non-combo-box list box. We make all of
+ * these Columns containing GtkLabels. This allows us to do
+ * the nasty force_left hack irrespective of whether there
+ * are tabs in the thing.
+ */
+ GtkWidget *listitem = gtk_list_item_new();
+ GtkWidget *cols = columns_new(10);
+ gint *percents;
+ int i, ncols;
+
+ /* Count the tabs in the text, and hence determine # of columns. */
+ ncols = 1;
+ for (i = 0; text[i]; i++)
+ if (text[i] == '\t')
+ ncols++;
+
+ assert(ncols <=
+ (uc->ctrl->listbox.ncols ? uc->ctrl->listbox.ncols : 1));
+ percents = snewn(ncols, gint);
+ percents[ncols-1] = 100;
+ for (i = 0; i < ncols-1; i++) {
+ percents[i] = uc->ctrl->listbox.percentages[i];
+ percents[ncols-1] -= percents[i];
+ }
+ columns_set_cols(COLUMNS(cols), ncols, percents);
+ sfree(percents);
+
+ for (i = 0; i < ncols; i++) {
+ int len = strcspn(text, "\t");
+ char *dup = dupprintf("%.*s", len, text);
+ GtkWidget *label;
+
+ text += len;
+ if (*text) text++;
+ label = gtk_label_new(dup);
+ sfree(dup);
+
+ columns_add(COLUMNS(cols), label, i, 1);
+ columns_force_left_align(COLUMNS(cols), label);
+ gtk_widget_show(label);
+ }
+ gtk_container_add(GTK_CONTAINER(listitem), cols);
+ gtk_widget_show(cols);
+ gtk_container_add(GTK_CONTAINER(uc->list), listitem);
+ gtk_widget_show(listitem);
+
+ if (ctrl->listbox.multisel) {
+ gtk_signal_connect(GTK_OBJECT(listitem), "key_press_event",
+ GTK_SIGNAL_FUNC(listitem_multi_key), uc->adj);
+ } else {
+ gtk_signal_connect(GTK_OBJECT(listitem), "key_press_event",
+ GTK_SIGNAL_FUNC(listitem_single_key), uc->adj);
+ }
+ gtk_signal_connect(GTK_OBJECT(listitem), "focus_in_event",
+ GTK_SIGNAL_FUNC(widget_focus), dp);
+ gtk_signal_connect(GTK_OBJECT(listitem), "button_press_event",
+ GTK_SIGNAL_FUNC(listitem_button_press), dp);
+ gtk_signal_connect(GTK_OBJECT(listitem), "button_release_event",
+ GTK_SIGNAL_FUNC(listitem_button_release), dp);
+ gtk_object_set_data(GTK_OBJECT(listitem), "user-data",
+ GINT_TO_POINTER(id));
+ goto done;