aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-05-07 20:51:05 +0200
committerChristian Grothoff <christian@grothoff.org>2018-05-07 20:51:14 +0200
commite41ad0dbfbd63ba64eb4fe29a0e0d6459606de06 (patch)
tree125042779f56d05f0922cca621a54b8c3a1ca2b7
parentbecf81b7244da0691486fe7e01558d7b35be28d9 (diff)
downloadgnunet-gtk-e41ad0dbfbd63ba64eb4fe29a0e0d6459606de06.tar.gz
gnunet-gtk-e41ad0dbfbd63ba64eb4fe29a0e0d6459606de06.zip
docu updaetsv0.11.0pre66
-rw-r--r--README2
-rw-r--r--configure.ac1
-rw-r--r--doc/Makefile.am1
-rw-r--r--doc/gnunet-conversation-gtk.129
-rw-r--r--doc/gnunet-fs-gtk.13
-rw-r--r--doc/gnunet-identity-gtk.13
-rw-r--r--doc/gnunet-namestore-gtk.13
-rw-r--r--doc/gnunet-peerinfo-gtk.13
-rw-r--r--src/Makefile.am2
-rw-r--r--src/main/.gitignore1
-rw-r--r--src/main/Makefile.am24
-rw-r--r--src/main/gnunet-gtk.c378
12 files changed, 32 insertions, 418 deletions
diff --git a/README b/README
index 5fe8309f..185fb13f 100644
--- a/README
+++ b/README
@@ -26,13 +26,13 @@ gnunet-gtk requires GTK 3.22.0 or higher and libgladeui-2 (i.e. 3.8 or
26After installation, you should have the following new programs: 26After installation, you should have the following new programs:
27 27
28* gnunet-setup --- a GUI to configure GNUnet 28* gnunet-setup --- a GUI to configure GNUnet
29* gnunet-gtk (X11-systems only) --- meta-gui
30* gnunet-fs-gtk --- a GUI for file-sharing with GNUnet 29* gnunet-fs-gtk --- a GUI for file-sharing with GNUnet
31* gnunet-peerinfo-gtk --- a GUI for inspecting which 30* gnunet-peerinfo-gtk --- a GUI for inspecting which
32 other peers your peer knows about 31 other peers your peer knows about
33* gnunet-namestore-gtk --- edit your GNS zones 32* gnunet-namestore-gtk --- edit your GNS zones
34* gnunet-identity-gtk --- manage your identities/pseudonyms 33* gnunet-identity-gtk --- manage your identities/pseudonyms
35* gnunet-statistics-gtk --- visualize GNUnet statistics 34* gnunet-statistics-gtk --- visualize GNUnet statistics
35* gnunet-conversation-gtk --- talk with other users
36 36
37 37
38Stay tuned 38Stay tuned
diff --git a/configure.ac b/configure.ac
index 4ccbb544..8379d2a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -543,7 +543,6 @@ src/fs/Makefile
543src/fs/gnunet-fs-gtk.conf 543src/fs/gnunet-fs-gtk.conf
544src/identity/Makefile 544src/identity/Makefile
545src/peerinfo/Makefile 545src/peerinfo/Makefile
546src/main/Makefile
547src/namestore/Makefile 546src/namestore/Makefile
548src/setup/Makefile 547src/setup/Makefile
549src/statistics/Makefile 548src/statistics/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 2a382cf7..40bd0365 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -2,6 +2,7 @@
2SUBDIRS = . doxygen 2SUBDIRS = . doxygen
3 3
4man_MANS = \ 4man_MANS = \
5 gnunet-conversation-gtk.1 \
5 gnunet-fs-gtk.1 \ 6 gnunet-fs-gtk.1 \
6 gnunet-identity-gtk.1 \ 7 gnunet-identity-gtk.1 \
7 gnunet-namestore-gtk.1 \ 8 gnunet-namestore-gtk.1 \
diff --git a/doc/gnunet-conversation-gtk.1 b/doc/gnunet-conversation-gtk.1
new file mode 100644
index 00000000..6a21876c
--- /dev/null
+++ b/doc/gnunet-conversation-gtk.1
@@ -0,0 +1,29 @@
1.TH GNUNET-CONVERSATION-GTK "1" "5 May 2018" "GNUnet"
2.SH NAME
3gnunet\-conversation\-gtk \- a gtk interface for talking with other users
4.SH SYNOPSIS
5.B gnunet\-conversation\-gtk
6[\fIOPTIONS\fR]
7.SH DESCRIPTION
8.PP
9gnunet\-conversation\-gtk is a gtk+ based GUI for making conversation over GNUnet. Users are addressed using the GNU Name System.
10.TP
11\fB\-h\fR, \fB\-\-help\fR
12print help page
13.TP
14\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
15load config file (default: ~/.config/gnunet.conf)
16.TP
17\fB\-s, \fB\-\-show-inactive\fR
18show peers even if we are not connected to them, have no (valid, non-expired) addresses for the peer, thus only know pretty much only their public keys; this will essentially list peers that we historically at some point encountered, but have currently no way to contact and that might not be running at all.
19.TP
20\fB\-v\fR, \fB\-\-version\fR
21print the version number
22.SH FILES
23.TP
24~/.config/gnunet.conf
25User's GNUnet configuration file
26.SH "REPORTING BUGS"
27Report bugs by using mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet-developers@gnu.org>
28.SH "SEE ALSO"
29\fBgnunet\-setup\fP(1)
diff --git a/doc/gnunet-fs-gtk.1 b/doc/gnunet-fs-gtk.1
index 44b0af2a..ebe01feb 100644
--- a/doc/gnunet-fs-gtk.1
+++ b/doc/gnunet-fs-gtk.1
@@ -14,9 +14,6 @@ print help page
14\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR 14\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
15load config file (default: ~/.config/gnunet.conf) 15load config file (default: ~/.config/gnunet.conf)
16.TP 16.TP
17\fB\-t, \fB\-\-tray\fR
18start with main window minimized (only put icon in tray)
19.TP
20\fB\-v\fR, \fB\-\-version\fR 17\fB\-v\fR, \fB\-\-version\fR
21print the version number 18print the version number
22.SH NOTES 19.SH NOTES
diff --git a/doc/gnunet-identity-gtk.1 b/doc/gnunet-identity-gtk.1
index 9d66c28e..e2c9d4c6 100644
--- a/doc/gnunet-identity-gtk.1
+++ b/doc/gnunet-identity-gtk.1
@@ -14,9 +14,6 @@ print help page
14\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR 14\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
15load config file (default: ~/.config/gnunet.conf) 15load config file (default: ~/.config/gnunet.conf)
16.TP 16.TP
17\fB\-t, \fB\-\-tray\fR
18start with main window minimized (only put icon in tray)
19.TP
20\fB\-v\fR, \fB\-\-version\fR 17\fB\-v\fR, \fB\-\-version\fR
21print the version number 18print the version number
22.SH FILES 19.SH FILES
diff --git a/doc/gnunet-namestore-gtk.1 b/doc/gnunet-namestore-gtk.1
index e22089ed..d14f34f6 100644
--- a/doc/gnunet-namestore-gtk.1
+++ b/doc/gnunet-namestore-gtk.1
@@ -14,9 +14,6 @@ print help page
14\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR 14\fB\-c \fIFILENAME\fR, \fB\-\-config=FILENAME\fR
15load config file (default: ~/.config/gnunet.conf) 15load config file (default: ~/.config/gnunet.conf)
16.TP 16.TP
17\fB\-t, \fB\-\-tray\fR
18start with main window minimized (only put icon in tray)
19.TP
20\fB\-v\fR, \fB\-\-version\fR 17\fB\-v\fR, \fB\-\-version\fR
21print the version number 18print the version number
22.SH FILES 19.SH FILES
diff --git a/doc/gnunet-peerinfo-gtk.1 b/doc/gnunet-peerinfo-gtk.1
index 0119c60c..f68e702b 100644
--- a/doc/gnunet-peerinfo-gtk.1
+++ b/doc/gnunet-peerinfo-gtk.1
@@ -17,9 +17,6 @@ load config file (default: ~/.config/gnunet.conf)
17\fB\-s, \fB\-\-show-inactive\fR 17\fB\-s, \fB\-\-show-inactive\fR
18show peers even if we are not connected to them, have no (valid, non-expired) addresses for the peer, thus only know pretty much only their public keys; this will essentially list peers that we historically at some point encountered, but have currently no way to contact and that might not be running at all. 18show peers even if we are not connected to them, have no (valid, non-expired) addresses for the peer, thus only know pretty much only their public keys; this will essentially list peers that we historically at some point encountered, but have currently no way to contact and that might not be running at all.
19.TP 19.TP
20\fB\-t, \fB\-\-tray\fR
21start with main window minimized (only put icon in tray)
22.TP
23\fB\-v\fR, \fB\-\-version\fR 20\fB\-v\fR, \fB\-\-version\fR
24print the version number 21print the version number
25.SH FILES 22.SH FILES
diff --git a/src/Makefile.am b/src/Makefile.am
index 4d1a9041..4fefc153 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,2 +1,2 @@
1# This Makefile.am is in the public domain 1# This Makefile.am is in the public domain
2SUBDIRS = . include lib $(GNUNET_FS_APP) $(GNUNET_SETUP_APP) $(GNUNET_PEERINFO_APP) $(GNUNET_CONVERSATION_APP) statistics identity namestore main 2SUBDIRS = . include lib $(GNUNET_FS_APP) $(GNUNET_SETUP_APP) $(GNUNET_PEERINFO_APP) $(GNUNET_CONVERSATION_APP) statistics identity namestore
diff --git a/src/main/.gitignore b/src/main/.gitignore
deleted file mode 100644
index 59df402c..00000000
--- a/src/main/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1gnunet-gtk
diff --git a/src/main/Makefile.am b/src/main/Makefile.am
deleted file mode 100644
index d0139262..00000000
--- a/src/main/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
1# This Makefile.am is in the public domain
2SUBDIRS = .
3
4AM_CPPFLAGS = \
5 -I$(top_srcdir)/ \
6 -I$(top_srcdir)/src/include
7
8bin_PROGRAMS = gnunet-gtk
9
10gnunet_gtk_SOURCES = \
11 gnunet-gtk.c
12
13gnunet_gtk_LDADD = \
14 $(top_builddir)/src/lib/libgnunetgtk.la \
15 @GTK_LIBS@ @GNUNET_LIBS@ @GLADE_LIBS@ \
16 $(WINLIBS) \
17 -lgnunetutil \
18 $(INTLLIBS)
19gnunet_gtk_CFLAGS = \
20 @GTK_CFLAGS@ \
21 @GNUNET_CFLAGS@ \
22 @GLADE_CFLAGS@
23gnunet_gtk_LDFLAGS = \
24 -export-dynamic
diff --git a/src/main/gnunet-gtk.c b/src/main/gnunet-gtk.c
deleted file mode 100644
index 68029152..00000000
--- a/src/main/gnunet-gtk.c
+++ /dev/null
@@ -1,378 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2012-2014 GNUnet e.V.
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 3, 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., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21/**
22 * @file src/main/gnunet-gtk.c
23 * @author Christian Grothoff
24 * @brief Gtk user interface for GNUnet
25 */
26#include "gnunet_gtk.h"
27#if HAVE_GTK_GTKX_H
28#include <gtk/gtkx.h>
29#endif
30
31/**
32 * Handle for a plugged in process.
33 */
34struct Plug
35{
36
37 /**
38 * Kept in a DLL.
39 */
40 struct Plug *prev;
41
42 /**
43 * Kept in a DLL.
44 */
45 struct Plug *next;
46
47 /**
48 * The socket.
49 */
50 GtkWidget *s;
51
52 /**
53 * Name of the binary.
54 */
55 const char *binary;
56
57 /**
58 * Environment variable we set.
59 */
60 const char *env_var;
61
62 /**
63 * Handle to the child process.
64 */
65 struct GNUNET_OS_Process *proc;
66
67 /**
68 * How long do we wait on restarts?
69 */
70 struct GNUNET_TIME_Relative backoff;
71
72 /**
73 * Task to restart process after crash.
74 */
75 struct GNUNET_SCHEDULER_Task * restart_task;
76
77 /**
78 * ID of the signal associated with the window.
79 */
80 gulong sig_id;
81
82};
83
84
85/**
86 * Main loop handle.
87 */
88static struct GNUNET_GTK_MainLoop *ml;
89
90/**
91 * Our configuration.
92 */
93static const struct GNUNET_CONFIGURATION_Handle *cfg;
94
95/**
96 * Global return value (for success/failure of gnunet-gtk).
97 */
98static int gret;
99
100/**
101 * Head of plugs.
102 */
103static struct Plug *p_head;
104
105/**
106 * Tail of plugs.
107 */
108static struct Plug *p_tail;
109
110
111/**
112 * Get an object from the main window.
113 *
114 * @param name name of the object
115 * @return NULL on error, otherwise the object
116 */
117static GObject *
118get_object (const char *name)
119{
120 if (NULL == ml)
121 return NULL;
122 return GNUNET_GTK_main_loop_get_object (ml, name);
123}
124
125
126/**
127 * Actual main to tear down the system.
128 *
129 * @param cls the main loop handle
130 */
131static void
132cleanup_task (void *cls)
133{
134 struct Plug *p;
135
136 while (NULL != (p = p_head))
137 {
138 if (NULL != p->proc)
139 {
140 (void) GNUNET_OS_process_kill (p->proc,
141 SIGTERM);
142 GNUNET_break (GNUNET_OK ==
143 GNUNET_OS_process_wait (p->proc));
144 GNUNET_OS_process_destroy (p->proc);
145 p->proc = NULL;
146 }
147 if (NULL != p->restart_task)
148 {
149 GNUNET_SCHEDULER_cancel (p->restart_task);
150 p->restart_task = NULL;
151 }
152 /* This object is long gone, as part of the cleanup
153 of the window from gtk_window_dispose that is
154 triggered with the shutdown; so we should not
155 do it here. (Keeping commented out to show
156 that there is symmetry with initialization --
157 kind-of) */
158 /* g_signal_handler_disconnect (p->s, p->sig_id); */
159 GNUNET_CONTAINER_DLL_remove (p_head,
160 p_tail,
161 p);
162 GNUNET_free (p);
163 }
164 if (NULL == ml)
165 {
166 GNUNET_break (0);
167 return;
168 }
169 GNUNET_GTK_main_loop_quit (ml);
170}
171
172
173/**
174 * Callback invoked if the application is supposed to exit.
175 */
176void
177gnunet_gtk_quit_cb (GObject * object,
178 gpointer user_data)
179{
180 GNUNET_SCHEDULER_shutdown ();
181}
182
183
184#ifdef GDK_WINDOWING_X11
185/**
186 * Start the child process for the plug.
187 *
188 * @param p plug identification
189 */
190static void
191start_process (struct Plug *p)
192{
193 char window_id[128];
194 Window w;
195
196 w = gtk_socket_get_id (GTK_SOCKET (p->s));
197 GNUNET_snprintf (window_id,
198 sizeof (window_id),
199 "%llu",
200 (unsigned long long) w);
201 setenv (p->env_var, window_id, 1);
202 p->proc = GNUNET_OS_start_process (GNUNET_NO,
203 GNUNET_OS_INHERIT_STD_ALL,
204 NULL, NULL, NULL,
205 p->binary,
206 p->binary,
207 NULL);
208}
209
210
211/**
212 * Restart crashed plugin process.
213 *
214 * @param cls the `struct Plug` of the plugin
215 */
216static void
217restart_process (void *cls)
218{
219 struct Plug *p = cls;
220
221 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
222 _("Restarting crashed plugin `%s'\n"),
223 p->binary);
224 p->restart_task = NULL;
225 start_process (p);
226}
227
228
229/**
230 * The window got detached, restart the child.
231 *
232 * @param sock socket the plug got detached from
233 * @param userdata our `struct Plug *`
234 * @return TRUE (keep socket open)
235 */
236static gboolean
237handle_remove (GtkSocket *sock,
238 gpointer userdata)
239{
240 struct Plug *p = userdata;
241
242 if (NULL != p->proc)
243 {
244 (void) GNUNET_OS_process_kill (p->proc, SIGTERM);
245 GNUNET_OS_process_destroy (p->proc);
246 p->proc = NULL;
247 }
248 p->backoff = GNUNET_TIME_STD_BACKOFF (p->backoff);
249 p->restart_task = GNUNET_SCHEDULER_add_delayed (p->backoff,
250 &restart_process,
251 p);
252 return TRUE;
253}
254
255
256/**
257 * Embed process in our GUI.
258 *
259 * @param container where to embed
260 * @param binary name of the binary to embed
261 * @param env_var name of the environment variable to set
262 */
263static void
264plug (const char *container,
265 const char *binary,
266 const char *env_var)
267{
268 GtkWidget *v;
269 GtkWidget *l;
270 struct Plug *p;
271 GtkNotebook *n;
272
273 p = GNUNET_new (struct Plug);
274 p->s = gtk_socket_new ();
275 gtk_widget_set_events (p->s,
276 GDK_ALL_EVENTS_MASK);
277 n = GTK_NOTEBOOK (get_object ("gnunet_gtk_notebook"));
278 v = GTK_WIDGET (get_object (container));
279 l = gtk_notebook_get_tab_label (n, v);
280 /* remove old tab, replace with new tab; effectively,
281 we preserve the label; but GtkNotebook does not
282 allow us to directly substitute the body of the tab */
283 g_object_ref (l);
284 gtk_notebook_remove_page (n,
285 gtk_notebook_page_num (n, v));
286 gtk_notebook_append_page (n, p->s, l);
287 g_object_unref (l);
288 p->binary = binary;
289 p->env_var = env_var;
290 p->sig_id = g_signal_connect (p->s,
291 "plug-removed",
292 G_CALLBACK (handle_remove),
293 p);
294 start_process (p);
295 gtk_widget_show (p->s);
296 GNUNET_CONTAINER_DLL_insert (p_head,
297 p_tail,
298 p);
299}
300#endif
301
302
303/**
304 * Actual main method that sets up the configuration window.
305 *
306 * @param cls the main loop handle
307 */
308static void
309run (void *cls)
310{
311 GtkWidget *main_window;
312
313 ml = cls;
314 cfg = GNUNET_GTK_main_loop_get_configuration (ml);
315 if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
316 return;
317 GNUNET_GTK_set_icon_search_path ();
318 GNUNET_GTK_setup_nls ();
319 main_window = GTK_WIDGET (get_object ("gnunet_gtk_window"));
320 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
321#ifdef GDK_WINDOWING_X11
322 plug ("gnunet_statistics_hbox",
323 "gnunet-statistics-gtk",
324 "GNUNET_STATISTICS_GTK_PLUG");
325 plug ("gnunet_peerinfo_hbox",
326 "gnunet-peerinfo-gtk",
327 "GNUNET_PEERINFO_GTK_PLUG");
328 plug ("gnunet_namestore_hbox",
329 "gnunet-namestore-gtk",
330 "GNUNET_NAMESTORE_GTK_PLUG");
331 plug ("gnunet_fs_hbox",
332 "gnunet-fs-gtk",
333 "GNUNET_FS_GTK_PLUG");
334 plug ("gnunet_identity_hbox",
335 "gnunet-identity-gtk",
336 "GNUNET_IDENTITY_GTK_PLUG");
337 plug ("gnunet_conversation_hbox",
338 "gnunet-conversation-gtk",
339 "GNUNET_CONVERSATION_GTK_PLUG");
340#if 0
341 plug ("gnunet_setup_hbox",
342 "gnunet-setup",
343 "GNUNET_SETUP_PLUG");
344#endif
345#endif
346 gtk_widget_show (main_window);
347 gtk_window_present (GTK_WINDOW (main_window));
348}
349
350
351/**
352 * Main function for gnunet-gtk.
353 *
354 * @param argc number of arguments
355 * @param argv arguments
356 * @return 0 on success
357 */
358int
359main (int argc, char *const *argv)
360{
361 struct GNUNET_GETOPT_CommandLineOption options[] = {
362 GNUNET_GETOPT_OPTION_END
363 };
364 int ret;
365
366 if (GNUNET_OK ==
367 GNUNET_GTK_main_loop_start ("gnunet-gtk",
368 "gnunet-gtk", argc, argv,
369 options, "gnunet_gtk.glade",
370 &run))
371 ret = gret;
372 else
373 ret = 1;
374 return ret;
375}
376
377
378/* end of gnunet-gtk.c */