summaryrefslogtreecommitdiff
path: root/src/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/text.c')
-rw-r--r--src/text.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/text.c b/src/text.c
index 0d2dbe11..ead35ec2 100644
--- a/src/text.c
+++ b/src/text.c
@@ -25,9 +25,10 @@
#include "zenity.h"
#include "util.h"
-void zenity_text_dialog_response (GtkWindow *window, int button, gpointer data);
+static void zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data);
-int zenity_text (ZenityData *data, ZenityTextData *text_data)
+void
+zenity_text (ZenityData *data, ZenityTextData *text_data)
{
GladeXML *glade_dialog = NULL;
GtkWidget *dialog;
@@ -36,13 +37,21 @@ int zenity_text (ZenityData *data, ZenityTextData *text_data)
glade_dialog = zenity_util_load_glade_file ("zenity_text_dialog");
- if (glade_dialog == NULL)
- return FALSE;
+ if (glade_dialog == NULL) {
+ data->exit_code = -1;
+ return;
+ }
glade_xml_signal_autoconnect (glade_dialog);
dialog = glade_xml_get_widget (glade_dialog, "zenity_text_dialog");
+ if (glade_dialog)
+ g_object_unref (glade_dialog);
+
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (zenity_text_dialog_response), data);
+
if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
@@ -60,24 +69,21 @@ int zenity_text (ZenityData *data, ZenityTextData *text_data)
gtk_widget_show (dialog);
gtk_main ();
-
- if (glade_dialog)
- g_object_unref (glade_dialog);
-
- return TRUE;
}
-void
-zenity_text_dialog_response (GtkWindow *window, int button, gpointer data)
+static void
+zenity_text_dialog_response (GtkWidget *widget, int response, gpointer data)
{
- GError *error = NULL;
+ ZenityData *zen_data = data;
- switch (button) {
+ switch (response) {
case GTK_RESPONSE_CLOSE:
+ zen_data->exit_code = 0;
gtk_main_quit ();
break;
default:
+ zen_data->exit_code = 1;
break;
}
}
bgstack15