aboutsummaryrefslogtreecommitdiff
path: root/src/statistics/gnunet-statistics-gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/statistics/gnunet-statistics-gtk.c')
-rw-r--r--src/statistics/gnunet-statistics-gtk.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/statistics/gnunet-statistics-gtk.c b/src/statistics/gnunet-statistics-gtk.c
index 9c8c4261..21b92e03 100644
--- a/src/statistics/gnunet-statistics-gtk.c
+++ b/src/statistics/gnunet-statistics-gtk.c
@@ -208,34 +208,26 @@ create_plot (const char *box_name, const struct PlotInfo *info)
208static void 208static void
209shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 209shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
210{ 210{
211 GNUNET_STATISTICS_destroy (statistics, GNUNET_NO);
212 statistics = NULL;
213}
214
215
216/**
217 * Callback invoked if the application is supposed to exit.
218 */
219void
220GNUNET_STATISTICS_GTK_quit_cb (GObject * object, gpointer user_data)
221{
222 GNUNET_GTK_tray_icon_destroy (); 211 GNUNET_GTK_tray_icon_destroy ();
223 GNUNET_GTK_main_loop_quit (ml); 212 GNUNET_GTK_main_loop_quit (ml);
213 ml = NULL;
214 GNUNET_STATISTICS_destroy (statistics, GNUNET_NO);
215 statistics = NULL;
224 if (connection_task != GNUNET_SCHEDULER_NO_TASK) 216 if (connection_task != GNUNET_SCHEDULER_NO_TASK)
225 { 217 {
226 GNUNET_SCHEDULER_cancel (connection_task); 218 GNUNET_SCHEDULER_cancel (connection_task);
227 connection_task = GNUNET_SCHEDULER_NO_TASK; 219 connection_task = GNUNET_SCHEDULER_NO_TASK;
228 } 220 }
229 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
230} 221}
231 222
223
232/** 224/**
233 * Callback invoked if the application is supposed to exit from the tray. 225 * Callback invoked if the application is supposed to exit.
234 */ 226 */
235void 227void
236GNUNET_GTK_quit_cb (GObject * object, gpointer user_data) 228GNUNET_STATISTICS_GTK_quit_cb (GObject * object, gpointer user_data)
237{ 229{
238 GNUNET_STATISTICS_GTK_quit_cb (object, user_data); 230 GNUNET_SCHEDULER_shutdown ();
239} 231}
240 232
241 233
@@ -270,7 +262,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
270 /* setup main window */ 262 /* setup main window */
271 main_window = GTK_WIDGET (get_object ("GNUNET_STATISTICS_GTK_main_window")); 263 main_window = GTK_WIDGET (get_object ("GNUNET_STATISTICS_GTK_main_window"));
272 gtk_window_maximize (GTK_WINDOW (main_window)); 264 gtk_window_maximize (GTK_WINDOW (main_window));
273 GNUNET_GTK_tray_icon_create (GTK_WINDOW (main_window), 265 GNUNET_GTK_tray_icon_create (ml,
266 GTK_WINDOW (main_window),
274 "gnunet-gtk" /* FIXME: different icon? */ , 267 "gnunet-gtk" /* FIXME: different icon? */ ,
275 "gnunet-statistics-gtk"); 268 "gnunet-statistics-gtk");
276 269
@@ -284,6 +277,8 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
284 gtk_widget_show (main_window); 277 gtk_widget_show (main_window);
285 gtk_window_present (GTK_WINDOW (main_window)); 278 gtk_window_present (GTK_WINDOW (main_window));
286 } 279 }
280 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
281 &shutdown_task, NULL);
287} 282}
288 283
289 284