107 bv_extras potential_tgt_extras,
109 const gchar *dlg_title,
110 const gchar *actor_label,
111 const gchar *tgt_label,
112 const gchar *do_label,
113 GCallback do_callback)
117 GtkWidget *box, *grid;
122 GtkWidget *default_option = NULL;
123 GtkWidget *first_option = NULL;
127 const struct extra_type *default_extra = NULL;
133 dlg = gtk_dialog_new_with_buttons(dlg_title, NULL, 0,
134 _(
"Close"), GTK_RESPONSE_NO,
135 do_label, GTK_RESPONSE_YES,
138 gtk_dialog_set_default_response(GTK_DIALOG(dlg), GTK_RESPONSE_NO);
139 gtk_window_set_destroy_with_parent(GTK_WINDOW(dlg),
TRUE);
141 main_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
142 box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
144 lbl = gtk_label_new(actor_label);
145 gtk_box_append(GTK_BOX(box), lbl);
151 icon = gtk_image_new();
153 gtk_widget_set_size_request(icon, tuw, tuh);
154 gtk_box_append(GTK_BOX(box), icon);
157 gtk_box_append(GTK_BOX(box), lbl);
159 gtk_box_append(GTK_BOX(main_box), box);
161 sep = gtk_separator_new(GTK_ORIENTATION_HORIZONTAL);
162 gtk_box_append(GTK_BOX(main_box), sep);
164 lbl = gtk_label_new(tgt_label);
165 gtk_box_append(GTK_BOX(main_box), lbl);
167 grid = gtk_grid_new();
180 cbdata->
tp_id = ptgt->id;
183 radio = gtk_check_button_new();
184 gtk_check_button_set_group(GTK_CHECK_BUTTON(radio),
185 GTK_CHECK_BUTTON(first_option));
186 if (first_option == NULL) {
187 first_option = radio;
188 default_option = first_option;
189 default_extra = ptgt;
191 g_signal_connect(radio,
"toggled",
193 g_signal_connect(radio,
"destroy",
195 if (ptgt == suggested_tgt_extra) {
196 default_option = radio;
197 default_extra = suggested_tgt_extra;
199 gtk_grid_attach(GTK_GRID(grid), radio, 0, tcount, 1, 1);
203 icon = gtk_image_new_from_pixbuf(tubuf);
204 g_object_unref(tubuf);
206 icon = gtk_image_new();
208 gtk_widget_set_size_request(icon, tew, teh);
209 gtk_grid_attach(GTK_GRID(grid), icon, 1, tcount, 1, 1);
212 gtk_grid_attach(GTK_GRID(grid), lbl, 2, tcount, 1, 1);
216 gtk_box_append(GTK_BOX(main_box), grid);
219 gtk_check_button_set_active(GTK_CHECK_BUTTON(default_option),
TRUE);
221 gtk_box_append(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(
dlg))),
224 g_object_set_data(G_OBJECT(
dlg),
"actor", GINT_TO_POINTER(
actor->
id));
225 g_object_set_data(G_OBJECT(
dlg),
"tile", ptile);
230 if (default_extra != NULL) {
231 g_object_set_data(G_OBJECT(
dlg),
"target", GINT_TO_POINTER(default_extra->
id));
234 g_signal_connect(
dlg,
"response", do_callback,
actor);
236 gtk_widget_show(gtk_dialog_get_content_area(GTK_DIALOG(
dlg)));
237 gtk_widget_show(
dlg);