diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-08 14:02:32 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-08 14:02:32 +0200 |
commit | 244e204d8ccf8d2dec1f23ba19b30f322002aaf0 (patch) | |
tree | 1f91269df76c72ef6e7b1f2b8abd919200071aba | |
parent | 7f5691514d3e34ee9f74336f4e2325bf7d06c53f (diff) | |
download | gnunet-gtk-244e204d8ccf8d2dec1f23ba19b30f322002aaf0.tar.gz gnunet-gtk-244e204d8ccf8d2dec1f23ba19b30f322002aaf0.zip |
fix #5925
-rw-r--r-- | src/fs/gnunet-fs-gtk.c | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c index aa87f262..e1c5a955 100644 --- a/src/fs/gnunet-fs-gtk.c +++ b/src/fs/gnunet-fs-gtk.c | |||
@@ -172,7 +172,7 @@ main_window_save_position (GtkWidget *main_window) | |||
172 | struct GNUNET_CONFIGURATION_Handle *cfgDefault; | 172 | struct GNUNET_CONFIGURATION_Handle *cfgDefault; |
173 | 173 | ||
174 | cfg = (struct GNUNET_CONFIGURATION_Handle *) | 174 | cfg = (struct GNUNET_CONFIGURATION_Handle *) |
175 | GNUNET_GTK_main_loop_get_configuration (ml); | 175 | GNUNET_GTK_main_loop_get_configuration (ml); |
176 | main_window_gdk = gtk_widget_get_window (main_window); | 176 | main_window_gdk = gtk_widget_get_window (main_window); |
177 | maximized = GNUNET_YES; | 177 | maximized = GNUNET_YES; |
178 | if (NULL != main_window_gdk) | 178 | if (NULL != main_window_gdk) |
@@ -205,7 +205,7 @@ main_window_save_position (GtkWidget *main_window) | |||
205 | "gnunet-fs-gtk", | 205 | "gnunet-fs-gtk", |
206 | "MAIN_WINDOW_MAXIMIZED", | 206 | "MAIN_WINDOW_MAXIMIZED", |
207 | (maximized == GNUNET_YES) ? "YES" | 207 | (maximized == GNUNET_YES) ? "YES" |
208 | : "NO"); | 208 | : "NO"); |
209 | 209 | ||
210 | cfgDefault = GNUNET_CONFIGURATION_create (); | 210 | cfgDefault = GNUNET_CONFIGURATION_create (); |
211 | (void) GNUNET_CONFIGURATION_load (cfgDefault, NULL); /* load defaults only */ | 211 | (void) GNUNET_CONFIGURATION_load (cfgDefault, NULL); /* load defaults only */ |
@@ -432,21 +432,21 @@ unique_app_message_cb (UniqueApp *app, | |||
432 | GNUNET_break (0); | 432 | GNUNET_break (0); |
433 | break; | 433 | break; |
434 | case UNIQUE_OPEN: { | 434 | case UNIQUE_OPEN: { |
435 | gchar **uris; | 435 | gchar **uris; |
436 | gint n_uris; | 436 | gint n_uris; |
437 | gint i; | 437 | gint i; |
438 | 438 | ||
439 | uris = unique_message_data_get_uris (message_data); | 439 | uris = unique_message_data_get_uris (message_data); |
440 | n_uris = g_strv_length (uris); | 440 | n_uris = g_strv_length (uris); |
441 | for (i = 0; i < n_uris; i++) | 441 | for (i = 0; i < n_uris; i++) |
442 | { | 442 | { |
443 | if (GNUNET_OK != | 443 | if (GNUNET_OK != |
444 | GNUNET_FS_GTK_handle_uri_string (uris[i], 1 /* anonymity level */)) | 444 | GNUNET_FS_GTK_handle_uri_string (uris[i], 1 /* anonymity level */)) |
445 | return UNIQUE_RESPONSE_PASSTHROUGH; | 445 | return UNIQUE_RESPONSE_PASSTHROUGH; |
446 | } | ||
447 | g_strfreev (uris); | ||
446 | } | 448 | } |
447 | g_strfreev (uris); | 449 | break; |
448 | } | ||
449 | break; | ||
450 | case UNIQUE_ACTIVATE: | 450 | case UNIQUE_ACTIVATE: |
451 | break; | 451 | break; |
452 | default: | 452 | default: |
@@ -458,7 +458,8 @@ unique_app_message_cb (UniqueApp *app, | |||
458 | 458 | ||
459 | 459 | ||
460 | static char * | 460 | static char * |
461 | format_service_list (unsigned int count, const char *const *list) | 461 | format_service_list (unsigned int count, |
462 | const struct GNUNET_ARM_ServiceInfo *list) | ||
462 | { | 463 | { |
463 | size_t len = 0; | 464 | size_t len = 0; |
464 | int i; | 465 | int i; |
@@ -473,7 +474,7 @@ format_service_list (unsigned int count, const char *const *list) | |||
473 | { | 474 | { |
474 | len += strlen (listheader); | 475 | len += strlen (listheader); |
475 | for (i = 0; i < count; i++) | 476 | for (i = 0; i < count; i++) |
476 | len += strlen (list[i]) + 1; | 477 | len += strlen (list[i].name) + 1; |
477 | } | 478 | } |
478 | len += 1; | 479 | len += 1; |
479 | result = p = GNUNET_malloc (len * sizeof (char)); | 480 | result = p = GNUNET_malloc (len * sizeof (char)); |
@@ -495,8 +496,8 @@ format_service_list (unsigned int count, const char *const *list) | |||
495 | p += r; | 496 | p += r; |
496 | for (i = 0; i < count; i++) | 497 | for (i = 0; i < count; i++) |
497 | { | 498 | { |
498 | size_t l = strlen (list[i]); | 499 | size_t l = strlen (list[i].name); |
499 | memcpy (p, list[i], l); | 500 | memcpy (p, list[i].name, l); |
500 | p += l; | 501 | p += l; |
501 | if (i + 1 < count) | 502 | if (i + 1 < count) |
502 | { | 503 | { |
@@ -514,7 +515,7 @@ static void | |||
514 | service_list_callback (void *cls, | 515 | service_list_callback (void *cls, |
515 | enum GNUNET_ARM_RequestStatus rs, | 516 | enum GNUNET_ARM_RequestStatus rs, |
516 | unsigned int count, | 517 | unsigned int count, |
517 | const char *const *list) | 518 | const struct GNUNET_ARM_ServiceInfo *list) |
518 | { | 519 | { |
519 | char *service_list; | 520 | char *service_list; |
520 | 521 | ||
@@ -549,7 +550,7 @@ arm_connection_state_change (void *cls, int connected) | |||
549 | static void | 550 | static void |
550 | service_status_change (void *cls, | 551 | service_status_change (void *cls, |
551 | const char *service, | 552 | const char *service, |
552 | enum GNUNET_ARM_ServiceStatus status) | 553 | enum GNUNET_ARM_ServiceMonitorStatus status) |
553 | { | 554 | { |
554 | /* Very crude, we can probably do better. | 555 | /* Very crude, we can probably do better. |
555 | * Maybe keep a list of running services, and modify it in response | 556 | * Maybe keep a list of running services, and modify it in response |
@@ -569,7 +570,7 @@ monitor_zone_error (void *cls) | |||
569 | GNUNET_FS_GTK_get_main_window_object ("namespace_label_liststore")); | 570 | GNUNET_FS_GTK_get_main_window_object ("namespace_label_liststore")); |
570 | gtk_list_store_clear (ls); | 571 | gtk_list_store_clear (ls); |
571 | gtk_widget_hide (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ( | 572 | gtk_widget_hide (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ( |
572 | "main_window_search_namespace_combobox"))); | 573 | "main_window_search_namespace_combobox"))); |
573 | } | 574 | } |
574 | 575 | ||
575 | 576 | ||
@@ -577,7 +578,7 @@ static void | |||
577 | monitor_zone_sync (void *cls) | 578 | monitor_zone_sync (void *cls) |
578 | { | 579 | { |
579 | gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ( | 580 | gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ( |
580 | "main_window_search_namespace_combobox"))); | 581 | "main_window_search_namespace_combobox"))); |
581 | } | 582 | } |
582 | 583 | ||
583 | 584 | ||
@@ -665,9 +666,9 @@ handle_sks_zone_identity (void *cls, | |||
665 | main_context.sks_zone = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); | 666 | main_context.sks_zone = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); |
666 | *main_context.sks_zone = *GNUNET_IDENTITY_ego_get_private_key (ego); | 667 | *main_context.sks_zone = *GNUNET_IDENTITY_ego_get_private_key (ego); |
667 | gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ( | 668 | gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ( |
668 | "main_window_search_namespace_label"))); | 669 | "main_window_search_namespace_label"))); |
669 | gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ( | 670 | gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object ( |
670 | "main_window_search_namespace_combobox"))); | 671 | "main_window_search_namespace_combobox"))); |
671 | main_context.zm = GNUNET_NAMESTORE_zone_monitor_start (main_context.cfg, | 672 | main_context.zm = GNUNET_NAMESTORE_zone_monitor_start (main_context.cfg, |
672 | main_context.sks_zone, | 673 | main_context.sks_zone, |
673 | GNUNET_YES, | 674 | GNUNET_YES, |
@@ -731,7 +732,7 @@ run (void *cls) | |||
731 | main_context.cfg = GNUNET_GTK_main_loop_get_configuration (ml); | 732 | main_context.cfg = GNUNET_GTK_main_loop_get_configuration (ml); |
732 | main_context.search_ns_treestore = | 733 | main_context.search_ns_treestore = |
733 | GTK_TREE_STORE (GNUNET_FS_GTK_get_main_window_object ( | 734 | GTK_TREE_STORE (GNUNET_FS_GTK_get_main_window_object ( |
734 | "main_window_search_namespace_treestore")); | 735 | "main_window_search_namespace_treestore")); |
735 | main_context.main_window = GTK_WIDGET ( | 736 | main_context.main_window = GTK_WIDGET ( |
736 | GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_main_window")); | 737 | GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_main_window")); |
737 | main_context.main_window = | 738 | main_context.main_window = |
@@ -742,55 +743,55 @@ run (void *cls) | |||
742 | GNUNET_FS_GTK_get_main_window_object ("namespace_selector_window")); | 743 | GNUNET_FS_GTK_get_main_window_object ("namespace_selector_window")); |
743 | main_context.ns_dropdown_button = | 744 | main_context.ns_dropdown_button = |
744 | GTK_TOGGLE_BUTTON (GNUNET_FS_GTK_get_main_window_object ( | 745 | GTK_TOGGLE_BUTTON (GNUNET_FS_GTK_get_main_window_object ( |
745 | "main_window_search_namespace_dropdown_button")); | 746 | "main_window_search_namespace_dropdown_button")); |
746 | main_context.search_ns_label = | 747 | main_context.search_ns_label = |
747 | GTK_LABEL (GNUNET_FS_GTK_get_main_window_object ( | 748 | GTK_LABEL (GNUNET_FS_GTK_get_main_window_object ( |
748 | "main_window_search_selected_namespace_label")); | 749 | "main_window_search_selected_namespace_label")); |
749 | 750 | ||
750 | main_context.search_entry = GTK_ENTRY ( | 751 | main_context.search_entry = GTK_ENTRY ( |
751 | GNUNET_FS_GTK_get_main_window_object ("main_window_search_entry")); | 752 | GNUNET_FS_GTK_get_main_window_object ("main_window_search_entry")); |
752 | 753 | ||
753 | downloads_treestore = GTK_TREE_STORE (GNUNET_FS_GTK_get_main_window_object ( | 754 | downloads_treestore = GTK_TREE_STORE (GNUNET_FS_GTK_get_main_window_object ( |
754 | "GNUNET_GTK_file_sharing_downloads_tree_store")); | 755 | "GNUNET_GTK_file_sharing_downloads_tree_store")); |
755 | main_context.anonymity_combo = | 756 | main_context.anonymity_combo = |
756 | GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object ( | 757 | GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object ( |
757 | "main_window_search_anonymity_combobox")); | 758 | "main_window_search_anonymity_combobox")); |
758 | main_context.anonymity_level_liststore = GTK_LIST_STORE ( | 759 | main_context.anonymity_level_liststore = GTK_LIST_STORE ( |
759 | GNUNET_FS_GTK_get_main_window_object ("anonymity_level_liststore")); | 760 | GNUNET_FS_GTK_get_main_window_object ("anonymity_level_liststore")); |
760 | 761 | ||
761 | main_context.preview_image = GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object ( | 762 | main_context.preview_image = GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object ( |
762 | "GNUNET_GTK_main_window_preview_image")); | 763 | "GNUNET_GTK_main_window_preview_image")); |
763 | main_context.md_liststore = GTK_LIST_STORE ( | 764 | main_context.md_liststore = GTK_LIST_STORE ( |
764 | GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_meta_data_list_store")); | 765 | GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_meta_data_list_store")); |
765 | main_context.md_treeview = | 766 | main_context.md_treeview = |
766 | GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object ( | 767 | GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object ( |
767 | "GNUNET_GTK_main_window_metadata_treeview")); | 768 | "GNUNET_GTK_main_window_metadata_treeview")); |
768 | main_context.ns_discovery_handle = NULL; | 769 | main_context.ns_discovery_handle = NULL; |
769 | 770 | ||
770 | main_context.download_location_chooser = | 771 | main_context.download_location_chooser = |
771 | GTK_FILE_CHOOSER (GNUNET_FS_GTK_get_main_window_object ( | 772 | GTK_FILE_CHOOSER (GNUNET_FS_GTK_get_main_window_object ( |
772 | "GNUNET_GTK_search_frame_download_location_chooser")); | 773 | "GNUNET_GTK_search_frame_download_location_chooser")); |
773 | main_context.download_name_entry = | 774 | main_context.download_name_entry = |
774 | GTK_ENTRY (GNUNET_FS_GTK_get_main_window_object ( | 775 | GTK_ENTRY (GNUNET_FS_GTK_get_main_window_object ( |
775 | "GNUNET_GTK_search_frame_download_filename_entry")); | 776 | "GNUNET_GTK_search_frame_download_filename_entry")); |
776 | main_context.download_anonymity_combo = | 777 | main_context.download_anonymity_combo = |
777 | GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object ( | 778 | GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object ( |
778 | "main_window_download_anonymity_combobox")); | 779 | "main_window_download_anonymity_combobox")); |
779 | main_context.download_recursive_checkbutton = | 780 | main_context.download_recursive_checkbutton = |
780 | GTK_CHECK_BUTTON (GNUNET_FS_GTK_get_main_window_object ( | 781 | GTK_CHECK_BUTTON (GNUNET_FS_GTK_get_main_window_object ( |
781 | "GNUNET_GTK_search_frame_download_recursive_checkbox")); | 782 | "GNUNET_GTK_search_frame_download_recursive_checkbox")); |
782 | main_context.download_download_button = | 783 | main_context.download_download_button = |
783 | GTK_BUTTON (GNUNET_FS_GTK_get_main_window_object ( | 784 | GTK_BUTTON (GNUNET_FS_GTK_get_main_window_object ( |
784 | "GNUNET_GTK_search_frame_download_download_button")); | 785 | "GNUNET_GTK_search_frame_download_download_button")); |
785 | main_context.download_panel = GTK_BOX (GNUNET_FS_GTK_get_main_window_object ( | 786 | main_context.download_panel = GTK_BOX (GNUNET_FS_GTK_get_main_window_object ( |
786 | "GNUNET_GTK_search_frame_download_vbox")); | 787 | "GNUNET_GTK_search_frame_download_vbox")); |
787 | 788 | ||
788 | main_context.notebook = GTK_NOTEBOOK ( | 789 | main_context.notebook = GTK_NOTEBOOK ( |
789 | GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_main_window_notebook")); | 790 | GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_main_window_notebook")); |
790 | 791 | ||
791 | main_context.connection_indicator = | 792 | main_context.connection_indicator = |
792 | GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object ( | 793 | GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object ( |
793 | "GNUNET_FS_GTK_main_window_connection_indicator")); | 794 | "GNUNET_FS_GTK_main_window_connection_indicator")); |
794 | 795 | ||
795 | GNUNET_GTK_set_icon_search_path (); | 796 | GNUNET_GTK_set_icon_search_path (); |
796 | GNUNET_GTK_setup_nls (); | 797 | GNUNET_GTK_setup_nls (); |
@@ -922,7 +923,8 @@ int | |||
922 | main (int argc, char **argv) | 923 | main (int argc, char **argv) |
923 | { | 924 | { |
924 | static struct GNUNET_GETOPT_CommandLineOption options[] = { | 925 | static struct GNUNET_GETOPT_CommandLineOption options[] = { |
925 | GNUNET_GETOPT_OPTION_END}; | 926 | GNUNET_GETOPT_OPTION_END |
927 | }; | ||
926 | #if HAVE_LIBUNIQUE | 928 | #if HAVE_LIBUNIQUE |
927 | int arge; | 929 | int arge; |
928 | 930 | ||