aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/daemon/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/daemon/daemon.c')
-rw-r--r--src/plugins/daemon/daemon.c56
1 files changed, 35 insertions, 21 deletions
diff --git a/src/plugins/daemon/daemon.c b/src/plugins/daemon/daemon.c
index a120b03c..1e0280a6 100644
--- a/src/plugins/daemon/daemon.c
+++ b/src/plugins/daemon/daemon.c
@@ -131,9 +131,7 @@ doUpdateMenus (void *arg)
131 int ret = *(int *) arg; 131 int ret = *(int *) arg;
132 static GtkWidget *killEntry = NULL; 132 static GtkWidget *killEntry = NULL;
133 static GtkWidget *launchEntry = NULL; 133 static GtkWidget *launchEntry = NULL;
134 static GtkWidget *statsEntryYes = NULL; 134 static GtkWidget *statsEntry = NULL;
135 static GtkWidget *statsEntryNo = NULL;
136 static GtkWidget *statsEntryError = NULL;
137 static GtkWidget *chooser = NULL; 135 static GtkWidget *chooser = NULL;
138 static int once = 1; 136 static int once = 1;
139 static int isLocal; 137 static int isLocal;
@@ -151,15 +149,9 @@ doUpdateMenus (void *arg)
151 launchEntry = 149 launchEntry =
152 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), 150 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
153 "startDaemon"); 151 "startDaemon");
154 statsEntryYes = 152 statsEntry =
155 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), 153 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
156 "statusPixmapYes"); 154 "statusPixmap");
157 statsEntryNo =
158 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
159 "statusPixmapNo");
160 statsEntryError =
161 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
162 "statusPixmapError");
163 chooser = 155 chooser =
164 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), 156 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
165 "gnunetdconfigFileChooserButton"); 157 "gnunetdconfigFileChooserButton");
@@ -216,26 +208,28 @@ doUpdateMenus (void *arg)
216 } 208 }
217 g_free (fn); 209 g_free (fn);
218 } 210 }
219 gtk_widget_hide (statsEntryYes); 211 gtk_image_set_from_stock (GTK_IMAGE(statsEntry), GTK_STOCK_YES,
212 GTK_ICON_SIZE_SMALL_TOOLBAR);
220 gtk_widget_set_sensitive (killEntry, FALSE); 213 gtk_widget_set_sensitive (killEntry, FALSE);
221 if (canStart && isLocal) 214 if (canStart && isLocal)
222 { 215 {
223 gtk_widget_set_sensitive (launchEntry, TRUE); 216 gtk_widget_set_sensitive (launchEntry, TRUE);
224 gtk_widget_show_all (statsEntryNo); 217 gtk_image_set_from_stock (GTK_IMAGE(statsEntry), GTK_STOCK_NO,
225 gtk_widget_hide (statsEntryError); 218 GTK_ICON_SIZE_SMALL_TOOLBAR);
226 } 219 }
227 else 220 else
228 { 221 {
229 gtk_widget_set_sensitive (launchEntry, FALSE); 222 gtk_widget_set_sensitive (launchEntry, FALSE);
230 gtk_widget_show_all (statsEntryError); 223 gtk_image_set_from_stock (GTK_IMAGE(statsEntry),
231 gtk_widget_hide (statsEntryNo); 224 GTK_STOCK_DIALOG_ERROR,
225 GTK_ICON_SIZE_SMALL_TOOLBAR);
226
232 } 227 }
233 } 228 }
234 else 229 else
235 { 230 {
236 gtk_widget_hide (statsEntryNo); 231 gtk_image_set_from_stock (GTK_IMAGE(statsEntry), GTK_STOCK_YES,
237 gtk_widget_hide (statsEntryError); 232 GTK_ICON_SIZE_SMALL_TOOLBAR);
238 gtk_widget_show_all (statsEntryYes);
239 gtk_widget_set_sensitive (killEntry, TRUE); 233 gtk_widget_set_sensitive (killEntry, TRUE);
240 gtk_widget_set_sensitive (launchEntry, FALSE); 234 gtk_widget_set_sensitive (launchEntry, FALSE);
241 } 235 }
@@ -259,6 +253,11 @@ cronCheckDaemon (void *dummy)
259 { 253 {
260 updateAppModel (NULL); 254 updateAppModel (NULL);
261 last = ret; 255 last = ret;
256 GNUNET_cron_del_job (cron, &cronCheckDaemon,
257 1/2 * GNUNET_CRON_SECONDS, NULL);
258 GNUNET_cron_add_job (cron, &cronCheckDaemon,
259 15 * GNUNET_CRON_SECONDS,
260 15 * GNUNET_CRON_SECONDS, NULL);
262 } 261 }
263 GNUNET_GTK_save_call (&doUpdateMenus, &ret); 262 GNUNET_GTK_save_call (&doUpdateMenus, &ret);
264} 263}
@@ -271,6 +270,7 @@ void
271on_startDaemon_clicked_daemon (GtkWidget * widget, gpointer data) 270on_startDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
272{ 271{
273 GtkWidget *launchEntry; 272 GtkWidget *launchEntry;
273 GtkWidget *statsEntry;
274 GtkWidget *chooser; 274 GtkWidget *chooser;
275 char *fn; 275 char *fn;
276 char *user; 276 char *user;
@@ -290,6 +290,12 @@ on_startDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
290 else 290 else
291 { 291 {
292 GNUNET_GTK_add_log_entry (_("Launching gnunetd...\n")); 292 GNUNET_GTK_add_log_entry (_("Launching gnunetd...\n"));
293 statsEntry =
294 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
295 "statusPixmap");
296 gtk_image_set_from_stock (GTK_IMAGE(statsEntry), GTK_STOCK_EXECUTE,
297 GTK_ICON_SIZE_SMALL_TOOLBAR);
298
293 chooser 299 chooser
294 = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), 300 = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
295 "gnunetdconfigFileChooserButton"); 301 "gnunetdconfigFileChooserButton");
@@ -359,8 +365,11 @@ void
359on_stopDaemon_clicked_daemon (GtkWidget * widget, gpointer data) 365on_stopDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
360{ 366{
361 GtkWidget *killEntry = NULL; 367 GtkWidget *killEntry = NULL;
368 GtkWidget *statsEntry;
362 struct GNUNET_ClientServerConnection *sock; 369 struct GNUNET_ClientServerConnection *sock;
363 370
371 GNUNET_cron_del_job (cron, &cronCheckDaemon, 15 * GNUNET_CRON_SECONDS,
372 NULL);
364 killEntry = 373 killEntry =
365 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "stopDaemon"); 374 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "stopDaemon");
366 gtk_widget_set_sensitive (killEntry, FALSE); 375 gtk_widget_set_sensitive (killEntry, FALSE);
@@ -383,12 +392,17 @@ on_stopDaemon_clicked_daemon (GtkWidget * widget, gpointer data)
383 } 392 }
384 else 393 else
385 { 394 {
395 statsEntry =
396 glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
397 "statusPixmap");
398 gtk_image_set_from_stock (GTK_IMAGE(statsEntry), GTK_STOCK_EXECUTE,
399 GTK_ICON_SIZE_SMALL_TOOLBAR);
386 GNUNET_GTK_add_log_entry (_("Terminating gnunetd...\n")); 400 GNUNET_GTK_add_log_entry (_("Terminating gnunetd...\n"));
387 } 401 }
388 GNUNET_client_connection_destroy (sock); 402 GNUNET_client_connection_destroy (sock);
389 } 403 }
390 GNUNET_cron_advance_job (GNUNET_GTK_get_cron_manager (), 404 GNUNET_cron_add_job (cron, &cronCheckDaemon, 1 * GNUNET_CRON_SECONDS,
391 &cronCheckDaemon, 15 * GNUNET_CRON_SECONDS, NULL); 405 1/2 * GNUNET_CRON_SECONDS, NULL);
392} 406}
393 407
394void 408void