+#else /* !GTK_CHECK_VERSION(2,0,0) */
+
+/*
+ * GTK 2 list box event handlers.
+ */
+
+static void listbox_doubleclick(GtkTreeView *treeview, GtkTreePath *path,
+ GtkTreeViewColumn *column, gpointer data)
+{
+ struct dlgparam *dp = (struct dlgparam *)data;
+ struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(treeview));
+ if (uc)
+ uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_ACTION);
+}
+
+static void listbox_selchange(GtkTreeSelection *treeselection,
+ gpointer data)
+{
+ struct dlgparam *dp = (struct dlgparam *)data;
+ GtkTreeView *tree = gtk_tree_selection_get_tree_view(treeselection);
+ struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(tree));
+ if (uc)
+ uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
+}
+
+struct draglist_valchange_ctx {
+ struct uctrl *uc;
+ struct dlgparam *dp;
+};
+
+static gboolean draglist_valchange(gpointer data)
+{
+ struct draglist_valchange_ctx *ctx =
+ (struct draglist_valchange_ctx *)data;
+
+ ctx->uc->ctrl->generic.handler(ctx->uc->ctrl, ctx->dp,
+ ctx->dp->data, EVENT_VALCHANGE);
+
+ sfree(ctx);
+
+ return FALSE;
+}
+
+static void listbox_reorder(GtkTreeModel *treemodel, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
+{
+ struct dlgparam *dp = (struct dlgparam *)data;
+ gpointer tree;
+ struct uctrl *uc;
+
+ if (dp->flags & FLAG_UPDATING_LISTBOX)
+ return; /* not a user drag operation */
+
+ tree = g_object_get_data(G_OBJECT(treemodel), "user-data");
+ uc = dlg_find_bywidget(dp, GTK_WIDGET(tree));
+ if (uc) {
+ /*
+ * We should cause EVENT_VALCHANGE on the list box, now
+ * that its rows have been reordered. However, the GTK 2
+ * docs say that at the point this signal is received the
+ * new row might not have actually been filled in yet.
+ *
+ * (So what smegging use is it then, eh? Don't suppose it
+ * occurred to you at any point that letting the
+ * application know _after_ the reordering was compelete
+ * might be helpful to someone?)
+ *
+ * To get round this, I schedule an idle function, which I
+ * hope won't be called until the main event loop is
+ * re-entered after the drag-and-drop handler has finished
+ * furtling with the list store.
+ */
+ struct draglist_valchange_ctx *ctx =
+ snew(struct draglist_valchange_ctx);
+ ctx->uc = uc;
+ ctx->dp = dp;
+ g_idle_add(draglist_valchange, ctx);
+ }
+}
+
+#endif /* !GTK_CHECK_VERSION(2,0,0) */
+
+#if !GTK_CHECK_VERSION(2,4,0)
+
+static void menuitem_activate(GtkMenuItem *item, gpointer data)
+{
+ struct dlgparam *dp = (struct dlgparam *)data;
+ GtkWidget *menushell = GTK_WIDGET(item)->parent;
+ gpointer optmenu = gtk_object_get_data(GTK_OBJECT(menushell), "user-data");
+ struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(optmenu));
+ uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
+}
+
+#else
+
+static void droplist_selchange(GtkComboBox *combo, gpointer data)
+{
+ struct dlgparam *dp = (struct dlgparam *)data;
+ struct uctrl *uc = dlg_find_bywidget(dp, GTK_WIDGET(combo));
+ if (uc)
+ uc->ctrl->generic.handler(uc->ctrl, dp, dp->data, EVENT_SELCHANGE);
+}
+
+#endif /* !GTK_CHECK_VERSION(2,4,0) */
+