aboutsummaryrefslogtreecommitdiff
path: root/src/common/helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/helper.c')
-rw-r--r--src/common/helper.c138
1 files changed, 68 insertions, 70 deletions
diff --git a/src/common/helper.c b/src/common/helper.c
index 2a06bf26..ee63c00d 100644
--- a/src/common/helper.c
+++ b/src/common/helper.c
@@ -142,7 +142,7 @@ GNUNET_GTK_save_call (GNUNET_ThreadMainFunction func, void *args)
142 GNUNET_mutex_lock (sclock); 142 GNUNET_mutex_lock (sclock);
143 if ((saveCallsUp == GNUNET_NO) || (!GNUNET_thread_test_self (mainThread))) 143 if ((saveCallsUp == GNUNET_NO) || (!GNUNET_thread_test_self (mainThread)))
144 { 144 {
145 GNUNET_GE_ASSERT(NULL, saveCallsUp != GNUNET_SYSERR); 145 GNUNET_GE_ASSERT (NULL, saveCallsUp != GNUNET_SYSERR);
146 call.args = args; 146 call.args = args;
147 call.func = func; 147 call.func = func;
148 call.sem = GNUNET_semaphore_create (0); 148 call.sem = GNUNET_semaphore_create (0);
@@ -555,11 +555,11 @@ GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS status,
555 g_free (iconPath); 555 g_free (iconPath);
556 gtk_icon_source_set_size_wildcarded (iconSource, FALSE); 556 gtk_icon_source_set_size_wildcarded (iconSource, FALSE);
557 gtk_icon_set_add_source (iconSet, iconSource); 557 gtk_icon_set_add_source (iconSet, iconSource);
558 558
559 gtk_icon_factory_add (GNUNET_GTK_get_iconFactory (), 559 gtk_icon_factory_add (GNUNET_GTK_get_iconFactory (),
560 "gnunet-gtk-status-connected", iconSet); 560 "gnunet-gtk-status-connected", iconSet);
561 gtk_icon_set_unref (iconSet); 561 gtk_icon_set_unref (iconSet);
562 562
563 iconSet = gtk_icon_set_new (); 563 iconSet = gtk_icon_set_new ();
564 iconPath = 564 iconPath =
565 g_strconcat (finalPath, "gnunet-gtk-status-unknown.svg", NULL); 565 g_strconcat (finalPath, "gnunet-gtk-status-unknown.svg", NULL);
@@ -625,89 +625,87 @@ GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS status,
625 return; 625 return;
626 switch (status) 626 switch (status)
627 { 627 {
628 case GNUNET_GTK_STATUS_CONNECTED : 628 case GNUNET_GTK_STATUS_CONNECTED:
629 GNUNET_GE_BREAK (NULL, peers > 0); 629 GNUNET_GE_BREAK (NULL, peers > 0);
630 if (peers == 1) 630 if (peers == 1)
631 { 631 {
632 gtk_label_set_text (GTK_LABEL (statusConnexionsLabel), 632 gtk_label_set_text (GTK_LABEL (statusConnexionsLabel),
633 _("Connected to 1 peer")); 633 _("Connected to 1 peer"));
634#if GTK_CHECK_VERSION (2,10,0) 634#if GTK_CHECK_VERSION (2,10,0)
635 gtk_status_icon_set_tooltip (trayIcon, 635 gtk_status_icon_set_tooltip (trayIcon,
636 _("GNUnet - Connected to 1 peer")); 636 _("GNUnet - Connected to 1 peer"));
637#endif 637#endif
638 } 638 }
639 else 639 else
640 { 640 {
641 label = g_strdup_printf (_("Connected to %Lu peers"), peers); 641 label = g_strdup_printf (_("Connected to %Lu peers"), peers);
642 gtk_label_set_text (GTK_LABEL (statusConnexionsLabel), label); 642 gtk_label_set_text (GTK_LABEL (statusConnexionsLabel), label);
643 g_free (label); 643 g_free (label);
644#if GTK_CHECK_VERSION (2,10,0) 644#if GTK_CHECK_VERSION (2,10,0)
645 label = 645 label =
646 g_strdup_printf (_("GNUnet - Connected to %Lu peers"), peers); 646 g_strdup_printf (_("GNUnet - Connected to %Lu peers"), peers);
647 gtk_status_icon_set_tooltip (trayIcon, label); 647 gtk_status_icon_set_tooltip (trayIcon, label);
648 g_free (label); 648 g_free (label);
649#endif 649#endif
650 } 650 }
651#if GTK_CHECK_VERSION (2,10,0) 651#if GTK_CHECK_VERSION (2,10,0)
652 gtk_status_icon_set_from_stock (trayIcon, 652 gtk_status_icon_set_from_stock (trayIcon,
653 "gnunet-gtk-status-connected"); 653 "gnunet-gtk-status-connected");
654#endif 654#endif
655 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic), 655 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic),
656 GTK_STOCK_NETWORK, 1); 656 GTK_STOCK_NETWORK, 1);
657 break; 657 break;
658 658
659 case GNUNET_GTK_STATUS_DISCONNECTED : 659 case GNUNET_GTK_STATUS_DISCONNECTED:
660 gtk_label_set_markup (GTK_LABEL (statusConnexionsLabel), 660 gtk_label_set_markup (GTK_LABEL (statusConnexionsLabel),
661 _("<b>Disconnected</b>")); 661 _("<b>Disconnected</b>"));
662 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic), 662 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic),
663 GTK_STOCK_DISCONNECT, 1); 663 GTK_STOCK_DISCONNECT, 1);
664#if GTK_CHECK_VERSION (2,10,0) 664#if GTK_CHECK_VERSION (2,10,0)
665 gtk_status_icon_set_tooltip (trayIcon, _("GNUnet - Disconnected")); 665 gtk_status_icon_set_tooltip (trayIcon, _("GNUnet - Disconnected"));
666 gtk_status_icon_set_from_stock (trayIcon, 666 gtk_status_icon_set_from_stock (trayIcon,
667 "gnunet-gtk-status-disconnected"); 667 "gnunet-gtk-status-disconnected");
668#endif 668#endif
669 break; 669 break;
670 670
671 case GNUNET_GTK_STATUS_DAEMONUP : 671 case GNUNET_GTK_STATUS_DAEMONUP:
672 gtk_label_set_markup (GTK_LABEL (statusConnexionsLabel), 672 gtk_label_set_markup (GTK_LABEL (statusConnexionsLabel),
673 _("Daemon running")); 673 _("Daemon running"));
674 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic), 674 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic),
675 GTK_STOCK_EXECUTE, 1); 675 GTK_STOCK_EXECUTE, 1);
676#if GTK_CHECK_VERSION (2,10,0) 676#if GTK_CHECK_VERSION (2,10,0)
677 gtk_status_icon_set_tooltip (trayIcon, 677 gtk_status_icon_set_tooltip (trayIcon, _("GNUnet - Daemon running"));
678 _("GNUnet - Daemon running")); 678 gtk_status_icon_set_from_icon_name (trayIcon, "gnunet-gtk");
679 gtk_status_icon_set_from_icon_name (trayIcon, "gnunet-gtk");
680#endif 679#endif
681 break; 680 break;
682 681
683 case GNUNET_GTK_STATUS_NODAEMON : 682 case GNUNET_GTK_STATUS_NODAEMON:
684 gtk_label_set_markup (GTK_LABEL (statusConnexionsLabel), 683 gtk_label_set_markup (GTK_LABEL (statusConnexionsLabel),
685 _("<b>Daemon not running</b>")); 684 _("<b>Daemon not running</b>"));
686 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic), 685 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic),
687 GTK_STOCK_NO, 1); 686 GTK_STOCK_NO, 1);
688#if GTK_CHECK_VERSION (2,10,0) 687#if GTK_CHECK_VERSION (2,10,0)
689 gtk_status_icon_set_tooltip (trayIcon, 688 gtk_status_icon_set_tooltip (trayIcon,
690 _("GNUnet - Daemon not running")); 689 _("GNUnet - Daemon not running"));
691 gtk_status_icon_set_from_stock (trayIcon, "gnunet-gtk-status-nodaemon"); 690 gtk_status_icon_set_from_stock (trayIcon, "gnunet-gtk-status-nodaemon");
692#endif 691#endif
693 break; 692 break;
694 693
695 default : /* GNUNET_GTK_STATUS_UNKNOWN */ 694 default: /* GNUNET_GTK_STATUS_UNKNOWN */
696 GNUNET_GTK_add_log_entry (_ 695 GNUNET_GTK_add_log_entry (_
697 ("WARNING: Failed to obtain connection statistics from gnunetd.\n")); 696 ("WARNING: Failed to obtain connection statistics from gnunetd.\n"));
698 gtk_label_set_text (GTK_LABEL (statusConnexionsLabel), 697 gtk_label_set_text (GTK_LABEL (statusConnexionsLabel),
699 _("Unknown status")); 698 _("Unknown status"));
700 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic), 699 gtk_image_set_from_stock (GTK_IMAGE (statusConnexionsPic),
701 GTK_STOCK_DIALOG_ERROR, 1); 700 GTK_STOCK_DIALOG_ERROR, 1);
702#if GTK_CHECK_VERSION (2,10,0) 701#if GTK_CHECK_VERSION (2,10,0)
703 gtk_status_icon_set_tooltip (trayIcon, _("Unknown status")); 702 gtk_status_icon_set_tooltip (trayIcon, _("Unknown status"));
704 gtk_status_icon_set_from_stock (trayIcon, 703 gtk_status_icon_set_from_stock (trayIcon, "gnunet-gtk-status-unknown");
705 "gnunet-gtk-status-unknown");
706#endif 704#endif
707 break; 705 break;
708 } 706 }
709 last_status = status; 707 last_status = status;
710 last_peers = peers; 708 last_peers = peers;
711} 709}
712 710
713/** 711/**