aboutsummaryrefslogtreecommitdiff
path: root/src/gnunet-gtk.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnunet-gtk.c')
-rw-r--r--src/gnunet-gtk.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/gnunet-gtk.c b/src/gnunet-gtk.c
index d66107dc..fc5916f0 100644
--- a/src/gnunet-gtk.c
+++ b/src/gnunet-gtk.c
@@ -87,10 +87,6 @@ struct MainContext
87 */ 87 */
88 GPollFD *cached_poll_array; 88 GPollFD *cached_poll_array;
89 89
90 /**
91 * The main window.
92 */
93 GtkWidget *main_window;
94 90
95 /** 91 /**
96 * Read set. 92 * Read set.
@@ -175,6 +171,8 @@ free_context (struct MainContext *context)
175 g_free (context->cached_poll_array); 171 g_free (context->cached_poll_array);
176 GNUNET_NETWORK_fdset_destroy (context->rs); 172 GNUNET_NETWORK_fdset_destroy (context->rs);
177 GNUNET_NETWORK_fdset_destroy (context->ws); 173 GNUNET_NETWORK_fdset_destroy (context->ws);
174 gtk_widget_destroy (GTK_WIDGET (gtk_builder_get_object (context->builder,
175 "GNUNET_GTK_main_window")));
178 g_object_unref (G_OBJECT (context->builder)); 176 g_object_unref (G_OBJECT (context->builder));
179 g_main_loop_unref (context->gml); 177 g_main_loop_unref (context->gml);
180 GNUNET_free (context); 178 GNUNET_free (context);
@@ -408,10 +406,14 @@ static void
408tray_icon_on_click(GtkStatusIcon *status_icon, 406tray_icon_on_click(GtkStatusIcon *status_icon,
409 gpointer user_data) 407 gpointer user_data)
410{ 408{
411 if (gtk_window_is_active (GTK_WINDOW (mc->main_window))) 409 GtkWindow *main_window;
412 gtk_widget_hide (mc->main_window); 410
411 main_window = GTK_WINDOW (gtk_builder_get_object (mc->builder,
412 "GNUNET_GTK_main_window"));
413 if (gtk_window_is_active (main_window))
414 gtk_widget_hide (GTK_WIDGET (main_window));
413 else 415 else
414 gtk_window_present (GTK_WINDOW (mc->main_window)); 416 gtk_window_present (main_window);
415} 417}
416 418
417 419
@@ -540,6 +542,7 @@ run (void *cls,
540 const struct GNUNET_CONFIGURATION_Handle *cfg) 542 const struct GNUNET_CONFIGURATION_Handle *cfg)
541{ 543{
542 int argc; 544 int argc;
545 GtkWidget *main_window;
543 546
544 /* command-line processing */ 547 /* command-line processing */
545 argc = 0; 548 argc = 0;
@@ -563,9 +566,9 @@ run (void *cls,
563 tray_icon = create_tray_icon(); 566 tray_icon = create_tray_icon();
564 567
565 /* setup main window */ 568 /* setup main window */
566 mc->main_window = GTK_WIDGET (gtk_builder_get_object (mc->builder, 569 main_window = GTK_WIDGET (gtk_builder_get_object (mc->builder,
567 "GNUNET_GTK_main_window")); 570 "GNUNET_GTK_main_window"));
568 gtk_window_maximize (GTK_WINDOW (mc->main_window)); 571 gtk_window_maximize (GTK_WINDOW (main_window));
569 572
570 /* initialize file-sharing */ 573 /* initialize file-sharing */
571 mc->plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY); 574 mc->plugins = EXTRACTOR_plugin_add_defaults (EXTRACTOR_OPTION_DEFAULT_POLICY);
@@ -610,8 +613,8 @@ run (void *cls,
610 /* make GUI visible */ 613 /* make GUI visible */
611 if (!tray_only) 614 if (!tray_only)
612 { 615 {
613 gtk_widget_show (mc->main_window); 616 gtk_widget_show (main_window);
614 gtk_window_present (GTK_WINDOW (mc->main_window)); 617 gtk_window_present (GTK_WINDOW (main_window));
615 } 618 }
616 /* start the event loop */ 619 /* start the event loop */
617 GNUNET_assert (TRUE == g_main_context_acquire (mc->gmc)); 620 GNUNET_assert (TRUE == g_main_context_acquire (mc->gmc));