diff options
Diffstat (limited to 'src/setup/gnunet-setup-options.c')
-rw-r--r-- | src/setup/gnunet-setup-options.c | 68 |
1 files changed, 51 insertions, 17 deletions
diff --git a/src/setup/gnunet-setup-options.c b/src/setup/gnunet-setup-options.c index c9b16350..bc6e2cb7 100644 --- a/src/setup/gnunet-setup-options.c +++ b/src/setup/gnunet-setup-options.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * @brief configuration details | 23 | * @brief configuration details |
24 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
25 | */ | 25 | */ |
26 | #include "gnunet-setup.h" | ||
26 | #include "gnunet-setup-options.h" | 27 | #include "gnunet-setup-options.h" |
27 | #include <gnunet/gnunet_util_lib.h> | 28 | #include <gnunet/gnunet_util_lib.h> |
28 | #include <gdk/gdkkeysyms.h> | 29 | #include <gdk/gdkkeysyms.h> |
@@ -605,7 +606,9 @@ GNUNET_setup_treeview_key_press_event_cb (GtkTreeView * tv, GdkEventKey * event, | |||
605 | sel = gtk_tree_view_get_selection (tv); | 606 | sel = gtk_tree_view_get_selection (tv); |
606 | if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) | 607 | if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter)) |
607 | return FALSE; | 608 | return FALSE; |
608 | gtk_tree_model_get (tm, &iter, 1, &editable, -1); | 609 | gtk_tree_model_get (tm, &iter, |
610 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, &editable, | ||
611 | -1); | ||
609 | if (TRUE == editable) | 612 | if (TRUE == editable) |
610 | return FALSE; /* likely currently editing... */ | 613 | return FALSE; /* likely currently editing... */ |
611 | gtk_list_store_remove (ls, &iter); | 614 | gtk_list_store_remove (ls, &iter); |
@@ -641,9 +644,17 @@ load_string_list_store (const void *cls, const char *section, | |||
641 | return GNUNET_SYSERR; | 644 | return GNUNET_SYSERR; |
642 | t = GNUNET_strdup (value); | 645 | t = GNUNET_strdup (value); |
643 | for (w = strtok (t, " "); w != NULL; w = strtok (NULL, " ")) | 646 | for (w = strtok (t, " "); w != NULL; w = strtok (NULL, " ")) |
644 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, w, 1, FALSE, -1); | 647 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, |
648 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, w, | ||
649 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, | ||
650 | FALSE, | ||
651 | -1); | ||
645 | GNUNET_free (t); | 652 | GNUNET_free (t); |
646 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, "", 1, TRUE, -1); | 653 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, |
654 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, "", | ||
655 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, | ||
656 | TRUE, | ||
657 | -1); | ||
647 | return GNUNET_OK; | 658 | return GNUNET_OK; |
648 | } | 659 | } |
649 | 660 | ||
@@ -678,7 +689,8 @@ save_string_list_store (const void *cls, const char *section, | |||
678 | { | 689 | { |
679 | do | 690 | do |
680 | { | 691 | { |
681 | gtk_tree_model_get (tm, &iter, 0, &val, -1); | 692 | gtk_tree_model_get (tm, &iter, |
693 | GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, &val, -1); | ||
682 | if (0 < strlen (val)) | 694 | if (0 < strlen (val)) |
683 | { | 695 | { |
684 | if (value == NULL) | 696 | if (value == NULL) |
@@ -725,9 +737,16 @@ add_dns_entry_to_list_store (void *cls, const char *section) | |||
725 | 737 | ||
726 | if (NULL == section) | 738 | if (NULL == section) |
727 | { | 739 | { |
728 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, 0, "", 1, | 740 | gtk_list_store_insert_with_values (ls, &iter, G_MAXINT, |
729 | (guint) 80, 2, (guint) 8080, 3, | 741 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, "", |
730 | "localhost4", 4, "tcp", -1); | 742 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, |
743 | (guint) 80, | ||
744 | GNUNET_GTK_SETUP_GNS_MC_TARGETPORT, | ||
745 | (guint) 8080, | ||
746 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, | ||
747 | "localhost4", | ||
748 | GNUNET_GTK_SETUP_GNS_MC_ISUDP, "tcp", | ||
749 | -1); | ||
731 | return; | 750 | return; |
732 | } | 751 | } |
733 | 752 | ||
@@ -781,9 +800,16 @@ add_dns_entry_to_list_store (void *cls, const char *section) | |||
781 | _("`%s' is not a valid port number!\n"), hostport); | 800 | _("`%s' is not a valid port number!\n"), hostport); |
782 | continue; | 801 | continue; |
783 | } | 802 | } |
784 | gtk_list_store_insert_with_values (ls, &iter, 0, 0, sld, 1, | 803 | gtk_list_store_insert_with_values (ls, &iter, 0, |
785 | (guint) local_port, 2, | 804 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, |
786 | (guint) host_port, 3, hostname, 4, | 805 | sld, |
806 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, | ||
807 | (guint) local_port, | ||
808 | GNUNET_GTK_SETUP_GNS_MC_TARGETPORT, | ||
809 | (guint) host_port, | ||
810 | GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME, | ||
811 | hostname, | ||
812 | GNUNET_GTK_SETUP_GNS_MC_ISUDP, | ||
787 | (TRUE == udp) ? "udp" : "tcp", -1); | 813 | (TRUE == udp) ? "udp" : "tcp", -1); |
788 | } | 814 | } |
789 | GNUNET_free (cpy); | 815 | GNUNET_free (cpy); |
@@ -916,8 +942,13 @@ update_vpn_dns_configuration (GtkTreeModel * tm) | |||
916 | if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) | 942 | if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) |
917 | do | 943 | do |
918 | { | 944 | { |
919 | gtk_tree_model_get (tm, &iter, 0, &hostname, 1, &srcport, 2, &targetport, | 945 | gtk_tree_model_get (tm, &iter, |
920 | 3, &targethost, 4, &tcpudp, -1); | 946 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, &hostname, |
947 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, &srcport, | ||
948 | GNUNET_GTK_SETUP_GNS_MC_TARGETPORT, &targetport, | ||
949 | GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME, &targethost, | ||
950 | GNUNET_GTK_SETUP_GNS_MC_ISUDP, &tcpudp, | ||
951 | -1); | ||
921 | if (0 != strlen (hostname)) | 952 | if (0 != strlen (hostname)) |
922 | { | 953 | { |
923 | pos = head; | 954 | pos = head; |
@@ -1025,7 +1056,7 @@ save_vpn_dns_service_dnsname (GtkCellRendererText * renderer, gchar * path, | |||
1025 | GNUNET_break (0); | 1056 | GNUNET_break (0); |
1026 | return; | 1057 | return; |
1027 | } | 1058 | } |
1028 | gtk_tree_model_get (tm, &iter, 0, &old, -1); | 1059 | gtk_tree_model_get (tm, &iter, GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, &old, -1); |
1029 | if ((0 != strlen (old)) && (0 == strlen (new_text))) | 1060 | if ((0 != strlen (old)) && (0 == strlen (new_text))) |
1030 | { | 1061 | { |
1031 | /* deletion */ | 1062 | /* deletion */ |
@@ -1036,7 +1067,8 @@ save_vpn_dns_service_dnsname (GtkCellRendererText * renderer, gchar * path, | |||
1036 | return; | 1067 | return; |
1037 | } | 1068 | } |
1038 | /* update model */ | 1069 | /* update model */ |
1039 | gtk_list_store_set (ls, &iter, 0, new_text, -1); | 1070 | gtk_list_store_set (ls, &iter, |
1071 | GNUNET_GTK_SETUP_GNS_MC_HOSTNAME, new_text, -1); | ||
1040 | /* update configuration */ | 1072 | /* update configuration */ |
1041 | update_vpn_dns_configuration (tm); | 1073 | update_vpn_dns_configuration (tm); |
1042 | if ((0 == strlen (old)) && (0 != strlen (new_text))) | 1074 | if ((0 == strlen (old)) && (0 != strlen (new_text))) |
@@ -1126,7 +1158,7 @@ save_vpn_dns_service_tcpudp (GtkCellRendererText * renderer, gchar * path, | |||
1126 | return; | 1158 | return; |
1127 | } | 1159 | } |
1128 | /* update model */ | 1160 | /* update model */ |
1129 | gtk_list_store_set (ls, &iter, 4, new_text, -1); | 1161 | gtk_list_store_set (ls, &iter, GNUNET_GTK_SETUP_GNS_MC_ISUDP, new_text, -1); |
1130 | /* update configuration */ | 1162 | /* update configuration */ |
1131 | update_vpn_dns_configuration (tm); | 1163 | update_vpn_dns_configuration (tm); |
1132 | } | 1164 | } |
@@ -1210,7 +1242,8 @@ save_vpn_dns_service_sourceport (GtkCellRendererText * renderer, gchar * path, | |||
1210 | return; | 1242 | return; |
1211 | } | 1243 | } |
1212 | /* update model */ | 1244 | /* update model */ |
1213 | gtk_list_store_set (ls, &iter, 1, (guint) port, -1); | 1245 | gtk_list_store_set (ls, &iter, |
1246 | GNUNET_GTK_SETUP_GNS_MC_SOURCEPORT, (guint) port, -1); | ||
1214 | /* update configuration */ | 1247 | /* update configuration */ |
1215 | update_vpn_dns_configuration (tm); | 1248 | update_vpn_dns_configuration (tm); |
1216 | } | 1249 | } |
@@ -1289,7 +1322,8 @@ save_vpn_dns_service_targethostname (GtkCellRendererText * renderer, | |||
1289 | return; | 1322 | return; |
1290 | } | 1323 | } |
1291 | /* update model */ | 1324 | /* update model */ |
1292 | gtk_list_store_set (ls, &iter, 3, new_text, -1); | 1325 | gtk_list_store_set (ls, &iter, |
1326 | GNUNET_GTK_SETUP_GNS_MC_TARGETHOSTNAME, new_text, -1); | ||
1293 | /* update configuration */ | 1327 | /* update configuration */ |
1294 | update_vpn_dns_configuration (tm); | 1328 | update_vpn_dns_configuration (tm); |
1295 | } | 1329 | } |