aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-fs-gtk_publish-dialog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/gnunet-fs-gtk_publish-dialog.c')
-rw-r--r--src/fs/gnunet-fs-gtk_publish-dialog.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c
index 757958be..cd1f1262 100644
--- a/src/fs/gnunet-fs-gtk_publish-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-dialog.c
@@ -834,16 +834,60 @@ GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget * dummy,
834 struct MainPublishingDialogContext *ctx = user_data; 834 struct MainPublishingDialogContext *ctx = user_data;
835 GtkTreeIter iter; 835 GtkTreeIter iter;
836 struct GNUNET_FS_FileInformation *fip; 836 struct GNUNET_FS_FileInformation *fip;
837 GtkTreeRowReference *rr;
838 GtkTreePath *path;
837 839
840 /* initially, both 'iter' and 'next' point to the selected row */
838 if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter)) 841 if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter))
839 { 842 {
840 GNUNET_break (0); 843 GNUNET_break (0);
841 return; 844 return;
842 } 845 }
846
847 path = gtk_tree_model_get_path (ctx->file_info_treemodel, &iter);
848 if (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter))
849 gtk_tree_path_next (path);
850 else
851 {
852 if (! gtk_tree_path_prev (path))
853 {
854 if ( (1 == gtk_tree_path_get_depth (path) ) ||
855 (! gtk_tree_path_up (path) ) )
856 {
857 gtk_tree_path_free (path);
858 path = NULL;
859 }
860 }
861 }
862 if (NULL == path)
863 {
864 rr = NULL;
865 }
866 else
867 {
868 rr = gtk_tree_row_reference_new (ctx->file_info_treemodel, path);
869 gtk_tree_path_free (path);
870 }
871
872 /* 'iter' might have again been clobbered, get it one more time... */
873 GNUNET_assert (gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter));
874
875 /* now delete the subtree */
843 gtk_tree_model_get (ctx->file_info_treemodel, &iter, 5, &fip, -1); 876 gtk_tree_model_get (ctx->file_info_treemodel, &iter, 5, &fip, -1);
844 GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL); 877 GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL);
845 GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (ctx->file_info_treemodel), 878 GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (ctx->file_info_treemodel),
846 &iter); 879 &iter);
880
881 /* finally, select the item from 'rr' (if any) */
882 if (NULL != rr)
883 {
884 path = gtk_tree_row_reference_get_path (rr);
885 gtk_tree_row_reference_free (rr);
886 gtk_tree_selection_select_path (ctx->file_info_selection, path);
887 gtk_tree_path_free (path);
888 }
889
890 /* and now, depending on the selection, update the sensitivity of buttons */
847 update_selectivity (ctx); 891 update_selectivity (ctx);
848} 892}
849 893