[gtk+] demos/gtk-demo/colorsel.c: Do not use gtk_dialog_run()
- From: Javier JardÃn <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] demos/gtk-demo/colorsel.c: Do not use gtk_dialog_run()
- Date: Mon, 27 Feb 2012 17:13:44 +0000 (UTC)
commit 8408819d613490ee710edd0ab63fa06a2c663db1
Author: Javier JardÃn <jjardon gnome org>
Date: Mon Feb 27 10:59:41 2012 +0000
demos/gtk-demo/colorsel.c: Do not use gtk_dialog_run()
demos/gtk-demo/colorsel.c | 26 +++++++++++++++++---------
1 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/demos/gtk-demo/colorsel.c b/demos/gtk-demo/colorsel.c
index 633e13b..d1d858c 100644
--- a/demos/gtk-demo/colorsel.c
+++ b/demos/gtk-demo/colorsel.c
@@ -31,26 +31,34 @@ draw_callback (GtkWidget *widget,
}
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)
{
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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]