From 1ac1da63f8de626ce10d350be7b29744a743ec95 Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Tue, 5 Mar 2013 16:56:24 -0300 Subject: But #674881 - Timeout option overriding normal exit code --- src/text.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'src/text.c') diff --git a/src/text.c b/src/text.c index 0163c3c0..05ada53d 100644 --- a/src/text.c +++ b/src/text.c @@ -344,6 +344,19 @@ zenity_text_toggle_button (GtkToggleButton *button, gpointer data) gtk_widget_set_sensitive (GTK_WIDGET(ok_button), gtk_toggle_button_get_active(button)); } +static void +zenity_text_dialog_output (ZenityData *zen_data) +{ + if (zen_text_data->editable) { + GtkTextIter start, end; + gchar *text; + gtk_text_buffer_get_bounds (zen_text_data->buffer, &start, &end); + text = gtk_text_buffer_get_text (zen_text_data->buffer, &start, &end, 0); + g_print ("%s", text); + g_free (text); + } +} + static void zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data) { @@ -351,17 +364,15 @@ zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data) switch (response) { case GTK_RESPONSE_CLOSE: - if (zen_text_data->editable) { - GtkTextIter start, end; - gchar *text; - gtk_text_buffer_get_bounds (zen_text_data->buffer, &start, &end); - text = gtk_text_buffer_get_text (zen_text_data->buffer, &start, &end, 0); - g_print ("%s", text); - g_free (text); - } + zenity_text_dialog_output (zen_data); zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK); break; + case ZENITY_TIMEOUT: + zenity_text_dialog_output (zen_data); + zen_data->exit_code = zenity_util_return_exit_code (ZENITY_TIMEOUT); + break; + default: /* Esc dialog */ zenity_util_exit_code_with_data(ZENITY_ESC, zen_data); -- cgit