]>
Commit | Line | Data |
---|---|---|
50a14534 EB |
1 | /* |
2 | * viking -- GPS Data and Topo Analyzer, Explorer, and Manager | |
3 | * | |
4 | * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net> | |
a482007a | 5 | * Copyright (C) 2008, Hein Ragas <viking@ragas.nl> |
24a6d212 | 6 | * Copyright (C) 2010-2014, Rob Norris <rw_norris@hotmail.com> |
50a14534 EB |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2 of the License, or | |
11 | * (at your option) any later version. | |
12 | * | |
13 | * This program is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with this program; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | * | |
22 | */ | |
23 | ||
4c77d5e0 GB |
24 | #ifdef HAVE_CONFIG_H |
25 | #include "config.h" | |
26 | #endif | |
27 | ||
50a14534 | 28 | #include "viking.h" |
dfad9456 | 29 | #include "degrees_converters.h" |
e8947958 | 30 | #include "authors.h" |
eb6a42c9 | 31 | #include "documenters.h" |
bc34c059 | 32 | #include "ui_util.h" |
50a14534 | 33 | |
4c77d5e0 GB |
34 | #include <glib/gi18n.h> |
35 | ||
50a14534 EB |
36 | #include <stdlib.h> |
37 | #include <string.h> | |
38 | #include <ctype.h> | |
39 | ||
40 | void a_dialog_msg ( GtkWindow *parent, gint type, const gchar *info, const gchar *extra ) | |
41 | { | |
42 | GtkWidget *msgbox = gtk_message_dialog_new ( parent, GTK_DIALOG_DESTROY_WITH_PARENT, type, GTK_BUTTONS_OK, info, extra ); | |
43 | gtk_dialog_run ( GTK_DIALOG(msgbox) ); | |
44 | gtk_widget_destroy ( msgbox ); | |
45 | } | |
46 | ||
47 | gboolean a_dialog_goto_latlon ( GtkWindow *parent, struct LatLon *ll, const struct LatLon *old ) | |
48 | { | |
7760b0cf | 49 | GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Go to Lat/Lon"), |
50a14534 EB |
50 | parent, |
51 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
52 | GTK_STOCK_CANCEL, | |
53 | GTK_RESPONSE_REJECT, | |
54 | GTK_STOCK_OK, | |
55 | GTK_RESPONSE_ACCEPT, | |
56 | NULL); | |
57 | GtkWidget *latlabel, *lonlabel; | |
58 | GtkWidget *lat, *lon; | |
59 | gchar *tmp_lat, *tmp_lon; | |
60 | ||
7760b0cf | 61 | latlabel = gtk_label_new (_("Latitude:")); |
50a14534 EB |
62 | lat = gtk_entry_new (); |
63 | tmp_lat = g_strdup_printf ( "%f", old->lat ); | |
64 | gtk_entry_set_text ( GTK_ENTRY(lat), tmp_lat ); | |
65 | g_free ( tmp_lat ); | |
66 | ||
7760b0cf | 67 | lonlabel = gtk_label_new (_("Longitude:")); |
50a14534 EB |
68 | lon = gtk_entry_new (); |
69 | tmp_lon = g_strdup_printf ( "%f", old->lon ); | |
70 | gtk_entry_set_text ( GTK_ENTRY(lon), tmp_lon ); | |
71 | g_free ( tmp_lon ); | |
72 | ||
73 | gtk_widget_show ( latlabel ); | |
74 | gtk_widget_show ( lonlabel ); | |
75 | gtk_widget_show ( lat ); | |
76 | gtk_widget_show ( lon ); | |
77 | ||
9b082b39 RN |
78 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), latlabel, FALSE, FALSE, 0); |
79 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), lat, FALSE, FALSE, 0); | |
80 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), lonlabel, FALSE, FALSE, 0); | |
81 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), lon, FALSE, FALSE, 0); | |
50a14534 | 82 | |
6c90d9d1 RN |
83 | // 'ok' when press return in the entry |
84 | g_signal_connect_swapped (lat, "activate", G_CALLBACK(a_dialog_response_accept), dialog); | |
85 | g_signal_connect_swapped (lon, "activate", G_CALLBACK(a_dialog_response_accept), dialog); | |
86 | ||
355fba11 RN |
87 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); |
88 | ||
50a14534 EB |
89 | if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) |
90 | { | |
dfad9456 GB |
91 | ll->lat = convert_dms_to_dec ( gtk_entry_get_text ( GTK_ENTRY(lat) ) ); |
92 | ll->lon = convert_dms_to_dec ( gtk_entry_get_text ( GTK_ENTRY(lon) ) ); | |
50a14534 EB |
93 | gtk_widget_destroy ( dialog ); |
94 | return TRUE; | |
95 | } | |
96 | ||
97 | gtk_widget_destroy ( dialog ); | |
98 | return FALSE; | |
99 | } | |
100 | ||
101 | gboolean a_dialog_goto_utm ( GtkWindow *parent, struct UTM *utm, const struct UTM *old ) | |
102 | { | |
a0f3579f | 103 | GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Go to UTM"), |
50a14534 EB |
104 | parent, |
105 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
106 | GTK_STOCK_CANCEL, | |
107 | GTK_RESPONSE_REJECT, | |
108 | GTK_STOCK_OK, | |
109 | GTK_RESPONSE_ACCEPT, | |
110 | NULL); | |
111 | GtkWidget *norlabel, *easlabel, *nor, *eas; | |
112 | GtkWidget *zonehbox, *zonespin, *letterentry; | |
113 | gchar *tmp_eas, *tmp_nor; | |
114 | gchar tmp_letter[2]; | |
115 | ||
7760b0cf | 116 | norlabel = gtk_label_new (_("Northing:")); |
50a14534 EB |
117 | nor = gtk_entry_new (); |
118 | tmp_nor = g_strdup_printf("%ld", (long) old->northing ); | |
119 | gtk_entry_set_text ( GTK_ENTRY(nor), tmp_nor ); | |
120 | g_free ( tmp_nor ); | |
121 | ||
7760b0cf | 122 | easlabel = gtk_label_new (_("Easting:")); |
50a14534 EB |
123 | eas = gtk_entry_new (); |
124 | tmp_eas = g_strdup_printf("%ld", (long) old->easting ); | |
125 | gtk_entry_set_text ( GTK_ENTRY(eas), tmp_eas ); | |
126 | g_free ( tmp_eas ); | |
127 | ||
128 | zonehbox = gtk_hbox_new ( FALSE, 0 ); | |
7760b0cf | 129 | gtk_box_pack_start ( GTK_BOX(zonehbox), gtk_label_new ( _("Zone:") ), FALSE, FALSE, 5 ); |
ac33062d | 130 | zonespin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( old->zone, 1, 60, 1, 5, 0 ), 1, 0 ); |
50a14534 | 131 | gtk_box_pack_start ( GTK_BOX(zonehbox), zonespin, TRUE, TRUE, 5 ); |
7760b0cf | 132 | gtk_box_pack_start ( GTK_BOX(zonehbox), gtk_label_new ( _("Letter:") ), FALSE, FALSE, 5 ); |
50a14534 EB |
133 | letterentry = gtk_entry_new (); |
134 | gtk_entry_set_max_length ( GTK_ENTRY(letterentry), 1 ); | |
135 | gtk_entry_set_width_chars ( GTK_ENTRY(letterentry), 2 ); | |
136 | tmp_letter[0] = old->letter; | |
137 | tmp_letter[1] = '\0'; | |
138 | gtk_entry_set_text ( GTK_ENTRY(letterentry), tmp_letter ); | |
139 | gtk_box_pack_start ( GTK_BOX(zonehbox), letterentry, FALSE, FALSE, 5 ); | |
140 | ||
141 | gtk_widget_show ( norlabel ); | |
142 | gtk_widget_show ( easlabel ); | |
143 | gtk_widget_show ( nor ); | |
144 | gtk_widget_show ( eas ); | |
145 | ||
146 | gtk_widget_show_all ( zonehbox ); | |
147 | ||
9b082b39 RN |
148 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), norlabel, FALSE, FALSE, 0); |
149 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), nor, FALSE, FALSE, 0); | |
150 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), easlabel, FALSE, FALSE, 0); | |
151 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), eas, FALSE, FALSE, 0); | |
152 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), zonehbox, FALSE, FALSE, 0); | |
50a14534 | 153 | |
355fba11 RN |
154 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); |
155 | ||
50a14534 EB |
156 | if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) |
157 | { | |
158 | const gchar *letter; | |
159 | utm->northing = atof ( gtk_entry_get_text ( GTK_ENTRY(nor) ) ); | |
160 | utm->easting = atof ( gtk_entry_get_text ( GTK_ENTRY(eas) ) ); | |
161 | utm->zone = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(zonespin) ); | |
162 | letter = gtk_entry_get_text ( GTK_ENTRY(letterentry) ); | |
163 | if (*letter) | |
164 | utm->letter = toupper(*letter); | |
165 | gtk_widget_destroy ( dialog ); | |
166 | return TRUE; | |
167 | } | |
168 | ||
169 | gtk_widget_destroy ( dialog ); | |
170 | return FALSE; | |
171 | } | |
172 | ||
173 | void a_dialog_response_accept ( GtkDialog *dialog ) | |
174 | { | |
175 | gtk_dialog_response ( dialog, GTK_RESPONSE_ACCEPT ); | |
176 | } | |
177 | ||
7767aa02 QT |
178 | static void get_selected_foreach_func(GtkTreeModel *model, |
179 | GtkTreePath *path, | |
180 | GtkTreeIter *iter, | |
181 | gpointer data) | |
182 | { | |
183 | GList **list = data; | |
184 | gchar *name; | |
185 | gtk_tree_model_get (model, iter, 0, &name, -1); | |
186 | *list = g_list_prepend(*list, name); | |
187 | } | |
188 | ||
02bba540 | 189 | GList *a_dialog_select_from_list ( GtkWindow *parent, GList *names, gboolean multiple_selection_allowed, const gchar *title, const gchar *msg ) |
291edcab HR |
190 | { |
191 | GtkTreeIter iter; | |
192 | GtkCellRenderer *renderer; | |
193 | GtkWidget *view; | |
194 | ||
7767aa02 | 195 | GtkWidget *dialog = gtk_dialog_new_with_buttons (title, |
291edcab HR |
196 | parent, |
197 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
198 | GTK_STOCK_CANCEL, | |
199 | GTK_RESPONSE_REJECT, | |
200 | GTK_STOCK_OK, | |
201 | GTK_RESPONSE_ACCEPT, | |
202 | NULL); | |
93ece96d RN |
203 | /* When something is selected then OK */ |
204 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); | |
205 | GtkWidget *response_w = NULL; | |
206 | #if GTK_CHECK_VERSION (2, 20, 0) | |
207 | /* Default to not apply - as initially nothing is selected! */ | |
208 | response_w = gtk_dialog_get_widget_for_response ( GTK_DIALOG(dialog), GTK_RESPONSE_REJECT ); | |
209 | #endif | |
291edcab HR |
210 | GtkListStore *store = gtk_list_store_new(1, G_TYPE_STRING); |
211 | ||
a814d755 RN |
212 | GtkWidget *scrolledwindow; |
213 | ||
02bba540 RN |
214 | GList *runner = names; |
215 | while (runner) | |
291edcab | 216 | { |
15f45edc | 217 | gtk_list_store_append(store, &iter); |
02bba540 RN |
218 | gtk_list_store_set(store, &iter, 0, runner->data, -1); |
219 | runner = g_list_next(runner); | |
291edcab | 220 | } |
291edcab HR |
221 | |
222 | view = gtk_tree_view_new(); | |
223 | renderer = gtk_cell_renderer_text_new(); | |
a814d755 RN |
224 | // Use the column header to display the message text, |
225 | // this makes the overall widget allocation simple as treeview takes up all the space | |
be64b02f RN |
226 | GtkTreeViewColumn *column; |
227 | column = gtk_tree_view_column_new_with_attributes (msg, renderer, "text", 0, NULL ); | |
228 | gtk_tree_view_column_set_sort_column_id (column, 0); | |
229 | gtk_tree_view_append_column (GTK_TREE_VIEW (view), column); | |
230 | ||
291edcab | 231 | gtk_tree_view_set_model(GTK_TREE_VIEW(view), GTK_TREE_MODEL(store)); |
7767aa02 QT |
232 | gtk_tree_selection_set_mode( gtk_tree_view_get_selection(GTK_TREE_VIEW(view)), |
233 | multiple_selection_allowed ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_BROWSE ); | |
291edcab HR |
234 | g_object_unref(store); |
235 | ||
a814d755 RN |
236 | scrolledwindow = gtk_scrolled_window_new ( NULL, NULL ); |
237 | gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW(scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC ); | |
238 | gtk_container_add ( GTK_CONTAINER(scrolledwindow), view ); | |
239 | ||
9b082b39 | 240 | gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), scrolledwindow, TRUE, TRUE, 0 ); |
a814d755 RN |
241 | // Ensure a reasonable number of items are shown, but let the width be automatically sized |
242 | gtk_widget_set_size_request ( dialog, -1, 400) ; | |
243 | ||
244 | gtk_widget_show_all ( dialog ); | |
291edcab | 245 | |
93ece96d RN |
246 | if ( response_w ) |
247 | gtk_widget_grab_focus ( response_w ); | |
248 | ||
291edcab HR |
249 | while ( gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT ) |
250 | { | |
c60f82df | 251 | GList *names_selected = NULL; |
291edcab | 252 | GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); |
c60f82df RN |
253 | gtk_tree_selection_selected_foreach(selection, get_selected_foreach_func, &names_selected); |
254 | if (names_selected) | |
291edcab | 255 | { |
291edcab | 256 | gtk_widget_destroy ( dialog ); |
c60f82df | 257 | return names_selected; |
291edcab | 258 | } |
7767aa02 | 259 | a_dialog_error_msg(parent, _("Nothing was selected")); |
291edcab HR |
260 | } |
261 | gtk_widget_destroy ( dialog ); | |
262 | return NULL; | |
263 | } | |
264 | ||
fb40bae0 | 265 | gchar *a_dialog_new_track ( GtkWindow *parent, gchar *default_name, gboolean is_route ) |
50a14534 | 266 | { |
e37b2a6d | 267 | GtkWidget *dialog = gtk_dialog_new_with_buttons ( is_route ? _("Add Route") : _("Add Track"), |
50a14534 EB |
268 | parent, |
269 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
270 | GTK_STOCK_CANCEL, | |
271 | GTK_RESPONSE_REJECT, | |
272 | GTK_STOCK_OK, | |
273 | GTK_RESPONSE_ACCEPT, | |
274 | NULL); | |
e37b2a6d | 275 | GtkWidget *label = gtk_label_new ( is_route ? _("Route Name:") : _("Track Name:") ); |
50a14534 EB |
276 | GtkWidget *entry = gtk_entry_new (); |
277 | ||
e13ab673 RN |
278 | if (default_name) |
279 | gtk_entry_set_text ( GTK_ENTRY(entry), default_name ); | |
280 | ||
9b082b39 RN |
281 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label, FALSE, FALSE, 0); |
282 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), entry, FALSE, FALSE, 0); | |
50a14534 EB |
283 | |
284 | g_signal_connect_swapped ( entry, "activate", G_CALLBACK(a_dialog_response_accept), GTK_DIALOG(dialog) ); | |
285 | ||
286 | gtk_widget_show ( label ); | |
287 | gtk_widget_show ( entry ); | |
288 | ||
79d73727 RN |
289 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); |
290 | ||
50a14534 EB |
291 | while ( gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT ) |
292 | { | |
293 | const gchar *constname = gtk_entry_get_text ( GTK_ENTRY(entry) ); | |
294 | if ( *constname == '\0' ) | |
7760b0cf | 295 | a_dialog_info_msg ( parent, _("Please enter a name for the track.") ); |
50a14534 EB |
296 | else { |
297 | gchar *name = g_strdup ( constname ); | |
00277caf RN |
298 | gtk_widget_destroy ( dialog ); |
299 | return name; | |
50a14534 EB |
300 | } |
301 | } | |
302 | gtk_widget_destroy ( dialog ); | |
303 | return NULL; | |
304 | } | |
305 | ||
23d6216c RN |
306 | static void today_clicked (GtkWidget *cal) |
307 | { | |
c2b57ea5 RN |
308 | GDateTime *now = g_date_time_new_now_local (); |
309 | gtk_calendar_select_month ( GTK_CALENDAR(cal), g_date_time_get_month(now)-1, g_date_time_get_year(now) ); | |
310 | gtk_calendar_select_day ( GTK_CALENDAR(cal), g_date_time_get_day_of_month(now) ); | |
311 | g_date_time_unref ( now ); | |
23d6216c RN |
312 | } |
313 | ||
a77c32c8 RN |
314 | /** |
315 | * a_dialog_get_date: | |
316 | * | |
317 | * Returns: a date as a string - always in ISO8601 format (YYYY-MM-DD) | |
318 | * This string can be NULL (especially when the dialog is cancelled) | |
319 | * Free the string after use | |
320 | */ | |
321 | gchar *a_dialog_get_date ( GtkWindow *parent, const gchar *title ) | |
322 | { | |
323 | GtkWidget *dialog = gtk_dialog_new_with_buttons ( title, | |
324 | parent, | |
325 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
326 | GTK_STOCK_CANCEL, | |
327 | GTK_RESPONSE_REJECT, | |
328 | GTK_STOCK_OK, | |
329 | GTK_RESPONSE_ACCEPT, | |
330 | NULL); | |
331 | GtkWidget *cal = gtk_calendar_new (); | |
23d6216c RN |
332 | GtkWidget *today = gtk_button_new_with_label ( _("Today") ); |
333 | ||
334 | static guint year = 0; | |
335 | static guint month = 0; | |
336 | static guint day = 0; | |
a77c32c8 | 337 | |
c2b57ea5 RN |
338 | if ( year != 0 ) { |
339 | // restore the last selected date | |
23d6216c RN |
340 | gtk_calendar_select_month ( GTK_CALENDAR(cal), month, year ); |
341 | gtk_calendar_select_day ( GTK_CALENDAR(cal), day ); | |
342 | } | |
343 | ||
344 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), today, FALSE, FALSE, 0); | |
a77c32c8 RN |
345 | gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), cal, FALSE, FALSE, 0); |
346 | ||
23d6216c RN |
347 | g_signal_connect_swapped ( G_OBJECT(today), "clicked", G_CALLBACK(today_clicked), cal ); |
348 | ||
349 | gtk_widget_show_all ( dialog ); | |
a77c32c8 RN |
350 | |
351 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); | |
352 | ||
353 | gchar *date_str = NULL; | |
354 | if ( gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT ) | |
355 | { | |
a77c32c8 | 356 | gtk_calendar_get_date ( GTK_CALENDAR(cal), &year, &month, &day ); |
23d6216c | 357 | date_str = g_strdup_printf ( "%d-%02d-%02d", year, month+1, day ); |
a77c32c8 RN |
358 | } |
359 | gtk_widget_destroy ( dialog ); | |
360 | return date_str; | |
361 | } | |
362 | ||
50a14534 | 363 | /* creates a vbox full of labels */ |
870e0b9a | 364 | GtkWidget *a_dialog_create_label_vbox ( gchar **texts, int label_count, gint spacing, gint padding ) |
50a14534 EB |
365 | { |
366 | GtkWidget *vbox, *label; | |
367 | int i; | |
870e0b9a | 368 | vbox = gtk_vbox_new( TRUE, spacing ); |
50a14534 EB |
369 | |
370 | for ( i = 0; i < label_count; i++ ) | |
371 | { | |
372 | label = gtk_label_new(NULL); | |
4c77d5e0 | 373 | gtk_label_set_markup ( GTK_LABEL(label), _(texts[i]) ); |
870e0b9a | 374 | gtk_box_pack_start ( GTK_BOX(vbox), label, FALSE, TRUE, padding ); |
50a14534 EB |
375 | } |
376 | return vbox; | |
377 | } | |
378 | ||
d91e5f2b | 379 | gboolean a_dialog_yes_or_no ( GtkWindow *parent, const gchar *message, const gchar *extra ) |
50a14534 EB |
380 | { |
381 | GtkWidget *dia; | |
382 | dia = gtk_message_dialog_new ( parent, | |
383 | GTK_DIALOG_DESTROY_WITH_PARENT, | |
384 | GTK_MESSAGE_QUESTION, | |
385 | GTK_BUTTONS_YES_NO, | |
386 | message, extra ); | |
387 | ||
388 | if ( gtk_dialog_run ( GTK_DIALOG(dia) ) == GTK_RESPONSE_YES ) | |
389 | { | |
390 | gtk_widget_destroy ( dia ); | |
391 | return TRUE; | |
392 | } | |
393 | else | |
394 | { | |
395 | gtk_widget_destroy ( dia ); | |
396 | return FALSE; | |
397 | } | |
398 | } | |
399 | ||
400 | static void zoom_spin_changed ( GtkSpinButton *spin, GtkWidget *pass_along[3] ) | |
401 | { | |
402 | if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON(pass_along[2]) ) ) | |
403 | gtk_spin_button_set_value ( | |
404 | GTK_SPIN_BUTTON(pass_along[GTK_WIDGET(spin) == pass_along[0] ? 1 : 0]), | |
405 | gtk_spin_button_get_value ( spin ) ); | |
406 | } | |
407 | ||
408 | gboolean a_dialog_custom_zoom ( GtkWindow *parent, gdouble *xmpp, gdouble *ympp ) | |
409 | { | |
7760b0cf | 410 | GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Zoom Factors..."), |
50a14534 EB |
411 | parent, |
412 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
413 | GTK_STOCK_CANCEL, | |
414 | GTK_RESPONSE_REJECT, | |
415 | GTK_STOCK_OK, | |
416 | GTK_RESPONSE_ACCEPT, | |
417 | NULL); | |
418 | GtkWidget *table, *label, *xlabel, *xspin, *ylabel, *yspin, *samecheck; | |
419 | GtkWidget *pass_along[3]; | |
420 | ||
421 | table = gtk_table_new ( 4, 2, FALSE ); | |
9b082b39 | 422 | gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), table, TRUE, TRUE, 0 ); |
50a14534 | 423 | |
da0a736b | 424 | label = gtk_label_new ( _("Zoom factor (in meters per pixel):") ); |
7760b0cf JJ |
425 | xlabel = gtk_label_new ( _("X (easting): ")); |
426 | ylabel = gtk_label_new ( _("Y (northing): ")); | |
50a14534 | 427 | |
ac33062d RN |
428 | pass_along[0] = xspin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( *xmpp, VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM, 1, 5, 0 ), 1, 8 ); |
429 | pass_along[1] = yspin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( *ympp, VIK_VIEWPORT_MIN_ZOOM, VIK_VIEWPORT_MAX_ZOOM, 1, 5, 0 ), 1, 8 ); | |
50a14534 | 430 | |
7760b0cf | 431 | pass_along[2] = samecheck = gtk_check_button_new_with_label ( _("X and Y zoom factors must be equal") ); |
50a14534 EB |
432 | /* TODO -- same factor */ |
433 | /* samecheck = gtk_check_button_new_with_label ( "Same x/y zoom factor" ); */ | |
434 | ||
435 | if ( *xmpp == *ympp ) | |
436 | gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON(samecheck), TRUE ); | |
437 | ||
438 | gtk_table_attach_defaults ( GTK_TABLE(table), label, 0, 2, 0, 1 ); | |
439 | gtk_table_attach_defaults ( GTK_TABLE(table), xlabel, 0, 1, 1, 2 ); | |
440 | gtk_table_attach_defaults ( GTK_TABLE(table), xspin, 1, 2, 1, 2 ); | |
441 | gtk_table_attach_defaults ( GTK_TABLE(table), ylabel, 0, 1, 2, 3 ); | |
442 | gtk_table_attach_defaults ( GTK_TABLE(table), yspin, 1, 2, 2, 3 ); | |
443 | gtk_table_attach_defaults ( GTK_TABLE(table), samecheck, 0, 2, 3, 4 ); | |
444 | ||
445 | gtk_widget_show_all ( table ); | |
446 | ||
447 | g_signal_connect ( G_OBJECT(xspin), "value-changed", G_CALLBACK(zoom_spin_changed), pass_along ); | |
448 | g_signal_connect ( G_OBJECT(yspin), "value-changed", G_CALLBACK(zoom_spin_changed), pass_along ); | |
449 | ||
79d73727 RN |
450 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); |
451 | ||
50a14534 EB |
452 | if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) |
453 | { | |
454 | *xmpp = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(xspin) ); | |
455 | *ympp = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(yspin) ); | |
456 | gtk_widget_destroy ( dialog ); | |
457 | return TRUE; | |
458 | } | |
459 | gtk_widget_destroy ( dialog ); | |
460 | return FALSE; | |
461 | } | |
111fa174 AF |
462 | |
463 | static void split_spin_focused ( GtkSpinButton *spin, GtkWidget *pass_along[1] ) | |
464 | { | |
465 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pass_along[0]), 1); | |
466 | } | |
467 | ||
468 | gboolean a_dialog_time_threshold ( GtkWindow *parent, gchar *title_text, gchar *label_text, guint *thr ) | |
469 | { | |
470 | GtkWidget *dialog = gtk_dialog_new_with_buttons (title_text, | |
471 | parent, | |
472 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
473 | GTK_STOCK_CANCEL, | |
474 | GTK_RESPONSE_REJECT, | |
475 | GTK_STOCK_OK, | |
476 | GTK_RESPONSE_ACCEPT, | |
477 | NULL); | |
478 | GtkWidget *table, *t1, *t2, *t3, *t4, *spin, *label; | |
479 | GtkWidget *pass_along[1]; | |
480 | ||
481 | table = gtk_table_new ( 4, 2, FALSE ); | |
9b082b39 | 482 | gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), table, TRUE, TRUE, 0 ); |
111fa174 AF |
483 | |
484 | label = gtk_label_new (label_text); | |
485 | ||
7760b0cf JJ |
486 | t1 = gtk_radio_button_new_with_label ( NULL, _("1 min") ); |
487 | t2 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t1), _("1 hour") ); | |
488 | t3 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t2), _("1 day") ); | |
489 | t4 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t3), _("Custom (in minutes):") ); | |
111fa174 AF |
490 | |
491 | pass_along[0] = t4; | |
492 | ||
ac33062d | 493 | spin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( *thr, 0, 65536, 1, 5, 0 ), 1, 0 ); |
111fa174 AF |
494 | |
495 | gtk_table_attach_defaults ( GTK_TABLE(table), label, 0, 2, 0, 1 ); | |
496 | gtk_table_attach_defaults ( GTK_TABLE(table), t1, 0, 1, 1, 2 ); | |
497 | gtk_table_attach_defaults ( GTK_TABLE(table), t2, 0, 1, 2, 3 ); | |
498 | gtk_table_attach_defaults ( GTK_TABLE(table), t3, 0, 1, 3, 4 ); | |
499 | gtk_table_attach_defaults ( GTK_TABLE(table), t4, 0, 1, 4, 5 ); | |
500 | gtk_table_attach_defaults ( GTK_TABLE(table), spin, 1, 2, 4, 5 ); | |
501 | ||
502 | gtk_widget_show_all ( table ); | |
503 | ||
504 | g_signal_connect ( G_OBJECT(spin), "grab-focus", G_CALLBACK(split_spin_focused), pass_along ); | |
505 | ||
79d73727 RN |
506 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); |
507 | ||
111fa174 AF |
508 | if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) |
509 | { | |
510 | if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t1))) { | |
511 | *thr = 1; | |
512 | } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t2))) { | |
513 | *thr = 60; | |
514 | } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t3))) { | |
515 | *thr = 60 * 24; | |
516 | } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t4))) { | |
517 | *thr = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(spin) ); | |
518 | } | |
519 | gtk_widget_destroy ( dialog ); | |
520 | return TRUE; | |
521 | } | |
522 | gtk_widget_destroy ( dialog ); | |
523 | return FALSE; | |
524 | } | |
d0a5f320 | 525 | |
16c7d8fc | 526 | /** |
a0dd9023 GB |
527 | * a_dialog_get_positive_number: |
528 | * | |
16c7d8fc | 529 | * Dialog to return a positive number via a spinbox within the supplied limits |
a0dd9023 GB |
530 | * |
531 | * Returns: A value of zero indicates the dialog was cancelled | |
16c7d8fc RN |
532 | */ |
533 | guint a_dialog_get_positive_number ( GtkWindow *parent, gchar *title_text, gchar *label_text, guint default_num, guint min, guint max, guint step ) | |
534 | { | |
535 | GtkWidget *dialog = gtk_dialog_new_with_buttons (title_text, | |
536 | parent, | |
537 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
538 | GTK_STOCK_CANCEL, | |
539 | GTK_RESPONSE_REJECT, | |
540 | GTK_STOCK_OK, | |
541 | GTK_RESPONSE_ACCEPT, | |
542 | NULL); | |
543 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); | |
544 | GtkWidget *response_w = NULL; | |
545 | #if GTK_CHECK_VERSION (2, 20, 0) | |
546 | response_w = gtk_dialog_get_widget_for_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); | |
547 | #endif | |
548 | ||
549 | GtkWidget *table, *spin, *label; | |
550 | guint result = default_num; | |
551 | ||
552 | table = gtk_table_new ( 2, 1, FALSE ); | |
9b082b39 | 553 | gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), table, TRUE, TRUE, 0 ); |
16c7d8fc RN |
554 | |
555 | label = gtk_label_new (label_text); | |
556 | spin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( default_num, min, max, step, 5, 0 ), 1, 0 ); | |
557 | ||
558 | gtk_table_attach_defaults ( GTK_TABLE(table), label, 0, 1, 0, 1 ); | |
559 | gtk_table_attach_defaults ( GTK_TABLE(table), spin, 0, 1, 1, 2 ); | |
560 | ||
561 | if ( response_w ) | |
562 | gtk_widget_grab_focus ( response_w ); | |
563 | ||
564 | gtk_widget_show_all ( table ); | |
565 | ||
566 | if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) | |
567 | { | |
568 | result = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(spin) ); | |
569 | gtk_widget_destroy ( dialog ); | |
570 | return result; | |
571 | } | |
572 | ||
573 | // Dialog cancelled | |
574 | gtk_widget_destroy ( dialog ); | |
575 | return 0; | |
576 | } | |
577 | ||
cbb35e4b | 578 | #if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 24) |
3530c91e GB |
579 | static void about_url_hook (GtkAboutDialog *about, |
580 | const gchar *link, | |
581 | gpointer data) | |
85beadba | 582 | { |
3530c91e GB |
583 | open_url (GTK_WINDOW(about), link); |
584 | } | |
585 | ||
586 | static void about_email_hook (GtkAboutDialog *about, | |
587 | const gchar *email, | |
588 | gpointer data) | |
589 | { | |
590 | new_email (GTK_WINDOW(about), email); | |
85beadba | 591 | } |
cbb35e4b | 592 | #endif |
d0a5f320 | 593 | |
d4235426 RN |
594 | /** |
595 | * Creates a dialog with list of text | |
596 | * Mostly useful for longer messages that have several lines of information. | |
597 | */ | |
598 | void a_dialog_list ( GtkWindow *parent, const gchar *title, GArray *array, gint padding ) | |
599 | { | |
600 | GtkWidget *dialog = gtk_dialog_new_with_buttons ( title, | |
601 | parent, | |
602 | GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, | |
603 | GTK_STOCK_CLOSE, | |
604 | GTK_RESPONSE_CLOSE, | |
605 | NULL); | |
606 | ||
607 | GtkBox *vbox = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); | |
608 | GtkWidget *label; | |
609 | ||
610 | for ( int i = 0; i < array->len; i++ ) { | |
611 | label = ui_label_new_selectable (NULL); | |
612 | gtk_label_set_markup ( GTK_LABEL(label), g_array_index(array,gchar*,i) ); | |
613 | gtk_box_pack_start ( GTK_BOX(vbox), label, FALSE, TRUE, padding ); | |
614 | } | |
615 | ||
616 | gtk_widget_show_all ( dialog ); | |
617 | gtk_dialog_run ( GTK_DIALOG(dialog) ); | |
618 | gtk_widget_destroy ( dialog ); | |
619 | } | |
620 | ||
d0a5f320 AF |
621 | void a_dialog_about ( GtkWindow *parent ) |
622 | { | |
85beadba GB |
623 | const gchar *program_name = PACKAGE_NAME; |
624 | const gchar *version = VIKING_VERSION; | |
625 | const gchar *website = VIKING_URL; | |
6493fea2 | 626 | const gchar *copyright = "2003-2008, Evan Battaglia\n2008-2013, Viking's contributors"; |
85beadba GB |
627 | const gchar *comments = _("GPS Data and Topo Analyzer, Explorer, and Manager."); |
628 | const gchar *license = _("This program is free software; you can redistribute it and/or modify " | |
d0a5f320 AF |
629 | "it under the terms of the GNU General Public License as published by " |
630 | "the Free Software Foundation; either version 2 of the License, or " | |
631 | "(at your option) any later version." | |
632 | "\n\n" | |
633 | "This program is distributed in the hope that it will be useful, " | |
634 | "but WITHOUT ANY WARRANTY; without even the implied warranty of " | |
635 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " | |
636 | "GNU General Public License for more details." | |
637 | "\n\n" | |
638 | "You should have received a copy of the GNU General Public License " | |
639 | "along with this program; if not, write to the Free Software " | |
85beadba GB |
640 | "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA"); |
641 | ||
23392193 RN |
642 | // Would be nice to use gtk_about_dialog_add_credit_section (), but that requires gtk 3.4 |
643 | // For now shove it in the 'artists' section so at least the information is easily visible | |
644 | // Something more advanced might have proper version information too... | |
645 | const gchar *libs[] = { | |
646 | "Compiled in libraries:", | |
647 | // Default libs | |
648 | "libglib-2.0", | |
649 | "libgthread-2.0", | |
650 | "libgtk+-2.0", | |
651 | "libgio-2.0", | |
652 | // Potentially optional libs (but probably couldn't build without them) | |
653 | #ifdef HAVE_LIBM | |
654 | "libm", | |
655 | #endif | |
656 | #ifdef HAVE_LIBZ | |
657 | "libz", | |
658 | #endif | |
659 | #ifdef HAVE_LIBCURL | |
660 | "libcurl", | |
661 | #endif | |
662 | // Actually optional libs | |
663 | #ifdef HAVE_LIBGPS | |
664 | "libgps", | |
665 | #endif | |
72bbd562 RN |
666 | #ifdef HAVE_LIBGEXIV2 |
667 | "libgexiv2", | |
668 | #endif | |
23392193 RN |
669 | #ifdef HAVE_LIBEXIF |
670 | "libexif", | |
671 | #endif | |
672 | #ifdef HAVE_LIBX11 | |
673 | "libX11", | |
04da83cd RN |
674 | #endif |
675 | #ifdef HAVE_LIBMAGIC | |
676 | "libmagic", | |
677 | #endif | |
678 | #ifdef HAVE_LIBBZ2 | |
679 | "libbz2", | |
0fb11294 RN |
680 | #endif |
681 | #ifdef HAVE_LIBSQLITE3 | |
682 | "libsqlite3", | |
5fa4fe86 RN |
683 | #endif |
684 | #ifdef HAVE_LIBMAPNIK | |
685 | "libmapnik", | |
23392193 RN |
686 | #endif |
687 | NULL | |
688 | }; | |
cbb35e4b RN |
689 | // Newer versions of GTK 'just work', calling gtk_show_uri() on the URL or email and opens up the appropriate program |
690 | // This is the old method: | |
691 | #if (GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 24) | |
3530c91e GB |
692 | gtk_about_dialog_set_url_hook (about_url_hook, NULL, NULL); |
693 | gtk_about_dialog_set_email_hook (about_email_hook, NULL, NULL); | |
cbb35e4b | 694 | #endif |
23392193 | 695 | |
85beadba GB |
696 | gtk_show_about_dialog (parent, |
697 | /* TODO do not set program-name and correctly set info for g_get_application_name */ | |
698 | "program-name", program_name, | |
699 | "version", version, | |
700 | "website", website, | |
701 | "comments", comments, | |
702 | "copyright", copyright, | |
703 | "license", license, | |
704 | "wrap-license", TRUE, | |
705 | /* logo automatically retrieved via gtk_window_get_default_icon_list */ | |
706 | "authors", AUTHORS, | |
eb6a42c9 | 707 | "documenters", DOCUMENTERS, |
551e7a38 | 708 | "translator-credits", _("Translation is coordinated on http://launchpad.net/viking"), |
23392193 | 709 | "artists", libs, |
85beadba | 710 | NULL); |
d0a5f320 | 711 | } |
7114e879 QT |
712 | |
713 | gboolean a_dialog_map_n_zoom(GtkWindow *parent, gchar *mapnames[], gint default_map, gchar *zoom_list[], gint default_zoom, gint *selected_map, gint *selected_zoom) | |
714 | { | |
715 | gchar **s; | |
716 | ||
7760b0cf | 717 | GtkWidget *dialog = gtk_dialog_new_with_buttons ( _("Download along track"), parent, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL ); |
6e450795 RN |
718 | gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); |
719 | GtkWidget *response_w = NULL; | |
720 | #if GTK_CHECK_VERSION (2, 20, 0) | |
721 | response_w = gtk_dialog_get_widget_for_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); | |
722 | #endif | |
1bc1c05b | 723 | |
7760b0cf | 724 | GtkWidget *map_label = gtk_label_new(_("Map type:")); |
1bc1c05b | 725 | GtkWidget *map_combo = vik_combo_box_text_new(); |
7114e879 | 726 | for (s = mapnames; *s; s++) |
1bc1c05b RN |
727 | vik_combo_box_text_append (GTK_COMBO_BOX(map_combo), *s); |
728 | gtk_combo_box_set_active (GTK_COMBO_BOX(map_combo), default_map); | |
729 | ||
7760b0cf | 730 | GtkWidget *zoom_label = gtk_label_new(_("Zoom level:")); |
1bc1c05b | 731 | GtkWidget *zoom_combo = vik_combo_box_text_new(); |
7114e879 | 732 | for (s = zoom_list; *s; s++) |
1bc1c05b RN |
733 | vik_combo_box_text_append (GTK_COMBO_BOX(zoom_combo), *s); |
734 | gtk_combo_box_set_active (GTK_COMBO_BOX(zoom_combo), default_zoom); | |
7114e879 QT |
735 | |
736 | GtkTable *box = GTK_TABLE(gtk_table_new(2, 2, FALSE)); | |
1bc1c05b RN |
737 | gtk_table_attach_defaults(box, map_label, 0, 1, 0, 1); |
738 | gtk_table_attach_defaults(box, map_combo, 1, 2, 0, 1); | |
739 | gtk_table_attach_defaults(box, zoom_label, 0, 1, 1, 2); | |
740 | gtk_table_attach_defaults(box, zoom_combo, 1, 2, 1, 2); | |
7114e879 | 741 | |
9b082b39 | 742 | gtk_box_pack_start ( GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), GTK_WIDGET(box), FALSE, FALSE, 5 ); |
7114e879 | 743 | |
6e450795 RN |
744 | if ( response_w ) |
745 | gtk_widget_grab_focus ( response_w ); | |
746 | ||
7114e879 QT |
747 | gtk_widget_show_all ( dialog ); |
748 | if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) != GTK_RESPONSE_ACCEPT ) { | |
749 | gtk_widget_destroy(dialog); | |
750 | return FALSE; | |
751 | } | |
752 | ||
1bc1c05b RN |
753 | *selected_map = gtk_combo_box_get_active(GTK_COMBO_BOX(map_combo)); |
754 | *selected_zoom = gtk_combo_box_get_active(GTK_COMBO_BOX(zoom_combo)); | |
7114e879 QT |
755 | |
756 | gtk_widget_destroy(dialog); | |
757 | return TRUE; | |
758 | } | |
53ac8302 GB |
759 | |
760 | /** | |
761 | * Display a dialog presenting the license of a map. | |
762 | * Allow to read the license by launching a web browser. | |
763 | */ | |
4033fba0 | 764 | void a_dialog_license ( GtkWindow *parent, const gchar *map, const gchar *license, const gchar *url) |
53ac8302 GB |
765 | { |
766 | GtkWidget *dialog = gtk_message_dialog_new (parent, | |
767 | GTK_DIALOG_DESTROY_WITH_PARENT, | |
768 | GTK_MESSAGE_INFO, | |
769 | GTK_BUTTONS_OK, | |
770 | _("The map data is licensed: %s."), | |
771 | license); | |
772 | gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), | |
b03ae39b | 773 | _("The data provided by '<b>%s</b>' are licensed under the following license: <b>%s</b>."), |
53ac8302 GB |
774 | map, license); |
775 | #define RESPONSE_OPEN_LICENSE 600 | |
776 | if (url != NULL) { | |
777 | gtk_dialog_add_button (GTK_DIALOG (dialog), _("Open license"), RESPONSE_OPEN_LICENSE); | |
778 | } | |
779 | gint response; | |
780 | do { | |
781 | response = gtk_dialog_run (GTK_DIALOG (dialog)); | |
782 | if (response == RESPONSE_OPEN_LICENSE) { | |
783 | open_url (parent, url); | |
784 | } | |
785 | } while (response != GTK_RESPONSE_DELETE_EVENT && response != GTK_RESPONSE_OK); | |
786 | gtk_widget_destroy (dialog); | |
787 | } |