106 GtkWidget *
dshell, *dlabel, *vgrid, *bbox;
109 dshell = gtk_window_new();
112 gtk_window_set_title(GTK_WINDOW(
dshell),
name);
114 gtk_window_set_transient_for(GTK_WINDOW(
dshell), parent);
115 gtk_window_set_destroy_with_parent(GTK_WINDOW(
dshell),
TRUE);
117 vgrid = gtk_grid_new();
118 gtk_orientable_set_orientation(GTK_ORIENTABLE(vgrid),
119 GTK_ORIENTATION_VERTICAL);
120 gtk_grid_set_row_spacing(GTK_GRID(vgrid), 5);
121 gtk_window_set_child(GTK_WINDOW(
dshell), vgrid);
123 gtk_widget_set_margin_start(vgrid, 5);
124 gtk_widget_set_margin_end(vgrid, 5);
125 gtk_widget_set_margin_top(vgrid, 5);
126 gtk_widget_set_margin_bottom(vgrid, 5);
128 dlabel = gtk_label_new(text);
129 gtk_grid_attach(GTK_GRID(vgrid), dlabel, 0, grid_row++, 1, 1);
131 bbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
132 gtk_grid_attach(GTK_GRID(vgrid), bbox, 0, grid_row++, 1, 1);
134 g_object_set_data(G_OBJECT(
dshell),
"bbox", bbox);
135 g_object_set_data(G_OBJECT(
dshell),
"nbuttons", GINT_TO_POINTER(0));
136 g_object_set_data(G_OBJECT(
dshell),
"hide", GINT_TO_POINTER(
FALSE));
138 gtk_widget_show(vgrid);
139 gtk_widget_show(dlabel);
161 GCallback handler, gpointer data,
162 bool meta,
const gchar *tool_tip)
164 GtkWidget *button, *bbox;
168 bbox = g_object_get_data(G_OBJECT(
dshell),
"bbox");
170 g_object_set_data(G_OBJECT(
dshell),
"nbuttons", GINT_TO_POINTER(nbuttons+1));
174 button = gtk_button_new_with_mnemonic(label);
175 gtk_box_append(GTK_BOX(bbox), button);
176 g_object_set_data(G_OBJECT(
dshell),
name, button);
179 g_signal_connect(button,
"clicked", handler, data);
184 g_signal_connect_after(button,
"clicked",
188 if (tool_tip != NULL) {
189 gtk_widget_set_tooltip_text(button, tool_tip);
void choice_dialog_add(GtkWidget *dshell, const gchar *label, GCallback handler, gpointer data, bool meta, const gchar *tool_tip)