diff options
Diffstat (limited to 'src/main_window_file_publish.c')
-rw-r--r-- | src/main_window_file_publish.c | 66 |
1 files changed, 57 insertions, 9 deletions
diff --git a/src/main_window_file_publish.c b/src/main_window_file_publish.c index cd831e41..113adcab 100644 --- a/src/main_window_file_publish.c +++ b/src/main_window_file_publish.c | |||
@@ -854,6 +854,43 @@ GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget * dummy, | |||
854 | 854 | ||
855 | 855 | ||
856 | /** | 856 | /** |
857 | * Get the file information struct corresponding to the | ||
858 | * given iter in the publish dialog tree model. Recursively | ||
859 | * builds the file information struct from the subtree. | ||
860 | * | ||
861 | * @param tm model to grab fi from | ||
862 | * @param iter position to grab fi from | ||
863 | * @return file information from the given position (never NULL) | ||
864 | */ | ||
865 | static struct GNUNET_FS_FileInformation * | ||
866 | get_file_information (GtkTreeModel *tm, | ||
867 | GtkTreeIter *iter) | ||
868 | { | ||
869 | struct GNUNET_FS_FileInformation *fi; | ||
870 | struct GNUNET_FS_FileInformation *fic; | ||
871 | struct GtkTreeIter child; | ||
872 | |||
873 | gtk_tree_model_get (tm, iter, | ||
874 | 5, &fi, | ||
875 | -1); | ||
876 | GNUNET_assert (fi != NULL); | ||
877 | if (gtk_tree_model_iter_children (tm, &child, iter)) | ||
878 | { | ||
879 | GNUNET_break (GNUNET_YES == | ||
880 | GNUNET_FS_file_information_is_directory (fi)); | ||
881 | do | ||
882 | { | ||
883 | fic = get_file_information (tm, &child); | ||
884 | GNUNET_break (GNUNET_OK == | ||
885 | GNUNET_FS_file_information_add (fi, fic)); | ||
886 | } | ||
887 | while (gtk_tree_model_iter_next (tm, &child)); | ||
888 | } | ||
889 | return fi; | ||
890 | } | ||
891 | |||
892 | |||
893 | /** | ||
857 | */ | 894 | */ |
858 | void | 895 | void |
859 | GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, | 896 | GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, |
@@ -864,6 +901,9 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, | |||
864 | gint ret; | 901 | gint ret; |
865 | GtkTreeView *tv; | 902 | GtkTreeView *tv; |
866 | GtkTreeSelection *sel; | 903 | GtkTreeSelection *sel; |
904 | GtkTreeIter iter; | ||
905 | struct GNUNET_FS_FileInformation *fi; | ||
906 | GtkTreeModel *tm; | ||
867 | 907 | ||
868 | GNUNET_assert (master_builder == NULL); | 908 | GNUNET_assert (master_builder == NULL); |
869 | master_builder = GNUNET_GTK_get_new_builder ("publish_dialog.glade"); | 909 | master_builder = GNUNET_GTK_get_new_builder ("publish_dialog.glade"); |
@@ -879,18 +919,26 @@ GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget * dummy, | |||
879 | ls = GTK_TREE_STORE (gtk_builder_get_object (master_builder, | 919 | ls = GTK_TREE_STORE (gtk_builder_get_object (master_builder, |
880 | "GNUNET_GTK_pseudonym_tree_store")); | 920 | "GNUNET_GTK_pseudonym_tree_store")); |
881 | /* FIXME: populate 'ls' */ | 921 | /* FIXME: populate 'ls' */ |
882 | #if WTF | ||
883 | GtkTreeStore *pts; | ||
884 | pts = GTK_TREE_STORE (gtk_builder_get_object (master_builder, | ||
885 | "GNUNET_GTK_file_sharing_publishing_tree_store")); | ||
886 | #endif | ||
887 | ret = gtk_dialog_run (GTK_DIALOG (ad)); | 922 | ret = gtk_dialog_run (GTK_DIALOG (ad)); |
888 | if (ret == GTK_RESPONSE_OK) | 923 | if (ret == GTK_RESPONSE_OK) |
889 | { | 924 | { |
890 | /* FIXME: trigger publication! */ | 925 | /* FIXME: grab namespace from ls! */ |
891 | GNUNET_break (0); | 926 | tm = GTK_TREE_MODEL (gtk_builder_get_object (master_builder, |
892 | } | 927 | "GNUNET_GTK_file_sharing_publishing_tree_store")); |
893 | /* FIXME: free state from 'ls' and pts */ | 928 | if (gtk_tree_model_get_iter_first (tm, &iter)) |
929 | do | ||
930 | { | ||
931 | fi = get_file_information (tm, &iter); | ||
932 | GNUNET_FS_publish_start (fs, | ||
933 | fi, | ||
934 | NULL /* FIXME: namespace */, | ||
935 | NULL /* FIXME: namespace id */, | ||
936 | NULL /* FIXME: namespace uid */, | ||
937 | GNUNET_FS_PUBLISH_OPTION_NONE); | ||
938 | } | ||
939 | while (gtk_tree_model_iter_next (tm, &iter)); | ||
940 | } | ||
941 | /* FIXME: free state from 'ls' */ | ||
894 | gtk_widget_destroy (ad); | 942 | gtk_widget_destroy (ad); |
895 | g_object_unref (G_OBJECT (master_builder)); | 943 | g_object_unref (G_OBJECT (master_builder)); |
896 | master_builder = NULL; | 944 | master_builder = NULL; |