aboutsummaryrefslogtreecommitdiff
path: root/src/setup/gnunet-setup-hostlist-editing.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/setup/gnunet-setup-hostlist-editing.c')
-rw-r--r--src/setup/gnunet-setup-hostlist-editing.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/src/setup/gnunet-setup-hostlist-editing.c b/src/setup/gnunet-setup-hostlist-editing.c
new file mode 100644
index 00000000..471327ca
--- /dev/null
+++ b/src/setup/gnunet-setup-hostlist-editing.c
@@ -0,0 +1,72 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 2, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19*/
20
21/**
22 * @file src/gnunet-setup-hostlist-editing.c
23 * @brief allow editing of the hostlist
24 * @author Christian Grothoff
25 */
26#include "gnunet-setup.h"
27
28/**
29 * Handle editing of text in the GtkListModel. Changes
30 * the new entry to non-editable and creates another
31 * empty entry at the end.
32 *
33 * @param renderer renderer emitting the signal
34 * @param path path identifying the edited cell
35 * @param new_text text that was added
36 * @param user_data not used
37 */
38void
39GNUNET_setup_hostlist_url_cellrenderertext_edited_cb (GtkCellRendererText *renderer,
40 gchar *path,
41 gchar *new_text,
42 gpointer user_data)
43{
44 GtkListStore *ls;
45 GtkTreeIter old;
46 GtkTreeIter iter;
47
48 ls = GTK_LIST_STORE (gtk_builder_get_object (builder,
49 "GNUNET_setup_hostlist_url_liststore"));
50 if (ls == NULL)
51 {
52 GNUNET_break (0);
53 return;
54 }
55 if (TRUE !=
56 gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ls),
57 &old,
58 path))
59 {
60 GNUNET_break (0);
61 return;
62 }
63
64 gtk_list_store_insert_before (ls, &iter, &old);
65 gtk_list_store_set (ls,
66 &iter,
67 0, new_text,
68 1, FALSE,
69 -1);
70}
71
72/* end of gnunet-setup-hostlist-editing.c */