diff options
Diffstat (limited to 'src/identity/gnunet-identity-gtk_create_ego.c')
-rw-r--r-- | src/identity/gnunet-identity-gtk_create_ego.c | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/src/identity/gnunet-identity-gtk_create_ego.c b/src/identity/gnunet-identity-gtk_create_ego.c deleted file mode 100644 index e88c617c..00000000 --- a/src/identity/gnunet-identity-gtk_create_ego.c +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | (C) 2005, 2006, 2010, 2012 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/fs/gnunet-fs-gtk_create-pseudonym.c | ||
23 | * @author Christian Grothoff | ||
24 | * @brief code to handle the main menu action to create a pseudonym | ||
25 | */ | ||
26 | #include "gnunet-fs-gtk_common.h" | ||
27 | #include "gnunet-fs-gtk.h" | ||
28 | |||
29 | |||
30 | /** | ||
31 | * Function called whenever text is added to the GtkEntry | ||
32 | * with the name of the namespace. Here, we check that only | ||
33 | * "valid" characters are used (as the result must be a valid | ||
34 | * filename on most OSes). | ||
35 | * | ||
36 | * @param entry GtkEntry being edited | ||
37 | * @param text the text | ||
38 | * @param length length of the text | ||
39 | * @param position where the text is being inserted | ||
40 | * @param data the builder of the dialog (unused) | ||
41 | */ | ||
42 | void | ||
43 | GNUNET_FS_GTK_create_namespace_insert_text_cb (GtkEntry *entry, | ||
44 | const gchar *text, | ||
45 | gint length, | ||
46 | gint *position, | ||
47 | gpointer data) | ||
48 | { | ||
49 | GtkEditable *editable = GTK_EDITABLE(entry); | ||
50 | gint i; | ||
51 | |||
52 | for (i=0; i < length; i++) | ||
53 | if ( (! isalnum((int) text[i])) && (text[i] != '_') && (text[i] != '-') ) | ||
54 | g_signal_stop_emission_by_name (G_OBJECT (editable), "insert_text"); | ||
55 | } | ||
56 | |||
57 | |||
58 | /** | ||
59 | * User completed the 'create pseudonym' dialog. Run the desired action. | ||
60 | * | ||
61 | * @param dialog the dialog | ||
62 | * @param response_id GTK_RESPONSE_OK on "OK" | ||
63 | * @param user_data the builder of the dialog | ||
64 | */ | ||
65 | void | ||
66 | GNUNET_GTK_create_namespace_dialog_response_cb (GtkDialog * dialog, | ||
67 | gint response_id, | ||
68 | gpointer user_data) | ||
69 | { | ||
70 | GtkBuilder *builder = GTK_BUILDER (user_data); | ||
71 | const char *name; | ||
72 | struct GNUNET_FS_Namespace *ns; | ||
73 | |||
74 | if (GTK_RESPONSE_OK != response_id) | ||
75 | { | ||
76 | gtk_widget_destroy (GTK_WIDGET (dialog)); | ||
77 | g_object_unref (G_OBJECT (builder)); | ||
78 | return; | ||
79 | } | ||
80 | name = gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder, | ||
81 | "GNUNET_GTK_create_namespace_name_entry"))); | ||
82 | if (NULL != name) | ||
83 | { | ||
84 | ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name); | ||
85 | GNUNET_break (NULL != ns); | ||
86 | if (NULL != ns) | ||
87 | GNUNET_FS_namespace_delete (ns, GNUNET_NO); | ||
88 | } | ||
89 | gtk_widget_destroy (GTK_WIDGET (dialog)); | ||
90 | g_object_unref (G_OBJECT (builder)); | ||
91 | } | ||
92 | |||
93 | |||
94 | /** | ||
95 | * User selected "create pseudonym" in the menu of the main window. | ||
96 | * | ||
97 | * @param dummy the menu entry | ||
98 | * @param user_data the main dialog builder, unused | ||
99 | */ | ||
100 | void | ||
101 | GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy, | ||
102 | gpointer user_data) | ||
103 | { | ||
104 | GtkWidget *ad; | ||
105 | GtkWidget *toplevel; | ||
106 | GtkBuilder *builder; | ||
107 | |||
108 | builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_create_namespace_dialog.glade", NULL); | ||
109 | if (NULL == builder) | ||
110 | { | ||
111 | GNUNET_break (0); | ||
112 | return; | ||
113 | } | ||
114 | ad = GTK_WIDGET (gtk_builder_get_object | ||
115 | (builder, "GNUNET_GTK_create_namespace_dialog")); | ||
116 | toplevel = gtk_widget_get_toplevel (dummy); | ||
117 | if (GTK_IS_WINDOW (toplevel)) | ||
118 | gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel)); | ||
119 | gtk_window_present (GTK_WINDOW (ad)); | ||
120 | } | ||
121 | |||
122 | |||
123 | /* end of gnunet-fs-gtk_create-pseudonym.c */ | ||