[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1261 - in gnunet-gtk: . src/common src/core src/plugins/ab
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1261 - in gnunet-gtk: . src/common src/core src/plugins/about src/plugins/daemon src/plugins/fs |
Date: |
Mon, 4 Jul 2005 16:29:41 -0700 (PDT) |
Author: grothoff
Date: 2005-07-04 16:29:31 -0700 (Mon, 04 Jul 2005)
New Revision: 1261
Modified:
gnunet-gtk/configure.ac
gnunet-gtk/mkinstalldirs
gnunet-gtk/src/common/Makefile.am
gnunet-gtk/src/core/Makefile.am
gnunet-gtk/src/core/main.c
gnunet-gtk/src/plugins/about/Makefile.am
gnunet-gtk/src/plugins/about/about.c
gnunet-gtk/src/plugins/daemon/Makefile.am
gnunet-gtk/src/plugins/daemon/daemon.c
gnunet-gtk/src/plugins/fs/fs.c
gnunet-gtk/src/plugins/fs/search.c
Log:
update
Modified: gnunet-gtk/configure.ac
===================================================================
--- gnunet-gtk/configure.ac 2005-07-04 22:56:51 UTC (rev 1260)
+++ gnunet-gtk/configure.ac 2005-07-04 23:29:31 UTC (rev 1261)
@@ -183,6 +183,8 @@
fi
AC_CHECK_HEADERS([GNUnet/gnunet_ecrs_lib.h GNUnet/gnunet_fsui_lib.h
GNUnet/gnunet_stats_lib.h GNUnet/gnunet_getoption_lib.h],,
AC_MSG_ERROR([compiling gnunet-gtk requires GNUnet core
headers]))
+
+SAVELIBS=$LIBS
AC_CHECK_LIB(gnunetutil,LOG,,
AC_MSG_ERROR([gnunet-gtk requires GNUnet-Util]))
AC_CHECK_LIB(gnunetecrs,ECRS_createMetaData,,
@@ -193,6 +195,7 @@
AC_MSG_ERROR([gnunet-gtk requires getoption]))
AC_CHECK_LIB(gnunetstats_api,requestStatistics,,
AC_MSG_ERROR([gnunet-gtk requires stats]))
+LIBS=$SAVELIBS
PKG_CHECK_MODULES(GNUNETGTK, libglade-2.0) # libgnomeui-2.0 >= 1.110.0
AC_SUBST(GNUNETGTK_CFLAGS)
Modified: gnunet-gtk/mkinstalldirs
===================================================================
--- gnunet-gtk/mkinstalldirs 2005-07-04 22:56:51 UTC (rev 1260)
+++ gnunet-gtk/mkinstalldirs 2005-07-04 23:29:31 UTC (rev 1261)
@@ -1,7 +1,7 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
-scriptversion=2004-02-15.20
+scriptversion=2005-02-02.21
# Original author: Noah Friedman <address@hidden>
# Created: 1993-05-16
@@ -27,7 +27,7 @@
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
- exit 0
+ exit $?
;;
-m) # -m PERM arg
shift
@@ -37,7 +37,7 @@
;;
--version)
echo "$0 $scriptversion"
- exit 0
+ exit $?
;;
--) # stop option processing
shift
Modified: gnunet-gtk/src/common/Makefile.am
===================================================================
--- gnunet-gtk/src/common/Makefile.am 2005-07-04 22:56:51 UTC (rev 1260)
+++ gnunet-gtk/src/common/Makefile.am 2005-07-04 23:29:31 UTC (rev 1261)
@@ -1,12 +1,13 @@
INCLUDES = \
- -I$(top_srcdir)/intl -I$(top_srcdir)/src/includes \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/src/include \
@GTK_CFLAGS@ \
@GNUNETGTK_CFLAGS@
lib_LTLIBRARIES = \
libgnunetgtk_common.la
-libgnunetgtk_common_la__SOURCES = \
+libgnunetgtk_common_la_SOURCES = \
helper.c
libgnunetgtk_common_la_LDFLAGS = \
Modified: gnunet-gtk/src/core/Makefile.am
===================================================================
--- gnunet-gtk/src/core/Makefile.am 2005-07-04 22:56:51 UTC (rev 1260)
+++ gnunet-gtk/src/core/Makefile.am 2005-07-04 23:29:31 UTC (rev 1261)
@@ -11,7 +11,7 @@
gnunet_gtk_LDADD = \
@GTK_LIBS@ \
- @GNUNETGTK_LIBS@ \
+ -lgnunetutil \
$(INTLLIBS) \
-lgthread-2.0 \
$(top_builddir)/src/common/libgnunetgtk_common.la
Modified: gnunet-gtk/src/core/main.c
===================================================================
--- gnunet-gtk/src/core/main.c 2005-07-04 22:56:51 UTC (rev 1260)
+++ gnunet-gtk/src/core/main.c 2005-07-04 23:29:31 UTC (rev 1261)
@@ -79,9 +79,8 @@
printhelp();
return SYSERR;
case 'v':
- printf("GNUnet v%s, gnunet-gkt v%s\n",
- VERSION,
- AFS_VERSION);
+ printf("gnunet-gtk v%s\n",
+ VERSION);
return SYSERR;
default:
LOG(LOG_FAILURE,
@@ -94,11 +93,80 @@
return OK;
}
+typedef struct Plugin {
+ struct Plugin * next;
+ char * name;
+ void * library;
+} Plugin;
+
+static Plugin * loadPlugin(const char * name,
+ Plugin * next) {
+ Plugin * p;
+ void * lib;
+
+ lib = loadDynamicLibrary("libgnunetgtk_plugin",
+ name);
+ if (lib == NULL) {
+ LOG(LOG_WARNING,
+ _("Failed to load plugin '%s'\n"),
+ name);
+ return next;
+ }
+ p = MALLOC(sizeof(Plugin));
+ p->name = STRDUP(name);
+ p->next = next;
+ p->library = lib;
+ return p;
+}
+
+static Plugin * loadPlugins(const char * names,
+ Plugin * plug) {
+ char * dup;
+ char * next;
+ const char * pos;
+
+ if (names == NULL)
+ return plug;
+
+ dup = STRDUP(names);
+ next = dup;
+ do {
+ while (*next == ' ')
+ next++;
+ pos = next;
+ while ( (*next != '\0') &&
+ (*next != ' ') )
+ next++;
+ if (*next == '\0') {
+ next = NULL; /* terminate! */
+ } else {
+ *next = '\0'; /* add 0-termination for pos */
+ next++;
+ }
+ if (strlen(pos) > 0) {
+ LOG(LOG_DEBUG,
+ "Loading plugin '%s'\n",
+ pos);
+ plug = loadPlugin(pos, plug);
+ }
+ } while (next != NULL);
+ FREE(dup);
+ return plug;
+}
+
+static void unloadPlugin(Plugin * plug) {
+ unloadDynamicLibrary(plug->library);
+ FREE(plug->name);
+ FREE(plug);
+}
+
GladeXML * mainXML;
char *gladeFile = NULL;
int main(int argc,
char *argv[]) {
+ Plugin * plugin;
+ char * load;
g_thread_init(NULL);
gtk_init(&argc, &argv);
@@ -109,7 +177,10 @@
startCron();
gtkInitSaveCalls();
/* load the plugins */
-
+ load = getConfigurationString("GNUNET-GTK",
+ "PLUGINS");
+ plugin = loadPlugins(load, NULL);
+ FREE(load);
/* load the interface */
#ifdef MINGW
gladeFile = MALLOC(_MAX_PATH + 1);
@@ -134,6 +205,13 @@
stopCron();
/* unload the plugins */
+ while (plugin != NULL) {
+ Plugin * next;
+
+ next = plugin->next;
+ unloadPlugin(plugin);
+ plugin = next;
+ }
gtkDoneSaveCalls();
UNREF(mainXML);
Modified: gnunet-gtk/src/plugins/about/Makefile.am
===================================================================
--- gnunet-gtk/src/plugins/about/Makefile.am 2005-07-04 22:56:51 UTC (rev
1260)
+++ gnunet-gtk/src/plugins/about/Makefile.am 2005-07-04 23:29:31 UTC (rev
1261)
@@ -3,15 +3,15 @@
-I$(top_srcdir)/src/include \
@GTK_CFLAGS@ \
@GNUNETGTK_CFLAGS@
-
+
plugindir = $(libdir)/gnunet-gtk
-
+
plugin_LTLIBRARIES = \
libgnunetgtkmodule_about.la
-
+
libgnunetgtkmodule_about_la_SOURCES = \
about.c
libgnunetgtkmodule_about_la_LIBADD = \
- $(top_builddir)/src/common/libgnunetgtk_common.la
+ $(top_builddir)/src/common/libgnunetgtk_common.la
libgnunetgtkmodule_about_la_LDFLAGS = \
-export-dynamic -avoid-version -module
Modified: gnunet-gtk/src/plugins/about/about.c
===================================================================
--- gnunet-gtk/src/plugins/about/about.c 2005-07-04 22:56:51 UTC (rev
1260)
+++ gnunet-gtk/src/plugins/about/about.c 2005-07-04 23:29:31 UTC (rev
1261)
@@ -18,7 +18,7 @@
*/
/**
- * @file src/about.c
+ * @file src/plugins/about/about.c
* @author Christian Grothoff
* @author Igor Wronsky
*
Modified: gnunet-gtk/src/plugins/daemon/Makefile.am
===================================================================
--- gnunet-gtk/src/plugins/daemon/Makefile.am 2005-07-04 22:56:51 UTC (rev
1260)
+++ gnunet-gtk/src/plugins/daemon/Makefile.am 2005-07-04 23:29:31 UTC (rev
1261)
@@ -12,6 +12,7 @@
libgnunetgtkmodule_daemon_la_SOURCES = \
daemon.c
libgnunetgtkmodule_daemon_la_LIBADD = \
- $(top_builddir)/src/common/libgnunetgtk_common.la
+ $(top_builddir)/src/common/libgnunetgtk_common.la \
+ -lgnunet_util
libgnunetgtkmodule_daemon_la_LDFLAGS = \
-export-dynamic -avoid-version -module
Modified: gnunet-gtk/src/plugins/daemon/daemon.c
===================================================================
--- gnunet-gtk/src/plugins/daemon/daemon.c 2005-07-04 22:56:51 UTC (rev
1260)
+++ gnunet-gtk/src/plugins/daemon/daemon.c 2005-07-04 23:29:31 UTC (rev
1261)
@@ -19,7 +19,7 @@
*/
/**
- * @file src/daemon.c
+ * @file src/plugins/daemon/daemon.c
* @brief code for gnunet-gtk gnunetd interaction
* @author Christian Grothoff
*/
@@ -30,51 +30,6 @@
#include "helper.h"
#include <GNUnet/gnunet_util.h>
-
-/**
- * Launch gnunetd w/ checks
- */
-void on_startDaemon_clicked(GtkWidget * widget,
- gpointer data) {
- GtkWidget * launchEntry = NULL;
- launchEntry
- = glade_xml_get_widget(mainXML,
- "startDaemon");
- gtk_widget_set_sensitive(launchEntry, FALSE);
- if (OK == checkGNUnetDaemonRunning() ) {
- cronCheckDaemon(NULL);
- return;
- } else {
- addLogEntry(_("Launching gnunetd..."));
- if (OK == startGNUnetDaemon(YES)) {
- addLogEntry(_("Launched gnunetd"));
- } else {
- addLogEntry(_("Launching gnunetd failed"));
- }
- }
-}
-
-/**
- * Kill gnunetd
- */
-void on_stopDaemon_clicked(GtkWidget * widget,
- gpointer data) {
- GtkWidget * killEntry = NULL;
- killEntry
- = glade_xml_get_widget(mainXML,
- "stopDaemon");
- gtk_widget_set_sensitive(killEntry, FALSE);
-
- if (OK == checkGNUnetDaemonRunning() ) {
- if (OK != stopGNUnetDaemon()) {
- guiMessage(_("Error requesting shutdown by gnunetd."));
- } else {
- addLogEntry(_("Terminating gnunetd..."));
- }
- }
- cronCheckDaemon(NULL);
-}
-
static gint doUpdateMenus(SaveCall * call) {
static GtkWidget * killEntry = NULL;
static GtkWidget * launchEntry = NULL;
@@ -135,7 +90,52 @@
}
}
-void __attribute__ ((constructor) daemon_ltdl_init(void) {
+
+/**
+ * Launch gnunetd w/ checks
+ */
+void on_startDaemon_clicked(GtkWidget * widget,
+ gpointer data) {
+ GtkWidget * launchEntry = NULL;
+ launchEntry
+ = glade_xml_get_widget(mainXML,
+ "startDaemon");
+ gtk_widget_set_sensitive(launchEntry, FALSE);
+ if (OK == checkGNUnetDaemonRunning() ) {
+ cronCheckDaemon(NULL);
+ return;
+ } else {
+ addLogEntry(_("Launching gnunetd..."));
+ if (OK == startGNUnetDaemon(YES)) {
+ addLogEntry(_("Launched gnunetd"));
+ } else {
+ addLogEntry(_("Launching gnunetd failed"));
+ }
+ }
+}
+
+/**
+ * Kill gnunetd
+ */
+void on_stopDaemon_clicked(GtkWidget * widget,
+ gpointer data) {
+ GtkWidget * killEntry = NULL;
+ killEntry
+ = glade_xml_get_widget(mainXML,
+ "stopDaemon");
+ gtk_widget_set_sensitive(killEntry, FALSE);
+
+ if (OK == checkGNUnetDaemonRunning() ) {
+ if (OK != stopGNUnetDaemon()) {
+ guiMessage(_("Error requesting shutdown by gnunetd."));
+ } else {
+ addLogEntry(_("Terminating gnunetd..."));
+ }
+ }
+ cronCheckDaemon(NULL);
+}
+
+void __attribute__ ((constructor)) daemon_ltdl_init(void) {
addCronJob(&cronCheckDaemon,
0,
15 * cronSECONDS,
Modified: gnunet-gtk/src/plugins/fs/fs.c
===================================================================
--- gnunet-gtk/src/plugins/fs/fs.c 2005-07-04 22:56:51 UTC (rev 1260)
+++ gnunet-gtk/src/plugins/fs/fs.c 2005-07-04 23:29:31 UTC (rev 1261)
@@ -19,7 +19,7 @@
*/
/**
- * @file src/fs.c
+ * @file src/plugins/fs/fs.c
* @brief main file-sharing code of gnunet-gtk
* @author Christian Grothoff
*/
@@ -120,7 +120,16 @@
(void*) event);
}
-void gtk_fs_init() {
+static void * shutdownCode(Semaphore * sig) {
+ fs_download_stop();
+ fs_search_stop();
+ FSUI_stop(ctx);
+ fs_upload_stop();
+ SEMAPHORE_UP(sig);
+ return NULL;
+}
+
+void __attribute__ ((constructor)) fs_ltdl_init(void) {
ctx = FSUI_start("gnunet-gtk",
YES,
&eventProcessor,
@@ -130,16 +139,7 @@
fs_upload_start();
}
-static void * shutdownCode(Semaphore * sig) {
- fs_download_stop();
- fs_search_stop();
- FSUI_stop(ctx);
- fs_upload_stop();
- SEMAPHORE_UP(sig);
- return NULL;
-}
-
-void gtk_fs_done() {
+void __attribute__ ((destructor)) fs_ltdl_fini(void) {
PTHREAD_T doneThread;
Semaphore * sig;
void * unused;
Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c 2005-07-04 22:56:51 UTC (rev 1260)
+++ gnunet-gtk/src/plugins/fs/search.c 2005-07-04 23:29:31 UTC (rev 1261)
@@ -19,7 +19,7 @@
*/
/**
- * @file src/search.c
+ * @file src/plugins/fs/search.c
* @brief code for searching with gnunet-gtk
* @author Christian Grothoff
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1261 - in gnunet-gtk: . src/common src/core src/plugins/about src/plugins/daemon src/plugins/fs,
grothoff <=