1 /*
2     Gpredict: Real-time satellite tracking and orbit prediction program
3 
4     Copyright (C)  2001-2017  Alexandru Csete, OZ9AEC
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, visit http://www.fsf.org/
18 */
19 #ifdef HAVE_CONFIG_H
20 #include <build-config.h>
21 #endif
22 #include <glib/gi18n.h>
23 #include <gtk/gtk.h>
24 
25 #include "gpredict-utils.h"
26 #include "sat-cfg.h"
27 #include "sat-log.h"
28 #include "sat-pref-sky-at-glance.h"
29 
30 
31 static GtkWidget *timesp;       /* spin button for number of hours */
32 static GtkWidget *col1, *col2, *col3, *col4, *col5;
33 static GtkWidget *col6, *col7, *col8, *col9, *col10;
34 
35 static gboolean dirty = FALSE;  /* used to check whether any changes have occurred */
36 static gboolean reset = FALSE;
37 
sat_pref_sky_at_glance_cancel()38 void sat_pref_sky_at_glance_cancel()
39 {
40     dirty = FALSE;
41     reset = FALSE;
42 }
43 
sat_pref_sky_at_glance_ok()44 void sat_pref_sky_at_glance_ok()
45 {
46     GdkRGBA         gdk_rgba;
47     guint           rgb;
48 
49     if (dirty)
50     {
51         /* values have changed; store new values */
52         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_TIME,
53                         gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON
54                                                          (timesp)));
55 
56         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col1), &gdk_rgba);
57         rgb = rgb_to_cfg(&gdk_rgba);
58         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_01, rgb);
59 
60         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col2), &gdk_rgba);
61         rgb = rgb_to_cfg(&gdk_rgba);
62         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_02, rgb);
63 
64         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col3), &gdk_rgba);
65         rgb = rgb_to_cfg(&gdk_rgba);
66         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_03, rgb);
67 
68         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col4), &gdk_rgba);
69         rgb = rgb_to_cfg(&gdk_rgba);
70         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_04, rgb);
71 
72         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col5), &gdk_rgba);
73         rgb = rgb_to_cfg(&gdk_rgba);
74         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_05, rgb);
75 
76         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col6), &gdk_rgba);
77         rgb = rgb_to_cfg(&gdk_rgba);
78         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_06, rgb);
79 
80         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col7), &gdk_rgba);
81         rgb = rgb_to_cfg(&gdk_rgba);
82         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_07, rgb);
83 
84         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col8), &gdk_rgba);
85         rgb = rgb_to_cfg(&gdk_rgba);
86         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_08, rgb);
87 
88         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col9), &gdk_rgba);
89         rgb = rgb_to_cfg(&gdk_rgba);
90         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_09, rgb);
91 
92         gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(col10), &gdk_rgba);
93         rgb = rgb_to_cfg(&gdk_rgba);
94         sat_cfg_set_int(SAT_CFG_INT_SKYATGL_COL_10, rgb);
95     }
96     else if (reset)
97     {
98         /* values haven't changed since last reset */
99         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_TIME);
100         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_01);
101         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_02);
102         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_03);
103         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_04);
104         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_05);
105         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_06);
106         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_07);
107         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_08);
108         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_09);
109         sat_cfg_reset_int(SAT_CFG_INT_SKYATGL_COL_10);
110 
111         /* FIXME: sats */
112     }
113 }
114 
spin_changed_cb(GtkWidget * spinner,gpointer data)115 static void spin_changed_cb(GtkWidget * spinner, gpointer data)
116 {
117     (void)spinner;
118     (void)data;
119 
120     dirty = TRUE;
121 }
122 
123 /**
124  * Reset settings.
125  *
126  * @param button The RESET button.
127  * @param data User data (unused).
128  *
129  * This function is called when the user clicks on the RESET button. The function
130  * will get the default values for the parameters and set the dirty and reset flags
131  * apropriately. The reset will not have any effect if the user cancels the
132  * dialog.
133  */
reset_cb(GtkWidget * button,gpointer data)134 static void reset_cb(GtkWidget * button, gpointer data)
135 {
136     guint           rgb;
137     GdkRGBA         gdk_rgba;
138 
139     (void)data;
140     (void)button;
141 
142     /* get defaults */
143 
144     /* hours */
145     gtk_spin_button_set_value(GTK_SPIN_BUTTON(timesp),
146                               sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_TIME));
147 
148     /* satellites */
149 
150     /* colours */
151     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_01);
152     rgb_from_cfg(rgb, &gdk_rgba);
153     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col1), &gdk_rgba);
154 
155     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_02);
156     rgb_from_cfg(rgb, &gdk_rgba);
157     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col2), &gdk_rgba);
158 
159     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_03);
160     rgb_from_cfg(rgb, &gdk_rgba);
161     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col3), &gdk_rgba);
162 
163     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_04);
164     rgb_from_cfg(rgb, &gdk_rgba);
165     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col4), &gdk_rgba);
166 
167     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_05);
168     rgb_from_cfg(rgb, &gdk_rgba);
169     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col5), &gdk_rgba);
170 
171     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_06);
172     rgb_from_cfg(rgb, &gdk_rgba);
173     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col6), &gdk_rgba);
174 
175     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_07);
176     rgb_from_cfg(rgb, &gdk_rgba);
177     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col7), &gdk_rgba);
178 
179     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_08);
180     rgb_from_cfg(rgb, &gdk_rgba);
181     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col8), &gdk_rgba);
182 
183     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_09);
184     rgb_from_cfg(rgb, &gdk_rgba);
185     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col9), &gdk_rgba);
186 
187     rgb = sat_cfg_get_int_def(SAT_CFG_INT_SKYATGL_COL_10);
188     rgb_from_cfg(rgb, &gdk_rgba);
189     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col10), &gdk_rgba);
190 
191     /* reset flags */
192     reset = TRUE;
193     dirty = FALSE;
194 }
195 
196 /**
197  * Manage color and font changes.
198  *
199  * @param but The color/font picker button that received the signal.
200  * @param data User data (always NULL).
201  *
202  * We don't need to do anything but set the dirty flag since the values can
203  * always be obtained from the global widgets.
204  */
colour_changed(GtkWidget * but,gpointer data)205 static void colour_changed(GtkWidget * but, gpointer data)
206 {
207     (void)but;
208     (void)data;
209 
210     dirty = TRUE;
211 }
212 
213 /**
214  * Create RESET button.
215  *
216  * @param cfg Config data or NULL in global mode.
217  * @param vbox The container.
218  *
219  * This function creates and sets up the view selector combos.
220  */
create_reset_button(GtkBox * vbox)221 static void create_reset_button(GtkBox * vbox)
222 {
223     GtkWidget      *button;
224     GtkWidget      *butbox;
225 
226     button = gtk_button_new_with_label(_("Reset"));
227     g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_cb), NULL);
228 
229     gtk_widget_set_tooltip_text(button,
230                                 _("Reset settings to the default values."));
231 
232     butbox = gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL);
233     gtk_button_box_set_layout(GTK_BUTTON_BOX(butbox), GTK_BUTTONBOX_END);
234     gtk_box_pack_end(GTK_BOX(butbox), button, FALSE, TRUE, 10);
235 
236     gtk_box_pack_end(vbox, butbox, FALSE, TRUE, 0);
237 }
238 
239 /**
240  * Create and initialise widgets for the sky-at-glance tab.
241  *
242  * The widgets must be preloaded with values from config. If a config value
243  * is NULL, sensible default values, eg. those from defaults.h should
244  * be loaded.
245  */
sat_pref_sky_at_glance_create()246 GtkWidget      *sat_pref_sky_at_glance_create()
247 {
248     GtkWidget      *table;
249     GtkWidget      *label;
250     GtkWidget      *vbox;
251     GdkRGBA         gdk_rgba;
252     guint           rgb;        /* 0xRRGGBB encoded colour */
253     guint           y;
254 
255     dirty = FALSE;
256     reset = FALSE;
257 
258     table = gtk_grid_new();
259     gtk_grid_set_column_homogeneous(GTK_GRID(table), TRUE);
260     gtk_grid_set_row_homogeneous(GTK_GRID(table), FALSE);
261     gtk_grid_set_column_spacing(GTK_GRID(table), 5);
262     gtk_grid_set_row_spacing(GTK_GRID(table), 5);
263 
264     label = gtk_label_new(NULL);
265     gtk_label_set_markup(GTK_LABEL(label), _("<b>Time:</b>"));
266     g_object_set(label, "xalign", 0.0f, "yalign", 0.5f, NULL);
267     gtk_grid_attach(GTK_GRID(table), label, 0, 0, 1, 1);
268 
269     /* number of hours */
270     label = gtk_label_new(_("Find and show passes that occur within"));
271     g_object_set(label, "xalign", 0.0f, "yalign", 0.5f, NULL);
272     gtk_grid_attach(GTK_GRID(table), label, 0, 1, 2, 1);
273     timesp = gtk_spin_button_new_with_range(1, 24, 1);
274     gtk_widget_set_tooltip_text(timesp,
275                                 _
276                                 ("The passes shown on the Sky at a Glance chart\n"
277                                  "will begin within this number of hours."));
278     gtk_spin_button_set_digits(GTK_SPIN_BUTTON(timesp), 0);
279     gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(timesp), TRUE);
280     gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(timesp), FALSE);
281     gtk_spin_button_set_value(GTK_SPIN_BUTTON(timesp),
282                               sat_cfg_get_int(SAT_CFG_INT_SKYATGL_TIME));
283     g_signal_connect(G_OBJECT(timesp), "value-changed",
284                      G_CALLBACK(spin_changed_cb), NULL);
285     gtk_grid_attach(GTK_GRID(table), timesp, 2, 1, 1, 1);
286     label = gtk_label_new(_("hours"));
287     g_object_set(label, "xalign", 0.0f, "yalign", 0.5f, NULL);
288     gtk_grid_attach(GTK_GRID(table), label, 3, 1, 1, 1);
289 
290     /* separator */
291     gtk_grid_attach(GTK_GRID(table),
292                     gtk_separator_new(GTK_ORIENTATION_HORIZONTAL), 0, 2, 5, 1);
293 
294     y = 3;
295 
296     label = gtk_label_new(NULL);
297     gtk_label_set_markup(GTK_LABEL(label), _("<b>Colours:</b>"));
298     g_object_set(label, "xalign", 0.0f, "yalign", 0.5f, NULL);
299     gtk_grid_attach(GTK_GRID(table), label, 0, y, 1, 1);
300 
301     /* colour 1 */
302     label = gtk_label_new(_("Satellite 1: "));
303     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
304     gtk_grid_attach(GTK_GRID(table), label, 0, y + 1, 1, 1);
305     col1 = gtk_color_button_new();
306     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col1), FALSE);
307     gtk_color_button_set_title(GTK_COLOR_BUTTON(col1), _("Select colour 1"));
308     gtk_grid_attach(GTK_GRID(table), col1, 1, y + 1, 1, 1);
309     gtk_widget_set_tooltip_text(col1, _("Click to select a colour"));
310     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_01);
311     rgb_from_cfg(rgb, &gdk_rgba);
312     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col1), &gdk_rgba);
313     g_signal_connect(col1, "color-set", G_CALLBACK(colour_changed), NULL);
314 
315     /* colour 2 */
316     label = gtk_label_new(_("Satellite 2: "));
317     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
318     gtk_grid_attach(GTK_GRID(table), label, 0, y + 2, 1, 1);
319     col2 = gtk_color_button_new();
320     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col2), FALSE);
321     gtk_color_button_set_title(GTK_COLOR_BUTTON(col1), _("Select colour 2"));
322     gtk_grid_attach(GTK_GRID(table), col2, 1, y + 2, 1, 1);
323     gtk_widget_set_tooltip_text(col2, _("Click to select a colour"));
324     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_02);
325     rgb_from_cfg(rgb, &gdk_rgba);
326     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col2), &gdk_rgba);
327     g_signal_connect(col2, "color-set", G_CALLBACK(colour_changed), NULL);
328 
329     /* colour 3 */
330     label = gtk_label_new(_("Satellite 3: "));
331     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
332     gtk_grid_attach(GTK_GRID(table), label, 0, y + 3, 1, 1);
333     col3 = gtk_color_button_new();
334     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col3), FALSE);
335     gtk_color_button_set_title(GTK_COLOR_BUTTON(col3), _("Select colour 3"));
336     gtk_grid_attach(GTK_GRID(table), col3, 1, y + 3, 1, 1);
337     gtk_widget_set_tooltip_text(col3, _("Click to select a colour"));
338     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_03);
339     rgb_from_cfg(rgb, &gdk_rgba);
340     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col3), &gdk_rgba);
341     g_signal_connect(col3, "color-set", G_CALLBACK(colour_changed), NULL);
342 
343     /* colour 4 */
344     label = gtk_label_new(_("Satellite 4: "));
345     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
346     gtk_grid_attach(GTK_GRID(table), label, 0, y + 4, 1, 1);
347     col4 = gtk_color_button_new();
348     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col4), FALSE);
349     gtk_color_button_set_title(GTK_COLOR_BUTTON(col4), _("Select colour 4"));
350     gtk_grid_attach(GTK_GRID(table), col4, 1, y + 4, 1, 1);
351     gtk_widget_set_tooltip_text(col4, _("Click to select a colour"));
352     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_04);
353     rgb_from_cfg(rgb, &gdk_rgba);
354     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col4), &gdk_rgba);
355     g_signal_connect(col4, "color-set", G_CALLBACK(colour_changed), NULL);
356 
357     /* colour 5 */
358     label = gtk_label_new(_("Satellite 5: "));
359     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
360     gtk_grid_attach(GTK_GRID(table), label, 0, y + 5, 1, 1);
361     col5 = gtk_color_button_new();
362     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col5), FALSE);
363     gtk_color_button_set_title(GTK_COLOR_BUTTON(col5), _("Select colour 5"));
364     gtk_grid_attach(GTK_GRID(table), col5, 1, y + 5, 1, 1);
365     gtk_widget_set_tooltip_text(col5, _("Click to select a colour"));
366     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_05);
367     rgb_from_cfg(rgb, &gdk_rgba);
368     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col5), &gdk_rgba);
369     g_signal_connect(col5, "color-set", G_CALLBACK(colour_changed), NULL);
370 
371     /* colour 6 */
372     label = gtk_label_new(_("Satellite 6: "));
373     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
374     gtk_grid_attach(GTK_GRID(table), label, 2, y + 1, 1, 1);
375     col6 = gtk_color_button_new();
376     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col6), FALSE);
377     gtk_color_button_set_title(GTK_COLOR_BUTTON(col6), _("Select colour 6"));
378     gtk_grid_attach(GTK_GRID(table), col6, 3, y + 1, 1, 1);
379     gtk_widget_set_tooltip_text(col6, _("Click to select a colour"));
380     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_06);
381     rgb_from_cfg(rgb, &gdk_rgba);
382     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col6), &gdk_rgba);
383     g_signal_connect(col6, "color-set", G_CALLBACK(colour_changed), NULL);
384 
385     /* colour 7 */
386     label = gtk_label_new(_("Satellite 7: "));
387     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
388     gtk_grid_attach(GTK_GRID(table), label, 2, y + 2, 1, 1);
389     col7 = gtk_color_button_new();
390     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col7), FALSE);
391     gtk_color_button_set_title(GTK_COLOR_BUTTON(col7), _("Select colour 7"));
392     gtk_grid_attach(GTK_GRID(table), col7, 3, y + 2, 1, 1);
393     gtk_widget_set_tooltip_text(col7, _("Click to select a colour"));
394     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_07);
395     rgb_from_cfg(rgb, &gdk_rgba);
396     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col7), &gdk_rgba);
397     g_signal_connect(col7, "color-set", G_CALLBACK(colour_changed), NULL);
398 
399     /* colour 8 */
400     label = gtk_label_new(_("Satellite 8: "));
401     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
402     gtk_grid_attach(GTK_GRID(table), label, 2, y + 3, 1, 1);
403     col8 = gtk_color_button_new();
404     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col8), FALSE);
405     gtk_color_button_set_title(GTK_COLOR_BUTTON(col8), _("Select colour 8"));
406     gtk_grid_attach(GTK_GRID(table), col8, 3, y + 3, 1, 1);
407     gtk_widget_set_tooltip_text(col8, _("Click to select a colour"));
408     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_08);
409     rgb_from_cfg(rgb, &gdk_rgba);
410     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col8), &gdk_rgba);
411     g_signal_connect(col8, "color-set", G_CALLBACK(colour_changed), NULL);
412 
413     /* colour 9 */
414     label = gtk_label_new(_("Satellite 9: "));
415     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
416     gtk_grid_attach(GTK_GRID(table), label, 2, y + 4, 1, 1);
417     col9 = gtk_color_button_new();
418     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col9), FALSE);
419     gtk_color_button_set_title(GTK_COLOR_BUTTON(col9), _("Select colour 9"));
420     gtk_grid_attach(GTK_GRID(table), col9, 3, y + 4, 1, 1);
421     gtk_widget_set_tooltip_text(col9, _("Click to select a colour"));
422     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_09);
423     rgb_from_cfg(rgb, &gdk_rgba);
424     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col9), &gdk_rgba);
425     g_signal_connect(col9, "color-set", G_CALLBACK(colour_changed), NULL);
426 
427     /* colour 10 */
428     label = gtk_label_new(_("Satellite 10: "));
429     g_object_set(label, "xalign", 1.0f, "yalign", 0.5f, NULL);
430     gtk_grid_attach(GTK_GRID(table), label, 2, y + 5, 1, 1);
431     col10 = gtk_color_button_new();
432     gtk_color_chooser_set_use_alpha(GTK_COLOR_CHOOSER(col10), FALSE);
433     gtk_color_button_set_title(GTK_COLOR_BUTTON(col10), _("Select colour 10"));
434     gtk_grid_attach(GTK_GRID(table), col10, 3, y + 5, 1, 1);
435     gtk_widget_set_tooltip_text(col10, _("Click to select a colour"));
436     rgb = sat_cfg_get_int(SAT_CFG_INT_SKYATGL_COL_10);
437     rgb_from_cfg(rgb, &gdk_rgba);
438     gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(col10), &gdk_rgba);
439     g_signal_connect(col10, "color-set", G_CALLBACK(colour_changed), NULL);
440 
441     /* create vertical box */
442     vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
443     gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE);
444     gtk_container_set_border_width(GTK_CONTAINER(vbox), 20);
445     gtk_box_pack_start(GTK_BOX(vbox), table, TRUE, TRUE, 0);
446 
447     /* create RESET button */
448     create_reset_button(GTK_BOX(vbox));
449 
450     return vbox;
451 }
452