aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/eggtrayicon.c37
-rw-r--r--src/core/main.c4
2 files changed, 21 insertions, 20 deletions
diff --git a/src/core/eggtrayicon.c b/src/core/eggtrayicon.c
index cc0fbc85..6a2708bb 100644
--- a/src/core/eggtrayicon.c
+++ b/src/core/eggtrayicon.c
@@ -602,19 +602,18 @@ static gboolean
602tray_clicked (GtkWidget * widget, GdkEvent * event) 602tray_clicked (GtkWidget * widget, GdkEvent * event)
603{ 603{
604#if GTK_CHECK_VERSION(2,10,0) 604#if GTK_CHECK_VERSION(2,10,0)
605 GtkWidget *root; 605 GtkWidget *root;
606 root = 606 root =
607 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), 607 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow");
608 "mainWindow"); 608 GdkWindowState main_window_state;
609 GdkWindowState main_window_state; 609 if (gtk_window_is_active (GTK_WINDOW (root)))
610 if (gtk_window_is_active (GTK_WINDOW (root))) 610 gtk_widget_hide (root);
611 gtk_widget_hide (root); 611 else
612 else 612 gtk_window_present (GTK_WINDOW (root));
613 gtk_window_present (GTK_WINDOW (root)); 613 main_window_state = GNUNET_GTK_get_main_window_state ();
614 main_window_state = GNUNET_GTK_get_main_window_state (); 614 if (main_window_state & GDK_WINDOW_STATE_MAXIMIZED)
615 if (main_window_state & GDK_WINDOW_STATE_MAXIMIZED) 615 gtk_window_maximize (GTK_WINDOW (root));
616 gtk_window_maximize (GTK_WINDOW (root)); 616 return TRUE;
617 return TRUE;
618#elif !defined (WINDOWS) 617#elif !defined (WINDOWS)
619 if (event->type == GDK_BUTTON_PRESS) 618 if (event->type == GDK_BUTTON_PRESS)
620 { 619 {
@@ -653,10 +652,10 @@ tray_clicked (GtkWidget * widget, GdkEvent * event)
653#if GTK_CHECK_VERSION(2,10,0) 652#if GTK_CHECK_VERSION(2,10,0)
654/* Function activated when the user tries to popup the menu */ 653/* Function activated when the user tries to popup the menu */
655static gboolean 654static gboolean
656on_tray_popup_menu (GtkStatusIcon *status_icon, guint button, 655on_tray_popup_menu (GtkStatusIcon * status_icon, guint button,
657 guint activate_time, gpointer trayContextMenu) 656 guint activate_time, gpointer trayContextMenu)
658{ 657{
659 gtk_menu_popup (GTK_MENU(trayContextMenu), NULL, NULL, NULL, NULL, 658 gtk_menu_popup (GTK_MENU (trayContextMenu), NULL, NULL, NULL, NULL,
660 button, activate_time); 659 button, activate_time);
661 return TRUE; 660 return TRUE;
662} 661}
@@ -673,7 +672,7 @@ initTrayIcon ()
673 GtkWidget *trayContextMenu; 672 GtkWidget *trayContextMenu;
674 GladeXML *trayContextMenuXML; 673 GladeXML *trayContextMenuXML;
675 GtkWidget *tray_quit; 674 GtkWidget *tray_quit;
676 675
677 trayContextMenuXML = 676 trayContextMenuXML =
678 glade_xml_new (GNUNET_GTK_get_glade_filename (), "trayContextMenu", 677 glade_xml_new (GNUNET_GTK_get_glade_filename (), "trayContextMenu",
679 PACKAGE_NAME); 678 PACKAGE_NAME);
@@ -681,14 +680,16 @@ initTrayIcon ()
681 "trayContextMenu"); 680 "trayContextMenu");
682 trayIcon = GNUNET_GTK_get_trayIcon (); 681 trayIcon = GNUNET_GTK_get_trayIcon ();
683 instDir = GNUNET_get_installation_path (GNUNET_IPK_DATADIR); 682 instDir = GNUNET_get_installation_path (GNUNET_IPK_DATADIR);
684 iconPath = g_strconcat (instDir, "/../gnunet-gtk/gnunet-gtk-tray.png", NULL); 683 iconPath =
684 g_strconcat (instDir, "/../gnunet-gtk/gnunet-gtk-tray.png", NULL);
685 GNUNET_free (instDir); 685 GNUNET_free (instDir);
686 gtk_status_icon_set_from_file (trayIcon, iconPath); 686 gtk_status_icon_set_from_file (trayIcon, iconPath);
687 g_free (iconPath); 687 g_free (iconPath);
688 gtk_status_icon_set_tooltip (trayIcon, _("GNU's peer-to-peer network")); 688 gtk_status_icon_set_tooltip (trayIcon, _("GNU's peer-to-peer network"));
689 tray_quit = glade_xml_get_widget (trayContextMenuXML, "tray_quit"); 689 tray_quit = glade_xml_get_widget (trayContextMenuXML, "tray_quit");
690 g_signal_connect_swapped (G_OBJECT (tray_quit), "activate", 690 g_signal_connect_swapped (G_OBJECT (tray_quit), "activate",
691 G_CALLBACK (on_tray_quit_activate), trayContextMenu); 691 G_CALLBACK (on_tray_quit_activate),
692 trayContextMenu);
692 g_signal_connect_swapped (G_OBJECT (trayIcon), "activate", 693 g_signal_connect_swapped (G_OBJECT (trayIcon), "activate",
693 G_CALLBACK (tray_clicked), trayContextMenu); 694 G_CALLBACK (tray_clicked), trayContextMenu);
694 g_signal_connect (G_OBJECT (trayIcon), "popup-menu", 695 g_signal_connect (G_OBJECT (trayIcon), "popup-menu",
diff --git a/src/core/main.c b/src/core/main.c
index 790f88d9..3fd82978 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -138,8 +138,8 @@ main (int argc, char *const *argv)
138 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow"); 138 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "mainWindow");
139 gtk_window_maximize (GTK_WINDOW (root)); 139 gtk_window_maximize (GTK_WINDOW (root));
140 gtk_widget_show (root); 140 gtk_widget_show (root);
141 gtk_window_present(GTK_WINDOW(root)); 141 gtk_window_present (GTK_WINDOW (root));
142 142
143 143
144 /* start the event loop */ 144 /* start the event loop */
145 gdk_threads_enter (); 145 gdk_threads_enter ();