From b39ad33c35bb93c647e7f6f05d1310a0ce6895d5 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Thu, 16 Jun 2011 11:07:58 -0300 Subject: Bug 651948 - zenity list does not return default value when timeout is over --- src/calendar.c | 2 +- src/color.c | 2 +- src/entry.c | 2 +- src/fileselection.c | 2 +- src/forms.c | 2 +- src/msg.c | 2 +- src/password.c | 2 +- src/progress.c | 2 +- src/scale.c | 2 +- src/text.c | 2 +- src/tree.c | 2 +- src/util.c | 11 +- src/util.h | 2 +- src/zenity.ui | 1066 ++++++++++++++++++++++++++++----------------------- 14 files changed, 615 insertions(+), 486 deletions(-) diff --git a/src/calendar.c b/src/calendar.c index 9aaee9f2..60931c49 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -85,7 +85,7 @@ zenity_calendar (ZenityData *data, ZenityCalendarData *cal_data) zenity_util_show_dialog (dialog); if(data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } g_object_unref (builder); diff --git a/src/color.c b/src/color.c index 8f31937f..eee68ee7 100644 --- a/src/color.c +++ b/src/color.c @@ -64,7 +64,7 @@ void zenity_colorselection (ZenityData *data, ZenityColorData *color_data) if (data->timeout_delay > 0) { g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, - NULL); + dialog); } gtk_main(); diff --git a/src/entry.c b/src/entry.c index d69d918a..ce6cda50 100644 --- a/src/entry.c +++ b/src/entry.c @@ -129,7 +129,7 @@ zenity_entry (ZenityData *data, ZenityEntryData *entry_data) zenity_util_show_dialog (dialog); if(data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } gtk_main (); diff --git a/src/fileselection.c b/src/fileselection.c index 026bb310..07d85c0d 100644 --- a/src/fileselection.c +++ b/src/fileselection.c @@ -136,7 +136,7 @@ void zenity_fileselection (ZenityData *data, ZenityFileData *file_data) zenity_util_show_dialog (dialog); if(data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } gtk_main (); diff --git a/src/forms.c b/src/forms.c index 9ad78deb..d6db7787 100644 --- a/src/forms.c +++ b/src/forms.c @@ -164,7 +164,7 @@ void zenity_forms_dialog (ZenityData *data, ZenityFormsData *forms_data) g_object_unref (builder); if (data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } gtk_main(); diff --git a/src/msg.c b/src/msg.c index 1a92875b..567ee23d 100644 --- a/src/msg.c +++ b/src/msg.c @@ -138,7 +138,7 @@ zenity_msg (ZenityData *data, ZenityMsgData *msg_data) zenity_util_show_dialog (dialog); if(data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } g_object_unref (builder); diff --git a/src/password.c b/src/password.c index 2de1a76b..219f5f9c 100644 --- a/src/password.c +++ b/src/password.c @@ -143,7 +143,7 @@ void zenity_password_dialog (ZenityData *data, ZenityPasswordData *password_data if (data->timeout_delay > 0) { g_timeout_add (data->timeout_delay * 1000, (GSourceFunc) zenity_util_timeout_handle, - NULL); + dialog); } gtk_main(); } diff --git a/src/progress.c b/src/progress.c index 29814d91..2533aa1c 100644 --- a/src/progress.c +++ b/src/progress.c @@ -286,7 +286,7 @@ zenity_progress (ZenityData *data, ZenityProgressData *progress_data) zenity_progress_read_info (progress_data); if(data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } gtk_main (); diff --git a/src/scale.c b/src/scale.c index c0d25d12..d6cc340b 100644 --- a/src/scale.c +++ b/src/scale.c @@ -92,7 +92,7 @@ zenity_scale (ZenityData *data, ZenityScaleData *scale_data) zenity_util_show_dialog (dialog); if(data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } g_object_unref (builder); diff --git a/src/text.c b/src/text.c index b8bf42eb..147e7066 100644 --- a/src/text.c +++ b/src/text.c @@ -160,7 +160,7 @@ zenity_text (ZenityData *data, ZenityTextData *text_data) g_object_unref (builder); if(data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } gtk_main (); diff --git a/src/tree.c b/src/tree.c index 7b466674..c7477c36 100644 --- a/src/tree.c +++ b/src/tree.c @@ -499,7 +499,7 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data) zenity_util_show_dialog (dialog); if(data->timeout_delay > 0) { - g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, NULL); + g_timeout_add_seconds (data->timeout_delay, (GSourceFunc) zenity_util_timeout_handle, dialog); } gtk_main (); diff --git a/src/util.c b/src/util.c index 7072c250..37845a0b 100644 --- a/src/util.c +++ b/src/util.c @@ -411,9 +411,14 @@ zenity_util_show_dialog (GtkWidget *dialog) } gboolean -zenity_util_timeout_handle (void) +zenity_util_timeout_handle (gpointer data) { - gtk_main_quit(); - exit(ZENITY_TIMEOUT); + GtkDialog *dialog = GTK_DIALOG(data); + if(dialog != NULL) + gtk_dialog_response(dialog, GTK_RESPONSE_OK); + else { + gtk_main_quit(); + exit(ZENITY_TIMEOUT); + } return FALSE; } diff --git a/src/util.h b/src/util.h index 2bf154ec..7005441b 100644 --- a/src/util.h +++ b/src/util.h @@ -28,7 +28,7 @@ void zenity_util_show_help (GError **error); gint zenity_util_return_exit_code (ZenityExitCode value); void zenity_util_show_dialog (GtkWidget *widget); -gboolean zenity_util_timeout_handle (void); +gboolean zenity_util_timeout_handle (gpointer data); G_END_DECLS diff --git a/src/zenity.ui b/src/zenity.ui index 5573bbde..3187d0ba 100644 --- a/src/zenity.ui +++ b/src/zenity.ui @@ -1,29 +1,85 @@ - + - + + 100 + 1 + 1 + + + False 5 Calendar selection center dialog - + - + True + False 2 + + + True + False + end + + + gtk-cancel + True + True + True + False + False + True + + + False + False + 0 + + + + + gtk-ok + True + True + True + True + False + False + True + + + False + False + 1 + + + + + False + True + end + 0 + + True + False 5 6 True + False 6 True + False 0 Select a date from below. True @@ -37,12 +93,15 @@ + True + True 0 True + False 0 C_alendar: True @@ -70,20 +129,43 @@ + False + True 1 + + + + zenity_calendar_cancel_button + zenity_calendar_ok_button + + + + False + 5 + Add a new entry + center + dialog + + + + True + False + 2 - + True + False end - + gtk-cancel True True True False + False True @@ -93,13 +175,14 @@ - + gtk-ok True True - True True + True False + False True @@ -111,78 +194,85 @@ False + True end 0 - - - - zenity_calendar_cancel_button - zenity_calendar_ok_button - - - - 5 - Warning - center - dialog - - - - True - 14 - + True - 5 - 12 + False + 6 - + True - 0 - 0 - gtk-dialog-warning - 6 + False + 6 + + + True + False + 0 + _Enter new text: + True + True + + + False + False + 0 + + + + + False + True 0 - - - True - True - 0 - Are you sure you want to proceed? - True - True - True - - - False - False - 1 - - + False + True 1 + + + + zenity_entry_cancel_button + zenity_entry_ok_button + + + + False + 5 + Error + center + dialog + + + + True + False + 14 - + True + False end - + gtk-ok True True - True True False + False True @@ -194,53 +284,109 @@ False + True end 0 + + + True + False + 6 + + + True + False + 5 + 12 + + + True + False + 0 + gtk-dialog-error + 6 + + + True + True + 0 + + + + + True + True + 0 + An error has occurred. + True + True + True + + + False + False + 1 + + + + + True + True + 0 + + + + + False + True + 1 + + - zenity_warning_ok_button + zenity_error_ok_button - + + False 5 - Question - center - dialog - + normal - + True - 14 - - + False + 2 + + True - 5 - 12 + False + end - + + gtk-cancel True - 0 - 0 - gtk-dialog-question - 6 + True + True + False + True False + False 0 - + + gtk-ok True True - 0 - Are you sure you want to proceed? - True - True - True + True + False + True False @@ -249,81 +395,89 @@ - - 1 - - - - - True - end - False + True end 0 - - - - - 5 - Add a new entry - center - dialog - - - - True - 2 - + True - 6 + False + 0 - + True - 6 + False + 12 + 12 + 6 - + True - 0 - _Enter new text: - True - True + False + 2 + 10 + 6 + + + + + + - - False - False - 0 - - - - - - False - 0 - + + + + True + False + <b>Forms dialog</b> + True + + False + True 1 + + + + cancelbutton12 + okbutton12 + + + + False + 5 + Information + center + dialog + + + + True + False + 14 - + True + False end - - gtk-cancel + + gtk-ok True True True False + False True @@ -332,15 +486,43 @@ 0 + + + False + True + end + 0 + + + + + True + False + 5 + 12 + + + True + False + 0 + gtk-dialog-info + 6 + + + True + True + 0 + + - - gtk-ok + True True - True - True - False - True + 0 + All updates are complete. + True + True + True False @@ -351,127 +533,176 @@ False - end - 0 + True + 1 - zenity_entry_cancel_button - zenity_entry_ok_button + zenity_info_ok_button - + + False 5 - Text View + Progress center - 300 - 200 dialog - + - + True + False 2 - - + + True - 5 + False + end - + + gtk-cancel True True - automatic - automatic - etched-in - - - True - True - 2 - 2 - False - word - 2 - 2 - textbuffer1 - - + True + False + False + True + False + False 0 - - - 1 - - - - - True - end - - gtk-close + + gtk-ok True + False True + True True False + False True False False - 0 + 1 False + True end 0 + + + True + False + 5 + 6 + + + True + False + 0 + Running... + True + + + False + False + 0 + + + + + True + False + 0.10000000149 + + + False + False + 1 + + + + + False + True + 1 + + - zenity_text_close_button + zenity_progress_cancel_button + zenity_progress_ok_button - + + False 5 - Progress + Question center dialog - + - + True - 2 + False + 14 + + + True + False + end + + + False + True + end + 0 + + - + True + False 5 - 6 + 12 - + True + False 0 - Running... - True + 0 + gtk-dialog-question + 6 False - False + True 0 - + True - 0.10000000149 + True + 0 + Are you sure you want to proceed? + True + True + True False @@ -481,20 +712,40 @@ + False + True 1 + + + + + True + False + 5 + Adjust the scale value + 300 + 100 + dialog + + + + True + False - + True + False end - + gtk-cancel True True True False + False True @@ -504,14 +755,13 @@ - + gtk-ok True - False True - True True False + False True @@ -523,127 +773,88 @@ False + True end 0 - - - - zenity_progress_cancel_button - zenity_progress_ok_button - - - - 5 - Error - center - dialog - - - - True - 14 - + True - 6 + False + 5 + 6 - + True - 5 - 12 - - - True - 0 - gtk-dialog-error - 6 - - - 0 - - - - - True - True - 0 - An error has occurred. - True - True - True - - - False - False - 1 - - + False + 0 + 4 + Adjust the scale value + True + False + False 0 - - - 1 - - - - - True - end - - gtk-ok + True True - True - False - True + adjustment1 + 0 + right - False - False - 0 + True + True + 1 False - end - 0 + True + 1 - zenity_error_ok_button + cancelbutton1 + okbutton1 - + + False 5 - Select items from the list + Text View center 300 - 196 + 200 dialog - + - + True - - + False + 2 + + True - 5 - 6 + False + end - + + gtk-close True - 0 - Select items from the list below. - True + True + True + False + False + True False @@ -651,33 +862,74 @@ 0 + + + False + True + end + 0 + + + + + True + False + 5 - + True True - automatic - automatic - in + etched-in - + True True - True + 2 + 2 + False + word + 2 + 2 + textbuffer1 - 1 + True + True + 0 + True + True 1 + + + + zenity_text_close_button + + + + False + 5 + Select items from the list + center + 300 + 196 + dialog + + + + True + False - + True + False end @@ -686,6 +938,7 @@ True True False + False True @@ -701,6 +954,7 @@ True True False + False True @@ -712,268 +966,139 @@ False + True end 0 - - - - zenity_tree_cancel_button - zenity_tree_ok_button - - - - 5 - Information - center - dialog - - - - True - 14 - + True + False 5 - 12 - - - True - 0 - gtk-dialog-info - 6 - - - 0 - - + 6 - + True - True - 0 - All updates are complete. + False + 0 + Select items from the list below. True - True - True False False - 1 + 0 - - - 1 - - - - - True - end - - gtk-ok + True True - True - False - True + in + + + True + True + True + + + + + - False - False - 0 + True + True + 1 False - end - 0 + True + 1 - zenity_info_ok_button + zenity_tree_cancel_button + zenity_tree_ok_button - - True + + False 5 - Adjust the scale value - 300 - 100 + Warning + center dialog - + - + True - - - True - 5 - 6 - - - True - 0 - 4 - Adjust the scale value - True - - - False - False - 0 - - - - - True - True - discontinuous - adjustment1 - 0 - right - - - 1 - - - - - 1 - - + False + 14 - + True + False end - - gtk-cancel - True - True - True - False - True - - - False - False - 0 - - - - + gtk-ok True True + True True False + False True False False - 1 + 0 False + True end 0 - - - - cancelbutton1 - okbutton1 - - - - 100 - 1 - 1 - - - - 5 - normal - - - True - 2 - - True - 0 - - - True - 12 - 12 - 6 - - - True - 2 - 10 - 6 - - - - - - - - - - - - - True - <b>Forms dialog</b> - True - - - - - 1 - - - - + True - end + False + 5 + 12 - - gtk-cancel + True - True - True - True + False + 0 + 0 + gtk-dialog-warning + 6 False - False + True 0 - - gtk-ok + True True - True - True + 0 + Are you sure you want to proceed? + True + True + True False @@ -984,15 +1109,14 @@ False - end - 0 + True + 1 - cancelbutton12 - okbutton12 + zenity_warning_ok_button -- cgit