diff options
Diffstat (limited to 'src/common/helper.c')
-rw-r--r-- | src/common/helper.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/common/helper.c b/src/common/helper.c index 97ec690c..7ffc84a5 100644 --- a/src/common/helper.c +++ b/src/common/helper.c | |||
@@ -625,6 +625,10 @@ char * validate_utf8(char * msg) { | |||
625 | FREE(msg); | 625 | FREE(msg); |
626 | msg = STRDUP(ret); | 626 | msg = STRDUP(ret); |
627 | g_free(ret); | 627 | g_free(ret); |
628 | GE_BREAK(NULL, | ||
629 | TRUE == g_utf8_validate(msg, | ||
630 | -1, | ||
631 | &end)); | ||
628 | return msg; | 632 | return msg; |
629 | } | 633 | } |
630 | 634 | ||
@@ -685,4 +689,53 @@ gboolean startGNUnetSetup (gboolean run_wizard) { | |||
685 | return code; | 689 | return code; |
686 | } | 690 | } |
687 | 691 | ||
692 | /** | ||
693 | * Identical to "gtk_tree_selection_selected_foreach", | ||
694 | * except that modifications of the underlying model | ||
695 | * during the iteration are tolerated. | ||
696 | */ | ||
697 | void ggc_tree_selection_selected_foreach(GtkTreeSelection *selection, | ||
698 | GtkTreeSelectionForeachFunc func, | ||
699 | gpointer data) { | ||
700 | unsigned int i; | ||
701 | unsigned int size; | ||
702 | GList * selected; | ||
703 | GtkTreeRowReference ** refs; | ||
704 | GtkTreeModel * model; | ||
705 | GtkTreePath * path; | ||
706 | GtkTreeIter iter; | ||
707 | |||
708 | selected = gtk_tree_selection_get_selected_rows(selection, | ||
709 | &model); | ||
710 | |||
711 | i = g_list_length(selected); | ||
712 | size = 0; | ||
713 | refs = NULL; | ||
714 | GROW(refs, | ||
715 | size, | ||
716 | i); | ||
717 | for (i=0;i<size;i++) | ||
718 | refs[i] = gtk_tree_row_reference_new(model, | ||
719 | g_list_nth_data(selected, i)); | ||
720 | g_list_foreach(selected, | ||
721 | (GFunc) >k_tree_path_free, | ||
722 | NULL); | ||
723 | g_list_free(selected); | ||
724 | for (i=0;i<size;i++) { | ||
725 | path = gtk_tree_row_reference_get_path(refs[i]); | ||
726 | gtk_tree_row_reference_free(refs[i]); | ||
727 | if (TRUE == gtk_tree_model_get_iter(model, | ||
728 | &iter, | ||
729 | path)) | ||
730 | func(model, | ||
731 | path, | ||
732 | &iter, | ||
733 | data); | ||
734 | gtk_tree_path_free(path); | ||
735 | } | ||
736 | GROW(refs, | ||
737 | size, | ||
738 | 0); | ||
739 | } | ||
740 | |||
688 | /* end of helper.c */ | 741 | /* end of helper.c */ |