diff options
author | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2008-06-28 08:53:10 +0000 |
---|---|---|
committer | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2008-06-28 08:53:10 +0000 |
commit | bb6ccf56690f1b0066492bb117da6ecd4007cf87 (patch) | |
tree | c88514c27b87a5dc2ec39b0d3ef1d46cfc9216f2 | |
parent | 4cbd002f3aaa8c068ea4063be309c8c1e15a489b (diff) | |
download | gnunet-gtk-bb6ccf56690f1b0066492bb117da6ecd4007cf87.tar.gz gnunet-gtk-bb6ccf56690f1b0066492bb117da6ecd4007cf87.zip |
fix reporting gnunetd status when starting/stopping
-rw-r--r-- | gnunet-gtk.glade | 23 | ||||
-rw-r--r-- | src/plugins/daemon/daemon.c | 56 |
2 files changed, 36 insertions, 43 deletions
diff --git a/gnunet-gtk.glade b/gnunet-gtk.glade index 33471797..9007b9d6 100644 --- a/gnunet-gtk.glade +++ b/gnunet-gtk.glade | |||
@@ -275,7 +275,7 @@ This release adds context-menus (right-click) which allow copying the URI of sea | |||
275 | </packing> | 275 | </packing> |
276 | </child> | 276 | </child> |
277 | <child> | 277 | <child> |
278 | <widget class="GtkImage" id="statusPixmapNo"> | 278 | <widget class="GtkImage" id="statusPixmap"> |
279 | <property name="visible">True</property> | 279 | <property name="visible">True</property> |
280 | <property name="stock">gtk-no</property> | 280 | <property name="stock">gtk-no</property> |
281 | </widget> | 281 | </widget> |
@@ -286,27 +286,6 @@ This release adds context-menus (right-click) which allow copying the URI of sea | |||
286 | <property name="position">2</property> | 286 | <property name="position">2</property> |
287 | </packing> | 287 | </packing> |
288 | </child> | 288 | </child> |
289 | <child> | ||
290 | <widget class="GtkImage" id="statusPixmapYes"> | ||
291 | <property name="visible">True</property> | ||
292 | <property name="stock">gtk-yes</property> | ||
293 | </widget> | ||
294 | <packing> | ||
295 | <property name="expand">False</property> | ||
296 | <property name="fill">False</property> | ||
297 | <property name="padding">5</property> | ||
298 | <property name="position">3</property> | ||
299 | </packing> | ||
300 | </child> | ||
301 | <child> | ||
302 | <widget class="GtkImage" id="statusPixmapError"> | ||
303 | <property name="stock">gtk-dialog-error</property> | ||
304 | </widget> | ||
305 | <packing> | ||
306 | <property name="expand">False</property> | ||
307 | <property name="position">4</property> | ||
308 | </packing> | ||
309 | </child> | ||
310 | </widget> | 289 | </widget> |
311 | </child> | 290 | </child> |
312 | <child> | 291 | <child> |
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 | |||
271 | on_startDaemon_clicked_daemon (GtkWidget * widget, gpointer data) | 270 | on_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 | |||
359 | on_stopDaemon_clicked_daemon (GtkWidget * widget, gpointer data) | 365 | on_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 | ||
394 | void | 408 | void |