2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 2003-2007 Hiroyuki Yamamoto & The Claws Mail Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include <gdk/gdkkeysyms.h>
25 #include "manage_window.h"
27 static void quote_colors_set_dialog_ok(GtkWidget *widget, gpointer data)
33 static void quote_colors_set_dialog_cancel(GtkWidget *widget, gpointer data)
39 static gboolean quote_colors_set_dialog_key_pressed(GtkWidget *widget,
43 if (event && event->keyval == GDK_Escape) {
47 } else if (event && event->keyval == GDK_Return) {
55 gint colorsel_select_color_rgb(gchar *title, gint rgbvalue)
58 GtkColorSelectionDialog *color_dialog;
61 color_dialog = GTK_COLOR_SELECTION_DIALOG(gtk_color_selection_dialog_new(title));
62 gtk_window_set_modal(GTK_WINDOW(color_dialog), TRUE);
63 gtk_window_set_resizable(GTK_WINDOW(color_dialog), FALSE);
64 manage_window_set_transient(GTK_WINDOW(color_dialog));
66 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->ok_button),
68 G_CALLBACK(quote_colors_set_dialog_ok), &result);
69 g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(color_dialog)->cancel_button),
71 G_CALLBACK(quote_colors_set_dialog_cancel), &result);
72 g_signal_connect(G_OBJECT(color_dialog), "key_press_event",
73 G_CALLBACK(quote_colors_set_dialog_key_pressed), &result);
75 /* preselect the previous color in the color selection dialog */
76 gtkut_convert_int_to_gdk_color(rgbvalue, &color);
77 gtk_color_selection_set_current_color
78 (GTK_COLOR_SELECTION(color_dialog->colorsel), &color);
80 gtk_widget_show(GTK_WIDGET(color_dialog));
84 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(color_dialog->colorsel), &color);
85 rgbvalue = gtkut_convert_gdk_color_to_int(&color);
88 gtk_widget_destroy(GTK_WIDGET(color_dialog));