[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r823 - GNUnet GNUnet/contrib GNUnet/m4 GNUnet/src/applicati
From: |
grothoff |
Subject: |
[GNUnet-SVN] r823 - GNUnet GNUnet/contrib GNUnet/m4 GNUnet/src/applications/fs/fsui GNUnet/src/include GNUnet/src/util branches/GNUnet06/src/applications/afs/gtkui gnunet-gtk gnunet-gtk/src |
Date: |
Thu, 26 May 2005 23:37:12 -0700 (PDT) |
Author: grothoff
Date: 2005-05-26 23:36:43 -0700 (Thu, 26 May 2005)
New Revision: 823
Added:
GNUnet/src/applications/fs/fsui/fsuitest2.c
gnunet-gtk/src/about.c
gnunet-gtk/src/daemon.c
gnunet-gtk/src/daemon.h
gnunet-gtk/src/fs.c
gnunet-gtk/src/fs.h
gnunet-gtk/src/gtk26about.c
gnunet-gtk/src/gtk26about.h
gnunet-gtk/src/helper.c
gnunet-gtk/src/helper.h
gnunet-gtk/src/main.h
gnunet-gtk/src/platform.h
gnunet-gtk/src/plibc.h
Modified:
GNUnet/configure.ac
GNUnet/contrib/gnunet.user
GNUnet/m4/Makefile.in
GNUnet/src/applications/fs/fsui/Makefile.am
GNUnet/src/applications/fs/fsui/fsui.c
GNUnet/src/include/gnunet_fsui_lib.h
GNUnet/src/util/logging.c
branches/GNUnet06/src/applications/afs/gtkui/helper.c
branches/GNUnet06/src/applications/afs/gtkui/main.c
gnunet-gtk/gnunet-gtk.glade
gnunet-gtk/src/Makefile.am
gnunet-gtk/src/main.c
gnunet-gtk/todo
Log:
update
Modified: GNUnet/configure.ac
===================================================================
--- GNUnet/configure.ac 2005-05-26 12:23:02 UTC (rev 822)
+++ GNUnet/configure.ac 2005-05-27 06:36:43 UTC (rev 823)
@@ -52,6 +52,18 @@
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
+# check for gtk >= 2.4.0
+AC_MSG_CHECKING(for gtk)
+AM_PATH_GTK_2_0(2.4.0,without_gtk=false,without_gtk=true)
+AM_CONDITIONAL(HAVE_GTK, test x$without_gtk != xtrue)
+if test $without_gtk != true
+then
+ AC_DEFINE_UNQUOTED([HAVE_GTK], 1, [We have GTK])
+else
+ AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?)
+fi
+
+
if test "$enable_shared" = "no"
then
AC_MSG_ERROR([GNUnet only works with shared libraries. Sorry.])
Modified: GNUnet/contrib/gnunet.user
===================================================================
--- GNUnet/contrib/gnunet.user 2005-05-26 12:23:02 UTC (rev 822)
+++ GNUnet/contrib/gnunet.user 2005-05-27 06:36:43 UTC (rev 823)
@@ -113,10 +113,10 @@
# Path to the gnunet.conf file for gnunetd (for
# forking gnunetd by gnunet-gtk)
-GNUNETD-CONFIG = /etc/gnunet.conf
+# default: not specified!
+# GNUNETD-CONFIG = /etc/gnunetd.conf
-
##########################################
# Defaults for gnunet-chat
##########################################
Modified: GNUnet/m4/Makefile.in
===================================================================
--- GNUnet/m4/Makefile.in 2005-05-26 12:23:02 UTC (rev 822)
+++ GNUnet/m4/Makefile.in 2005-05-27 06:36:43 UTC (rev 823)
@@ -38,12 +38,13 @@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ac_define_dir.m4 \
- $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/guile.m4 \
- $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/libgcrypt.m4 $(top_srcdir)/m4/nls.m4 \
- $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
- $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
+ $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gtk-2.0.m4 \
+ $(top_srcdir)/m4/guile.m4 $(top_srcdir)/m4/iconv.m4 \
+ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
+ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libgcrypt.m4 \
+ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
+ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -91,11 +92,15 @@
F77 = @F77@
FFLAGS = @FFLAGS@
GMSGFMT = @GMSGFMT@
+GTK_CFLAGS = @GTK_CFLAGS@
+GTK_LIBS = @GTK_LIBS@
GUILE = @GUILE@
GUILE_CONFIG = @GUILE_CONFIG@
GUILE_TOOLS = @GUILE_TOOLS@
HAVE_CURSES_FALSE = @HAVE_CURSES_FALSE@
HAVE_CURSES_TRUE = @HAVE_CURSES_TRUE@
+HAVE_GTK_FALSE = @HAVE_GTK_FALSE@
+HAVE_GTK_TRUE = @HAVE_GTK_TRUE@
HAVE_GUILE_FALSE = @HAVE_GUILE_FALSE@
HAVE_GUILE_TRUE = @HAVE_GUILE_TRUE@
HAVE_IPV6_FALSE = @HAVE_IPV6_FALSE@
@@ -149,6 +154,7 @@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
POSUB = @POSUB@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
Modified: GNUnet/src/applications/fs/fsui/Makefile.am
===================================================================
--- GNUnet/src/applications/fs/fsui/Makefile.am 2005-05-26 12:23:02 UTC (rev
822)
+++ GNUnet/src/applications/fs/fsui/Makefile.am 2005-05-27 06:36:43 UTC (rev
823)
@@ -24,7 +24,8 @@
check_PROGRAMS = \
- fsuitest
+ fsuitest \
+ fsuitest2
TESTS = $(check_PROGRAMS)
@@ -34,3 +35,11 @@
$(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
$(top_builddir)/src/applications/fs/fsui/libgnunetfsui.la \
$(top_builddir)/src/util/libgnunetutil.la
+
+
+fsuitest2_SOURCES = \
+ fsuitest2.c
+fsuitest2_LDADD = \
+ $(top_builddir)/src/applications/fs/ecrs/libgnunetecrs.la \
+ $(top_builddir)/src/applications/fs/fsui/libgnunetfsui.la \
+ $(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c 2005-05-26 12:23:02 UTC (rev
822)
+++ GNUnet/src/applications/fs/fsui/fsui.c 2005-05-27 06:36:43 UTC (rev
823)
@@ -268,6 +268,8 @@
FSUI_EventCallback cb,
void * closure) {
FSUI_Context * ret;
+ FSUI_SearchList * list;
+ ResultPending * rp;
char * fn;
char * gh;
int fd;
@@ -314,20 +316,23 @@
goto WARN;
if (ntohl(big) > 16 * 1024 * 1024)
goto WARN;
- ret->collectionData
- = MALLOC(ntohl(big));
- if (ntohl(big) - sizeof(unsigned int) !=
- READ(fd,
- &ret->collectionData[1],
- ntohl(big) - sizeof(unsigned int))) {
- FREE(ret->collectionData);
+ if (big == 0) {
ret->collectionData = NULL;
- goto WARN;
+ } else {
+ ret->collectionData
+ = MALLOC(ntohl(big));
+ if (ntohl(big) - sizeof(unsigned int) !=
+ READ(fd,
+ &ret->collectionData[1],
+ ntohl(big) - sizeof(unsigned int))) {
+ FREE(ret->collectionData);
+ ret->collectionData = NULL;
+ goto WARN;
+ }
}
/* deserialize pending searches! */
while (1) {
- FSUI_SearchList * list;
char * buf;
if (sizeof(unsigned int) !=
@@ -411,8 +416,6 @@
readFileInfo(fd,
&list->resultsReceived[i]);
for (i=0;i<list->sizeUnmatchedResultsReceived;i++) {
- ResultPending * rp;
-
rp = &list->unmatchedResultsReceived[i];
readFileInfo(fd,
&rp->fi);
@@ -421,16 +424,14 @@
READ(fd,
&big,
sizeof(unsigned int))) {
- /* FIXME: memory leak! */
- goto WARN;
+ goto WARNL;
}
rp->matchingKeyCount
= ntohl(big);
if ( (rp->matchingKeyCount > 1024) ||
(rp->matchingKeyCount >
list->numberOfURIKeys) ) {
- /* FIXME: memory leak! */
- goto WARN;
+ goto WARNL;
}
if (rp->matchingKeyCount > 0)
@@ -446,8 +447,7 @@
rp->matchingKeys,
sizeof(HashCode512) *
rp->matchingKeyCount)) {
- /* FIXME: memory leak! */
- goto WARN;
+ goto WARNL;
}
}
@@ -459,6 +459,7 @@
/* FIXME: start search threads! */
// PTHREAD_CREATE(&list->handle);
+
/* finally: prepend to list */
list->next
= ret->activeSearches;
@@ -471,6 +472,28 @@
/* success, read complete! */
goto END;
+ WARNL:
+ for (i=0;i<list->sizeResultsReceived;i++) {
+ if (list->resultsReceived[i].uri != NULL)
+ ECRS_freeUri(list->resultsReceived[i].uri);
+ if (list->resultsReceived[i].meta != NULL)
+ ECRS_freeMetaData(list->resultsReceived[i].meta);
+ }
+ GROW(list->resultsReceived,
+ list->sizeResultsReceived,
+ 0);
+ for (i=0;i<list->sizeUnmatchedResultsReceived;i++) {
+ rp = &list->unmatchedResultsReceived[i];
+
+ if (rp->fi.uri != NULL)
+ ECRS_freeUri(rp->fi.uri);
+ if (rp->fi.meta != NULL)
+ ECRS_freeMetaData(rp->fi.meta);
+ FREENONNULL(rp->matchingKeys);
+ }
+ GROW(list->resultsReceived,
+ list->sizeResultsReceived,
+ 0);
WARN:
LOG(LOG_WARNING,
_("FSUI state file '%s' had syntax error at offset %u.\n"),
@@ -550,10 +573,14 @@
fd = -1;
}
if (fd != -1) {
- /* serialize collection data */
- WRITE(fd,
- ctx->collectionData,
- ntohl(ctx->collectionData->size));
+ if (ctx->collectionData == NULL) {
+ WRITEINT(fd, 0);
+ } else {
+ /* serialize collection data */
+ WRITE(fd,
+ ctx->collectionData,
+ ntohl(ctx->collectionData->size));
+ }
}
while (ctx->activeSearches != NULL) {
spos = ctx->activeSearches;
Added: GNUnet/src/applications/fs/fsui/fsuitest2.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsuitest2.c 2005-05-26 12:23:02 UTC (rev
822)
+++ GNUnet/src/applications/fs/fsui/fsuitest2.c 2005-05-27 06:36:43 UTC (rev
823)
@@ -0,0 +1,115 @@
+/*
+ This file is part of GNUnet.
+ (C) 2004, 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file applications/fs/fsui/fsuitest.c
+ * @brief testcase for fsui (upload-download)
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "gnunet_util.h"
+#include "gnunet_fsui_lib.h"
+#include <sys/wait.h>
+
+#define CHECK(a) if (!(a)) { ok = NO; BREAK(); goto FAILURE; }
+
+static int parseCommandLine(int argc,
+ char * argv[]) {
+ FREENONNULL(setConfigurationString("GNUNETD",
+ "_MAGIC_",
+ "NO"));
+ FREENONNULL(setConfigurationString("GNUNETD",
+ "LOGFILE",
+ NULL));
+ FREENONNULL(setConfigurationString("GNUNET",
+ "LOGLEVEL",
+ "WARNING"));
+ return OK;
+}
+
+static struct FSUI_Context * ctx;
+
+static void eventCallback(void * cls,
+ const FSUI_Event * event) {
+}
+
+
+int main(int argc, char * argv[]){
+ pid_t daemon;
+ int status;
+ int ok;
+
+ daemon = fork();
+ if (daemon == 0) {
+ if (0 != execlp("gnunetd", /* what binary to execute, must be in $PATH! */
+ "gnunetd", /* arg0, path to gnunet binary */
+ "-d", /* do not daemonize so we can easily kill you */
+ "-c",
+ "check.conf", /* configuration file */
+ NULL)) {
+ fprintf(stderr,
+ _("'%s' failed: %s\n"),
+ "execlp",
+ STRERROR(errno));
+ return -1;
+ }
+ }
+ ok = YES;
+ initUtil(argc, argv, &parseCommandLine);
+ startCron();
+ gnunet_util_sleep(5 * cronSECONDS); /* give gnunetd time to start */
+
+ /* ACTUAL TEST CODE */
+ ctx = FSUI_start("fsuitest2",
+ YES,
+ &eventCallback,
+ NULL);
+ CHECK(ctx != NULL);
+ FSUI_stop(ctx);
+ /* ACTUAL TEST CODE */
+ ctx = FSUI_start("fsuitest2",
+ YES,
+ &eventCallback,
+ NULL);
+ CHECK(ctx != NULL);
+ FAILURE:
+ if (ctx != NULL)
+ FSUI_stop(ctx);
+
+ stopCron();
+ doneUtil();
+ if (daemon != -1) {
+ if (0 != kill(daemon, SIGTERM))
+ DIE_STRERROR("kill");
+ if (daemon != waitpid(daemon, &status, 0))
+ DIE_STRERROR("waitpid");
+
+ if ( (WEXITSTATUS(status) == 0) &&
+ (ok == YES) )
+ return 0;
+ else
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+/* end of fsuitest2.c */
Modified: GNUnet/src/include/gnunet_fsui_lib.h
===================================================================
--- GNUnet/src/include/gnunet_fsui_lib.h 2005-05-26 12:23:02 UTC (rev
822)
+++ GNUnet/src/include/gnunet_fsui_lib.h 2005-05-27 06:36:43 UTC (rev
823)
@@ -388,7 +388,6 @@
* if keywords is not legal (i.e. empty).
*/
struct ECRS_URI * FSUI_parseCharKeywordURI(const char * keywords); /* helper.c
*/
-
/**
* Create an ECRS URI from a user-supplied command line of keywords.
* The command line may contain the reserved word 'AND' to create a
Modified: GNUnet/src/util/logging.c
===================================================================
--- GNUnet/src/util/logging.c 2005-05-26 12:23:02 UTC (rev 822)
+++ GNUnet/src/util/logging.c 2005-05-27 06:36:43 UTC (rev 823)
@@ -373,6 +373,10 @@
if (bInited)
MUTEX_LOCK(&logMutex);
+ if ( (customLog != NULL) &&
+ (proc != NULL) ) {
+ BREAK();
+ }
customLog = proc;
if (bInited)
Modified: branches/GNUnet06/src/applications/afs/gtkui/helper.c
===================================================================
--- branches/GNUnet06/src/applications/afs/gtkui/helper.c 2005-05-26
12:23:02 UTC (rev 822)
+++ branches/GNUnet06/src/applications/afs/gtkui/helper.c 2005-05-27
06:36:43 UTC (rev 823)
@@ -539,378 +539,9 @@
gtk_widget_show_all(window);
}
-/**
- * Checks if gnunetd is running
- *
- * NOTE: Uses CS_PROTO_CLIENT_COUNT query to determine if
- * gnunetd is running
- */
-static int checkDaemonRunning(void) {
- GNUNET_TCP_SOCKET * sock;
- CS_HEADER csHdr;
- int ret;
- sock = getClientSocket();
- if(sock == NULL) {
- BREAK();
- return SYSERR;
- }
- csHdr.size
- = htons(sizeof(CS_HEADER));
- csHdr.tcpType
- = htons(CS_PROTO_CLIENT_COUNT);
- if (SYSERR == writeToSocket(sock,
- &csHdr)) {
- LOG(LOG_DEBUG,
- _("gnunetd is NOT running.\n"));
- releaseClientSocket(sock);
- return SYSERR;
- }
- if (SYSERR == readTCPResult(sock,
- &ret)) {
- BREAK();
- releaseClientSocket(sock);
- return SYSERR;
- }
- releaseClientSocket(sock);
-
- return OK;
-}
-
-#if LINUX || OSX || SOLARIS || SOMEBSD
-static int launchWithExec() {
- pid_t pid;
-
- pid = fork();
- if (pid == 0) {
- char * args[4];
- char * path;
- char * cp;
-
- path = NULL;
- cp = getConfigurationString("MAIN",
- "ARGV[0]");
- if (cp != NULL) {
- int i = strlen(cp);
- while ( (i >= 0) &&
- (cp[i] != DIR_SEPARATOR) )
- i--;
- if ( i != -1 ) {
- cp[i+1] = '\0';
- path = MALLOC(i+1+strlen("gnunetd"));
- strcpy(path, cp);
- strcat(path, "gnunetd");
- args[0] = path;
- FREE(cp);
- } else {
- args[0] = "gnunetd";
- }
- }
- cp = getConfigurationString("GNUNET-GTK",
- "GNUNETD-CONFIG");
- if (cp != NULL) {
- args[1] = "-c";
- args[2] = cp;
- } else {
- args[1] = NULL;
- }
- args[3] = NULL;
- errno = 0;
- nice(10); /* return value is not well-defined */
- if (errno != 0)
- LOG_STRERROR(LOG_WARNING, "nice");
- if (path != NULL)
- execv(path,
- args);
- else
- execvp("gnunetd",
- args);
- LOG_STRERROR(LOG_FAILURE, "exec");
- LOG(LOG_FAILURE,
- _("Attempted path to '%s' was '%s'.\n"),
- "gnunetd",
- (path == NULL) ? "gnunetd" : path);
- FREENONNULL(path); /* yeah, right, like we're likely to get
- here... */
- FREENONNULL(args[1]);
- _exit(-1);
- } else {
- pid_t ret;
- int status;
-
- ret = waitpid(pid, &status, 0);
- if (ret == -1) {
- LOG_STRERROR(LOG_ERROR, "waitpid");
- return SYSERR;
- }
- if ( (WIFEXITED(status) &&
- (0 != WEXITSTATUS(status)) ) ) {
- guiMessage(_("Starting gnunetd failed, error code: %d"),
- WEXITSTATUS(status));
- return SYSERR;
- }
-#ifdef WCOREDUMP
- if (WCOREDUMP(status)) {
- guiMessage(_("Starting gnunetd failed (core dumped)."));
- return SYSERR;
- }
-#endif
- if (WIFSIGNALED(status) ||
- WTERMSIG(status) ) {
- guiMessage(_("Starting gnunetd failed (aborted by signal)."));
- return SYSERR;
- }
- return OK;
- }
-}
-#endif
-
-static int doLaunch() {
-
-#if LINUX || OSX || SOLARIS || SOMEBSD
- return launchWithExec();
-#elif MINGW
- char szCall[_MAX_PATH + 1], szWd[_MAX_PATH + 1], szCWd[_MAX_PATH + 1];
- char *args[1];
-
- conv_to_win_path("/bin/gnunetd.exe", szCall);
- conv_to_win_path("/bin", szWd);
- _getcwd(szCWd, _MAX_PATH);
-
- chdir(szWd);
- args[0] = NULL;
- spawnvp(_P_NOWAIT, szCall, (const char *const *) args);
- chdir(szCWd);
-
- return OK;
-#else
- /* any system out there that does not support THIS!? */
- system("gnunetd"); /* we may not have nice,
- so let's be minimalistic here. */
- return OK;
-#endif
-}
-
-/**
- * Launch gnunetd, don't check if its running
- */
-static void launchDaemonNoCheck(GtkWidget * widget,
- gpointer data) {
- /* sanity checks, not critical for ports */
- char * host = getConfigurationString("NETWORK",
- "HOST");
- if (host != NULL) {
- if (0 != strcmp(host,
- "localhost")) {
- char * hostname;
- hostname = MALLOC(1024);
- if (0 != gethostname(hostname, 1024)) {
- LOG_STRERROR(LOG_ERROR, "gethostname");
- } else {
- /* we could go crazy here and try to open a socket locally
- and then attempt to connect to it using the NS lookup result
- for "host" -- and do it for IPv4 and IPv6 and possibly still
- be wrong due some crazy firewall configuration. Or we can
- just do the simpelst thing (strcmp) and expect the user to
- fix it if he cares to have the warning go away... */
- if (0 != strcmp(host,
- hostname)) {
- guiMessage("gnunetd is configured to run on host '%s' and\n"
- "gnunet-gtk is running on host '%s', which seems to be a
different machine.\n"
- "gnunet-gtk can only start gnunetd on host '%s'.\n"
- "This may not be what you want (it may not work).\n"
- "I will proceed anyway, good luck.",
- host,
- hostname,
- hostname);
- }
- }
- FREE(hostname);
- }
- FREE(host);
- }
- /* end of sanity checks */
- doLaunch();
- pollForLaunch = TRUE;
- gtk_widget_destroy(GTK_WIDGET(data));
-}
-
-/**
- * Launch gnunetd w/ checks
- */
-void launchDaemon(GtkWidget * widget,
- gpointer data) {
- if (OK == checkDaemonRunning() ) {
- guiMessage(_("gnunetd is already running"));
- return;
- } else {
- doLaunch();
- pollForLaunch = TRUE;
- }
-}
-
-/**
- * Kill gnunetd
- */
-void killDaemon(GtkWidget * widget,
- gpointer data) {
- if (OK == checkDaemonRunning() ) {
- GNUNET_TCP_SOCKET * sock;
- CS_HEADER csHdr;
- int ret;
-
- sock = getClientSocket();
- if (sock == NULL) {
- /* well, probably already dead */
- return;
- }
- csHdr.size
- = htons(sizeof(CS_HEADER));
- csHdr.tcpType
- = htons(CS_PROTO_SHUTDOWN_REQUEST);
- if (SYSERR == writeToSocket(sock,
- &csHdr)) {
- guiMessage(_("Error sending shutdown request to gnunetd."));
- releaseClientSocket(sock);
- return;
- }
- if (SYSERR == readTCPResult(sock,
- &ret)) {
- guiMessage(_("Error reading shutdown confirmation from gnunetd."));
- releaseClientSocket(sock);
- return;
- }
- if (ret == OK)
- guiMessage(_("gnunetd agreed to shut down."));
- else
- guiMessage(_("gnunetd refused to shut down (error code '%d')."),
- ret);
- releaseClientSocket(sock);
- } else {
- guiMessage(_("gnunetd is not running."));
- }
-}
-
/**
- * Ask if the user wishes to start gnunetd
- */
-static void initDaemonStartDialog(void) {
- GtkWidget *dialog;
- GtkWidget *label;
- GtkWidget *okay_button;
- GtkWidget *no_button;
-
- dialog = gtk_dialog_new();
- label = gtk_label_new(_("gnunetd (daemon) doesn't seem to be
running.\nWould you like to start it?\n"));
- gtk_container_add (GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),
- label);
-
- okay_button = gtk_button_new_with_label(_("Yes!"));
- no_button = gtk_button_new_with_label(_("No."));
-
- gtk_signal_connect(GTK_OBJECT(okay_button),
- "clicked",
- GTK_SIGNAL_FUNC(launchDaemonNoCheck),
- dialog);
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
- okay_button);
- gtk_signal_connect(GTK_OBJECT(no_button),
- "clicked",
- GTK_SIGNAL_FUNC(destroyWidget),
- dialog);
- gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
- no_button);
-
- gtk_widget_show_all(dialog);
-}
-
-/**
- * Checks if gnunetd is running and if not, prompts user
- * to run gnunetd. Always returns OK.
- */
-int checkForDaemon(void) {
- if (SYSERR == checkDaemonRunning()) {
- char * host;
-
- host = getConfigurationString("NETWORK",
- "HOST");
- if (host != NULL && strcmp(host,
- "localhost")==0 )
- initDaemonStartDialog();
- else
- guiMessage(_("gnunetd does not seem to be running.\n"
- "Unfortunately, gnunet-gtk cannot identify config entry"
- "\n\nNETWORK/HOST '%s'\n\n"
- "as a local machine, so gnunetd cannot be\n"
- "launched by gnunet-gtk."),
- (host == NULL ? "" : host) );
- }
-
- return OK;
-}
-
-static gint doUpdateMenus(SaveCall * call) {
- static GtkWidget * killEntry = NULL;
- static GtkWidget * launchEntry = NULL;
- static GtkWidget * statsEntry = NULL;
- static int once = 1;
- static int isLocal;
- char * host;
- int ret;
-
- ret = * (int*) call->args;
- if (once) {
- once = 0;
- killEntry = gtk_item_factory_get_widget(itemFactory,
- "/Advanced/"
- "Kill gnunetd");
- launchEntry = gtk_item_factory_get_widget(itemFactory,
- "/Advanced/"
- "Launch gnunetd");
- statsEntry = gtk_item_factory_get_widget(itemFactory,
- "/File/"
- "Show gnunetd stats");
- host = getConfigurationString("NETWORK",
- "HOST");
- if ( (host == NULL) ||
- (strcmp(host, "localhost")==0) )
- isLocal = TRUE;
- else
- isLocal = FALSE;
- FREENONNULL(host);
- }
- if (ret == SYSERR) {
- gtk_widget_set_sensitive(statsEntry, FALSE);
- gtk_widget_set_sensitive(killEntry, FALSE);
- gtk_widget_set_sensitive(launchEntry, (TRUE & isLocal) );
- } else {
- gtk_widget_set_sensitive(statsEntry, TRUE);
- gtk_widget_set_sensitive(killEntry, TRUE);
- gtk_widget_set_sensitive(launchEntry, FALSE);
-
- if (pollForLaunch == TRUE) {
- pollForLaunch = FALSE;
- guiMessage(_("gnunetd is now running."));
- }
- }
- gtkSaveCallDone(call->sem);
- return FALSE;
-}
-
-void cronCheckDaemon(void * dummy) {
- static int last = 42;
- int ret;
-
- ret = checkDaemonRunning();
- if (ret != last) {
- last = ret;
- gtkSaveCall((GtkFunction) doUpdateMenus, &ret);
- }
-}
-
-
-/**
* A function for numeric comparisons of strings
*/
gint numericComp(GtkCList *clist,
Modified: branches/GNUnet06/src/applications/afs/gtkui/main.c
===================================================================
--- branches/GNUnet06/src/applications/afs/gtkui/main.c 2005-05-26 12:23:02 UTC
(rev 822)
+++ branches/GNUnet06/src/applications/afs/gtkui/main.c 2005-05-27 06:36:43 UTC
(rev 823)
@@ -861,7 +861,7 @@
startAFSPriorityTracker();
gdk_threads_enter();
setCustomLogProc(addLogEntry);
-#ifdef MINGW
+#ifdef MINGW
if (! debug_flag)
FreeConsole();
#endif
Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/gnunet-gtk.glade 2005-05-27 06:36:43 UTC (rev 823)
@@ -52,7 +52,7 @@
<property name="visible">True</property>
<property name="label">gtk-about</property>
<property name="use_stock">True</property>
- <signal name="activate" handler="on_about_activate"/>
+ <signal name="activate" handler="on_about_clicked"/>
</widget>
</child>
</widget>
@@ -78,19 +78,60 @@
<property name="enable_popup">False</property>
<child>
- <widget class="GtkLabel" id="splashScreen">
+ <widget class="GtkScrolledWindow" id="scrolledwindow19">
<property name="visible">True</property>
- <property name="label" translatable="yes">Welcome to GNUnet
-</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">True</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkViewport" id="viewport6">
+ <property name="visible">True</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+
+ <child>
+ <widget class="GtkLabel" id="label75">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span
size="x-large">Welcome to gnunet-gtk 0.7.0</span>
+
+gnunet-gtk is the GTK+ user interface for GNUnet. It is intended to eventually
provide a universal, pluggable interface for all GNUnet services.
+
+This is an alpha release. Many features are not working and others are
missing. The GNUnet homepage offers information about new versions of
gnunet-gtk.
+
+<span size="x-large">Important changes (compared to gnunet-gtk
0.6.6):</span>
+
+The redesign of the GNUnet core has also affected gnunet-gtk. The new codebase
is based on glade, which should make it easier to customize and extend
gnunet-gtk.
+
+The new codebase is mostly a collection of GTK+ signal handlers that trigger
the appropriate actions on GNUnet's FSUI and ECRS libraries.
+
+The code is still far from complete, missing features include:
+* support for starting and stopping gnunetd
+* support for file sharing (insert, search, download, pseudonyms, namespaces,
directories, collections)
+* support for statistics (raw, graphical)
+* support for chat
+
+We hope that you will enjoy gnunet-gtk (especially once it is ready).
+
+
+Thank you,
+
+
+ The GNUnet Team</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">True</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ </child>
</widget>
<packing>
<property name="tab_expand">False</property>
@@ -166,12 +207,12 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkButton"
id="startGnunetdButton">
+ <widget class="GtkButton"
id="startDaemon">
<property
name="visible">True</property>
<property
name="can_focus">True</property>
<property
name="relief">GTK_RELIEF_NORMAL</property>
<property
name="focus_on_click">True</property>
- <signal name="clicked"
handler="on_startGnunetdButton_clicked" last_modification_time="Mon, 23 May
2005 19:05:11 GMT"/>
+ <signal name="clicked"
handler="on_startDaemon_clicked" last_modification_time="Mon, 23 May 2005
19:05:11 GMT"/>
<child>
<widget class="GtkAlignment"
id="alignment1">
@@ -211,7 +252,7 @@
<child>
<widget class="GtkLabel"
id="startButton">
<property
name="visible">True</property>
- <property name="label"
translatable="yes">_start gnunetd</property>
+ <property name="label"
translatable="yes">start gnunetd</property>
<property
name="use_underline">True</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_RIGHT</property>
@@ -287,7 +328,7 @@
<child>
<widget class="GtkLabel"
id="label64">
<property
name="visible">True</property>
- <property name="label"
translatable="yes">s_top gnunetd</property>
+ <property name="label"
translatable="yes">stop gnunetd</property>
<property
name="use_underline">True</property>
<property
name="use_markup">False</property>
<property
name="justify">GTK_JUSTIFY_LEFT</property>
@@ -317,7 +358,7 @@
</child>
<child>
- <widget class="GtkImage"
id="statusPixmap">
+ <widget class="GtkImage"
id="statusPixmapNo">
<property
name="visible">True</property>
<property
name="stock">gtk-no</property>
<property
name="icon_size">4</property>
@@ -327,7 +368,7 @@
<property name="ypad">0</property>
<accessibility>
<atkproperty
name="AtkObject::accessible_name" translatable="yes">status</atkproperty>
- <atkproperty
name="AtkObject::accessible_description" translatable="yes">gnunetd
status</atkproperty>
+ <atkproperty
name="AtkObject::accessible_description" translatable="yes">gnunetd status: not
running</atkproperty>
</accessibility>
</widget>
<packing>
@@ -336,6 +377,28 @@
<property name="fill">False</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkImage"
id="statusPixmapYes">
+ <property agent="glademm"
name="cxx_visibility">public</property>
+ <property
name="visible">True</property>
+ <property
name="stock">gtk-yes</property>
+ <property
name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <accessibility>
+ <atkproperty
name="AtkObject::accessible_name" translatable="yes">status</atkproperty>
+ <atkproperty
name="AtkObject::accessible_description" translatable="yes">gnunetd status:
running</atkproperty>
+ </accessibility>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property
name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
</child>
@@ -432,6 +495,7 @@
<child>
<widget class="GtkTreeView" id="clist2">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property
name="visible">True</property>
<property
name="can_focus">True</property>
<property
name="headers_visible">True</property>
@@ -535,6 +599,7 @@
<child>
<widget class="GtkTreeView" id="clist7">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@@ -589,6 +654,7 @@
<child>
<widget class="GtkTreeView" id="clist5">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@@ -643,6 +709,7 @@
<child>
<widget class="GtkTreeView" id="clist6">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@@ -712,7 +779,8 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkNotebook" id="notebook6">
+ <widget class="GtkNotebook" id="downloadNotebook">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
<property name="show_border">True</property>
@@ -783,7 +851,8 @@
</accessibility>
<child internal-child="entry">
- <widget class="GtkEntry" id="combo-entry2">
+ <widget class="GtkEntry" id="searchKeywordGtkEntry">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -931,24 +1000,9 @@
</child>
<child>
- <widget class="GtkOptionMenu" id="optionmenu1">
+ <widget class="GtkComboBoxEntry"
id="searchNamespaceComboBoxEntry">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="history">0</property>
-
- <child internal-child="menu">
- <widget class="GtkMenu" id="convertwidget16">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkMenuItem"
id="convertwidget17">
- <property name="visible">True</property>
- <property name="label"
translatable="yes">global (everywhere)</property>
- <property name="use_underline">True</property>
- </widget>
- </child>
- </widget>
- </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -1025,6 +1079,7 @@
<child>
<widget class="GtkRadioButton" id="indexbutton">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label"
translatable="yes">index</property>
@@ -1044,6 +1099,7 @@
<child>
<widget class="GtkRadioButton" id="insertButton">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label"
translatable="yes">insert</property>
@@ -1099,6 +1155,7 @@
<child>
<widget class="GtkRadioButton" id="radiobutton2">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">file
only</property>
@@ -1118,6 +1175,7 @@
<child>
<widget class="GtkRadioButton" id="radiobutton3">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">recursive
(for entire directories)</property>
@@ -1182,6 +1240,7 @@
<child internal-child="entry">
<widget class="GtkEntry" id="combo-entry1">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -1236,7 +1295,7 @@
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
- <signal name="activate"
handler="on_mainFileSharingInsertBrowseButton_activate"
object="fsinsertfilenamecombo" last_modification_time="Mon, 23 May 2005
17:09:36 GMT"/>
+ <signal name="clicked"
handler="on_mainFileSharingInsertBrowseButton_clicked"
object="fsinsertfilenamecombo" last_modification_time="Mon, 23 May 2005
17:09:36 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment7">
@@ -1437,7 +1496,7 @@
<property name="visible">True</property>
<property name="label"
translatable="yes">_Namespace</property>
<property name="use_underline">True</property>
- <signal name="activate_item"
handler="on_create_namespace_activate" last_modification_time="Mon, 23 May 2005
19:13:47 GMT"/>
+ <signal name="activate_item"
handler="on_create_namespace_clicked" last_modification_time="Mon, 23 May 2005
19:13:47 GMT"/>
</widget>
</child>
@@ -1446,7 +1505,7 @@
<property name="visible">True</property>
<property name="label"
translatable="yes">_Directory</property>
<property name="use_underline">True</property>
- <signal name="activate_item"
handler="on_create_directory_activate" last_modification_time="Mon, 23 May 2005
19:13:40 GMT"/>
+ <signal name="activate_item"
handler="on_create_directory_clicked" last_modification_time="Mon, 23 May 2005
19:13:40 GMT"/>
</widget>
</child>
@@ -1455,7 +1514,7 @@
<property name="visible">True</property>
<property name="label"
translatable="yes">_Collection</property>
<property name="use_underline">True</property>
- <signal name="activate_item"
handler="on_create_collection_activate" last_modification_time="Mon, 23 May
2005 19:13:32 GMT"/>
+ <signal name="activate_item"
handler="on_create_collection_clicked" last_modification_time="Mon, 23 May 2005
19:13:32 GMT"/>
</widget>
</child>
@@ -1464,7 +1523,7 @@
<property name="visible">True</property>
<property name="label"
translatable="yes">_Advertisement</property>
<property name="use_underline">True</property>
- <signal name="activate_item"
handler="on_create_advertisement_activate" last_modification_time="Mon, 23 May
2005 19:13:53 GMT"/>
+ <signal name="activate_item"
handler="on_create_advertisement_clicked" last_modification_time="Mon, 23 May
2005 19:13:53 GMT"/>
</widget>
</child>
</widget>
@@ -1488,7 +1547,7 @@
<property name="tooltip"
translatable="yes">Will prevent future insertions into the namespace (will not
delete content in the namespace)</property>
<property name="label"
translatable="yes">_Namespace</property>
<property name="use_underline">True</property>
- <signal name="activate_item"
handler="on_namespace2_activate" last_modification_time="Mon, 23 May 2005
19:14:04 GMT"/>
+ <signal name="activate_item"
handler="on_namespace2_clicked" last_modification_time="Mon, 23 May 2005
19:14:04 GMT"/>
</widget>
</child>
@@ -1498,7 +1557,7 @@
<property name="tooltip"
translatable="yes">end collection (will not delete content already in the
collection)</property>
<property name="label"
translatable="yes">_Collection</property>
<property name="use_underline">True</property>
- <signal name="activate_item"
handler="on_collection_delete_activate" last_modification_time="Mon, 23 May
2005 19:14:11 GMT"/>
+ <signal name="activate_item"
handler="on_collection_delete_clicked" last_modification_time="Mon, 23 May 2005
19:14:11 GMT"/>
</widget>
</child>
</widget>
@@ -1596,6 +1655,7 @@
<child>
<widget class="GtkTreeView" id="clist1">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property
name="headers_visible">True</property>
@@ -1689,6 +1749,7 @@
<child>
<widget class="GtkVBox" id="statisticsnotebookvbox">
+ <property agent="glademm" name="cxx_visibility">public</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
@@ -1745,7 +1806,8 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkNotebook" id="notebook3">
+ <widget class="GtkNotebook" id="chatnotebook">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="can_focus">True</property>
<property name="show_tabs">True</property>
<property name="show_border">True</property>
@@ -1808,6 +1870,7 @@
<child internal-child="entry">
<widget class="GtkEntry" id="chatMainEntryLine">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -1817,8 +1880,8 @@
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
- <signal name="activate"
handler="chatMainEntryLine_activate" last_modification_time="Mon, 23 May 2005
17:28:12 GMT"/>
- <signal name="editing_done"
handler="on_chatMainEntryLine_editing_done" last_modification_time="Mon, 23 May
2005 17:28:16 GMT"/>
+ <signal name="activate"
handler="chatMainEntryLine_clicked" last_modification_time="Mon, 23 May 2005
17:28:12 GMT"/>
+ <signal name="editing_done"
handler="on_chatMainEntryLine_editing_done_clicked"
last_modification_time="Mon, 23 May 2005 17:28:16 GMT"/>
<accelerator key="Return" modifiers="0"
signal="activate"/>
</widget>
</child>
@@ -1923,6 +1986,7 @@
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
@@ -1976,7 +2040,7 @@
<accessibility>
<atkproperty name="AtkObject::accessible_name"
translatable="yes">Delete button</atkproperty>
</accessibility>
- <signal name="activate"
handler="on_metaDataDialogDeleteButton_activate" last_modification_time="Mon,
23 May 2005 18:49:51 GMT"/>
+ <signal name="activate"
handler="on_metaDataDialogDeleteButton_clicked" object="metaDataDialog"
last_modification_time="Mon, 23 May 2005 18:49:51 GMT"/>
<accelerator key="Delete" modifiers="0" signal="activate"/>
</widget>
</child>
@@ -2075,6 +2139,7 @@
<child>
<widget class="GtkOptionMenu" id="optionmenu2">
+ <property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">0</property>
@@ -2124,6 +2189,7 @@
<child>
<widget class="GtkEntry" id="metaDataDialogValueEntry">
+ <property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -2173,6 +2239,7 @@
<child>
<widget class="GtkTreeView" id="metaDataDialogMetaDataList">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@@ -2241,6 +2308,7 @@
<child>
<widget class="GtkEntry" id="fileInformationKeywordEntry">
+ <property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -2250,8 +2318,8 @@
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
- <signal name="activate"
handler="fileInformationKeywordEntry_activate" object="metaDataDialog"
last_modification_time="Mon, 23 May 2005 17:23:09 GMT"/>
- <signal name="editing_done"
handler="fileInformationKeywordEntry_activate" object="metaDataDialog"
last_modification_time="Mon, 23 May 2005 18:56:54 GMT"/>
+ <signal name="activate"
handler="fileInformationKeywordEntry_clicked" object="metaDataDialog"
last_modification_time="Mon, 23 May 2005 17:23:09 GMT"/>
+ <signal name="editing_done"
handler="fileInformationKeywordEntry_clicked" object="metaDataDialog"
last_modification_time="Mon, 23 May 2005 18:56:54 GMT"/>
<accelerator key="Return" modifiers="0" signal="activate"/>
</widget>
<packing>
@@ -2288,6 +2356,7 @@
<child>
<widget class="GtkTreeView" id="metaDataDialogKeywordList">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="tooltip" translatable="yes">Select entries
and use Delete button in order to delete keywords.</property>
<property name="can_focus">True</property>
@@ -2398,6 +2467,7 @@
<child>
<widget class="GtkTreeView" id="clist10">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@@ -2453,13 +2523,15 @@
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow14">
+ <widget class="GtkScrolledWindow" id="searchPageScrolledWindow">
+ <property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <signal name="destroy" handler="on_searchPageScrolledWindow_destroy"
object="searchPageScrolledWindow" last_modification_time="Thu, 26 May 2005
22:41:04 GMT"/>
<child>
<widget class="GtkViewport" id="viewport5">
@@ -2483,6 +2555,7 @@
<child>
<widget class="GtkTreeView" id="searchResults">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@@ -2506,65 +2579,96 @@
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_downloadButton_clicked"
object="searchResults" last_modification_time="Mon, 23 May 2005 18:59:36 GMT"/>
+ <signal name="activate" handler="on_downloadButton_clicked"
object="searchResults" last_modification_time="Thu, 26 May 2005 09:26:15 GMT"/>
<accelerator key="Return" modifiers="GDK_CONTROL_MASK"
signal="activate"/>
<child>
- <widget class="GtkAlignment" id="alignment3">
+ <widget class="GtkHBox" id="hbox23">
<property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <property name="top_padding">0</property>
- <property name="bottom_padding">0</property>
- <property name="left_padding">0</property>
- <property name="right_padding">0</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
<child>
- <widget class="GtkHBox" id="hbox13">
+ <widget class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">2</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">0</property>
+ <property name="yscale">0</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">0</property>
+ <property name="right_padding">0</property>
<child>
- <widget class="GtkImage" id="image3">
+ <widget class="GtkHBox" id="hbox13">
<property name="visible">True</property>
- <property name="stock">gtk-copy</property>
- <property name="icon_size">4</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <property name="homogeneous">False</property>
+ <property name="spacing">2</property>
- <child>
- <widget class="GtkLabel" id="label65">
- <property name="visible">True</property>
- <property name="label"
translatable="yes">_Download</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property
name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-copy</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label65">
+ <property name="visible">True</property>
+ <property name="label"
translatable="yes">_Download</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property
name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
</child>
</widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
</child>
+
+ <child>
+ <widget class="GtkButton" id="closeSearchButton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <signal name="clicked"
handler="on_closeSearchButton_clicked" object="searchPageScrolledWindow"
last_modification_time="Thu, 26 May 2005 22:42:37 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
@@ -2613,6 +2717,7 @@
<child>
<widget class="GtkTreeView" id="namespaceContentFrameTreeView">
+ <property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
@@ -2642,7 +2747,7 @@
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
- <signal name="clicked"
handler="on_namespaceInsertButton_activate" object="namespaceContentFrame"
last_modification_time="Mon, 23 May 2005 19:00:01 GMT"/>
+ <signal name="clicked" handler="on_namespaceInsertButton_clicked"
object="namespaceContentFrame" last_modification_time="Mon, 23 May 2005
19:00:01 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment4">
@@ -2718,7 +2823,7 @@
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">False</property>
- <signal name="clicked" handler="on_namespaceUpdateButton_clicked"
object="namespaceContentFrameTreeView" last_modification_time="Mon, 23 May 2005
19:01:59 GMT"/>
+ <signal name="clicked" handler="on_namespaceUpdateButton_clicked"
object="namespaceContentFrame" last_modification_time="Mon, 23 May 2005
19:01:59 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment5">
@@ -2835,6 +2940,7 @@
<child>
<widget class="GtkTextView" id="chatLogViewer">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -2868,6 +2974,7 @@
<child>
<widget class="GtkComboBoxEntry" id="chatLineTextEntry">
+ <property agent="glademm"
name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="items" translatable="yes">/join
#gnunet</property>
<signal name="editing_done"
handler="on_chatLineTextEntry_editing_done" last_modification_time="Mon, 23 May
2005 17:18:48 GMT"/>
@@ -2980,7 +3087,8 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkTreeView" id="treeview3">
+ <widget class="GtkTreeView" id="chatUserListTreeView">
+ <property agent="glademm" name="cxx_visibility">public</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
Modified: gnunet-gtk/src/Makefile.am
===================================================================
--- gnunet-gtk/src/Makefile.am 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/Makefile.am 2005-05-27 06:36:43 UTC (rev 823)
@@ -9,12 +9,21 @@
-DGLADE_FILE="\"$(DESTDIR)$(pkgdatadir)/gnunet-gtk.glade\""
gnunet_gtk_SOURCES = \
- main.c main.h gettext.h
+ about.c \
+ daemon.c daemon.h \
+ fs.c fs.h \
+ gettext.h \
+ gtk26about.c gtk26about.h \
+ helper.c helper.h \
+ main.c main.h \
+ platform.h plibc.h \
+ search.c
gnunet_gtk_LDADD = \
@GTK_LIBS@ \
@GNUNETGTK_LIBS@ \
- $(INTLLIBS)
+ $(INTLLIBS) \
+ -lgthread-2.0
gnunet_gtk_LDFLAGS = \
-export-dynamic
Added: gnunet-gtk/src/about.c
===================================================================
--- gnunet-gtk/src/about.c 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/about.c 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,125 @@
+/*
+ This file is part of GNUnet
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/applications/afs/gtkui/about.c
+ * @author Christian Grothoff
+ * @author Igor Wronsky
+ *
+ * This file contains the about dialog.
+ */
+
+#include "config.h"
+#include "gettext.h"
+#include <gdk-pixbuf/gdk-pixbuf.h>
+#include "gtk26about.h"
+
+#include "helper.h"
+
+/**
+ * This displays an about window
+ *
+ * Todo: the GTK demo can do links.
+ */
+void on_about_clicked(GtkWidget *dummy,
+ gpointer data) {
+ const gchar * authors[] = {
+ "Juergen Appel <address@hidden>",
+ "Krista Bennett <address@hidden>",
+ "James Blackwell <address@hidden>",
+ "Ludovic Courtes <address@hidden>",
+ "Nils Durner <address@hidden>",
+ "Renaldo Ferreira <address@hidden>",
+ "Christian Grothoff <address@hidden>",
+ "Eric Haumant",
+ "Tzvetan Horozov <address@hidden>",
+ "Gerd Knorr <address@hidden>",
+ "Werner Koch <address@hidden>",
+ "Uli Luckas <address@hidden>",
+ "Blake Matheny <address@hidden>",
+ "Glenn McGrath <address@hidden>",
+ "Hendrik Pagenhardt <address@hidden>",
+ "Ioana Patrascu <address@hidden>",
+ "Marko Raeihae",
+ "Paul Ruth <address@hidden>",
+ "Risto Saarelma",
+ "Antti Salonen",
+ "Tiberius Stef <address@hidden>",
+ "Tuomas Toivonen",
+ "Tomi Tukiainen",
+ "Kevin Vandersloot <address@hidden>",
+ "Simo Viitanen",
+ "Larry Waldo",
+ "Igor Wronsky <address@hidden>",
+ "<address@hidden>",
+ NULL,
+ };
+ const gchar * artists[] = {
+ "Christian Muellner <address@hidden>",
+ "Alex Jones <address@hidden>",
+ NULL,
+ };
+ const char * trans = _("translator-credits");
+ const char * license = "GNUnet is free software; you can redistribute it
and/or modify\n"
+ "it under the terms of the GNU General Public License
as published\n"
+ "by the Free Software Foundation; either version 2, or
(at your\n"
+ "option) any later version.\n\n"
+ "GNUnet is distributed in the hope that it will be
useful, but\n"
+ "WITHOUT ANY WARRANTY; without even the implied
warranty of\n"
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.\n"
+ "See the GNU General Public License for more
details.\n\n"
+ "You should have received a copy of the GNU General
Public License\n"
+ "along with GNUnet; see the file COPYING. If not,
write to the\n"
+ "Free Software Foundation, Inc., 59 Temple Place -
Suite 330,\n"
+ "Boston, MA 02111-1307, USA.\n";
+
+ GdkPixbuf * logo;
+ GError * error;
+
+ error = NULL;
+ logo = gdk_pixbuf_new_from_file("gnunet_logo.png",
+ &error);
+ if (logo != NULL) {
+ gtk_show_about_dialog(NULL,
+ "logo", logo,
+ "name", "gnunet-gtk",
+ "version", VERSION,
+ "copyright" , "(C) 2001-2005 Christian Grothoff (and
other contributing authors)",
+ "website", "http://www.gnu.org/software/gnunet/",
+ "license", license,
+ "authors", authors,
+ "artists", artists,
+ (0 == strcmp(trans,"translator-credits")) ? NULL :
"translator_credits", trans,
+ NULL);
+ g_object_unref(G_OBJECT(logo));
+ } else {
+ gtk_show_about_dialog(NULL,
+ "name", "gnunet-gtk",
+ "version", VERSION,
+ "copyright" , "(C) 2001-2005 Christian Grothoff (and
other contributing authors)",
+ "website", "http://www.gnu.org/software/gnunet/",
+ "license", license,
+ "authors", authors,
+ "artists", artists,
+ (0 == strcmp(trans,"translator-credits")) ? NULL :
"translator_credits", trans,
+ NULL);
+ }
+}
+
+/* end of about.c */
Added: gnunet-gtk/src/daemon.c
===================================================================
--- gnunet-gtk/src/daemon.c 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/daemon.c 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,315 @@
+/*
+ This file is part of GNUnet.
+ (C) 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/daemon.c
+ * @brief code for gnunet-gtk gnunetd interaction
+ * @author Christian Grothoff
+ */
+
+#include "platform.h"
+#include "daemon.h"
+#include "main.h"
+#include "helper.h"
+#ifndef MINGW
+ #include <sys/wait.h>
+#endif
+#include <GNUnet/gnunet_util.h>
+#include <GNUnet/gnunet_protocols.h>
+
+/**
+ * Checks if gnunetd is running
+ *
+ * NOTE: Uses CS_PROTO_CLIENT_COUNT query to determine if
+ * gnunetd is running
+ */
+static int checkDaemonRunning(void) {
+ GNUNET_TCP_SOCKET * sock;
+ CS_HEADER csHdr;
+ int ret;
+
+ sock = getClientSocket();
+ if(sock == NULL) {
+ BREAK();
+ return SYSERR;
+ }
+
+ csHdr.size
+ = htons(sizeof(CS_HEADER));
+ csHdr.type
+ = htons(CS_PROTO_CLIENT_COUNT);
+ if (SYSERR == writeToSocket(sock,
+ &csHdr)) {
+ LOG(LOG_DEBUG,
+ _("gnunetd is NOT running.\n"));
+ releaseClientSocket(sock);
+ return SYSERR;
+ }
+ if (SYSERR == readTCPResult(sock,
+ &ret)) {
+ releaseClientSocket(sock);
+ return SYSERR;
+ }
+ releaseClientSocket(sock);
+
+ return OK;
+}
+
+
+
+#if LINUX || OSX || SOLARIS || SOMEBSD
+static int launchWithExec() {
+ pid_t pid;
+
+ pid = fork();
+ if (pid == 0) {
+ char * args[4];
+ char * path;
+ char * cp;
+
+ path = NULL;
+ cp = getConfigurationString("MAIN",
+ "ARGV[0]");
+ if (cp != NULL) {
+ int i = strlen(cp);
+ while ( (i >= 0) &&
+ (cp[i] != DIR_SEPARATOR) )
+ i--;
+ if ( i != -1 ) {
+ cp[i+1] = '\0';
+ path = MALLOC(i+1+strlen("gnunetd"));
+ strcpy(path, cp);
+ strcat(path, "gnunetd");
+ args[0] = path;
+ FREE(cp);
+ } else {
+ args[0] = "gnunetd";
+ }
+ }
+ cp = getConfigurationString("GNUNET-GTK",
+ "GNUNETD-CONFIG");
+ if (cp != NULL) {
+ args[1] = "-c";
+ args[2] = cp;
+ } else {
+ args[1] = NULL;
+ }
+ args[3] = NULL;
+ errno = 0;
+ nice(10); /* return value is not well-defined */
+ if (errno != 0)
+ LOG_STRERROR(LOG_WARNING, "nice");
+ if (path != NULL)
+ execv(path,
+ args);
+ else
+ execvp("gnunetd",
+ args);
+ LOG_STRERROR(LOG_FAILURE, "exec");
+ LOG(LOG_FAILURE,
+ _("Attempted path to '%s' was '%s'.\n"),
+ "gnunetd",
+ (path == NULL) ? "gnunetd" : path);
+ FREENONNULL(path); /* yeah, right, like we're likely to get
+ here... */
+ FREENONNULL(args[1]);
+ _exit(-1);
+ } else {
+ pid_t ret;
+ int status;
+
+ ret = waitpid(pid, &status, 0);
+ if (ret == -1) {
+ LOG_STRERROR(LOG_ERROR, "waitpid");
+ return SYSERR;
+ }
+ if ( (WIFEXITED(status) &&
+ (0 != WEXITSTATUS(status)) ) ) {
+ guiMessage(_("Starting gnunetd failed, error code: %d"),
+ WEXITSTATUS(status));
+ return SYSERR;
+ }
+#ifdef WCOREDUMP
+ if (WCOREDUMP(status)) {
+ guiMessage(_("Starting gnunetd failed (core dumped)."));
+ return SYSERR;
+ }
+#endif
+ if (WIFSIGNALED(status) ||
+ WTERMSIG(status) ) {
+ guiMessage(_("Starting gnunetd failed (aborted by signal)."));
+ return SYSERR;
+ }
+ return OK;
+ }
+}
+#endif
+
+static int doLaunch() {
+
+#if LINUX || OSX || SOLARIS || SOMEBSD
+ return launchWithExec();
+#elif MINGW
+ char szCall[_MAX_PATH + 1], szWd[_MAX_PATH + 1], szCWd[_MAX_PATH + 1];
+ char *args[1];
+
+ conv_to_win_path("/bin/gnunetd.exe", szCall);
+ conv_to_win_path("/bin", szWd);
+ _getcwd(szCWd, _MAX_PATH);
+
+ chdir(szWd);
+ args[0] = NULL;
+ spawnvp(_P_NOWAIT, szCall, (const char *const *) args);
+ chdir(szCWd);
+
+ return OK;
+#else
+ /* any system out there that does not support THIS!? */
+ system("gnunetd"); /* we may not have nice,
+ so let's be minimalistic here. */
+ return OK;
+#endif
+}
+
+/**
+ * Launch gnunetd w/ checks
+ */
+void on_startDaemon_clicked(GtkWidget * widget,
+ gpointer data) {
+ if (OK == checkDaemonRunning() ) {
+ cronCheckDaemon(NULL);
+ return;
+ } else {
+ addLogEntry(_("Launching gnunetd..."));
+ doLaunch();
+ }
+}
+
+/**
+ * Kill gnunetd
+ */
+void on_stopDaemon_clicked(GtkWidget * widget,
+ gpointer data) {
+ if (OK == checkDaemonRunning() ) {
+ GNUNET_TCP_SOCKET * sock;
+ CS_HEADER csHdr;
+ int ret;
+
+ sock = getClientSocket();
+ if (sock == NULL) {
+ cronCheckDaemon(NULL);
+ /* well, probably already dead */
+ return;
+ }
+ csHdr.size
+ = htons(sizeof(CS_HEADER));
+ csHdr.type
+ = htons(CS_PROTO_SHUTDOWN_REQUEST);
+ if (SYSERR == writeToSocket(sock,
+ &csHdr)) {
+ guiMessage(_("Error sending shutdown request to gnunetd."));
+ releaseClientSocket(sock);
+ cronCheckDaemon(NULL);
+ return;
+ }
+ if (SYSERR == readTCPResult(sock,
+ &ret)) {
+ guiMessage(_("Error reading shutdown confirmation from gnunetd."));
+ releaseClientSocket(sock);
+ cronCheckDaemon(NULL);
+ return;
+ }
+ if (ret == OK) {
+ static GtkWidget * killEntry;
+ killEntry
+ = glade_xml_get_widget(mainXML,
+ "stopDaemon");
+ gtk_widget_set_sensitive(killEntry, FALSE);
+ addLogEntry(_("Terminating gnunetd..."));
+ } else {
+ guiMessage(_("gnunetd refused to shut down (error code '%d')."),
+ ret);
+ }
+ releaseClientSocket(sock);
+ }
+ cronCheckDaemon(NULL);
+}
+
+static gint doUpdateMenus(SaveCall * call) {
+ static GtkWidget * killEntry = NULL;
+ static GtkWidget * launchEntry = NULL;
+ static GtkWidget * statsEntryYes = NULL;
+ static GtkWidget * statsEntryNo = NULL;
+ static int once = 1;
+ static int isLocal;
+ char * host;
+ int ret;
+
+ ret = * (int*) call->args;
+ if (once) {
+ once = 0;
+ killEntry
+ = glade_xml_get_widget(mainXML,
+ "stopDaemon");
+ launchEntry
+ = glade_xml_get_widget(mainXML,
+ "startDaemon");
+ statsEntryYes
+ = glade_xml_get_widget(mainXML,
+ "statusPixmapYes");
+ statsEntryNo
+ = glade_xml_get_widget(mainXML,
+ "statusPixmapNo");
+ host = getConfigurationString("NETWORK",
+ "HOST");
+ if ( (host == NULL) ||
+ (strcmp(host, "localhost")==0) )
+ isLocal = TRUE;
+ else
+ isLocal = FALSE;
+ FREENONNULL(host);
+ }
+ if (ret == SYSERR) {
+ gtk_widget_hide(statsEntryYes);
+ gtk_widget_show_all(statsEntryNo);
+ gtk_widget_set_sensitive(killEntry, FALSE);
+ gtk_widget_set_sensitive(launchEntry, (TRUE & isLocal) );
+ } else {
+ gtk_widget_hide(statsEntryNo);
+ gtk_widget_show_all(statsEntryYes);
+ gtk_widget_set_sensitive(killEntry, TRUE);
+ gtk_widget_set_sensitive(launchEntry, FALSE);
+ }
+ gtkSaveCallDone(call->sem);
+ return FALSE;
+}
+
+void cronCheckDaemon(void * dummy) {
+ static int last = 42;
+ int ret;
+
+ ret = checkDaemonRunning();
+ if (ret != last) {
+ last = ret;
+ gtkSaveCall((GtkFunction) doUpdateMenus, &ret);
+ }
+}
+
+/* end of daemon.c */
Added: gnunet-gtk/src/daemon.h
===================================================================
--- gnunet-gtk/src/daemon.h 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/daemon.h 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,33 @@
+/*
+ This file is part of GNUnet.
+ (C) 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/daemon.h
+ * @brief code for gnunet-gtk gnunetd interaction
+ * @author Christian Grothoff
+ */
+
+
+#ifndef GTK_DAEMON_H
+#define GTK_DAEMON_H
+
+void cronCheckDaemon(void * dummy);
+
+#endif
Added: gnunet-gtk/src/fs.c
===================================================================
--- gnunet-gtk/src/fs.c 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/fs.c 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,54 @@
+/*
+ This file is part of GNUnet.
+ (C) 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/fs.c
+ * @brief main file-sharing code of gnunet-gtk
+ * @author Christian Grothoff
+ */
+
+#include "fs.h"
+
+
+struct FSUI_Context * ctx;
+
+/**
+ * FSUI event handler.
+ */
+static void eventProcessor(void * cls,
+ const FSUI_Event * event) {
+ printf("FSUI event received!\n");
+}
+
+void gtk_fs_init() {
+ /* FSUI initialization here! */
+ ctx = FSUI_start("gnunet-gtk",
+ YES,
+ &eventProcessor,
+ NULL);
+ fs_search_start();
+}
+
+void gtk_fs_done() {
+ fs_search_stop();
+ FSUI_stop(ctx);
+}
+
+/* end of fs.c */
Added: gnunet-gtk/src/fs.h
===================================================================
--- gnunet-gtk/src/fs.h 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/fs.h 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,39 @@
+/*
+ This file is part of GNUnet.
+ (C) 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/fs.h
+ * @brief file-sharing globals of gnunet-gtk
+ * @author Christian Grothoff
+ */
+
+#ifndef GTK_FS_H
+#define GTK_FS_H
+
+#include <GNUnet/gnunet_ecrs_lib.h>
+#include <GNUnet/gnunet_fsui_lib.h>
+
+extern struct FSUI_Context * ctx;
+
+void gtk_fs_init(void);
+
+void gtk_fs_done(void);
+
+#endif
Added: gnunet-gtk/src/gtk26about.c
===================================================================
--- gnunet-gtk/src/gtk26about.c 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/gtk26about.c 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,1846 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2001 CodeFactory AB
+ * Copyright (C) 2001, 2002 Anders Carlsson
+ * Copyright (C) 2003, 2004 Matthias Clasen <address@hidden>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Author: Anders Carlsson <address@hidden>
+ *
+ * Modified by the GTK+ Team and others 1997-2004. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#include "platform.h"
+#include "gtk26about.h"
+#include <string.h>
+#include <gdk/gdkkeysyms.h>
+#include <gtk/gtk.h>
+#include <gtk/gtktext.h>
+
+typedef struct _GtkAboutDialogPrivate GtkAboutDialogPrivate;
+struct _GtkAboutDialogPrivate
+{
+ gchar *name;
+ gchar *version;
+ gchar *copyright;
+ gchar *comments;
+ gchar *website;
+ gchar *website_label;
+ gchar *translator_credits;
+ gchar *license;
+
+ gchar **authors;
+ gchar **documenters;
+ gchar **artists;
+
+ GtkWidget *logo_image;
+ GtkWidget *name_label;
+ GtkWidget *comments_label;
+ GtkWidget *copyright_label;
+ GtkWidget *website_button;
+
+ GtkWidget *credits_button;
+ GtkWidget *credits_dialog;
+ GtkWidget *license_button;
+ GtkWidget *license_dialog;
+
+ GdkCursor *hand_cursor;
+ GdkCursor *regular_cursor;
+ gboolean hovering_over_link;
+};
+
+#define GTK_ABOUT_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj),
GTK_TYPE_ABOUT_DIALOG, GtkAboutDialogPrivate))
+
+
+enum
+{
+ PROP_0,
+ PROP_NAME,
+ PROP_VERSION,
+ PROP_COPYRIGHT,
+ PROP_COMMENTS,
+ PROP_WEBSITE,
+ PROP_WEBSITE_LABEL,
+ PROP_LICENSE,
+ PROP_AUTHORS,
+ PROP_DOCUMENTERS,
+ PROP_TRANSLATOR_CREDITS,
+ PROP_ARTISTS,
+ PROP_LOGO
+};
+
+static void gtk_about_dialog_finalize (GObject
*object);
+static void gtk_about_dialog_get_property (GObject
*object,
+ guint
prop_id,
+ GValue
*value,
+ GParamSpec
*pspec);
+static void gtk_about_dialog_set_property (GObject
*object,
+ guint
prop_id,
+ const GValue
*value,
+ GParamSpec
*pspec);
+static void update_name_version (GtkAboutDialog
*about);
+static GtkIconSet * icon_set_new_from_pixbufs (GList
*pixbufs);
+static void activate_url (GtkWidget
*widget,
+ gpointer
data);
+static void set_link_button_text (GtkWidget
*about,
+ GtkWidget
*button,
+ gchar
*text);
+static GtkWidget * create_link_button (GtkWidget
*about,
+ gchar
*text,
+ gchar
*url,
+ GCallback
callback,
+ gpointer
data);
+static void follow_if_link (GtkAboutDialog
*about,
+ GtkTextIter
*iter);
+static void set_cursor_if_appropriate (GtkAboutDialog
*about,
+ GtkTextView
*text_view,
+ gint
x,
+ gint
y);
+static void add_credits_page (GtkAboutDialog
*about,
+ GtkWidget
*notebook,
+ gchar
*title,
+ gchar
**people);
+static gboolean credits_key_press_event (GtkWidget
*text_view,
+ GdkEventKey
*event,
+ GtkAboutDialog
*about);
+static gboolean credits_event_after (GtkWidget
*text_view,
+ GdkEvent
*event,
+ GtkAboutDialog
*about);
+static gboolean credits_motion_notify_event (GtkWidget
*text_view,
+ GdkEventMotion
*event,
+ GtkAboutDialog
*about);
+static gboolean credits_visibility_notify_event (GtkWidget
*text_view,
+ GdkEventVisibility
*event,
+ GtkAboutDialog
*about);
+static void display_credits_dialog (GtkWidget
*button,
+ gpointer
data);
+static void display_license_dialog (GtkWidget
*button,
+ gpointer
data);
+
+
+static GtkAboutDialogActivateLinkFunc activate_email_hook = NULL;
+static GtkAboutDialogActivateLinkFunc activate_url_hook = NULL;
+
+G_DEFINE_TYPE (GtkAboutDialog, gtk_about_dialog, GTK_TYPE_DIALOG);
+
+static void
+gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
+{
+ GObjectClass *object_class;
+ GtkWidgetClass *widget_class;
+ GtkDialogClass *dialog_class;
+
+ object_class = (GObjectClass *)klass;
+ widget_class = (GtkWidgetClass *)klass;
+ dialog_class = (GtkDialogClass *)klass;
+
+ object_class->set_property = gtk_about_dialog_set_property;
+ object_class->get_property = gtk_about_dialog_get_property;
+
+ object_class->finalize = gtk_about_dialog_finalize;
+
+ g_object_class_install_property (object_class,
+ PROP_NAME,
+ g_param_spec_string ("name",
+ gettext_noop("Program
name"),
+ gettext_noop("The name
of the program. If this is not set, it defaults to g_get_application_name()"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_VERSION,
+ g_param_spec_string ("version",
+ gettext_noop("Program
version"),
+ gettext_noop("The
version of the program"),
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_COPYRIGHT,
+ g_param_spec_string ("copyright",
+ gettext_noop("Copyright
string"),
+ gettext_noop("Copyright
information for the program"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_COMMENTS,
+ g_param_spec_string ("comments",
+ gettext_noop("Comments
string"),
+ gettext_noop("Comments
about the program"),
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_LICENSE,
+ g_param_spec_string ("license",
+ gettext_noop("License"),
+ gettext_noop("The
license of the program"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_WEBSITE,
+ g_param_spec_string ("website",
+ gettext_noop("Website
URL"),
+ gettext_noop("The URL
for the link to the website of the program"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_WEBSITE_LABEL,
+ g_param_spec_string ("website_label",
+ gettext_noop("Website
label"),
+ gettext_noop("The label
for the link to the website of the program. If this is not set, it defaults to
the URL"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_AUTHORS,
+ g_param_spec_boxed ("authors",
+ gettext_noop("Authors"),
+ gettext_noop("List of
authors of the programs"),
+ G_TYPE_STRV,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_DOCUMENTERS,
+ g_param_spec_boxed ("documenters",
+
gettext_noop("Documenters"),
+ gettext_noop("List of
people documenting the program"),
+ G_TYPE_STRV,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_ARTISTS,
+ g_param_spec_boxed ("artists",
+ gettext_noop("Artists"),
+ gettext_noop("List of
people who have contributed artwork to the program"),
+ G_TYPE_STRV,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_TRANSLATOR_CREDITS,
+ g_param_spec_string ("translator_credits",
+
gettext_noop("Translator credits"),
+ gettext_noop("Credits
to the translators. This string should be marked as translatable"),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_LOGO,
+ g_param_spec_object ("logo",
+ gettext_noop("Logo"),
+ gettext_noop("A logo
for the about box. If this is not set, it defaults to
gtk_window_get_default_icon_list()"),
+ GDK_TYPE_PIXBUF,
+ G_PARAM_READWRITE));
+
+ /* Style properties */
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("link_color",
+
gettext_noop("Link Color"),
+
gettext_noop("Color of hyperlinks"),
+ GDK_TYPE_COLOR,
+
G_PARAM_READABLE));
+
+ g_type_class_add_private (object_class, sizeof (GtkAboutDialogPrivate));
+}
+
+static void
+gtk_about_dialog_init (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+ GtkWidget *vbox, *hbox, *button;
+
+ /* Data */
+ priv = GTK_ABOUT_DIALOG_GET_PRIVATE (about);
+ about->private_data = priv;
+
+ priv->name = NULL;
+ priv->version = NULL;
+ priv->copyright = NULL;
+ priv->comments = NULL;
+ priv->website = NULL;
+ priv->website_label = NULL;
+ priv->translator_credits = NULL;
+ priv->authors = NULL;
+ priv->documenters = NULL;
+ priv->artists = NULL;
+
+ priv->hand_cursor = gdk_cursor_new (GDK_HAND2);
+ priv->regular_cursor = gdk_cursor_new (GDK_XTERM);
+ priv->hovering_over_link = FALSE;
+
+ /* Widgets */
+ gtk_widget_push_composite_child ();
+ vbox = gtk_vbox_new (FALSE, 8);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 8);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (about)->vbox), vbox, TRUE, TRUE, 0);
+
+ priv->logo_image = gtk_image_new ();
+ gtk_box_pack_start (GTK_BOX (vbox), priv->logo_image, FALSE, FALSE, 0);
+
+ priv->name_label = gtk_label_new (NULL);
+ gtk_label_set_selectable (GTK_LABEL (priv->name_label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (priv->name_label), GTK_JUSTIFY_CENTER);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->name_label, FALSE, FALSE, 0);
+
+ priv->comments_label = gtk_label_new (NULL);
+ gtk_label_set_selectable (GTK_LABEL (priv->comments_label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (priv->comments_label), GTK_JUSTIFY_CENTER);
+ gtk_label_set_line_wrap (GTK_LABEL (priv->comments_label), TRUE);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->comments_label, FALSE, FALSE, 0);
+
+ priv->copyright_label = gtk_label_new (NULL);
+ gtk_label_set_selectable (GTK_LABEL (priv->copyright_label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (priv->copyright_label),
GTK_JUSTIFY_CENTER);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->copyright_label, FALSE, FALSE, 0);
+
+ button = create_link_button (GTK_WIDGET (about), "", "",
+ G_CALLBACK (activate_url), about);
+
+ hbox = gtk_hbox_new (TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, FALSE, 0);
+ priv->website_button = button;
+
+ gtk_widget_show (vbox);
+ gtk_widget_show (priv->logo_image);
+ gtk_widget_show (priv->name_label);
+ gtk_widget_show (hbox);
+
+ /* Add the OK button */
+ gtk_dialog_add_button (GTK_DIALOG (about), GTK_STOCK_OK, GTK_RESPONSE_OK);
+ gtk_dialog_set_default_response (GTK_DIALOG (about), GTK_RESPONSE_OK);
+
+ /* Add the credits button */
+ button = gtk_button_new_from_stock (gettext_noop("_Credits"));
+ gtk_box_pack_end (GTK_BOX (GTK_DIALOG (about)->action_area),
+ button, FALSE, TRUE, 0);
+ gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG
(about)->action_area), button, TRUE);
+ g_signal_connect (button, "clicked", G_CALLBACK (display_credits_dialog),
about);
+ priv->credits_button = button;
+ priv->credits_dialog = NULL;
+
+ /* Add the license button */
+ button = gtk_button_new_from_stock (gettext_noop("_License"));
+ gtk_box_pack_end (GTK_BOX (GTK_DIALOG (about)->action_area),
+ button, FALSE, TRUE, 0);
+ gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (GTK_DIALOG
(about)->action_area), button, TRUE);
+ g_signal_connect (button, "clicked", G_CALLBACK (display_license_dialog),
about);
+ priv->license_button = button;
+ priv->license_dialog = NULL;
+
+ gtk_window_set_resizable (GTK_WINDOW (about), FALSE);
+
+ gtk_widget_pop_composite_child ();
+}
+
+static void
+gtk_about_dialog_finalize (GObject *object)
+{
+ GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
+ GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ g_free (priv->name);
+ g_free (priv->version);
+ g_free (priv->copyright);
+ g_free (priv->comments);
+ g_free (priv->license);
+ g_free (priv->website);
+ g_free (priv->website_label);
+ g_free (priv->translator_credits);
+
+ g_strfreev (priv->authors);
+ g_strfreev (priv->documenters);
+ g_strfreev (priv->artists);
+
+ g_free (priv);
+ about->private_data = NULL;
+
+ G_OBJECT_CLASS (gtk_about_dialog_parent_class)->finalize (object);
+}
+
+static void
+gtk_about_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_NAME:
+ gtk_about_dialog_set_name (about, g_value_get_string (value));
+ break;
+ case PROP_VERSION:
+ gtk_about_dialog_set_version (about, g_value_get_string (value));
+ break;
+ case PROP_COMMENTS:
+ gtk_about_dialog_set_comments (about, g_value_get_string (value));
+ break;
+ case PROP_WEBSITE:
+ gtk_about_dialog_set_website (about, g_value_get_string (value));
+ break;
+ case PROP_WEBSITE_LABEL:
+ gtk_about_dialog_set_website_label (about, g_value_get_string (value));
+ break;
+ case PROP_LICENSE:
+ gtk_about_dialog_set_license (about, g_value_get_string (value));
+ break;
+ case PROP_COPYRIGHT:
+ gtk_about_dialog_set_copyright (about, g_value_get_string (value));
+ break;
+ case PROP_LOGO:
+ gtk_about_dialog_set_logo (about, g_value_get_object (value));
+ break;
+ case PROP_AUTHORS:
+ gtk_about_dialog_set_authors (about, (gchar**)g_value_get_boxed (value));
+ break;
+ case PROP_DOCUMENTERS:
+ gtk_about_dialog_set_documenters (about, (gchar**)g_value_get_boxed
(value));
+ break;
+ case PROP_ARTISTS:
+ gtk_about_dialog_set_artists (about, (gchar**)g_value_get_boxed (value));
+ break;
+ case PROP_TRANSLATOR_CREDITS:
+ gtk_about_dialog_set_translator_credits (about, g_value_get_string
(value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_about_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
+ GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ switch (prop_id)
+ {
+ case PROP_NAME:
+ g_value_set_string (value, priv->name);
+ break;
+ case PROP_VERSION:
+ g_value_set_string (value, priv->version);
+ break;
+ case PROP_COPYRIGHT:
+ g_value_set_string (value, priv->copyright);
+ break;
+ case PROP_COMMENTS:
+ g_value_set_string (value, priv->comments);
+ break;
+ case PROP_WEBSITE:
+ g_value_set_string (value, priv->website);
+ break;
+ case PROP_WEBSITE_LABEL:
+ g_value_set_string (value, priv->website_label);
+ break;
+ case PROP_LICENSE:
+ g_value_set_string (value, priv->license);
+ break;
+ case PROP_TRANSLATOR_CREDITS:
+ g_value_set_string (value, priv->translator_credits);
+ break;
+ case PROP_AUTHORS:
+ g_value_set_boxed (value, priv->authors);
+ break;
+ case PROP_DOCUMENTERS:
+ g_value_set_boxed (value, priv->documenters);
+ break;
+ case PROP_ARTISTS:
+ g_value_set_boxed (value, priv->artists);
+ break;
+ case PROP_LOGO:
+ g_value_set_object (value, gtk_image_get_pixbuf (GTK_IMAGE
(priv->logo_image)));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+/**
+ * gtk_about_dialog_get_name:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the program name displayed in the about dialog.
+ *
+ * Return value: The program name. The string is owned by the about
+ * dialog and must not be modified.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar *
+gtk_about_dialog_get_name (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->name;
+}
+
+static void
+update_name_version (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *title_string, *name_string;
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ title_string = g_strdup_printf (gettext_noop("About %s"), priv->name);
+ gtk_window_set_title (GTK_WINDOW (about), title_string);
+ g_free (title_string);
+
+ if (priv->version != NULL)
+ name_string = g_markup_printf_escaped ("<span size=\"xx-large\"
weight=\"bold\">%s %s</span>",
+ priv->name, priv->version);
+ else
+ name_string = g_markup_printf_escaped ("<span size=\"xx-large\"
weight=\"bold\">%s</span>",
+ priv->name);
+
+ gtk_label_set_markup (GTK_LABEL (priv->name_label), name_string);
+
+ g_free (name_string);
+}
+
+/**
+ * gtk_about_dialog_set_name:
+ * @about: a #GtkAboutDialog
+ * @name: the program name
+ *
+ * Sets the name to display in the about dialog.
+ * If this is not set, it defaults to g_get_application_name().
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_name (GtkAboutDialog *about,
+ const gchar *name)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+ tmp = priv->name;
+ priv->name = g_strdup (name ? name : g_get_application_name ());
+ g_free (tmp);
+
+ update_name_version (about);
+
+ g_object_notify (G_OBJECT (about), "name");
+}
+
+/**
+ * gtk_about_dialog_get_version:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the version string.
+ *
+ * Return value: The version string. The string is owned by the about
+ * dialog and must not be modified.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar *
+gtk_about_dialog_get_version (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->version;
+}
+
+/**
+ * gtk_about_dialog_set_version:
+ * @about: a #GtkAboutDialog
+ * @version: the version string
+ *
+ * Sets the version string to display in the about dialog.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_version (GtkAboutDialog *about,
+ const gchar *version)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->version;
+ priv->version = version ? g_strdup (version) : NULL;
+ g_free (tmp);
+
+ update_name_version (about);
+
+ g_object_notify (G_OBJECT (about), "version");
+}
+
+/**
+ * gtk_about_dialog_get_copyright:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the copyright string.
+ *
+ * Return value: The copyright string. The string is owned by the about
+ * dialog and must not be modified.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar *
+gtk_about_dialog_get_copyright (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->copyright;
+}
+
+/**
+ * gtk_about_dialog_set_copyright:
+ * @about: a #GtkAboutDialog
+ * @copyright: the copyright string
+ *
+ * Sets the copyright string to display in the about dialog.
+ * This should be a short string of one or two lines.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_copyright (GtkAboutDialog *about,
+ const gchar *copyright)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *copyright_string, *tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->copyright;
+ priv->copyright = copyright ? g_strdup (copyright) : NULL;
+ g_free (tmp);
+
+ if (priv->copyright != NULL)
+ {
+ copyright_string = g_markup_printf_escaped ("<span
size=\"small\">%s</span>",
+ priv->copyright);
+ gtk_label_set_markup (GTK_LABEL (priv->copyright_label),
copyright_string);
+ g_free (copyright_string);
+
+ gtk_widget_show (priv->copyright_label);
+ }
+ else
+ gtk_widget_hide (priv->copyright_label);
+
+ g_object_notify (G_OBJECT (about), "copyright");
+}
+
+/**
+ * gtk_about_dialog_get_comments:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the comments string.
+ *
+ * Return value: The comments. The string is owned by the about
+ * dialog and must not be modified.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar *
+gtk_about_dialog_get_comments (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->comments;
+}
+
+/**
+ * gtk_about_dialog_set_comments:
+ * @about: a #GtkAboutDialog
+ * @comments: a comments string
+ *
+ * Sets the comments string to display in the about
+ * dialog. This should be a short string of one or
+ * two lines.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_comments (GtkAboutDialog *about,
+ const gchar *comments)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->comments;
+ if (comments)
+ {
+ priv->comments = g_strdup (comments);
+ gtk_label_set_text (GTK_LABEL (priv->comments_label), priv->comments);
+ gtk_widget_show (priv->comments_label);
+ }
+ else
+ {
+ priv->comments = NULL;
+ gtk_widget_hide (priv->comments_label);
+ }
+ g_free (tmp);
+
+ g_object_notify (G_OBJECT (about), "comments");
+}
+
+/**
+ * gtk_about_dialog_get_license:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the license information.
+ *
+ * Return value: The license information. The string is owned by the about
+ * dialog and must not be modified.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar *
+gtk_about_dialog_get_license (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->license;
+}
+
+/**
+ * gtk_about_dialog_set_license:
+ * @about: a #GtkAboutDialog
+ * @license: the license information or %NULL
+ *
+ * Sets the license information to be displayed in the secondary
+ * license dialog. If @license is %NULL, the license button is
+ * hidden.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_license (GtkAboutDialog *about,
+ const gchar *license)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->license;
+ if (license)
+ {
+ priv->license = g_strdup (license);
+ gtk_widget_show (priv->license_button);
+ }
+ else
+ {
+ priv->license = NULL;
+ gtk_widget_hide (priv->license_button);
+ }
+ g_free (tmp);
+
+ g_object_notify (G_OBJECT (about), "license");
+}
+
+/**
+ * gtk_about_dialog_get_website:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the website URL.
+ *
+ * Return value: The website URL. The string is owned by the about
+ * dialog and must not be modified.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar *
+gtk_about_dialog_get_website (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->website;
+}
+
+/**
+ * gtk_about_dialog_set_website:
+ * @about: a #GtkAboutDialog
+ * @website: a URL string starting with "http://"
+ *
+ * Sets the URL to use for the website link.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_website (GtkAboutDialog *about,
+ const gchar *website)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->website;
+ if (website != NULL)
+ {
+ priv->website = g_strdup (website);
+ if (activate_url_hook != NULL)
+ {
+ g_object_set_data_full (G_OBJECT (priv->website_button),
+ "url", g_strdup (website), g_free);
+ if (priv->website_label == NULL)
+ gtk_about_dialog_set_website_label (about, website);
+ }
+ else
+ {
+ GtkWidget *hbox = priv->website_button->parent;
+ gtk_widget_destroy (priv->website_button);
+ priv->website_button = gtk_label_new (website);
+ gtk_label_set_selectable (GTK_LABEL (priv->website_button), TRUE);
+ gtk_container_add (GTK_CONTAINER (hbox), priv->website_button);
+ gtk_widget_show (priv->website_button);
+ }
+ }
+ else
+ {
+ priv->website = NULL;
+ g_object_set_data (G_OBJECT (priv->website_button), "url", NULL);
+ }
+ g_free (tmp);
+
+ g_object_notify (G_OBJECT (about), "website");
+}
+
+/**
+ * gtk_about_dialog_get_website_label:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the label used for the website link.
+ *
+ * Return value: The label used for the website link. The string is owned by
the about
+ * dialog and must not be modified.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar *
+gtk_about_dialog_get_website_label (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->website_label;
+}
+
+/**
+ * gtk_about_dialog_set_website_label:
+ * @about: a #GtkAboutDialog
+ * @website_label: the label used for the website link
+ *
+ * Sets the label to be used for the website link.
+ * It defaults to the website URL.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_website_label (GtkAboutDialog *about,
+ const gchar *website_label)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->website_label;
+ if (activate_url_hook != NULL)
+ {
+ if (website_label != NULL)
+ {
+ priv->website_label = g_strdup (website_label);
+ set_link_button_text (GTK_WIDGET (about),
+ priv->website_button,
+ priv->website_label);
+ gtk_widget_show (priv->website_button);
+ }
+ else
+ {
+ priv->website_label = NULL;
+ gtk_widget_hide (priv->website_button);
+ }
+ }
+ g_free (tmp);
+
+ g_object_notify (G_OBJECT (about), "website_label");
+}
+
+/**
+ * gtk_about_dialog_get_authors:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the string which are displayed in the authors tab
+ * of the secondary credits dialog.
+ *
+ * Return value: A %NULL-terminated string array containing
+ * the authors. The array is owned by the about dialog
+ * and must not be modified.
+ *
+ * Since: 2.6
+ **/
+gchar **
+gtk_about_dialog_get_authors (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->authors;
+}
+
+/**
+ * gtk_about_dialog_set_authors:
+ * @about: a #GtkAboutDialog
+ * @authors: a %NULL-terminated array of strings
+ *
+ * Sets the strings which are displayed in the authors tab
+ * of the secondary credits dialog.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_authors (GtkAboutDialog *about,
+ gchar **authors)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar **tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->authors;
+ priv->authors = g_strdupv (authors);
+ g_strfreev (tmp);
+
+ if (priv->authors != NULL)
+ gtk_widget_show (priv->credits_button);
+
+ g_object_notify (G_OBJECT (about), "authors");
+}
+
+/**
+ * gtk_about_dialog_get_documenters:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the string which are displayed in the documenters
+ * tab of the secondary credits dialog.
+ *
+ * Return value: A %NULL-terminated string array containing
+ * the documenters. The array is owned by the about dialog
+ * and must not be modified.
+ *
+ * Since: 2.6
+ **/
+gchar **
+gtk_about_dialog_get_documenters (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->documenters;
+}
+
+/**
+ * gtk_about_dialog_set_documenters:
+ * @about: a #GtkAboutDialog
+ * @authors: a %NULL-terminated array of strings
+ *
+ * Sets the strings which are displayed in the documenters tab
+ * of the secondary credits dialog.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_documenters (GtkAboutDialog *about,
+ gchar **documenters)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar **tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->documenters;
+ priv->documenters = g_strdupv (documenters);
+ g_strfreev (tmp);
+
+ if (priv->documenters != NULL)
+ gtk_widget_show (priv->credits_button);
+
+ g_object_notify (G_OBJECT (about), "documenters");
+}
+
+/**
+ * gtk_about_dialog_get_artists:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the string which are displayed in the artists tab
+ * of the secondary credits dialog.
+ *
+ * Return value: A %NULL-terminated string array containing
+ * the artists. The array is owned by the about dialog
+ * and must not be modified.
+ *
+ * Since: 2.6
+ **/
+gchar **
+gtk_about_dialog_get_artists (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->artists;
+}
+
+/**
+ * gtk_about_dialog_set_artists:
+ * @about: a #GtkAboutDialog
+ * @authors: a %NULL-terminated array of strings
+ *
+ * Sets the strings which are displayed in the artists tab
+ * of the secondary credits dialog.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_artists (GtkAboutDialog *about,
+ gchar **artists)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar **tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->artists;
+ priv->artists = g_strdupv (artists);
+ g_strfreev (tmp);
+
+ if (priv->artists != NULL)
+ gtk_widget_show (priv->credits_button);
+
+ g_object_notify (G_OBJECT (about), "artists");
+}
+
+/**
+ * gtk_about_dialog_get_translator_credits:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the translator credits string which is displayed
+ * in the translators tab of the secondary credits dialog.
+ *
+ * Return value: The translator credits string. The string is
+ * owned by the about dialog and must not be modified.
+ *
+ * Since: 2.6
+ **/
+G_CONST_RETURN gchar *
+gtk_about_dialog_get_translator_credits (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return priv->translator_credits;
+}
+
+/**
+ * gtk_about_dialog_set_translator_credits:
+ * @about: a #GtkAboutDialog
+ * @translator_credits: the translator credits
+ *
+ * Sets the translator credits string which is displayed in
+ * the translators tab of the secondary credits dialog.
+ *
+ * The intended use for this string is to display the translator
+ * of the language which is currently used in the user interface.
+ * Using gettext(), a simple way to achieve that is to mark the
+ * string for translation:
+ * <informalexample><programlisting>
+ * gtk_about_dialog_set_translator_credits (about, _("translator-credits"));
+ * </programlisting></informalexample>
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_translator_credits (GtkAboutDialog *about,
+ const gchar *translator_credits)
+{
+ GtkAboutDialogPrivate *priv;
+ gchar *tmp;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ tmp = priv->translator_credits;
+ priv->translator_credits = g_strdup (translator_credits);
+ g_free (tmp);
+
+ if (priv->translator_credits != NULL)
+ gtk_widget_show (priv->credits_button);
+
+ g_object_notify (G_OBJECT (about), "translator-credits");
+}
+
+/**
+ * gtk_about_dialog_get_logo:
+ * @about: a #GtkAboutDialog
+ *
+ * Returns the pixbuf displayed as logo in the about dialog.
+ *
+ * Return value: the pixbuf displayed as logo. The pixbuf is
+ * owned by the about dialog. If you want to keep a reference
+ * to it, you have to call g_object_ref() on it.
+ *
+ * Since: 2.6
+ **/
+GdkPixbuf *
+gtk_about_dialog_get_logo (GtkAboutDialog *about)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ return gtk_image_get_pixbuf (GTK_IMAGE (priv->logo_image));
+}
+
+static GtkIconSet *
+icon_set_new_from_pixbufs (GList *pixbufs)
+{
+ GtkIconSet *icon_set = gtk_icon_set_new ();
+
+ for (; pixbufs; pixbufs = pixbufs->next)
+ {
+ GdkPixbuf *pixbuf = GDK_PIXBUF (pixbufs->data);
+
+ GtkIconSource *icon_source = gtk_icon_source_new ();
+ gtk_icon_source_set_pixbuf (icon_source, pixbuf);
+ gtk_icon_set_add_source (icon_set, icon_source);
+ }
+
+ return icon_set;
+}
+
+/**
+ * gtk_about_dialog_set_logo:
+ * @about: a #GtkAboutDialog
+ * @pixbuf: a #GdkPixbuf, or %NULL
+ *
+ * Sets the pixbuf to be displayed as logo in
+ * the about dialog. If it is %NULL, the default
+ * window icon set with gtk_window_set_default_icon ()
+ * will be used.
+ *
+ * Since: 2.6
+ **/
+void
+gtk_about_dialog_set_logo (GtkAboutDialog *about,
+ GdkPixbuf *pixbuf)
+{
+ GtkAboutDialogPrivate *priv;
+
+ g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
+
+ priv = (GtkAboutDialogPrivate *)about->private_data;
+
+ if (pixbuf != NULL)
+ gtk_image_set_from_pixbuf (GTK_IMAGE (priv->logo_image), pixbuf);
+ else
+ {
+ GList *pixbufs = gtk_window_get_default_icon_list ();
+
+ if (pixbufs != NULL)
+ {
+ GtkIconSet *icon_set = icon_set_new_from_pixbufs (pixbufs);
+
+ gtk_image_set_from_icon_set (GTK_IMAGE (priv->logo_image),
+ icon_set, GTK_ICON_SIZE_DIALOG);
+
+ gtk_icon_set_unref (icon_set);
+ g_list_free (pixbufs);
+ }
+ }
+
+ g_object_notify (G_OBJECT (about), "logo");
+}
+
+static void
+activate_url (GtkWidget *widget,
+ gpointer data)
+{
+ GtkAboutDialog *about = GTK_ABOUT_DIALOG (data);
+ gchar *url = g_object_get_data (G_OBJECT (widget), "url");
+
+ if (activate_url_hook != NULL)
+ (* activate_url_hook) (about, url);
+}
+
+static void
+set_link_button_text (GtkWidget *about,
+ GtkWidget *button,
+ gchar *text)
+{
+ GtkWidget *label;
+ gchar *link;
+ GdkColor *style_link_color;
+ GdkColor link_color = { 0, 0, 0, 0xffff };
+
+ gtk_widget_ensure_style (about);
+ gtk_widget_style_get (about, "link_color", &style_link_color, NULL);
+ if (style_link_color)
+ {
+ link_color = *style_link_color;
+ gdk_color_free (style_link_color);
+ }
+
+ link = g_markup_printf_escaped ("<span foreground=\"#%04x%04x%04x\"
underline=\"single\">%s</span>",
+ link_color.red, link_color.green,
link_color.blue, text);
+
+ label = gtk_bin_get_child (GTK_BIN (button));
+ gtk_label_set_markup (GTK_LABEL (label), link);
+ g_free (link);
+}
+
+static GtkWidget *
+create_link_button (GtkWidget *about,
+ gchar *text,
+ gchar *url,
+ GCallback callback,
+ gpointer data)
+{
+ GtkWidget *button;
+
+ button = gtk_button_new_with_label ("");
+ GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
+ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
+
+ g_object_set_data_full (G_OBJECT (button), "url", g_strdup (url), g_free);
+ set_link_button_text (about, button, text);
+
+ g_signal_connect (G_OBJECT (button), "clicked", callback, data);
+
+ return button;
+}
+
+static void
+follow_if_link (GtkAboutDialog *about,
+ GtkTextIter *iter)
+{
+ GSList *tags = NULL, *tagp = NULL;
+
+ tags = gtk_text_iter_get_tags (iter);
+ for (tagp = tags; tagp != NULL; tagp = tagp->next)
+ {
+ GtkTextTag *tag = tagp->data;
+ gchar *email = g_object_get_data (G_OBJECT (tag), "email");
+ gchar *url = g_object_get_data (G_OBJECT (tag), "url");
+
+ if (email != NULL && activate_email_hook != NULL)
+ {
+ (* activate_email_hook) (about, email);
+ break;
+ }
+
+ if (url != NULL && activate_url_hook != NULL)
+ {
+ (* activate_url_hook) (about, url);
+ break;
+ }
+ }
+
+ if (tags)
+ g_slist_free (tags);
+}
+
+static gboolean
+credits_key_press_event (GtkWidget *text_view,
+ GdkEventKey *event,
+ GtkAboutDialog *about)
+{
+ GtkTextIter iter;
+ GtkTextBuffer *buffer;
+
+ switch (event->keyval)
+ {
+ case GDK_Return:
+ case GDK_KP_Enter:
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
+ gtk_text_buffer_get_iter_at_mark (buffer, &iter,
+ gtk_text_buffer_get_insert (buffer));
+ follow_if_link (about, &iter);
+ break;
+
+ default:
+ break;
+ }
+
+ return FALSE;
+}
+
+static gboolean
+credits_event_after (GtkWidget *text_view,
+ GdkEvent *event,
+ GtkAboutDialog *about)
+{
+ GtkTextIter start, end, iter;
+ GtkTextBuffer *buffer;
+ GdkEventButton *button_event;
+ gint x, y;
+
+ if (event->type != GDK_BUTTON_RELEASE)
+ return FALSE;
+
+ button_event = (GdkEventButton *)event;
+
+ if (button_event->button != 1)
+ return FALSE;
+
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
+
+ /* we shouldn't follow a link if the user has selected something */
+ gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
+ if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
+ return FALSE;
+
+ gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
+ GTK_TEXT_WINDOW_WIDGET,
+ button_event->x, button_event->y, &x,
&y);
+
+ gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y);
+
+ follow_if_link (about, &iter);
+
+ return FALSE;
+}
+
+static void
+set_cursor_if_appropriate (GtkAboutDialog *about,
+ GtkTextView *text_view,
+ gint x,
+ gint y)
+{
+ GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
+ GSList *tags = NULL, *tagp = NULL;
+ GtkTextBuffer *buffer;
+ GtkTextIter iter;
+ gboolean hovering_over_link = FALSE;
+
+ buffer = gtk_text_view_get_buffer (text_view);
+
+ gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
+
+ tags = gtk_text_iter_get_tags (&iter);
+ for (tagp = tags; tagp != NULL; tagp = tagp->next)
+ {
+ GtkTextTag *tag = tagp->data;
+ gchar *email = g_object_get_data (G_OBJECT (tag), "email");
+ gchar *url = g_object_get_data (G_OBJECT (tag), "url");
+
+ if (email != NULL || url != NULL)
+ {
+ hovering_over_link = TRUE;
+ break;
+ }
+ }
+
+ if (hovering_over_link != priv->hovering_over_link)
+ {
+ priv->hovering_over_link = hovering_over_link;
+
+ if (hovering_over_link)
+ gdk_window_set_cursor (gtk_text_view_get_window (text_view,
GTK_TEXT_WINDOW_TEXT), priv->hand_cursor);
+ else
+ gdk_window_set_cursor (gtk_text_view_get_window (text_view,
GTK_TEXT_WINDOW_TEXT), priv->regular_cursor);
+ }
+
+ if (tags)
+ g_slist_free (tags);
+}
+
+static gboolean
+credits_motion_notify_event (GtkWidget *text_view,
+ GdkEventMotion *event,
+ GtkAboutDialog *about)
+{
+ gint x, y;
+
+ gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
+ GTK_TEXT_WINDOW_WIDGET,
+ event->x, event->y, &x, &y);
+
+ set_cursor_if_appropriate (about, GTK_TEXT_VIEW (text_view), x, y);
+
+ gdk_window_get_pointer (text_view->window, NULL, NULL, NULL);
+
+ return FALSE;
+}
+
+
+static gboolean
+credits_visibility_notify_event (GtkWidget *text_view,
+ GdkEventVisibility *event,
+ GtkAboutDialog *about)
+{
+ gint wx, wy, bx, by;
+
+ gdk_window_get_pointer (text_view->window, &wx, &wy, NULL);
+
+ gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
+ GTK_TEXT_WINDOW_WIDGET,
+ wx, wy, &bx, &by);
+
+ set_cursor_if_appropriate (about, GTK_TEXT_VIEW (text_view), bx, by);
+
+ return FALSE;
+}
+
+static void
+add_credits_page (GtkAboutDialog *about,
+ GtkWidget *notebook,
+ gchar *title,
+ gchar **people)
+{
+ gchar **p;
+ gchar *q0, *q1, *q2, *r1, *r2;
+ GtkWidget *sw, *view;
+ GtkTextBuffer *buffer;
+ GtkStyle *style;
+ gboolean linkify_email, linkify_urls;
+ GdkColor *style_link_color;
+ GdkColor link_color = { 0, 0, 0, 0xffff };
+
+ linkify_email = (activate_email_hook != NULL);
+ linkify_urls = (activate_url_hook != NULL);
+
+ gtk_widget_ensure_style (GTK_WIDGET (about));
+ gtk_widget_style_get (GTK_WIDGET (about), "link_color", &style_link_color,
NULL);
+ if (style_link_color)
+ {
+ link_color = *style_link_color;
+ gdk_color_free (style_link_color);
+ }
+
+ view = gtk_text_view_new ();
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+ gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
+ gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 8);
+ gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 8);
+
+ g_signal_connect (G_OBJECT (view), "key-press-event",
+ G_CALLBACK (credits_key_press_event), about);
+ g_signal_connect (G_OBJECT (view), "event-after",
+ G_CALLBACK (credits_event_after), about);
+ g_signal_connect (G_OBJECT (view), "motion-notify-event",
+ G_CALLBACK (credits_motion_notify_event), about);
+ g_signal_connect (G_OBJECT (view), "visibility-notify-event",
+ G_CALLBACK (credits_visibility_notify_event), about);
+
+ style = gtk_widget_get_style (view);
+ gtk_widget_modify_base (view, GTK_STATE_NORMAL,
+ &style->base[GTK_STATE_INSENSITIVE]);
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (sw), view);
+
+ gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
+ sw, gtk_label_new (title));
+
+ if (people == NULL)
+ {
+ gtk_widget_hide (view);
+ return;
+ }
+ else
+ gtk_widget_show (view);
+
+ for (p = people; *p; p++)
+ {
+ q0 = *p;
+ while (*q0)
+ {
+ q1 = linkify_email ? strchr (q0, '<') : NULL;
+ q2 = q1 ? strchr (q1, '>') : NULL;
+ r1 = linkify_urls ? strstr (q0, "http://") : NULL;
+ r2 = r1 ? (strpbrk (r1, " \n\t") ? : strchr (r1, '\0')) : NULL;
+
+ if (r1 && r2 && (!q1 || !q2 || (r1 < q1)))
+ {
+ q1 = r1;
+ q2 = r2;
+ }
+
+ if (q1 && q2)
+ {
+ GtkTextIter end;
+ gchar *link;
+ gchar *link_type;
+ GtkTextTag *tag;
+
+ gtk_text_buffer_insert_at_cursor (buffer, q0, q1 - q0);
+ gtk_text_buffer_get_end_iter (buffer, &end);
+
+ q0 = q2;
+
+ if (*q1 == '<')
+ {
+ q1++;
+ q0++;
+ link_type = "email";
+ }
+ else
+ link_type = "url";
+
+ link = g_strndup (q1, q2 - q1);
+ tag = gtk_text_buffer_create_tag (buffer, NULL,
+ "foreground_gdk", &link_color,
+ "underline",
PANGO_UNDERLINE_SINGLE,
+ NULL);
+ g_object_set_data_full (G_OBJECT (tag), link_type, g_strdup
(link), g_free);
+ gtk_text_buffer_insert_with_tags (buffer, &end, link, -1, tag,
NULL);
+
+ g_free (link);
+ }
+ else
+ {
+ gtk_text_buffer_insert_at_cursor (buffer, q0, -1);
+ break;
+ }
+ }
+
+ if (p[1])
+ gtk_text_buffer_insert_at_cursor (buffer, "\n", 1);
+ }
+}
+
+static void
+display_credits_dialog (GtkWidget *button,
+ gpointer data)
+{
+ GtkAboutDialog *about = (GtkAboutDialog *)data;
+ GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
+ GtkWidget *dialog, *notebook;
+
+ if (priv->credits_dialog != NULL)
+ {
+ gtk_window_present (GTK_WINDOW (priv->credits_dialog));
+ return;
+ }
+
+ dialog = gtk_dialog_new_with_buttons (gettext_noop("Credits"),
+ GTK_WINDOW (about),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+ priv->credits_dialog = dialog;
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 360, 260);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ gtk_window_set_modal (GTK_WINDOW (dialog),
+ gtk_window_get_modal (GTK_WINDOW (about)));
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), dialog);
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (gtk_widget_destroyed),
+ &(priv->credits_dialog));
+
+ notebook = gtk_notebook_new ();
+ gtk_container_set_border_width (GTK_CONTAINER (notebook), 8);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, TRUE,
TRUE, 0);
+
+ if (priv->authors != NULL)
+ add_credits_page (about, notebook, gettext_noop("Written by"),
priv->authors);
+
+ if (priv->documenters != NULL)
+ add_credits_page (about, notebook, gettext_noop("Documented by"),
priv->documenters);
+
+ if (priv->translator_credits != NULL)
+ {
+ gchar *translators[2];
+
+ translators[0] = priv->translator_credits;
+ translators[1] = NULL;
+
+ add_credits_page (about, notebook, gettext_noop("Translated by"),
translators);
+ }
+
+ if (priv->artists != NULL)
+ add_credits_page (about, notebook, gettext_noop("Artwork by"),
priv->artists);
+
+ gtk_widget_show_all (dialog);
+}
+
+static void
+display_license_dialog (GtkWidget *button,
+ gpointer data)
+{
+ GtkAboutDialog *about = (GtkAboutDialog *)data;
+ GtkAboutDialogPrivate *priv = (GtkAboutDialogPrivate *)about->private_data;
+ GtkWidget *dialog, *view, *sw;
+
+ if (priv->license_dialog != NULL)
+ {
+ gtk_window_present (GTK_WINDOW (priv->license_dialog));
+ return;
+ }
+
+ dialog = gtk_dialog_new_with_buttons (gettext_noop("License"),
+ GTK_WINDOW (about),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+ priv->license_dialog = dialog;
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 420, 320);
+ gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
+
+ gtk_window_set_modal (GTK_WINDOW (dialog),
+ gtk_window_get_modal (GTK_WINDOW (about)));
+
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (gtk_widget_destroy), dialog);
+ g_signal_connect (dialog, "destroy",
+ G_CALLBACK (gtk_widget_destroyed),
+ &(priv->license_dialog));
+
+ sw = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_container_set_border_width (GTK_CONTAINER (sw), 8);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), sw, TRUE, TRUE, 0);
+
+ view = gtk_text_view_new ();
+ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)),
+ priv->license, -1);
+
+ gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
+ gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
+ gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 8);
+ gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 8);
+
+ gtk_container_add (GTK_CONTAINER (sw), view);
+
+ gtk_widget_show_all (dialog);
+}
+
+/**
+ * gtk_about_dialog_new:
+ *
+ * Creates a new #GtkAboutDialog.
+ *
+ * Returns: a newly created #GtkAboutDialog
+ *
+ * Since: 2.6
+ */
+GtkWidget *
+gtk_about_dialog_new (void)
+{
+ GtkAboutDialog *dialog = GTK_ABOUT_DIALOG (g_object_new
(GTK_TYPE_ABOUT_DIALOG, NULL));
+
+ /* force defaults */
+ gtk_about_dialog_set_name (dialog, NULL);
+ gtk_about_dialog_set_logo (dialog, NULL);
+
+ /* Close dialog on user response */
+ g_signal_connect (G_OBJECT (dialog),
+ "response",
+ G_CALLBACK (gtk_widget_hide),
+ NULL);
+
+ return GTK_WIDGET (dialog);
+}
+
+/**
+ * gtk_about_dialog_set_email_hook:
+ * @func: a function to call when an email link is activated.
+ *
+ * Installs a global function to be called whenever the user activates an
+ * email link in an about dialog.
+ *
+ * Return value: the previous email hook.
+ *
+ * Since: 2.6
+ */
+GtkAboutDialogActivateLinkFunc
+gtk_about_dialog_set_email_hook (GtkAboutDialogActivateLinkFunc func)
+{
+ GtkAboutDialogActivateLinkFunc old;
+
+ old = activate_email_hook;
+
+ activate_email_hook = func;
+
+ return old;
+}
+
+/**
+ * gtk_about_dialog_set_email_hook:
+ * @func: a function to call when a URL link is activated.
+ *
+ * Installs a global function to be called whenever the user activates a
+ * URL link in an about dialog.
+ *
+ * Return value: the previous URL hook.
+ *
+ * Since: 2.6
+ */
+GtkAboutDialogActivateLinkFunc
+gtk_about_dialog_set_url_hook (GtkAboutDialogActivateLinkFunc func)
+{
+ GtkAboutDialogActivateLinkFunc old;
+
+ old = activate_url_hook;
+
+ activate_url_hook = func;
+
+ return old;
+}
+
+/**
+ * gtk_show_about_dialog:
+ * @parent: transient parent, or %NULL for none
+ * @first_property_name: the name of the first property
+ * @Varargs: value of first property, followed by more properties,
%NULL-terminated
+ *
+ * This is a convenience function for showing an application's about box.
+ *
+ * Since: 2.6
+ */
+void
+gtk_show_about_dialog (GtkWindow *parent,
+ const gchar *first_property_name,
+ ...)
+{
+ static GtkWidget *global_about_dialog = NULL;
+ GtkWidget *dialog = NULL;
+ va_list var_args;
+
+ if (parent)
+ dialog = g_object_get_data (G_OBJECT (parent), "gtk-about-dialog");
+ else
+ dialog = global_about_dialog;
+
+ if (!dialog)
+ {
+ dialog = gtk_about_dialog_new ();
+
+ g_object_ref (G_OBJECT (dialog));
+ gtk_object_sink (GTK_OBJECT (dialog));
+
+ g_signal_connect (dialog, "delete_event", G_CALLBACK
(gtk_widget_hide_on_delete), NULL);
+
+ va_start (var_args, first_property_name);
+ g_object_set_valist (G_OBJECT (dialog), first_property_name, var_args);
+ va_end (var_args);
+
+ if (parent)
+ {
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
+ g_object_set_data_full (G_OBJECT (parent), "gtk-about-dialog",
+ dialog, g_object_unref);
+ }
+ else
+ global_about_dialog = dialog;
+
+ }
+
+ gtk_window_present (GTK_WINDOW (dialog));
+}
+
+
+
+
+
+
+
Added: gnunet-gtk/src/gtk26about.h
===================================================================
--- gnunet-gtk/src/gtk26about.h 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/gtk26about.h 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,117 @@
+/* This code was copied from GTK (2.6/CVS).
+
+ GTK - The GIMP Toolkit
+
+ Copyright (C) 2001 CodeFactory AB
+ Copyright (C) 2001 Anders Carlsson <address@hidden>
+ Copyright (C) 2003, 2004 Matthias Clasen <address@hidden>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the Gnome Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+ Author: Anders Carlsson <address@hidden>
+
+*/
+
+#ifndef __GTK_ABOUT_DIALOG_H__
+#define __GTK_ABOUT_DIALOG_H__
+
+#include <gtk/gtkdialog.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_ABOUT_DIALOG (gtk_about_dialog_get_type ())
+#define GTK_ABOUT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_CAST
((object), GTK_TYPE_ABOUT_DIALOG, GtkAboutDialog))
+#define GTK_ABOUT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GTK_TYPE_ABOUT_DIALOG, GtkAboutDialogClass))
+#define GTK_IS_ABOUT_DIALOG(object) (G_TYPE_CHECK_INSTANCE_TYPE
((object), GTK_TYPE_ABOUT_DIALOG))
+#define GTK_IS_ABOUT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GTK_TYPE_ABOUT_DIALOG))
+#define GTK_ABOUT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GTK_TYPE_ABOUT_DIALOG, GtkAboutDialogClass))
+
+typedef struct _GtkAboutDialog GtkAboutDialog;
+typedef struct _GtkAboutDialogClass GtkAboutDialogClass;
+
+struct _GtkAboutDialog
+{
+ GtkDialog parent_instance;
+
+ /*< private >*/
+ gpointer private_data;
+};
+
+struct _GtkAboutDialogClass
+{
+ GtkDialogClass parent_class;
+
+ /* Padding for future expansion */
+ void (*_gtk_reserved1) (void);
+ void (*_gtk_reserved2) (void);
+ void (*_gtk_reserved3) (void);
+ void (*_gtk_reserved4) (void);
+};
+
+GType gtk_about_dialog_get_type (void)
G_GNUC_CONST;
+GtkWidget *gtk_about_dialog_new (void);
+void gtk_show_about_dialog (GtkWindow
*parent,
+ const gchar
*first_property_name,
+ ...);
+
+G_CONST_RETURN gchar *gtk_about_dialog_get_name (GtkAboutDialog
*about);
+void gtk_about_dialog_set_name (GtkAboutDialog
*about,
+ const gchar
*name);
+G_CONST_RETURN gchar *gtk_about_dialog_get_version (GtkAboutDialog
*about);
+void gtk_about_dialog_set_version (GtkAboutDialog
*about,
+ const gchar
*version);
+G_CONST_RETURN gchar *gtk_about_dialog_get_copyright (GtkAboutDialog
*about);
+void gtk_about_dialog_set_copyright (GtkAboutDialog
*about,
+ const gchar
*copyright);
+G_CONST_RETURN gchar *gtk_about_dialog_get_comments (GtkAboutDialog
*about);
+void gtk_about_dialog_set_comments (GtkAboutDialog
*about,
+ const gchar
*comments);
+G_CONST_RETURN gchar *gtk_about_dialog_get_license (GtkAboutDialog
*about);
+void gtk_about_dialog_set_license (GtkAboutDialog
*about,
+ const gchar
*license);
+G_CONST_RETURN gchar *gtk_about_dialog_get_website (GtkAboutDialog
*about);
+void gtk_about_dialog_set_website (GtkAboutDialog
*about,
+ const gchar
*website);
+G_CONST_RETURN gchar *gtk_about_dialog_get_website_label (GtkAboutDialog
*about);
+void gtk_about_dialog_set_website_label (GtkAboutDialog
*about,
+ const gchar
*website_label);
+gchar **gtk_about_dialog_get_authors (GtkAboutDialog
*about);
+void gtk_about_dialog_set_authors (GtkAboutDialog
*about,
+ gchar
**authors);
+gchar **gtk_about_dialog_get_documenters (GtkAboutDialog
*about);
+void gtk_about_dialog_set_documenters (GtkAboutDialog
*about,
+ gchar
**documenters);
+gchar ** gtk_about_dialog_get_artists (GtkAboutDialog
*about);
+void gtk_about_dialog_set_artists (GtkAboutDialog
*about,
+ gchar
**artists);
+G_CONST_RETURN gchar *gtk_about_dialog_get_translator_credits (GtkAboutDialog
*about);
+void gtk_about_dialog_set_translator_credits (GtkAboutDialog
*about,
+ const gchar
*translator_credits);
+GdkPixbuf *gtk_about_dialog_get_logo (GtkAboutDialog
*about);
+void gtk_about_dialog_set_logo (GtkAboutDialog
*about,
+ GdkPixbuf
*logo);
+
+typedef void (* GtkAboutDialogActivateLinkFunc) (GtkAboutDialog *about,
+ const gchar *link);
+
+GtkAboutDialogActivateLinkFunc gtk_about_dialog_set_email_hook
(GtkAboutDialogActivateLinkFunc func);
+GtkAboutDialogActivateLinkFunc gtk_about_dialog_set_url_hook
(GtkAboutDialogActivateLinkFunc func);
+
+G_END_DECLS
+
+#endif /* __GTK_ABOUT_DIALOG_H__ */
+
+
Added: gnunet-gtk/src/helper.c
===================================================================
--- gnunet-gtk/src/helper.c 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/helper.c 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,498 @@
+/*
+ This file is part of GNUnet
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+/**
+ * @file src/applications/afs/gtkui/helper.c
+ * @brief This file contains some GUI helper functions
+ * @author Igor Wronsky
+ */
+
+#include "platform.h"
+#include "helper.h"
+#include <stdlib.h>
+#ifndef MINGW
+ #include <sys/wait.h>
+#endif
+#include "main.h"
+
+#define HELPER_DEBUG NO
+
+GtkWidget * infoWindow = NULL;
+
+static GtkWidget * infoText = NULL;
+
+/* the main thread */
+static PTHREAD_T mainThread;
+
+static SaveCall ** psc;
+static unsigned int pscCount;
+static Mutex sclock;
+
+/**
+ * Call a callback function from the mainloop/main thread ("SaveCall").
+ * Since GTK doesn't work with multi-threaded applications under Windows,
+ * all GTK operations have to be done in the main thread
+ */
+void gtkSaveCall(GtkFunction func, void *args) {
+ SaveCall call;
+ int i;
+
+ call.args = args;
+ call.func = func;
+ MUTEX_LOCK(&sclock);
+ if (! PTHREAD_SELF_TEST(&mainThread)) {
+ call.sem = SEMAPHORE_NEW(0);
+ GROW(psc,
+ pscCount,
+ pscCount+1);
+ psc[pscCount-1] = &call;
+ MUTEX_UNLOCK(&sclock);
+ gtk_idle_add(func, &call);
+ SEMAPHORE_DOWN(call.sem);
+ /* remove from psc list */
+ MUTEX_LOCK(&sclock);
+ for (i=0;i<pscCount;i++)
+ if (psc[i] == &call) {
+ psc[i] = psc[pscCount-1];
+ break;
+ }
+ GNUNET_ASSERT(i != pscCount);
+ GROW(psc,
+ pscCount,
+ pscCount-1);
+ MUTEX_UNLOCK(&sclock);
+ SEMAPHORE_FREE(call.sem);
+ } else {
+ MUTEX_UNLOCK(&sclock);
+ call.sem = NULL;
+ func(&call);
+ }
+}
+
+/**
+ * Initialize "SaveCalls"
+ */
+void gtkInitSaveCalls() {
+ MUTEX_CREATE_RECURSIVE(&sclock);
+ PTHREAD_GET_SELF(&mainThread);
+}
+
+int gtkRunSomeSaveCalls() {
+ int i;
+
+ if (! PTHREAD_SELF_TEST(&mainThread))
+ return NO;
+ MUTEX_LOCK(&sclock);
+ if (pscCount == 0) {
+ MUTEX_UNLOCK(&sclock);
+ return NO;
+ }
+ i = randomi(pscCount);
+ if (TRUE == g_idle_remove_by_data(psc[i]))
+ psc[i]->func(psc[i]);
+ MUTEX_UNLOCK(&sclock);
+ gnunet_util_sleep(50 * cronMILLIS);
+ /* sleep here is somewhat important, first of
+ all, after completion we need to give the
+ semaphore-mechanism time to remove the save-call
+ from the list to avoid running it twice;
+ also, this function might be called in a tight
+ loop (see search.c), so we should give the
+ other threads some time to run. */
+
+ return YES;
+}
+
+void gtkDoneSaveCalls() {
+ int i;
+ PTHREAD_REL_SELF(&mainThread);
+ MUTEX_LOCK(&sclock);
+ for (i=0;i<pscCount;i++)
+ psc[i]->func(psc[i]);
+ i = pscCount;
+ MUTEX_UNLOCK(&sclock);
+ /* wait until all PSC-jobs have left
+ the gtkSaveCall method before destroying
+ the mutex! */
+ while (i != 0) {
+ gnunet_util_sleep(50 * cronMILLIS);
+ MUTEX_LOCK(&sclock);
+ i = pscCount;
+ MUTEX_UNLOCK(&sclock);
+ }
+ MUTEX_DESTROY(&sclock);
+}
+
+
+/**
+ * Called from a "SaveCall"-function to indicate that it is done
+ */
+void gtkSaveCallDone(Semaphore *sem) {
+ if (sem)
+ SEMAPHORE_UP(sem);
+}
+
+/**
+ * Destroy a widget. Called from threads other than the main thread
+ */
+gint doDestroyWidget(SaveCall *call) {
+ gtk_widget_destroy((GtkWidget *) call->args);
+
+ gtkSaveCallDone(call->sem);
+
+ return FALSE;
+}
+
+/**
+ * Callback for handling "delete_event": close the window
+ */
+gint deleteEvent(GtkWidget * widget,
+ GdkEvent * event,
+ gpointer data) {
+#if DEBUG_HELPER
+ LOG(LOG_DEBUG,
+ "In '%s'.\n",
+ __FUNCTION__);
+#endif
+ return FALSE;
+}
+
+/**
+ * A callback to destroy any widget given as second argument
+ */
+void destroyWidget(GtkWidget * dummy,
+ GtkWidget * widget) {
+#if DEBUG_HELPER
+ LOG(LOG_DEBUG,
+ "In '%s' of %p.\n",
+ __FUNCTION__,
+ widget);
+#endif
+ gtk_widget_destroy(widget);
+}
+
+/**
+ * Callback function for guiMessage()
+ */
+gint doGuiMessage(SaveCall *call) {
+ GtkWidget * window;
+ GtkWidget * label;
+ GtkWidget * box;
+ GtkWidget * button;
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_container_set_border_width(GTK_CONTAINER(window), 10);
+ gtk_window_set_title(GTK_WINDOW(window),
+ _("Notification"));
+ gtk_signal_connect(GTK_OBJECT(window),
+ "delete_event",
+ GTK_SIGNAL_FUNC(deleteEvent),
+ NULL);
+
+ box = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(window),
+ box);
+
+ label = gtk_label_new((gchar *) call->args);
+ free((gchar *) call->args); /* allocated in g_strdup_vprintf */
+ gtk_box_pack_start(GTK_BOX(box),
+ label,
+ FALSE,
+ FALSE,
+ 0);
+
+ button = gtk_button_new_with_label(_("Ok"));
+ gtk_signal_connect(GTK_OBJECT (button),
+ "clicked",
+ GTK_SIGNAL_FUNC(destroyWidget),
+ window);
+ gtk_box_pack_start(GTK_BOX(box),button,FALSE,FALSE,0);
+
+ gtk_window_set_position(GTK_WINDOW(window),
+ GTK_WIN_POS_MOUSE);
+ gtk_widget_show_all(window);
+ gtk_widget_grab_focus(button);
+
+ gtkSaveCallDone(call->sem);
+
+ return FALSE;
+}
+
+/**
+ * Displays an informative message to the user in a fresh window
+ */
+void guiMessage(const char * format, ...) {
+ va_list args;
+ gchar *note;
+
+ va_start(args, format);
+ note = g_strdup_vprintf(format, args);
+ va_end(args);
+
+ gtkSaveCall((GtkFunction) doGuiMessage, note);
+}
+
+static void hideWindow(GtkWidget * widget,
+ gpointer data) {
+ if(widget)
+ gtk_widget_hide(widget);
+}
+
+/**
+ * Callback for infoMessage()
+ */
+gint doInfoMessage(SaveCall *call) {
+ GtkTextIter iter;
+ GtkTextBuffer * buffer;
+
+ if(!infoWindow) {
+ GtkWidget * box1;
+ GtkWidget * button;
+ GtkWidget * scrolled_window;
+
+ infoWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_signal_connect(GTK_OBJECT(infoWindow),
+ "delete_event",
+ GTK_SIGNAL_FUNC(deleteEvent),
+ NULL);
+
+ gtk_window_set_title(GTK_WINDOW(infoWindow),
+ _("Messages"));
+ gtk_widget_set_usize(GTK_WIDGET(infoWindow),
+ 780,
+ 300);
+
+ box1 = gtk_vbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER (infoWindow),
+ box1);
+ gtk_widget_show(box1);
+
+ /* create a scrollable window */
+ scrolled_window = gtk_scrolled_window_new(NULL, NULL);
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_ALWAYS);
+ gtk_box_pack_start(GTK_BOX(box1),
+ scrolled_window,
+ TRUE,
+ TRUE,
+ 0);
+ gtk_widget_show(scrolled_window);
+
+ /* create a text widget */
+ infoText = gtk_text_view_new();
+
+ gtk_text_view_set_editable(GTK_TEXT_VIEW (infoText),
+ FALSE);
+ gtk_container_add(GTK_CONTAINER(scrolled_window),
+ infoText);
+ gtk_widget_show(infoText);
+ gtk_widget_realize(infoText);
+
+ /* finish with a close button */
+ button = gtk_button_new_with_label(_("Close"));
+ gtk_box_pack_start(GTK_BOX (box1),
+ button,
+ FALSE,
+ FALSE,
+ 0);
+ gtk_signal_connect_object(GTK_OBJECT(button),
+ "clicked",
+ GTK_SIGNAL_FUNC(hideWindow),
+ GTK_OBJECT(infoWindow));
+ gtk_signal_connect_object(GTK_OBJECT(infoWindow),
+ "delete_event",
+ GTK_SIGNAL_FUNC(hideWindow),
+ GTK_OBJECT(infoWindow));
+ gtk_signal_connect_object(GTK_OBJECT(infoWindow),
+ "destroy",
+ GTK_SIGNAL_FUNC(hideWindow),
+ GTK_OBJECT(infoWindow));
+ gtk_widget_show(button);
+ }
+ if(((InfoMessage *) call->args)->doPopup==YES)
+ gtk_widget_show(infoWindow);
+
+ /* append the text */
+ buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW (infoText));
+ gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
+ gtk_text_buffer_insert(buffer,
+ &iter,
+ ((InfoMessage *) call->args)->note,
+ -1);
+
+ gtkSaveCallDone(call->sem);
+
+ return FALSE;
+}
+
+/**
+ * Appends a message to the info window
+ *
+ * @param doPopup do we open the window, YES or NO
+ *
+ */
+void infoMessage(int doPopup, const char * format, ...) {
+ va_list args;
+ InfoMessage info;
+
+ va_start(args, format);
+ info.note = g_strdup_vprintf(format, args);
+ va_end(args);
+ info.doPopup = doPopup;
+ gtkSaveCall((GtkFunction) doInfoMessage, &info);
+ g_free(info.note);
+}
+
+/**
+ * Appends a log entry to the info window
+ *
+ * @param txt the log entry
+ *
+ */
+void addLogEntry(const char *txt) {
+ static GtkWidget * s = NULL;
+ static int once = 1;
+ static guint id;
+
+ if (once) {
+ once = 0;
+ s = glade_xml_get_widget(mainXML,
+ "statusbar");
+ id = gtk_statusbar_get_context_id(GTK_STATUSBAR(s),
+ "LOG");
+ } else
+ gtk_statusbar_pop(GTK_STATUSBAR(s),
+ id);
+ gtk_statusbar_push(GTK_STATUSBAR(s),
+ id,
+ txt);
+ infoMessage(NO, txt);
+}
+
+GtkNotebook * notebook = NULL;
+
+gint doAddToNotebook(SaveCall *call) {
+ GtkWidget * label = gtk_label_new(((AddNotebook *) call->args)->labelName);
+ gtk_notebook_append_page(notebook,
+ ((AddNotebook *) call->args)->frame,
+ label);
+ gtk_widget_show(((AddNotebook *) call->args)->frame);
+
+ gtkSaveCallDone(call->sem);
+
+ return FALSE;
+}
+
+void addToNotebook(const char * labelName,
+ GtkWidget * frame) {
+ AddNotebook note;
+
+ note.labelName = labelName;
+ note.frame = frame;
+ /* add a new notebook for the search results */
+ gtkSaveCall((GtkFunction) doAddToNotebook, ¬e);
+}
+
+/**
+ * A function for numeric comparisons of strings
+ */
+gint numericComp(GtkCList *clist,
+ gconstpointer ptr1,
+ gconstpointer ptr2) {
+ double value1;
+ double value2;
+ GtkCListRow * row1 = (GtkCListRow *) ptr1;
+ GtkCListRow * row2 = (GtkCListRow *) ptr2;
+
+ value1 = atof(GTK_CELL_TEXT(row1->cell[clist->sort_column])->text);
+ value2 = atof(GTK_CELL_TEXT(row2->cell[clist->sort_column])->text);
+
+ if(value1>value2)
+ return(-1);
+ else if(value1==value2)
+ return(0);
+ else
+ return(1);
+}
+
+/**
+ * A function for case-insensitive text comparisons
+ */
+gint alphaComp(GtkCList *clist,
+ gconstpointer ptr1,
+ gconstpointer ptr2) {
+ char * text1;
+ char * text2;
+ GtkCListRow * row1 = (GtkCListRow *) ptr1;
+ GtkCListRow * row2 = (GtkCListRow *) ptr2;
+
+ text1 = GTK_CELL_TEXT(row1->cell[clist->sort_column])->text;
+ text2 = GTK_CELL_TEXT(row2->cell[clist->sort_column])->text;
+
+ return (strcasecmp(text1,text2));
+}
+
+/**
+ * A function for percentage comparisons
+ */
+gint percentComp(GtkCList *clist,
+ gconstpointer ptr1,
+ gconstpointer ptr2) {
+ char * tmp1;
+ char * tmp2;
+ double value1;
+ double value2;
+ GtkCListRow * row1 = (GtkCListRow *) ptr1;
+ GtkCListRow * row2 = (GtkCListRow *) ptr2;
+
+ tmp1 = GTK_CELL_TEXT(row1->cell[clist->sort_column])->text;
+ tmp2 = GTK_CELL_TEXT(row2->cell[clist->sort_column])->text;
+
+ /* Hack for DONE strings :) */
+ if(strstr(tmp1,"%") == 0) {
+ if(strstr(tmp2,"%") == 0)
+ return 0; /* Both "DONE" */
+ else
+ return -1; /* A done, B not */
+ }
+ if(strstr(tmp2,"%")==0)
+ return 1; /* B done, A not */
+
+ /* Both have %, must remove */
+ tmp1 = STRDUP(GTK_CELL_TEXT(row1->cell[clist->sort_column])->text);
+ tmp2 = STRDUP(GTK_CELL_TEXT(row2->cell[clist->sort_column])->text);
+
+ tmp1[strlen(tmp1)-1]=0;
+ tmp2[strlen(tmp2)-1]=0;
+
+ value1 = atof(tmp1);
+ value2 = atof(tmp2);
+
+ FREE(tmp1);
+ FREE(tmp2);
+
+ if(value1>value2)
+ return(-1);
+ else if(value1==value2)
+ return(0);
+ else
+ return(1);
+}
+
+/* end of helper.c */
Added: gnunet-gtk/src/helper.h
===================================================================
--- gnunet-gtk/src/helper.h 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/helper.h 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,139 @@
+/*
+ This file is part of GNUnet
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/helper.h
+ * @author Igor Wronsky
+ */
+
+#ifndef GTKUI_HELPER_H
+#define GTKUI_HELPER_H
+
+#include "platform.h"
+#include <GNUnet/gnunet_util.h>
+
+/* for GTK 2 */
+#define GTK_ENABLE_BROKEN
+
+#include <gtk/gtk.h>
+#include <gtk/gtktext.h>
+
+typedef struct {
+ Semaphore *sem;
+ void *args;
+ GtkFunction func;
+} SaveCall;
+
+typedef struct {
+ int doPopup;
+ gchar *note;
+} InfoMessage;
+
+typedef struct {
+ const char *labelName;
+ GtkWidget *frame;
+} AddNotebook;
+
+
+/* callback: window close: close the window */
+gint deleteEvent(GtkWidget * widget,
+ GdkEvent * event,
+ gpointer data);
+
+/**
+ * A callback to destroy any widget given as second argument
+ *
+ */
+void destroyWidget(GtkWidget * dummy, GtkWidget * widget);
+
+/**
+ * Displays an informative message to the user
+ */
+void guiMessage(const char * format, ...);
+
+/**
+ * Appends a message to the info window
+ */
+void infoMessage(int doPopup, const char * format, ...);
+
+/**
+ * Appends a log entry to the info window
+ *
+ * @param txt the log entry
+ *
+ */
+void addLogEntry(const char *txt);
+
+/**
+ * A function for numeric comparisons of strings
+ */
+gint numericComp(GtkCList *clist,
+ gconstpointer ptr1,
+ gconstpointer ptr2);
+
+/**
+ * A function for case-insensitive text comparisons
+ */
+gint alphaComp(GtkCList *clist,
+ gconstpointer ptr1,
+ gconstpointer ptr2);
+
+/**
+ * A function for comparisons of percentages
+ */
+gint percentComp(GtkCList *clist,
+ gconstpointer ptr1,
+ gconstpointer ptr2);
+
+/**
+ * A general right-button popup menu callback
+ */
+gboolean popupCallback(GtkWidget *widget,
+ GdkEvent *event,
+ GtkWidget *menu );
+
+/**
+ * Call a callback function from the mainloop/main thread ("SaveCall").
+ * Since GTK doesn't work with multi-threaded applications under Windows,
+ * all GTK operations have to be done in the main thread
+ */
+void gtkSaveCall(GtkFunction func, void *args);
+
+/**
+ * Initialize "SaveCalls"
+ */
+void gtkInitSaveCalls();
+
+void gtkDoneSaveCalls();
+
+int gtkRunSomeSaveCalls();
+
+/**
+ * Called from a "SaveCall"-function to indicate that it is done
+ */
+void gtkSaveCallDone(Semaphore *sem);
+
+/**
+ * Destroy a widget. Called from threads other than the main thread
+ */
+gint doDestroyWidget(SaveCall *call);
+
+extern GtkWidget * infoWindow;
+
+#endif
Modified: gnunet-gtk/src/main.c
===================================================================
--- gnunet-gtk/src/main.c 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/main.c 2005-05-27 06:36:43 UTC (rev 823)
@@ -27,30 +27,18 @@
#include "config.h"
#include "gettext.h"
-#include <gtk/gtk.h>
-#include <glade/glade.h>
-
#include <GNUnet/gnunet_util.h>
-#include <GNUnet/gnunet_ecrs_lib.h>
-#include <GNUnet/gnunet_fsui_lib.h>
#include "main.h"
+#include "fs.h"
+#include "daemon.h"
+#include "helper.h"
/**
- * FSUI event handler.
- */
-static void eventProcessor(void * cls,
- const FSUI_Event * event) {
- printf("FSUI event received!\n");
-}
-
-/**
* Prints the usage information for this command if the user errs.
*/
static void printhelp() {
static Help help[] = {
- { 'a', "anonymity", "LEVEL",
- gettext_noop("set the desired LEVEL of receiver-anonymity") },
HELP_CONFIG,
HELP_HELP,
HELP_HOSTNAME,
@@ -109,33 +97,42 @@
}
GladeXML * mainXML;
-struct FSUI_Context * ctx;
int main(int argc,
char *argv[]) {
+ g_thread_init(NULL);
gtk_init(&argc, &argv);
if (SYSERR == initUtil(argc,
argv,
&parseOptions))
return 0;
-
+ startCron();
+ gtkInitSaveCalls();
/* load the interface */
mainXML = glade_xml_new(GLADE_FILE,
"mainWindow",
NULL);
/* connect the signals in the interface */
+ setCustomLogProc(&addLogEntry);
glade_xml_signal_autoconnect(mainXML);
-
- /* FSUI initialization here! */
- ctx = FSUI_start("gnunet-gtk",
- YES,
- &eventProcessor,
- NULL);
-
+ gtk_fs_init();
+ addCronJob(&cronCheckDaemon,
+ 0,
+ 15 * cronSECONDS,
+ NULL);
/* start the event loop */
+ gdk_threads_enter();
gtk_main();
- FSUI_stop(ctx);
+ gdk_threads_leave();
+ setCustomLogProc(NULL);
+ gtkDoneSaveCalls();
+ stopCron();
+ delCronJob(&cronCheckDaemon,
+ 15 * cronSECONDS,
+ NULL);
+ gtk_fs_done();
+ g_object_unref(mainXML);
doneUtil();
return 0;
Added: gnunet-gtk/src/main.h
===================================================================
--- gnunet-gtk/src/main.h 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/main.h 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,35 @@
+/*
+ This file is part of GNUnet.
+ (C) 2005 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file src/main.h
+ * @brief globals of gnunet-gtk
+ * @author Christian Grothoff
+ */
+
+#ifndef MAIN_H
+#define MAIN_H
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+extern GladeXML * mainXML;
+
+#endif
Added: gnunet-gtk/src/platform.h
===================================================================
--- gnunet-gtk/src/platform.h 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/platform.h 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,175 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other
contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+/**
+ * @file include/platform.h
+ * @brief plaform specifics
+ *
+ * @author Nils Durner
+ */
+
+#ifndef PLATFORM_H
+#define PLATFORM_H
+
+#ifndef HAVE_USED_CONFIG_H
+#define HAVE_USED_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gettext.h"
+
+#include "plibc.h"
+
+/**
+ * For strptime (glibc2 needs this).
+ */
+#ifndef _XOPEN_SOURCE
+#define _XOPEN_SOURCE
+#endif
+
+
+/* configuration options */
+
+#define VERBOSE_STATS 0
+
+#ifdef CYGWIN
+ #include <sys/reent.h>
+ #define _REENT_ONLY
+#endif
+
+#include <pthread.h>
+#ifdef CYGWIN
+ #undef _REENT_ONLY
+#endif
+
+#ifdef _MSC_VER
+ #include <Winsock2.h>
+#else
+#ifndef MINGW
+ #include <netdb.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <netinet/tcp.h>
+ #include <netinet/in.h>
+ #include <pwd.h>
+ #include <sys/ioctl.h>
+#else
+ #include "winproc.h"
+#endif
+#endif
+
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#ifndef _MSC_VER
+#include <ltdl.h> /* KLB_FIX */
+#endif
+#include <errno.h>
+#include <signal.h>
+#ifndef _MSC_VER
+#include <unistd.h> /* KLB_FIX */
+#endif
+#include <sys/stat.h>
+#include <sys/types.h>
+#ifndef _MSC_VER
+#include <dirent.h> /* KLB_FIX */
+#endif
+#include <fcntl.h>
+#include <math.h>
+
+#if TIME_WITH_SYS_TIME
+ #include <sys/time.h>
+ #include <time.h>
+#else
+ #if HAVE_SYS_TIME_H
+ #include <sys/time.h>
+ #else
+ #include <time.h>
+ #endif
+#endif
+
+/* if we have both openssl & libgcrypt, stick
+ to openssl for now (who has the obscure
+ libgcrypt CVS version that works for us!?...) */
+#if USE_OPENSSL
+ #if USE_GCRYPT
+ #undef USE_GCRYPT
+ #define USE_GCRYPT 0
+ #endif
+#endif
+
+#ifdef SOMEBSD
+ #include <net/if.h>
+#endif
+#ifdef FREEBSD
+ #include <semaphore.h>
+#endif
+#ifdef OSX
+#include <semaphore.h>
+#endif
+#ifdef LINUX
+#include <net/if.h>
+#endif
+#ifdef SOLARIS
+#include <sys/sockio.h>
+#include <sys/loadavg.h>
+#include <semaphore.h>
+#endif
+#ifdef CYGWIN
+#include <windows.h>
+#include <cygwin/if.h>
+#endif
+#include <errno.h>
+
+#include <limits.h>
+
+#if HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
+#include <locale.h>
+#include "gettext.h"
+
+
+#ifdef CYGWIN
+ #define SIOCGIFCONF _IOW('s', 100, struct ifconf) /* get if list */
+ #define SIOCGIFFLAGS _IOW('s', 101, struct ifreq) /* Get if flags */
+ #define SIOCGIFADDR _IOW('s', 102, struct ifreq) /* Get if addr */
+#endif
+
+#ifndef MINGW
+#include <sys/mman.h>
+#endif
+
+#ifdef OSX
+ #define socklen_t unsigned int
+#endif
+
+#if !HAVE_ATOLL
+long long atoll(const char *nptr);
+#endif
+
+#if ENABLE_NLS
+ #include "langinfo.h"
+#endif
+
+#endif
Added: gnunet-gtk/src/plibc.h
===================================================================
--- gnunet-gtk/src/plibc.h 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/src/plibc.h 2005-05-27 06:36:43 UTC (rev 823)
@@ -0,0 +1,565 @@
+/*
+ This file is part of PlibC.
+ (C) 2005 Nils Durner (and other contributing authors)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+*/
+
+/**
+ * @file include/plibc.h
+ * @brief PlibC header
+ * @attention This file is usually not installed under Unix,
+ * so ship it with your application
+ * @version $Revision: 1.16 $
+ */
+
+#ifndef _PLIBC_H_
+#define _PLIBC_H_
+
+#ifndef SIGALRM
+ #define SIGALRM 14
+#endif
+
+#if ENABLE_NLS
+ #include "langinfo.h"
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef WINDOWS
+
+#include <windows.h>
+#include <time.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <dirent.h>
+
+#define __BYTE_ORDER BYTE_ORDER
+#define __BIG_ENDIAN BIG_ENDIAN
+
+/* Conflicts with our definitions */
+#define __G_WIN32_H__
+
+/* Convert LARGE_INTEGER to double */
+#define Li2Double(x) ((double)((x).HighPart) * 4.294967296E9 + \
+ (double)((x).LowPart))
+
+#define socklen_t int
+#define ssize_t int
+#define ftruncate chsize
+#define off_t int
+#define int64_t long long
+#define int32_t long
+
+/* Thanks to the Cygwin project */
+#define EPERM 1 /* Not super-user */
+#define ENOENT 2 /* No such file or directory */
+#define ESRCH 3 /* No such process */
+#define EINTR 4 /* Interrupted system call */
+#define EIO 5 /* I/O error */
+#define ENXIO 6 /* No such device or address */
+#define E2BIG 7 /* Arg list too long */
+#define ENOEXEC 8 /* Exec format error */
+#define EBADF 9 /* Bad file number */
+#define ECHILD 10 /* No children */
+#define EAGAIN 11 /* Resource unavailable or operation would block, try
again */
+#define ENOMEM 12 /* Not enough memory */
+#define EACCES 13 /* Permission denied */
+#define EFAULT 14 /* Bad address */
+#define ENOTBLK 15 /* Block device required */
+#define EBUSY 16 /* Mount device busy */
+#define EEXIST 17 /* File exists */
+#define EXDEV 18 /* Cross-device link */
+#define ENODEV 19 /* No such device */
+#define ENOTDIR 20 /* Not a directory */
+#define EISDIR 21 /* Is a directory */
+#define EINVAL 22 /* Invalid argument */
+#define ENFILE 23 /* Too many open files in system */
+#define EMFILE 24 /* Too many open files */
+#define ENOTTY 25 /* Not a typewriter */
+#define ETXTBSY 26 /* Text file busy */
+#define EFBIG 27 /* File too large */
+#define ENOSPC 28 /* No space left on device */
+#define ESPIPE 29 /* Illegal seek */
+#define EROFS 30 /* Read only file system */
+#define EMLINK 31 /* Too many links */
+#define EPIPE 32 /* Broken pipe */
+#define EDOM 33 /* Math arg out of domain of func */
+#define ERANGE 34 /* Math result not representable */
+#define ENOMSG 35 /* No message of desired type */
+#define EIDRM 36 /* Identifier removed */
+#define ECHRNG 37 /* Channel number out of range */
+#define EL2NSYNC 38 /* Level 2 not synchronized */
+#define L3HLT 39 /* Level 3 halted */
+#define EL3RST 40 /* Level 3 reset */
+#define ELNRNG 41 /* Link number out of range */
+#define EUNATCH 42 /* Protocol driver not attached */
+#define ENOCSI 43 /* No CSI structure available */
+#define EL2HLT 44 /* Level 2 halted */
+#undef EDEADLK
+#define EDEADLK 45 /* Deadlock condition */
+#undef ENOLCK
+#define ENOLCK 46 /* No record locks available */
+#define EBADE 50 /* Invalid exchange */
+#define EBADR 51 /* Invalid request descriptor */
+#define EXFULL 52 /* Exchange full */
+#define ENOANO 53 /* No anode */
+#define EBADRQC 54 /* Invalid request code */
+#define EBADSLT 55 /* Invalid slot */
+#undef EDEADLOCK
+#define EDEADLOCK 56 /* File locking deadlock error */
+#define EBFONT 57 /* Bad font file fmt */
+#define ENOSTR 60 /* Device not a stream */
+#define ENODATA 61 /* No data (for no delay io) */
+#define ETIME 62 /* Timer expired */
+#define ENOSR 63 /* Out of streams resources */
+#define ENONET 64 /* Machine is not on the network */
+#define ENOPKG 65 /* Package not installed */
+#define EREMOTE 66 /* The object is remote */
+#define ENOLINK 67 /* The link has been severed */
+#define EADV 68 /* Advertise error */
+#define ESRMNT 69 /* Srmount error */
+#define ECOMM 70 /* Communication error on send */
+#define EPROTO 71 /* Protocol error */
+#define EMULTIHOP 74 /* Multihop attempted */
+#define ELBIN 75 /* Inode is remote (not really error) */
+#define EDOTDOT 76 /* Cross mount point (not really error) */
+#define EBADMSG 77 /* Trying to read unreadable message */
+#define ENOTUNIQ 80 /* Given log. name not unique */
+#define EBADFD 81 /* f.d. invalid for this operation */
+#define EREMCHG 82 /* Remote address changed */
+#define ELIBACC 83 /* Can't access a needed shared lib */
+#define ELIBBAD 84 /* Accessing a corrupted shared lib */
+#define ELIBSCN 85 /* .lib section in a.out corrupted */
+#define ELIBMAX 86 /* Attempting to link in too many libs */
+#define ELIBEXEC 87 /* Attempting to exec a shared library */
+#undef ENOSYS
+#define ENOSYS 88 /* Function not implemented */
+#define ENMFILE 89 /* No more files */
+#undef ENOTEMPTY
+#define ENOTEMPTY 90 /* Directory not empty */
+#undef ENAMETOOLONG
+#define ENAMETOOLONG 91 /* File or path name too long */
+#define ELOOP 92 /* Too many symbolic links */
+#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+#define EPFNOSUPPORT 96 /* Protocol family not supported */
+#define ECONNRESET 104 /* Connection reset by peer */
+#define ENOBUFS 105 /* No buffer space available */
+#define EAFNOSUPPORT 106 /* Address family not supported by protocol family */
+#define EPROTOTYPE 107 /* Protocol wrong type for socket */
+#define ENOTSOCK 108 /* Socket operation on non-socket */
+#define ENOPROTOOPT 109 /* Protocol not available */
+#define ESHUTDOWN 110 /* Can't send after socket shutdown */
+#define ECONNREFUSED 111 /* Connection refused */
+#define EADDRINUSE 112 /* Address already in use */
+#define ECONNABORTED 113 /* Connection aborted */
+#define ENETUNREACH 114 /* Network is unreachable */
+#define ENETDOWN 115 /* Network interface is not configured */
+#undef ETIMEDOUT
+#define ETIMEDOUT 116 /* Connection timed out */
+#define EHOSTDOWN 117 /* Host is down */
+#define EHOSTUNREACH 118 /* Host is unreachable */
+#define EINPROGRESS 119 /* Connection already in progress */
+#define EALREADY 120 /* Socket already connected */
+#define EDESTADDRREQ 121 /* Destination address required */
+#define EMSGSIZE 122 /* Message too long */
+#define EPROTONOSUPPORT 123 /* Unknown protocol */
+#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
+#define EADDRNOTAVAIL 125 /* Address not available */
+#define ENETRESET 126 /* Connection aborted by network */
+#define EISCONN 127 /* Socket is already connected */
+#define ENOTCONN 128 /* Socket is not connected */
+#define ETOOMANYREFS 129 /* Too many references: cannot splice */
+#define EPROCLIM 130 /* Too many processes */
+#define EUSERS 131 /* Too many users */
+#define EDQUOT 132 /* Disk quota exceeded */
+#define ESTALE 133 /* Unknown error */
+#undef ENOTSUP
+#define ENOTSUP 134 /* Not supported */
+#define ENOMEDIUM 135 /* No medium (in tape drive) */
+#define ENOSHARE 136 /* No such host or network path */
+#define ECASECLASH 137 /* Filename exists with different case */
+#define EWOULDBLOCK EAGAIN /* Operation would block */
+
+#undef HOST_NOT_FOUND
+#define HOST_NOT_FOUND 1
+#undef TRY_AGAIN
+#define TRY_AGAIN 2
+#undef NO_RECOVERY
+#define NO_RECOVERY 3
+#undef NO_ADDRESS
+#define NO_ADDRESS 4
+
+#define PROT_READ 0x1
+#define PROT_WRITE 0x2
+#define MAP_SHARED 0x1
+#define MAP_PRIVATE 0x2 /* unsupported */
+#define MAP_FIXED 0x10
+
+struct statfs
+{
+ long f_type; /* type of filesystem (see below) */
+ long f_bsize; /* optimal transfer block size */
+ long f_blocks; /* total data blocks in file system */
+ long f_bfree; /* free blocks in fs */
+ long f_bavail; /* free blocks avail to non-superuser */
+ long f_files; /* total file nodes in file system */
+ long f_ffree; /* free file nodes in fs */
+ long f_fsid; /* file system id */
+ long f_namelen; /* maximum length of filenames */
+ long f_spare[6]; /* spare for later */
+};
+
+/* Taken from the Wine project <http://www.winehq.org>
+ /wine/include/winternl.h */
+enum SYSTEM_INFORMATION_CLASS
+{
+ SystemBasicInformation = 0,
+ Unknown1,
+ SystemPerformanceInformation = 2,
+ SystemTimeOfDayInformation = 3, /* was SystemTimeInformation */
+ Unknown4,
+ SystemProcessInformation = 5,
+ Unknown6,
+ Unknown7,
+ SystemProcessorPerformanceInformation = 8,
+ Unknown9,
+ Unknown10,
+ SystemDriverInformation,
+ Unknown12,
+ Unknown13,
+ Unknown14,
+ Unknown15,
+ SystemHandleList,
+ Unknown17,
+ Unknown18,
+ Unknown19,
+ Unknown20,
+ SystemCacheInformation,
+ Unknown22,
+ SystemInterruptInformation = 23,
+ SystemExceptionInformation = 33,
+ SystemRegistryQuotaInformation = 37,
+ SystemLookasideInformation = 45
+};
+
+typedef struct
+{
+ LARGE_INTEGER IdleTime;
+ LARGE_INTEGER KernelTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER Reserved1[2];
+ ULONG Reserved2;
+} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
+
+#define sleep(secs) (Sleep(secs * 1000))
+
+/*********************** statfs *****************************/
+/* fake block size */
+#define FAKED_BLOCK_SIZE 512
+
+/* linux-compatible values for fs type */
+#define MSDOS_SUPER_MAGIC 0x4d44
+#define NTFS_SUPER_MAGIC 0x5346544E
+
+/*********************** End of statfs ***********************/
+
+#define SHUT_RDWR SD_BOTH
+
+/* Operations for flock() */
+#define LOCK_SH 1 /* shared lock */
+#define LOCK_EX 2 /* exclusive lock */
+#define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+#define LOCK_UN 8 /* remove lock */
+
+/* Not supported under MinGW */
+#define S_IRGRP 0
+#define S_IWGRP 0
+#define S_IROTH 0
+#define S_IXGRP 0
+#define S_IWOTH 0
+#define S_IXOTH 0
+#define S_ISUID 0
+#define S_ISGID 0
+#define S_ISVTX 0
+#define S_IRWXG 0
+#define S_IRWXO 0
+
+#define SetErrnoFromWinError(e) _SetErrnoFromWinError(e, __FILE__, __LINE__)
+
+/**
+ * @brief index() - same as strchr()
+ */
+#define index(s, c) strchr(s, c)
+
+BOOL _plibc_CreateShortcut(const char *pszSrc, const char *pszDest);
+BOOL _plibc_DereferenceShortcut(char *pszShortcut);
+long QueryRegistry(HKEY hMainKey, char *pszKey, char *pszSubKey,
+ char *pszBuffer, long *pdLength);
+
+BOOL __win_IsHandleMarkedAsBlocking(SOCKET hHandle);
+void __win_SetHandleBlockingMode(SOCKET s, BOOL bBlocking);
+void __win_DiscardHandleBlockingMode(SOCKET s);
+int _win_isSocketValid(int s);
+int plibc_conv_to_win_path(const char *pszUnix, char *pszWindows);
+
+typedef void (*TPanicProc) (int, char *);
+void plibc_set_panic_proc(TPanicProc proc);
+
+int flock(int fd, int operation);
+int fsync(int fildes);
+int inet_pton(int af, const char *src, void *dst);
+int inet_pton4(const char *src, u_char *dst, int pton);
+#if USE_IPV6
+int inet_pton6(const char *src, u_char *dst);
+#endif
+int truncate(const char *fname, int distance);
+int statfs(const char *path, struct statfs *buf);
+const char *hstrerror(int err);
+void gettimeofday(struct timeval *tp, void *tzp);
+int mkstemp(char *tmplate);
+char *strptime (const char *buf, const char *format, struct tm *tm);
+char *ctime(const time_t *clock);
+char *ctime_r(const time_t *clock, char *buf);
+int plibc_init(char *pszOrg, char *pszApp);
+void plibc_shutdown(void);
+int plibc_conv_to_win_path_ex(const char *pszUnix, char *pszWindows, int
derefLinks);
+void _SetErrnoFromWinError(long lWinError, char *pszCaller, int iLine);
+void SetErrnoFromWinsockError(long lWinError);
+void SetHErrnoFromWinError(long lWinError);
+void SetErrnoFromHRESULT(HRESULT hRes);
+FILE *_win_fopen(const char *filename, const char *mode);
+DIR *_win_opendir(const char *dirname);
+int _win_open(const char *filename, int oflag, ...);
+#ifdef ENABLE_NLS
+char *_win_bindtextdomain(const char *domainname, const char *dirname);
+#endif
+int _win_chdir(const char *path);
+int _win_close(int fd);
+int _win_creat(const char *path, mode_t mode);
+int _win_fstat(int handle, struct stat *buffer);
+int _win_pipe(int *phandles);
+int _win_rmdir(const char *path);
+int _win_access( const char *path, int mode );
+int _win_chmod(const char *filename, int pmode);
+char *realpath(const char *file_name, char *resolved_name);
+int _win_remove(const char *path);
+int _win_rename(const char *oldname, const char *newname);
+int _win_stat(const char *path, struct stat *buffer);
+int _win_unlink(const char *filename);
+int _win_write(int fildes, const void *buf, size_t nbyte);
+int _win_read(int fildes, void *buf, size_t nbyte);
+size_t _win_fwrite(const void *buffer, size_t size, size_t count, FILE
*stream);
+size_t _win_fread( void *buffer, size_t size, size_t count, FILE *stream );
+int _win_symlink(const char *path1, const char *path2);
+void *_win_mmap(void *start, size_t len, int access, int flags, int fd,
+ unsigned long long offset);
+int _win_munmap(void *start, size_t length);
+int _win_lstat(const char *path, struct stat *buf);
+int _win_readlink(const char *path, char *buf, size_t bufsize);
+int _win_accept(SOCKET s, struct sockaddr *addr, int *addrlen);
+int _win_printf(const char *format,...);
+int _win_fprintf(FILE *f,const char *format,...);
+int _win_vprintf(const char *format, va_list ap);
+int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vsprintf(char *dest,const char *format, va_list arg_ptr);
+int _win_vsnprintf(char* str, size_t size, const char *format, va_list
arg_ptr);
+int _win_snprintf(char *str,size_t size,const char *format,...);
+int _win_sprintf(char *dest,const char *format,...);
+int _win_vsscanf(const char* str, const char* format, va_list arg_ptr);
+int _win_sscanf(const char *str, const char *format, ...);
+int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr);
+int _win_vscanf(const char *format, va_list arg_ptr);
+int _win_scanf(const char *format, ...);
+int _win_fscanf(FILE *stream, const char *format, ...);
+int _win_bind(SOCKET s, const struct sockaddr *name, int namelen);
+int _win_connect(SOCKET s,const struct sockaddr *name, int namelen);
+int _win_getpeername(SOCKET s, struct sockaddr *name,
+ int *namelen);
+int _win_getsockname(SOCKET s, struct sockaddr *name,
+ int *namelen);
+int _win_getsockopt(SOCKET s, int level, int optname, char *optval,
+ int *optlen);
+int _win_listen(SOCKET s, int backlog);
+int _win_recv(SOCKET s, char *buf, int len, int flags);
+int _win_recvfrom(SOCKET s, void *buf, int len, int flags,
+ struct sockaddr *from, int *fromlen);
+int _win_select(int max_fd, fd_set * rfds, fd_set * wfds, fd_set * efds,
+ const struct timeval *tv);
+int _win_send(SOCKET s, const char *buf, int len, int flags);
+int _win_sendto(SOCKET s, const char *buf, int len, int flags,
+ const struct sockaddr *to, int tolen);
+int _win_setsockopt(SOCKET s, int level, int optname, const void *optval,
+ int optlen);
+int _win_shutdown(SOCKET s, int how);
+SOCKET _win_socket(int af, int type, int protocol);
+struct hostent *_win_gethostbyaddr(const char *addr, int len, int type);
+struct hostent *_win_gethostbyname(const char *name);
+char *_win_strerror(int errnum);
+int IsWinNT(void);
+
+#if !HAVE_STRNDUP
+char *strndup (const char *s, size_t n);
+#endif
+#if !HAVE_STRNLEN
+size_t strnlen (const char *str, size_t maxlen);
+#endif
+
+#endif /* WINDOWS */
+
+#ifndef WINDOWS
+ #define DIR_SEPARATOR '/'
+ #define DIR_SEPARATOR_STR "/"
+ #define NEWLINE "\n"
+
+#ifdef ENABLE_NLS
+ #define BINDTEXTDOMAIN(d, n) bindtextdomain(d, n)
+#endif
+ #define CREAT(p, m) creat(p, m)
+ #undef FOPEN
+ #define FOPEN(f, m) fopen(f, m)
+ #define OPENDIR(d) opendir(d)
+ #define OPEN(f) open(f)
+ #define CHDIR(d) chdir(d)
+ #define CLOSE(f) close(f)
+ #define RMDIR(f) rmdir(f)
+ #define ACCESS(p, m) access(p, m)
+ #define CHMOD(f, p) chmod(f, p)
+ #define FSTAT(h, b) fstat(h, b)
+ #define PIPE(h) pipe(h)
+ #define REMOVE(p) remove(p)
+ #define RENAME(o, n) rename(o, n)
+ #define STAT(p, b) stat(p, b)
+ #define UNLINK(f) unlink(f)
+ #define WRITE(f, b, n) write(f, b, n)
+ #define READ(f, b, n) read(f, b, n)
+ #define GN_FREAD(b, s, c, f) fread(b, s, c, f)
+ #define GN_FWRITE(b, s, c, f) fwrite(b, s, c, f)
+ #define SYMLINK(a, b) symlink(a, b)
+ #define MMAP(s, l, p, f, d, o) mmap(s, l, p, f, d, o)
+ #define MUNMAP(s, l) munmap(s, l)
+ #define STRERROR(i) strerror(i)
+ #define READLINK(p, b, s) readlink(p, b, s)
+ #define LSTAT(p, b) lstat(p, b)
+ #define PRINTF(f, ...) printf(f , __VA_ARGS__)
+ #define FPRINTF(fil, fmt, ...) fprintf(fil, fmt, __VA_ARGS__)
+ #define VPRINTF(f, a) vprintf(f, a)
+ #define VFPRINTF(s, f, a) vfprintf(s, f, a)
+ #define VSPRINTF(d, f, a) vsprintf(d, f, a)
+ #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a)
+ #define _REAL_SNPRINTF(str, size, fmt, ...) snprintf(str, size, fmt,
__VA_ARGS__)
+ #define SPRINTF(d, f, ...) sprintf(d, f, __VA_ARGS__)
+ #define VSSCANF(s, f, a) vsscanf(s, f, a)
+ #define SSCANF(s, f, ...) sscanf(s, f, __VA_ARGS__)
+ #define VFSCANF(s, f, a) vfscanf(s, f, a)
+ #define VSCANF(f, a) vscanf(f, a)
+ #define SCANF(f, ...) scanf(f, __VA_ARGS__)
+ #define FSCANF(s, f, ...) fscanf(s, f, __VA_ARGS__)
+ #define ACCEPT(s, a, l) accept(s, a, l)
+ #define BIND(s, n, l) bind(s, n, l)
+ #define CONNECT(s, n, l) connect(s, n, l)
+ #define GETPEERNAME(s, n, l) getpeername(s, n, l)
+ #define GETSOCKNAME(s, n, l) getsockname(s, n, l)
+ #define GETSOCKOPT(s, l, o, v, p) getsockopt(s, l, o, v, p)
+ #define LISTEN(s, b) listen(s, b)
+ #define RECV(s, b, l, f) recv(s, b, l, f)
+ #define RECVFROM(s, b, l, f, r, o) recvfrom(s, b, l, f, r, o)
+ #define SELECT(n, r, w, e, t) select(n, r, w, e, t)
+ #define SEND(s, b, l, f) send(s, b, l, f)
+ #define SENDTO(s, b, l, f, o, n) sendto(s, b, l, f, o, n)
+ #define SETSOCKOPT(s, l, o, v, n) setsockopt(s, l, o, v, n)
+ #define SHUTDOWN(s, h) shutdown(s, h)
+ #define SOCKET(a, t, p) socket(a, t, p)
+ #define GETHOSTBYADDR(a, l, t) gethostbyname(a, l, t)
+ #define GETHOSTBYNAME(n) gethostbyname(n)
+#else
+ #define DIR_SEPARATOR '\\'
+ #define DIR_SEPARATOR_STR "\\"
+ #define NEWLINE "\r\n"
+
+#ifdef ENABLE_NLS
+ #define BINDTEXTDOMAIN(d, n) _win_bindtextdomain(d, n)
+#endif
+ #define CREAT(p, m) _win_creat(p, m)
+ #define FOPEN(f, m) _win_fopen(f, m)
+ #define OPENDIR(d) _win_opendir(d)
+ #define OPEN(f) _win_open(f)
+ #define CHDIR(d) _win_chdir(d)
+ #define CLOSE(f) _win_close(f)
+ #define FSTAT(h, b) _win_fstat(h, b)
+ #define RMDIR(f) _win_rmdir(f)
+ #define ACCESS(p, m) _win_access(p, m)
+ #define CHMOD(f, p) _win_chmod(f, p)
+ #define PIPE(h) _win_pipe(h)
+ #define REMOVE(p) _win_remove(p)
+ #define RENAME(o, n) _win_rename(o, n)
+ #define STAT(p, b) _win_stat(p, b)
+ #define UNLINK(f) _win_unlink(f)
+ #define WRITE(f, b, n) _win_write(f, b, n)
+ #define READ(f, b, n) _win_read(f, b, n)
+ #define GN_FREAD(b, s, c, f) _win_fread(b, s, c, f)
+ #define GN_FWRITE(b, s, c, f) _win_fwrite(b, s, c, f)
+ #define SYMLINK(a, b) _win_symlink(a, b)
+ #define MMAP(s, l, p, f, d, o) _win_mmap(s, l, p, f, d, o)
+ #define MUNMAP(s, l) _win_munmap(s, l)
+ #define STRERROR(i) _win_strerror(i)
+ #define READLINK(p, b, s) _win_readlink(p, b, s)
+ #define LSTAT(p, b) _win_lstat(p, b)
+ #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__)
+ #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__)
+ #define VPRINTF(f, a) _win_vprintf(f, a)
+ #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a)
+ #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a)
+ #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a)
+ #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt,
__VA_ARGS__)
+ #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__)
+ #define VSSCANF(s, f, a) _win_vsscanf(s, f, a)
+ #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__)
+ #define VFSCANF(s, f, a) _win_vfscanf(s, f, a)
+ #define VSCANF(f, a) _win_vscanf(f, a)
+ #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__)
+ #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__)
+ #define ACCEPT(s, a, l) _win_accept(s, a, l)
+ #define BIND(s, n, l) _win_bind(s, n, l)
+ #define CONNECT(s, n, l) _win_connect(s, n, l)
+ #define GETPEERNAME(s, n, l) _win_getpeername(s, n, l)
+ #define GETSOCKNAME(s, n, l) _win_getsockname(s, n, l)
+ #define GETSOCKOPT(s, l, o, v, p) _win_getsockopt(s, l, o, v, p)
+ #define LISTEN(s, b) _win_listen(s, b)
+ #define RECV(s, b, l, f) _win_recv(s, b, l, f)
+ #define RECVFROM(s, b, l, f, r, o) _win_recvfrom(s, b, l, f, r, o)
+ #define SELECT(n, r, w, e, t) _win_select(n, r, w, e, t)
+ #define SEND(s, b, l, f) _win_send(s, b, l, f)
+ #define SENDTO(s, b, l, f, o, n) _win_sendto(s, b, l, f, o, n)
+ #define SETSOCKOPT(s, l, o, v, n) _win_setsockopt(s, l, o, v, n)
+ #define SHUTDOWN(s, h) _win_shutdown(s, h)
+ #define SOCKET(a, t, p) _win_socket(a, t, p)
+ #define GETHOSTBYADDR(a, l, t) _win_gethostbyname(a, l, t)
+ #define GETHOSTBYNAME(n) _win_gethostbyname(n)
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //_PLIBC_H_
+
+/* end of plibc.h */
Modified: gnunet-gtk/todo
===================================================================
--- gnunet-gtk/todo 2005-05-26 12:23:02 UTC (rev 822)
+++ gnunet-gtk/todo 2005-05-27 06:36:43 UTC (rev 823)
@@ -1,17 +1,20 @@
High priority:
* figure out how list views work
-* decide between C and C++
- (figure out how to inspect internals of
- object tree in C / C++)
-* basic FS integration (insert, search, download)
-* better widget naming -- conventions?
+* basic FS integration:
+ - search:
+ + properly get page from glade window
+ + properly initialize tree view
+ + process search result events
+ + process search frame close event
+ + support namespace URIs
+ + update namespace list combo box
+ - insert
+ - download
Important:
-* look at pango for welcome/splash screen
* advanced FS operations (namespace, collection)
* stats integration
* available apps
-* about dialog
Later:
* more help-texts
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r823 - GNUnet GNUnet/contrib GNUnet/m4 GNUnet/src/applications/fs/fsui GNUnet/src/include GNUnet/src/util branches/GNUnet06/src/applications/afs/gtkui gnunet-gtk gnunet-gtk/src,
grothoff <=