+ GtkWidget *dialog = gtk_dialog_new_with_buttons (title,
+ parent,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+ /* When something is selected then OK */
+ gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT );
+ GtkWidget *response_w = NULL;
+#if GTK_CHECK_VERSION (2, 20, 0)
+ /* Default to not apply - as initially nothing is selected! */
+ response_w = gtk_dialog_get_widget_for_response ( GTK_DIALOG(dialog), GTK_RESPONSE_REJECT );
+#endif
+ GtkListStore *store = gtk_list_store_new(1, G_TYPE_STRING);
+
+ GtkWidget *scrolledwindow;
+
+ GList *runner = names;
+ while (runner)
+ {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter, 0, runner->data, -1);
+ runner = g_list_next(runner);
+ }
+
+ view = gtk_tree_view_new();
+ renderer = gtk_cell_renderer_text_new();
+ // Use the column header to display the message text,
+ // this makes the overall widget allocation simple as treeview takes up all the space
+ gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(view), -1, msg, renderer, "text", 0, NULL);
+ gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store));
+ gtk_tree_view_set_headers_visible( GTK_TREE_VIEW(view), TRUE);
+ gtk_tree_selection_set_mode( gtk_tree_view_get_selection(GTK_TREE_VIEW(view)),
+ multiple_selection_allowed ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_BROWSE );
+ g_object_unref(store);
+
+ scrolledwindow = gtk_scrolled_window_new ( NULL, NULL );
+ gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC );
+ gtk_container_add ( GTK_CONTAINER(scrolledwindow), view );
+
+ gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), scrolledwindow, TRUE, TRUE, 0 );
+ // Ensure a reasonable number of items are shown, but let the width be automatically sized
+ gtk_widget_set_size_request ( dialog, -1, 400) ;
+
+ gtk_widget_show_all ( dialog );
+
+ if ( response_w )
+ gtk_widget_grab_focus ( response_w );
+
+ while ( gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT )
+ {
+ GList *names = NULL;
+ GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
+ gtk_tree_selection_selected_foreach(selection, get_selected_foreach_func, &names);
+ if (names)
+ {
+ gtk_widget_destroy ( dialog );
+ return (names);