diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk_event-handler.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk_event-handler.c | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c b/src/fs/gnunet-fs-gtk_event-handler.c index 24833481..bbe7772d 100644 --- a/src/fs/gnunet-fs-gtk_event-handler.c +++ b/src/fs/gnunet-fs-gtk_event-handler.c | |||
@@ -1,10 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | (C) 2010, 2011, 2012 Christian Grothoff (and other contributing authors) | 3 | (C) 2010-2013 Christian Grothoff (and other contributing authors) |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
7 | by the Free Software Foundation; either version 2, or (at your | 7 | by the Free Software Foundation; either version 3, or (at your |
8 | option) any later version. | 8 | option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
@@ -968,13 +968,21 @@ copy_search_uri_to_clipboard_ctx_menu (GtkMenuItem *item, gpointer user_data) | |||
968 | GNUNET_free (uris); | 968 | GNUNET_free (uris); |
969 | } | 969 | } |
970 | 970 | ||
971 | /* Called for each embedded sks. Return GNUNET_OK to continue iteration */ | 971 | |
972 | typedef int (*embedded_sks_callback) (void *cls, const struct GNUNET_FS_Uri *sks_uri, | 972 | /** |
973 | const char *sks_uri_string, struct GNUNET_FS_PseudonymIdentifier *nsid); | 973 | * Called for each embedded sks. |
974 | * | ||
975 | * @return GNUNET_OK to continue iteration | ||
976 | */ | ||
977 | typedef int (*EmbeddedSksCallback) (void *cls, | ||
978 | const struct GNUNET_FS_Uri *sks_uri, | ||
979 | const char *sks_uri_string, | ||
980 | const struct GNUNET_CRYPTO_EccPublicKey *nsid); | ||
981 | |||
974 | 982 | ||
975 | struct sks_scanner_callback_context | 983 | struct sks_scanner_callback_context |
976 | { | 984 | { |
977 | embedded_sks_callback cb; | 985 | EmbeddedSksCallback cb; |
978 | void *cls; | 986 | void *cls; |
979 | }; | 987 | }; |
980 | 988 | ||
@@ -1014,7 +1022,8 @@ check_for_embedded_sks (void *cls, | |||
1014 | char *id = GNUNET_FS_uri_sks_get_content_id (sks_uri); | 1022 | char *id = GNUNET_FS_uri_sks_get_content_id (sks_uri); |
1015 | if (NULL != id) | 1023 | if (NULL != id) |
1016 | { | 1024 | { |
1017 | struct GNUNET_FS_PseudonymIdentifier nsid; | 1025 | struct GNUNET_CRYPTO_EccPublicKey nsid; |
1026 | |||
1018 | if ((0 == strcmp (id, "/")) && | 1027 | if ((0 == strcmp (id, "/")) && |
1019 | (GNUNET_OK == GNUNET_FS_uri_sks_get_namespace (sks_uri, &nsid))) | 1028 | (GNUNET_OK == GNUNET_FS_uri_sks_get_namespace (sks_uri, &nsid))) |
1020 | result = ctx->cb (ctx->cls, sks_uri, data, &nsid); | 1029 | result = ctx->cb (ctx->cls, sks_uri, data, &nsid); |
@@ -1034,7 +1043,7 @@ check_for_embedded_sks (void *cls, | |||
1034 | */ | 1043 | */ |
1035 | static void | 1044 | static void |
1036 | find_embedded_sks (const struct GNUNET_CONTAINER_MetaData *meta, | 1045 | find_embedded_sks (const struct GNUNET_CONTAINER_MetaData *meta, |
1037 | embedded_sks_callback cb, void *cls) | 1046 | EmbeddedSksCallback cb, void *cls) |
1038 | { | 1047 | { |
1039 | struct sks_scanner_callback_context ctx; | 1048 | struct sks_scanner_callback_context ctx; |
1040 | 1049 | ||
@@ -1045,21 +1054,25 @@ find_embedded_sks (const struct GNUNET_CONTAINER_MetaData *meta, | |||
1045 | } | 1054 | } |
1046 | 1055 | ||
1047 | 1056 | ||
1048 | struct sks_population_context | 1057 | struct SksPopulationContext |
1049 | { | 1058 | { |
1050 | GtkMenu *menu; | 1059 | GtkMenu *menu; |
1051 | int counter; | 1060 | int counter; |
1052 | uintptr_t anonymity_level; | 1061 | uintptr_t anonymity_level; |
1053 | }; | 1062 | }; |
1054 | 1063 | ||
1055 | /* Called for every SKS URI in metadata. Adds up to 3 menu items | 1064 | |
1065 | /** | ||
1066 | * Called for every SKS URI in metadata. Adds up to 3 menu items | ||
1056 | * that will initiate downloads for these SKS URIs | 1067 | * that will initiate downloads for these SKS URIs |
1057 | */ | 1068 | */ |
1058 | static int | 1069 | static int |
1059 | populate_popup_with_sks_items (void *cls, const struct GNUNET_FS_Uri *sks_uri, | 1070 | populate_popup_with_sks_items (void *cls, |
1060 | const char *sks_uri_string, struct GNUNET_FS_PseudonymIdentifier *nsid) | 1071 | const struct GNUNET_FS_Uri *sks_uri, |
1072 | const char *sks_uri_string, | ||
1073 | const struct GNUNET_CRYPTO_EccPublicKey *nsid) | ||
1061 | { | 1074 | { |
1062 | struct sks_population_context *ctx = cls; | 1075 | struct SksPopulationContext *ctx = cls; |
1063 | GtkWidget *child; | 1076 | GtkWidget *child; |
1064 | char *label; | 1077 | char *label; |
1065 | GtkWidget *ns_association_icon; | 1078 | GtkWidget *ns_association_icon; |
@@ -1084,6 +1097,7 @@ populate_popup_with_sks_items (void *cls, const struct GNUNET_FS_Uri *sks_uri, | |||
1084 | return (ctx->counter < 4) ? GNUNET_OK : GNUNET_SYSERR; | 1097 | return (ctx->counter < 4) ? GNUNET_OK : GNUNET_SYSERR; |
1085 | } | 1098 | } |
1086 | 1099 | ||
1100 | |||
1087 | /** | 1101 | /** |
1088 | * Context menu was requested for a search result list. | 1102 | * Context menu was requested for a search result list. |
1089 | * Compute which menu items are applicable and display | 1103 | * Compute which menu items are applicable and display |
@@ -1110,9 +1124,9 @@ search_list_popup (GtkTreeModel *tm, | |||
1110 | struct SearchListPopupContext *spc; | 1124 | struct SearchListPopupContext *spc; |
1111 | struct GNUNET_CONTAINER_MetaData *meta; | 1125 | struct GNUNET_CONTAINER_MetaData *meta; |
1112 | int is_directory = GNUNET_NO; | 1126 | int is_directory = GNUNET_NO; |
1113 | struct sks_population_context sks_pop_ctx; | 1127 | struct SksPopulationContext sks_pop_ctx; |
1114 | 1128 | ||
1115 | spc = GNUNET_malloc (sizeof (struct SearchListPopupContext)); | 1129 | spc = GNUNET_new (struct SearchListPopupContext); |
1116 | spc->tab = tab; | 1130 | spc->tab = tab; |
1117 | path = gtk_tree_model_get_path (tm, iter); | 1131 | path = gtk_tree_model_get_path (tm, iter); |
1118 | spc->rr = gtk_tree_row_reference_new (tm, path); | 1132 | spc->rr = gtk_tree_row_reference_new (tm, path); |
@@ -2166,7 +2180,7 @@ static int | |||
2166 | see_if_there_are_any_sks_uris (void *cls, | 2180 | see_if_there_are_any_sks_uris (void *cls, |
2167 | const struct GNUNET_FS_Uri *sks_uri, | 2181 | const struct GNUNET_FS_Uri *sks_uri, |
2168 | const char *sks_uri_string, | 2182 | const char *sks_uri_string, |
2169 | struct GNUNET_FS_PseudonymIdentifier *nsid) | 2183 | const struct GNUNET_CRYPTO_EccPublicKey *nsid) |
2170 | { | 2184 | { |
2171 | gboolean *gb = cls; | 2185 | gboolean *gb = cls; |
2172 | 2186 | ||