diff options
Diffstat (limited to 'src/namestore/gnunet-namestore-gtk.c')
-rw-r--r-- | src/namestore/gnunet-namestore-gtk.c | 82 |
1 files changed, 69 insertions, 13 deletions
diff --git a/src/namestore/gnunet-namestore-gtk.c b/src/namestore/gnunet-namestore-gtk.c index 2258b5bc..60ab84d5 100644 --- a/src/namestore/gnunet-namestore-gtk.c +++ b/src/namestore/gnunet-namestore-gtk.c | |||
@@ -902,12 +902,6 @@ handle_records_for_merge (void *cls, | |||
902 | { | 902 | { |
903 | struct MoveOperationContext *moc = cls; | 903 | struct MoveOperationContext *moc = cls; |
904 | 904 | ||
905 | if (NULL == label) | ||
906 | { | ||
907 | moc->it = NULL; | ||
908 | merge_with_existing_records (moc, 0, NULL); | ||
909 | return; | ||
910 | } | ||
911 | if (0 != strcmp (label, | 905 | if (0 != strcmp (label, |
912 | moc->edc->name)) | 906 | moc->edc->name)) |
913 | { | 907 | { |
@@ -921,6 +915,40 @@ handle_records_for_merge (void *cls, | |||
921 | 915 | ||
922 | 916 | ||
923 | /** | 917 | /** |
918 | * Error communicating with database, complain to user. | ||
919 | * | ||
920 | * @param cls the `struct MoveOperationContext` | ||
921 | */ | ||
922 | static void | ||
923 | handle_records_for_merge_error (void *cls) | ||
924 | { | ||
925 | struct MoveOperationContext *moc = cls; | ||
926 | struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = moc->edc; | ||
927 | |||
928 | show_error_message (_("Failed to communicate with database"), | ||
929 | _("Check that your peer is configured correctly.")); | ||
930 | GNUNET_free (moc->data); | ||
931 | GNUNET_free (moc); | ||
932 | free_edit_dialog_context (edc); | ||
933 | } | ||
934 | |||
935 | |||
936 | /** | ||
937 | * Finished zone iteration. Proceed. | ||
938 | * | ||
939 | * @param cls the `struct MoveOperationContext` | ||
940 | */ | ||
941 | static void | ||
942 | handle_records_for_merge_end (void *cls) | ||
943 | { | ||
944 | struct MoveOperationContext *moc = cls; | ||
945 | |||
946 | moc->it = NULL; | ||
947 | merge_with_existing_records (moc, 0, NULL); | ||
948 | } | ||
949 | |||
950 | |||
951 | /** | ||
924 | * The edit dialog completed; update the namestore and the | 952 | * The edit dialog completed; update the namestore and the |
925 | * view based on the new values in @a edc. | 953 | * view based on the new values in @a edc. |
926 | * | 954 | * |
@@ -1069,8 +1097,12 @@ edit_dialog_continuation (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc, | |||
1069 | GNUNET_CONTAINER_DLL_insert (moc_head, moc_tail, moc); | 1097 | GNUNET_CONTAINER_DLL_insert (moc_head, moc_tail, moc); |
1070 | moc->it = GNUNET_NAMESTORE_zone_iteration_start (namestore, | 1098 | moc->it = GNUNET_NAMESTORE_zone_iteration_start (namestore, |
1071 | pk, | 1099 | pk, |
1100 | &handle_records_for_merge_error, | ||
1101 | moc, | ||
1072 | &handle_records_for_merge, | 1102 | &handle_records_for_merge, |
1073 | moc); | 1103 | moc, |
1104 | &handle_records_for_merge_end, | ||
1105 | moc); | ||
1074 | /* zone changed, remove record from old zone, add to new zone! */ | 1106 | /* zone changed, remove record from old zone, add to new zone! */ |
1075 | if (GNUNET_YES == edc->old_record_in_namestore) | 1107 | if (GNUNET_YES == edc->old_record_in_namestore) |
1076 | { | 1108 | { |
@@ -2237,6 +2269,33 @@ zone_sync_proc (void *cls) | |||
2237 | 2269 | ||
2238 | 2270 | ||
2239 | /** | 2271 | /** |
2272 | * Function called once our model is again inconsistent with | ||
2273 | * the current zone. Hides the view. | ||
2274 | * | ||
2275 | * @param cls NULL | ||
2276 | */ | ||
2277 | static void | ||
2278 | zone_iteration_error (void *cls) | ||
2279 | { | ||
2280 | clear_zone_view (); | ||
2281 | gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_pseu_hbox"))); | ||
2282 | #if HAVE_QRENCODE_H | ||
2283 | setup_qrcode (); | ||
2284 | gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image"))); | ||
2285 | gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button"))); | ||
2286 | gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator"))); | ||
2287 | #else | ||
2288 | gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image"))); | ||
2289 | gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button"))); | ||
2290 | gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator"))); | ||
2291 | #endif | ||
2292 | gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_status_label"))); | ||
2293 | gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_scrolledwindow"))); | ||
2294 | gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_zone_combobox"))); | ||
2295 | } | ||
2296 | |||
2297 | |||
2298 | /** | ||
2240 | * Function called for each record in the current zone. Update the | 2299 | * Function called for each record in the current zone. Update the |
2241 | * widgets accordingly. | 2300 | * widgets accordingly. |
2242 | * | 2301 | * |
@@ -2272,12 +2331,6 @@ zone_iteration_proc (void *cls, | |||
2272 | GtkTreeIter sel_iter; | 2331 | GtkTreeIter sel_iter; |
2273 | GtkTreePath *sel_path; | 2332 | GtkTreePath *sel_path; |
2274 | 2333 | ||
2275 | if ((NULL == zone_key) && (NULL == name)) | ||
2276 | { | ||
2277 | /* disconnect from namestore, clear view */ | ||
2278 | clear_zone_view (); | ||
2279 | return; | ||
2280 | } | ||
2281 | if ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) && | 2334 | if ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) && |
2282 | (0 != strcmp (name, GNUNET_GNS_MASTERZONE_STR)) ) | 2335 | (0 != strcmp (name, GNUNET_GNS_MASTERZONE_STR)) ) |
2283 | { | 2336 | { |
@@ -2553,7 +2606,10 @@ load_zone (const char *name, | |||
2553 | #endif | 2606 | #endif |
2554 | zmon = GNUNET_NAMESTORE_zone_monitor_start (cfg, pkey, | 2607 | zmon = GNUNET_NAMESTORE_zone_monitor_start (cfg, pkey, |
2555 | GNUNET_YES, | 2608 | GNUNET_YES, |
2609 | &zone_iteration_error, | ||
2610 | NULL, | ||
2556 | &zone_iteration_proc, | 2611 | &zone_iteration_proc, |
2612 | NULL, | ||
2557 | &zone_sync_proc, | 2613 | &zone_sync_proc, |
2558 | NULL); | 2614 | NULL); |
2559 | } | 2615 | } |