diff options
Diffstat (limited to 'src/fs/gnunet-fs-gtk_create-pseudonym.c')
-rw-r--r-- | src/fs/gnunet-fs-gtk_create-pseudonym.c | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/fs/gnunet-fs-gtk_create-pseudonym.c b/src/fs/gnunet-fs-gtk_create-pseudonym.c new file mode 100644 index 00000000..650017ee --- /dev/null +++ b/src/fs/gnunet-fs-gtk_create-pseudonym.c | |||
@@ -0,0 +1,97 @@ | |||
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 | * User completed the 'create pseudonym' dialog. Run the desired action. | ||
32 | * | ||
33 | * @param dialog the dialog | ||
34 | * @param response_id '-5' on "OK" | ||
35 | * @param user_data the builder of the dialog | ||
36 | */ | ||
37 | void | ||
38 | GNUNET_GTK_create_namespace_dialog_response_cb (GtkDialog * dialog, | ||
39 | gint response_id, | ||
40 | gpointer user_data) | ||
41 | { | ||
42 | GtkBuilder *builder = GTK_BUILDER (user_data); | ||
43 | const char *name; | ||
44 | struct GNUNET_FS_Namespace *ns; | ||
45 | GtkWidget *ad; | ||
46 | |||
47 | ad = GTK_WIDGET (gtk_builder_get_object | ||
48 | (builder, "GNUNET_GTK_create_namespace_dialog")); | ||
49 | if (response_id != -5) | ||
50 | { | ||
51 | gtk_widget_destroy (ad); | ||
52 | g_object_unref (G_OBJECT (builder)); | ||
53 | return; | ||
54 | } | ||
55 | name = gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder, | ||
56 | "GNUNET_GTK_create_namespace_name_entry"))); | ||
57 | /* FIXME: show busy dialog while doing key creation */ | ||
58 | if (NULL != name) | ||
59 | { | ||
60 | ns = GNUNET_FS_namespace_create (GNUNET_FS_GTK_get_fs_handle (), name); | ||
61 | GNUNET_FS_namespace_delete (ns, GNUNET_NO); | ||
62 | } | ||
63 | gtk_widget_destroy (ad); | ||
64 | g_object_unref (G_OBJECT (builder)); | ||
65 | } | ||
66 | |||
67 | |||
68 | /** | ||
69 | * User selected "create pseudonym" in the menu of the main window. | ||
70 | * | ||
71 | * @param dummy the menu entry | ||
72 | * @param user_data the main dialog builder, unused | ||
73 | */ | ||
74 | void | ||
75 | GNUNET_GTK_main_menu_create_pseudonym_activate_cb (GtkWidget * dummy, | ||
76 | gpointer user_data) | ||
77 | { | ||
78 | GtkWidget *ad; | ||
79 | GtkWidget *toplevel; | ||
80 | GtkBuilder *builder; | ||
81 | |||
82 | builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_create_namespace_dialog.glade", NULL); | ||
83 | if (NULL == builder) | ||
84 | { | ||
85 | GNUNET_break (0); | ||
86 | return; | ||
87 | } | ||
88 | ad = GTK_WIDGET (gtk_builder_get_object | ||
89 | (builder, "GNUNET_GTK_create_namespace_dialog")); | ||
90 | toplevel = gtk_widget_get_toplevel (dummy); | ||
91 | if (GTK_IS_WINDOW (toplevel)) | ||
92 | gtk_window_set_transient_for (GTK_WINDOW (ad), GTK_WINDOW (toplevel)); | ||
93 | gtk_window_present (GTK_WINDOW (ad)); | ||
94 | } | ||
95 | |||
96 | |||
97 | /* end of gnunet-fs-gtk_create-pseudonym.c */ | ||