diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-03 13:10:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-03 13:10:01 +0000 |
commit | ce10aef80a820bacf1e0f4fd741703b89bc2efd2 (patch) | |
tree | fd6e72b82090652eb8c6f2339850ddb9f7d90888 | |
parent | e5c0b2f9dd3d466879d4609aece439f2e843445f (diff) | |
download | gnunet-gtk-ce10aef80a820bacf1e0f4fd741703b89bc2efd2.tar.gz gnunet-gtk-ce10aef80a820bacf1e0f4fd741703b89bc2efd2.zip |
-cleaner
-rw-r--r-- | src/fs/gnunet-fs-gtk_download-save-as.c | 66 |
1 files changed, 30 insertions, 36 deletions
diff --git a/src/fs/gnunet-fs-gtk_download-save-as.c b/src/fs/gnunet-fs-gtk_download-save-as.c index 1cd45e8d..812e073d 100644 --- a/src/fs/gnunet-fs-gtk_download-save-as.c +++ b/src/fs/gnunet-fs-gtk_download-save-as.c | |||
@@ -91,37 +91,10 @@ GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget * widget, GdkEvent * event, | |||
91 | gpointer user_data) | 91 | gpointer user_data) |
92 | { | 92 | { |
93 | struct DownloadAsDialogContext *dlc = user_data; | 93 | struct DownloadAsDialogContext *dlc = user_data; |
94 | GtkBuilder *builder; | ||
95 | struct DownloadContext *dc; | ||
96 | GtkWidget *cb; | ||
97 | 94 | ||
98 | builder = dlc->builder; | 95 | save_as_dialog_free_download_context (dlc->dc); |
99 | dc = dlc->dc; | 96 | g_object_unref (G_OBJECT (dlc->builder)); |
100 | cb = GTK_WIDGET (gtk_builder_get_object | ||
101 | (builder, "GNUNET_GTK_save_as_recursive_check_button")); | ||
102 | if (GTK_RESPONSE_OK != dlc->response) | ||
103 | { | ||
104 | save_as_dialog_free_download_context (dc); | ||
105 | g_object_unref (G_OBJECT (dlc->builder)); | ||
106 | GNUNET_free (dlc); | ||
107 | return FALSE; | ||
108 | } | ||
109 | /* FIXME-UGLY: this code should be in the 'save_as_dialog_response_cb' instead */ | ||
110 | GNUNET_free_non_null (dc->filename); | ||
111 | dc->filename = | ||
112 | GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dlc->dialog)); | ||
113 | dc->is_recursive = | ||
114 | (TRUE == | ||
115 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES : | ||
116 | GNUNET_NO; | ||
117 | dc->anonymity = | ||
118 | gtk_spin_button_get_value (GTK_SPIN_BUTTON | ||
119 | (gtk_builder_get_object | ||
120 | (builder, | ||
121 | "GNUNET_GTK_save_as_dialog_anonymity_spin_button"))); | ||
122 | g_object_unref (G_OBJECT (builder)); | ||
123 | GNUNET_free (dlc); | 97 | GNUNET_free (dlc); |
124 | GNUNET_FS_GTK_download_context_start_download (dc); | ||
125 | return FALSE; | 98 | return FALSE; |
126 | } | 99 | } |
127 | 100 | ||
@@ -140,15 +113,36 @@ GNUNET_GTK_save_as_dialog_response_cb (GtkDialog * dialog, | |||
140 | gpointer user_data) | 113 | gpointer user_data) |
141 | { | 114 | { |
142 | struct DownloadAsDialogContext *dlc = user_data; | 115 | struct DownloadAsDialogContext *dlc = user_data; |
116 | struct DownloadContext *dc; | ||
117 | GtkToggleButton *cb; | ||
143 | 118 | ||
144 | dlc->response = response_id; | 119 | dc = dlc->dc; |
145 | /* dialogs don't get delete-event the way normal windows do, | 120 | if (GTK_RESPONSE_OK != dlc->response) |
146 | call the handler manually */ | 121 | { |
147 | /* FIXME-UGLY: this is a bit ugly; instead, move the code | 122 | save_as_dialog_free_download_context (dc); |
148 | to close the dialog nicely into here! */ | 123 | gtk_widget_destroy (GTK_WIDGET (dialog)); |
149 | GNUNET_GTK_save_as_dialog_delete_event_cb (GTK_WIDGET (dialog), NULL, | 124 | g_object_unref (G_OBJECT (dlc->builder)); |
150 | user_data); | 125 | GNUNET_free (dlc); |
126 | return; | ||
127 | } | ||
128 | GNUNET_free_non_null (dc->filename); | ||
129 | dc->filename = | ||
130 | GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dlc->dialog)); | ||
131 | cb = GTK_TOGGLE_BUTTON (gtk_builder_get_object | ||
132 | (dlc->builder, "GNUNET_GTK_save_as_recursive_check_button")); | ||
133 | dc->is_recursive = | ||
134 | (TRUE == | ||
135 | gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES : | ||
136 | GNUNET_NO; | ||
137 | dc->anonymity = | ||
138 | gtk_spin_button_get_value (GTK_SPIN_BUTTON | ||
139 | (gtk_builder_get_object | ||
140 | (dlc->builder, | ||
141 | "GNUNET_GTK_save_as_dialog_anonymity_spin_button"))); | ||
151 | gtk_widget_destroy (GTK_WIDGET (dialog)); | 142 | gtk_widget_destroy (GTK_WIDGET (dialog)); |
143 | g_object_unref (G_OBJECT (dlc->builder)); | ||
144 | GNUNET_free (dlc); | ||
145 | GNUNET_FS_GTK_download_context_start_download (dc); | ||
152 | } | 146 | } |
153 | 147 | ||
154 | 148 | ||