summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/tree.c b/src/tree.c
index 01be45cd..401fbe00 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -31,7 +31,7 @@
static GladeXML *glade_dialog;
-void zenity_tree_dialog_response (GtkWindow *window, int button, gpointer data);
+static void zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data);
static void
zenity_tree_toggled_callback (GtkCellRendererToggle *cell, gchar *path_string, gpointer data)
@@ -104,7 +104,7 @@ zenity_tree_fill_entries (GtkTreeView *tree_view, const gchar **args, gint n_col
}
}
-int
+void
zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
{
GtkWidget *dialog;
@@ -118,13 +118,18 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
glade_dialog = zenity_util_load_glade_file ("zenity_tree_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_tree_dialog");
+ g_signal_connect (G_OBJECT (dialog), "response",
+ G_CALLBACK (zenity_tree_dialog_response), data);
+
if (data->dialog_title)
gtk_window_set_title (GTK_WINDOW (dialog), data->dialog_title);
@@ -209,25 +214,26 @@ zenity_tree (ZenityData *data, ZenityTreeData *tree_data)
if (glade_dialog)
g_object_unref (glade_dialog);
-
- return TRUE;
}
-void
-zenity_tree_dialog_response (GtkWindow *window, int button, gpointer data)
+static void
+zenity_tree_dialog_response (GtkWidget *widget, int response, gpointer data)
{
- GError *error = NULL;
+ ZenityData *zen_data = data;
- switch (button) {
+ switch (response) {
case GTK_RESPONSE_OK:
+ zen_data->exit_code = 0;
gtk_main_quit ();
break;
case GTK_RESPONSE_CANCEL:
+ zen_data->exit_code = 1;
gtk_main_quit ();
break;
default:
+ zen_data->exit_code = 1;
break;
}
}
bgstack15