2 Copyright (C) 2010-2011 jeanfi@gmail.com
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 int ui_change_color(const char *title, struct color *col)
27 GtkColorSelection *colorsel;
29 GtkColorSelectionDialog *colordlg;
32 color.green = col->green;
33 color.blue = col->blue;
35 colordlg = (GtkColorSelectionDialog *)
36 gtk_color_selection_dialog_new(title);
38 colorsel = GTK_COLOR_SELECTION(colordlg->colorsel);
40 gtk_color_selection_set_previous_color(colorsel, &color);
41 gtk_color_selection_set_current_color(colorsel, &color);
43 res = gtk_dialog_run(GTK_DIALOG(colordlg));
45 if (res == GTK_RESPONSE_OK) {
46 gtk_color_selection_get_current_color(colorsel, &color);
48 color_set(col, color.red, color.green, color.blue);
51 gtk_widget_destroy(GTK_WIDGET(colordlg));
53 return res == GTK_RESPONSE_OK;