Commit 8408819d authored by Javier Jardón's avatar Javier Jardón

demos/gtk-demo/colorsel.c: Do not use gtk_dialog_run()

parent f73ff748
......@@ -30,6 +30,18 @@ draw_callback (GtkWidget *widget,
return TRUE;
}
static void
response_cb (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
if (response_id == GTK_RESPONSE_OK)
{
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &color);
gtk_widget_override_background_color (da, 0, &color);
}
}
static void
change_color_callback (GtkWidget *button,
gpointer data)
......@@ -37,20 +49,16 @@ change_color_callback (GtkWidget *button,
GtkWidget *dialog;
GtkColorSelection *colorsel;
GtkColorChooserDialog *selection_dialog;
gint response;
dialog = gtk_color_chooser_dialog_new ("Changing color", GTK_WINDOW (window));
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (dialog), &color);
response = gtk_dialog_run (GTK_DIALOG (dialog));
if (response == GTK_RESPONSE_OK)
{
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (dialog), &color);
gtk_widget_override_background_color (da, 0, &color);
}
g_signal_connect (dialog,
"response",
G_CALLBACK (response_cb),
NULL);
gtk_widget_destroy (dialog);
gtk_widget_show_all (dialog);
}
GtkWidget *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment