2 * Copyright (C) 2010-2012 jeanfi@gmail.com
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * 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
23 int ui_change_color(const char *title, struct color *col)
26 GtkColorSelection *colorsel;
28 GtkColorSelectionDialog *colordlg;
31 color.green = col->green;
32 color.blue = col->blue;
34 colordlg = GTK_COLOR_SELECTION_DIALOG
35 (gtk_color_selection_dialog_new(title));
37 colorsel = GTK_COLOR_SELECTION
38 (gtk_color_selection_dialog_get_color_selection(colordlg));
40 gtk_color_selection_set_current_color(colorsel, &color);
42 res = gtk_dialog_run(GTK_DIALOG(colordlg));
44 if (res == GTK_RESPONSE_OK) {
45 gtk_color_selection_get_current_color(colorsel, &color);
47 color_set(col, color.red, color.green, color.blue);
50 gtk_widget_destroy(GTK_WIDGET(colordlg));
52 return res == GTK_RESPONSE_OK;