[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r1302 - in gnunet-gtk: . src/plugins/daemon
From: |
grothoff |
Subject: |
[GNUnet-SVN] r1302 - in gnunet-gtk: . src/plugins/daemon |
Date: |
Wed, 6 Jul 2005 16:46:05 -0700 (PDT) |
Author: grothoff
Date: 2005-07-06 16:46:00 -0700 (Wed, 06 Jul 2005)
New Revision: 1302
Modified:
gnunet-gtk/gnunet-gtk.glade
gnunet-gtk/src/plugins/daemon/Makefile.am
gnunet-gtk/src/plugins/daemon/daemon.c
Log:
getoption
Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2005-07-06 21:52:56 UTC (rev 1301)
+++ gnunet-gtk/gnunet-gtk.glade 2005-07-06 23:46:00 UTC (rev 1302)
@@ -568,7 +568,7 @@
<property
name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <widget class="GtkTreeView" id="clist2">
+ <widget class="GtkTreeView"
id="applicationList">
<property agent="glademm"
name="cxx_visibility">public</property>
<property
name="visible">True</property>
<property
name="can_focus">True</property>
Modified: gnunet-gtk/src/plugins/daemon/Makefile.am
===================================================================
--- gnunet-gtk/src/plugins/daemon/Makefile.am 2005-07-06 21:52:56 UTC (rev
1301)
+++ gnunet-gtk/src/plugins/daemon/Makefile.am 2005-07-06 23:46:00 UTC (rev
1302)
@@ -3,16 +3,17 @@
-I$(top_srcdir)/src/include \
@GTK_CFLAGS@ \
@GNUNETGTK_CFLAGS@
-
+
plugindir = $(libdir)/GNUnet
-
+
plugin_LTLIBRARIES = \
libgnunetgtkmodule_daemon.la
-
+
libgnunetgtkmodule_daemon_la_SOURCES = \
daemon.c
libgnunetgtkmodule_daemon_la_LIBADD = \
$(top_builddir)/src/common/libgnunetgtk_common.la \
- -lgnunetutil
+ -lgnunetutil \
+ -lgnunetgetoption_api
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-06 21:52:56 UTC (rev
1301)
+++ gnunet-gtk/src/plugins/daemon/daemon.c 2005-07-06 23:46:00 UTC (rev
1302)
@@ -26,6 +26,7 @@
#include "platform.h"
#include "gnunetgtk_common.h"
+#include <GNUnet/gnunet_getoption_lib.h>
static void doUpdateMenus(void * arg) {
@@ -139,24 +140,109 @@
cronCheckDaemon(NULL);
}
+
+/**
+ * cron job that periodically updates the model for the
+ * application list.
+ */
+static void updateAppModelSafe(void * unused) {
+ GNUNET_TCP_SOCKET * sock;
+ GtkWidget * w;
+ GtkListStore * model;
+ GtkTreeIter iter;
+ char * apps;
+ char * next;
+ char * pos;
+
+ model = gtk_list_store_new(1, G_TYPE_STRING);
+ sock = getClientSocket();
+ if (sock == NULL) {
+ apps = NULL;
+ } else {
+ apps
+ = getConfigurationOptionValue(sock,
+ "GNUNETD",
+ "APPLICATIONS");
+ releaseClientSocket(sock);
+ }
+ if (apps != NULL) {
+ next = apps;
+ 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) {
+ gtk_list_store_append(model,
+ &iter);
+ gtk_list_store_set(model,
+ &iter,
+ 0, pos,
+ -1);
+ }
+ } while (next != NULL);
+ FREE(apps);
+ }
+ w = glade_xml_get_widget(getMainXML(),
+ "applicationList");
+ gtk_tree_view_set_model(GTK_TREE_VIEW(w),
+ GTK_TREE_MODEL(model));
+}
+
+static void updateAppModel(void * dummy) {
+ gtkSaveCall(&updateAppModelSafe, NULL);
+}
+
void init_daemon() {
GtkWidget * tab;
+ GtkWidget * apps;
+ GtkListStore * model;
+ GtkCellRenderer * renderer;
+ apps
+ = glade_xml_get_widget(getMainXML(),
+ "applicationList");
+ model = gtk_list_store_new(1, G_TYPE_STRING);
+ gtk_tree_view_set_model(GTK_TREE_VIEW(apps),
+ GTK_TREE_MODEL(model));
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(apps),
+ -1,
+ _("Applications"),
+ renderer,
+ "text", 0,
+ NULL);
+
+ updateAppModelSafe(NULL);
tab
= glade_xml_get_widget(getMainXML(),
"daemonScrolledWindow");
-
gtk_widget_show(tab);
addCronJob(&cronCheckDaemon,
0,
15 * cronSECONDS,
NULL);
+ addCronJob(&updateAppModel,
+ 5 * cronMINUTES,
+ 5 * cronMINUTES,
+ NULL);
}
void done_daemon() {
delCronJob(&cronCheckDaemon,
15 * cronSECONDS,
NULL);
+ delCronJob(&updateAppModel,
+ 5 * cronMINUTES,
+ NULL);
}
/* end of daemon.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r1302 - in gnunet-gtk: . src/plugins/daemon,
grothoff <=