aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-03-06 14:36:26 +0000
committerChristian Grothoff <christian@grothoff.org>2012-03-06 14:36:26 +0000
commitfc7db4f0f58e1b82de30fe8334142ba2352801ba (patch)
treedf3fb68c7f034642214cd3c79f5e9837cb525752
parent635ab143834391a0dcb4d4357238e61d90bfd834 (diff)
downloadgnunet-gtk-fc7db4f0f58e1b82de30fe8334142ba2352801ba.tar.gz
gnunet-gtk-fc7db4f0f58e1b82de30fe8334142ba2352801ba.zip
-starting with gnunet-gns-gtk GUI
-rw-r--r--configure.ac14
-rw-r--r--contrib/Makefile.am2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/gns/Makefile.am22
-rw-r--r--src/gns/gnunet-gns-gtk.c141
-rw-r--r--src/gns/gnunet-gns-gtk_about.c42
6 files changed, 220 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index 1b33e28c..5f184603 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
1# This file is part of GNUnet. 1# This file is part of GNUnet.
2# (C) 2001--2011 Christian Grothoff (and other contributing authors) 2# (C) 2001--2012 Christian Grothoff (and other contributing authors)
3# 3#
4# GNUnet is free software; you can redistribute it and/or modify 4# GNUnet is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published 5# it under the terms of the GNU General Public License as published
@@ -117,7 +117,7 @@ AM_GNU_GETTEXT([external])
117 117
118AC_CHECK_HEADERS([errno.h stdio.h unistd.h locale.h sys/stat.h sys/types.h langinfo.h libintl.h unistd.h stddef.h argz.h sys/socket.h netinet/in.h stdarg.h]) 118AC_CHECK_HEADERS([errno.h stdio.h unistd.h locale.h sys/stat.h sys/types.h langinfo.h libintl.h unistd.h stddef.h argz.h sys/socket.h netinet/in.h stdarg.h])
119 119
120GNUNET_FS_APP="fs" 120GNUNET_FS_APP=""
121AC_ARG_ENABLE([fs-app], 121AC_ARG_ENABLE([fs-app],
122 AS_HELP_STRING([--disable-fs-app],[Do not build gnunet-fs-gtk application])) 122 AS_HELP_STRING([--disable-fs-app],[Do not build gnunet-fs-gtk application]))
123AS_IF([test "x$enable_fs_app" != "xno"], [ 123AS_IF([test "x$enable_fs_app" != "xno"], [
@@ -125,6 +125,14 @@ AS_IF([test "x$enable_fs_app" != "xno"], [
125]) 125])
126AC_SUBST(GNUNET_FS_APP) 126AC_SUBST(GNUNET_FS_APP)
127 127
128GNUNET_GNS_APP=""
129AC_ARG_ENABLE([gns-app],
130 AS_HELP_STRING([--disable-gns-app],[Do not build gnunet-gns-gtk application]))
131AS_IF([test "x$enable_gns_app" != "xno"], [
132 GNUNET_FS_APP="gns"
133])
134AC_SUBST(GNUNET_FS_APP)
135
128GNUNET_SETUP_APP="" 136GNUNET_SETUP_APP=""
129AC_ARG_ENABLE([setup-app], 137AC_ARG_ENABLE([setup-app],
130 AS_HELP_STRING([--disable-setup-app],[Do not build gnunet-setup application])) 138 AS_HELP_STRING([--disable-setup-app],[Do not build gnunet-setup application]))
@@ -392,6 +400,7 @@ AC_DEFINE_DIR([PACKAGE_DATA], [datarootdir], [The directory for installing read-
392packagesrcdir=`cd $srcdir && pwd` 400packagesrcdir=`cd $srcdir && pwd`
393AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [source dir]) 401AC_DEFINE_UNQUOTED(PACKAGE_SOURCE_DIR, "${packagesrcdir}", [source dir])
394 402
403AC_SUBST(GNUNET_GNS_GTK_NAME, "GNUnet-GNS-GTK", [name of the program])
395AC_SUBST(GNUNET_FS_GTK_NAME, "GNUnet-FS-GTK", [name of the program]) 404AC_SUBST(GNUNET_FS_GTK_NAME, "GNUnet-FS-GTK", [name of the program])
396AC_SUBST(GNUNET_PEERINFO_GTK_NAME, "GNUnet-Peerinfo-GTK", [name of the program]) 405AC_SUBST(GNUNET_PEERINFO_GTK_NAME, "GNUnet-Peerinfo-GTK", [name of the program])
397AC_SUBST(GNUNET_STATISTICS_GTK_NAME, "GNUnet-Statistics-GTK", [name of the program]) 406AC_SUBST(GNUNET_STATISTICS_GTK_NAME, "GNUnet-Statistics-GTK", [name of the program])
@@ -421,6 +430,7 @@ src/Makefile
421src/include/Makefile 430src/include/Makefile
422src/lib/Makefile 431src/lib/Makefile
423src/fs/Makefile 432src/fs/Makefile
433src/gns/Makefile
424src/peerinfo/Makefile 434src/peerinfo/Makefile
425src/setup/Makefile 435src/setup/Makefile
426src/statistics/Makefile 436src/statistics/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index b796dde4..2f87c8ec 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -28,6 +28,8 @@ pkgdata_DATA = \
28 gnunet_fs_gtk_search_tab.glade \ 28 gnunet_fs_gtk_search_tab.glade \
29 gnunet_fs_gtk_select_pseudonym_dialog.glade \ 29 gnunet_fs_gtk_select_pseudonym_dialog.glade \
30 gnunet_fs_gtk_progress_dialog.glade \ 30 gnunet_fs_gtk_progress_dialog.glade \
31 gnunet_gns_gtk_about_window.glade \
32 gnunet_gns_gtk_main_window.glade \
31 gnunet_gtk_status_bar_menu.glade \ 33 gnunet_gtk_status_bar_menu.glade \
32 gnunet_peerinfo_gtk_about_window.glade \ 34 gnunet_peerinfo_gtk_about_window.glade \
33 gnunet_peerinfo_gtk_main_window.glade \ 35 gnunet_peerinfo_gtk_main_window.glade \
diff --git a/src/Makefile.am b/src/Makefile.am
index d0768e0f..749665ca 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1 +1 @@
SUBDIRS = . include lib $(GNUNET_FS_APP) $(GNUNET_SETUP_APP) $(GNUNET_PEERINFO_APP) statistics SUBDIRS = . include lib $(GNUNET_FS_APP) $(GNUNET_GNS_APP) $(GNUNET_SETUP_APP) $(GNUNET_PEERINFO_APP) statistics
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
new file mode 100644
index 00000000..200677a2
--- /dev/null
+++ b/src/gns/Makefile.am
@@ -0,0 +1,22 @@
1SUBDIRS = .
2
3INCLUDES = \
4 -I$(top_srcdir)/ \
5 -I$(top_srcdir)/src/include \
6 @GTK_CFLAGS@ \
7 @GNUNET_CFLAGS@ \
8 @GLADE_CFLAGS@
9
10bin_PROGRAMS = gnunet-gns-gtk
11
12gnunet_gns_gtk_SOURCES = \
13 gnunet-gns-gtk.c \
14 gnunet-gns-gtk_about.c
15gnunet_gns_gtk_LDADD = \
16 $(top_builddir)/src/lib/libgnunetgtk.la \
17 @GTK_LIBS@ \
18 @GLADE_LIBS@ @GNUNET_LIBS@ \
19 -lgnunetutil \
20 $(INTLLIBS)
21gnunet_gns_gtk_LDFLAGS = \
22 -export-dynamic
diff --git a/src/gns/gnunet-gns-gtk.c b/src/gns/gnunet-gns-gtk.c
new file mode 100644
index 00000000..e18aea4a
--- /dev/null
+++ b/src/gns/gnunet-gns-gtk.c
@@ -0,0 +1,141 @@
1/*
2 This file is part of GNUnet.
3 (C) 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/gns/gnunet-gns-gtk.c
23 * @brief Main function of gnunet-gns-gtk
24 * @author Christian Grothoff
25 */
26#include "gnunet_gtk.h"
27
28/**
29 * Handle to our main loop.
30 */
31static struct GNUNET_GTK_MainLoop *ml;
32
33/**
34 * Should gnunet-gns-gtk start in tray mode?
35 */
36static int tray_only;
37
38
39/**
40 * Get cfg.
41 */
42static const struct GNUNET_CONFIGURATION_Handle *
43get_configuration ()
44{
45 return GNUNET_GTK_main_loop_get_configuration (ml);
46}
47
48
49/**
50 * Get an object from the main window.
51 *
52 * @param name name of the object
53 * @return NULL on error
54 */
55static GObject *
56get_object (const char *name)
57{
58 return GNUNET_GTK_main_loop_get_object (ml, name);
59}
60
61
62/**
63 * Task run on shutdown.
64 *
65 * @param cls unused
66 * @param tc scheduler context, unused
67 */
68static void
69shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
70{
71}
72
73
74/**
75 * Callback invoked if the application is supposed to exit.
76 */
77void
78GNUNET_GNS_GTK_quit_cb (GObject * object, gpointer user_data)
79{
80 GNUNET_GTK_tray_icon_destroy ();
81 GNUNET_GTK_main_loop_quit (ml);
82 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
83}
84
85
86/**
87 * Actual main function run right after GNUnet's scheduler
88 * is initialized. Initializes up GTK and Glade.
89 */
90static void
91run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
92{
93 GtkWidget *main_window;
94
95 ml = cls;
96
97 if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
98 {
99 return;
100 }
101
102 GNUNET_GTK_set_icon_search_path ();
103 GNUNET_GTK_setup_nls ();
104 /* setup main window */
105 main_window = GTK_WIDGET (get_object ("GNUNET_GNS_GTK_main_window"));
106 gtk_window_maximize (GTK_WINDOW (main_window));
107 GNUNET_GTK_tray_icon_create (GTK_WINDOW (main_window),
108 "gnunet-gtk" /* FIXME: different icon? */ ,
109 "gnunet-gns-gtk");
110
111 /* make GUI visible */
112 if (!tray_only)
113 {
114 gtk_widget_show (main_window);
115 gtk_window_present (GTK_WINDOW (main_window));
116 }
117}
118
119
120int
121main (int argc, char *const *argv)
122{
123 static struct GNUNET_GETOPT_CommandLineOption options[] = {
124 {'t', "tray", NULL,
125 gettext_noop ("start in tray mode"), 0,
126 &GNUNET_GETOPT_set_one, &tray_only},
127 GNUNET_GETOPT_OPTION_END
128 };
129
130 if (GNUNET_OK !=
131 GNUNET_GTK_main_loop_start ("gnunet-gns-gtk",
132 "GTK GUI for editing our zone", argc,
133 argv, options,
134 "gnunet_gns_gtk_main_window.glade",
135 &run))
136 return 1;
137 return 0;
138}
139
140
141/* end of gnunet-gns-gtk.c */
diff --git a/src/gns/gnunet-gns-gtk_about.c b/src/gns/gnunet-gns-gtk_about.c
new file mode 100644
index 00000000..378eb86f
--- /dev/null
+++ b/src/gns/gnunet-gns-gtk_about.c
@@ -0,0 +1,42 @@
1/*
2 This file is part of GNUnet
3 (C) 2005, 2006, 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/gns/gnunet-gns-gtk_about.c
23 * @author Christian Grothoff
24 * @author Igor Wronsky
25 *
26 * This file contains the about dialog.
27 */
28#include "gnunet_gtk.h"
29
30
31/**
32 * This displays an about window
33 */
34void
35GNUNET_GNS_GTK_about_imagemenuitem_activate_cb (GtkWidget * dummy,
36 gpointer data)
37{
38 GNUNET_GTK_display_about ("gnunet_gns_gtk_about_window.glade");
39}
40
41
42/* end of gnunet-gns-gtk_about.c */