summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJavier Jardón <jjardon@gnome.org>2015-03-22 06:30:57 +0000
committerJavier Jardón <jjardon@gnome.org>2015-03-22 09:16:16 +0000
commite54c5db6aa0374db35abe8ae6e128648e95a35b1 (patch)
treed1165ebb23a2ed6e06562990e5ae450393133d18 /src
parentRework zenity_util_set_window_icon* to not use stock images (diff)
downloadzenity-e54c5db6aa0374db35abe8ae6e128648e95a35b1.tar.gz
zenity-e54c5db6aa0374db35abe8ae6e128648e95a35b1.tar.bz2
zenity-e54c5db6aa0374db35abe8ae6e128648e95a35b1.zip
src/color.c: Port to GtkColorChooserDialog
Diffstat (limited to 'src')
-rw-r--r--src/color.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/color.c b/src/color.c
index 6820bbbe..2a7e0396 100644
--- a/src/color.c
+++ b/src/color.c
@@ -34,27 +34,21 @@ static void zenity_colorselection_dialog_response (GtkWidget *widget, int respon
void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
{
GtkWidget *dialog;
- GtkWidget *colorsel;
GtkWidget *button;
- GdkColor color;
+ GdkRGBA color;
zen_data = data;
- dialog = gtk_color_selection_dialog_new (NULL);
+ dialog = gtk_color_chooser_dialog_new (data->dialog_title, NULL);
g_signal_connect (G_OBJECT (dialog), "response",
G_CALLBACK (zenity_colorselection_dialog_response),
color_data);
- if (data->dialog_title)
- gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
-
- colorsel = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (dialog));
-
if (color_data->color) {
- if (gdk_color_parse (color_data->color, &color))
- gtk_color_selection_set_current_color (GTK_COLOR_SELECTION (colorsel),
- &color);
+ if (gdk_rgba_parse (&color, color_data->color)) {
+ gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color);
+ }
}
if (data->ok_label) {
@@ -72,8 +66,7 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
if (data->modal)
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
- gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (colorsel),
- color_data->show_palette);
+ g_object_set (dialog, "show-editor", !color_data->show_palette, NULL);
zenity_util_show_dialog (dialog, data->attach);
@@ -89,15 +82,13 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data)
static void
zenity_colorselection_dialog_response (GtkWidget *widget, int response, gpointer data)
{
- GtkWidget *colorsel;
- GdkColor color;
+ GdkRGBA color;
switch (response) {
case GTK_RESPONSE_OK:
- zenity_util_exit_code_with_data(ZENITY_OK, zen_data);
- colorsel = gtk_color_selection_dialog_get_color_selection (GTK_COLOR_SELECTION_DIALOG (widget));
- gtk_color_selection_get_current_color (GTK_COLOR_SELECTION (colorsel), &color);
- g_print ("%s\n", gdk_color_to_string (&color));
+ zenity_util_exit_code_with_data(ZENITY_OK, zen_data);
+ gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (widget), &color);
+ g_print ("%s\n", gdk_rgba_to_string (&color));
break;
case GTK_RESPONSE_CANCEL:
bgstack15