417 |
savelog (gpointer arg, gchar * logfile, gint type, gint first, gint last) |
savelog (gpointer arg, gchar * logfile, gint type, gint first, gint last) |
418 |
{ |
{ |
419 |
LOGDB *lp; |
LOGDB *lp; |
420 |
gint i, j, pid = 0; |
gint i, j, pid; |
421 |
G_CONST_RETURN gchar *label; |
G_CONST_RETURN gchar *label; |
422 |
gchar **item, *pathstr; |
gchar **item, *pathstr; |
423 |
gint fields[QSO_FIELDS], widths[QSO_FIELDS]; |
gint fields[QSO_FIELDS], widths[QSO_FIELDS]; |
426 |
GtkTreeModel *model; |
GtkTreeModel *model; |
427 |
GtkTreePath *path; |
GtkTreePath *path; |
428 |
GtkTreeIter iter; |
GtkTreeIter iter; |
|
gboolean largelog = FALSE; |
|
429 |
|
|
430 |
item = g_new0 (gchar *, QSO_FIELDS); |
item = g_new0 (gchar *, QSO_FIELDS); |
431 |
|
|
445 |
} |
} |
446 |
|
|
447 |
lp = log_file_create (logfile, type, logw->columns, fields, widths); |
lp = log_file_create (logfile, type, logw->columns, fields, widths); |
|
if (last - first > 1000) largelog = TRUE; |
|
448 |
|
|
449 |
if (lp) |
if (lp) |
450 |
{ |
{ |
451 |
if (largelog) |
pid = fork (); /* use fork for large log saving */ |
|
pid = fork (); /* use fork for large log saving */ |
|
452 |
if (pid == 0) |
if (pid == 0) |
453 |
{ |
{ |
454 |
model = gtk_tree_view_get_model (GTK_TREE_VIEW(logw->treeview)); |
model = gtk_tree_view_get_model (GTK_TREE_VIEW(logw->treeview)); |
471 |
g_free (pathstr); |
g_free (pathstr); |
472 |
} |
} |
473 |
log_file_close (lp); |
log_file_close (lp); |
474 |
if (largelog) _exit (0); |
_exit (0); |
475 |
} |
} |
476 |
/* check the child every second */ |
/* check the child every second */ |
477 |
if (largelog) |
log_file_close (lp); |
478 |
g_timeout_add (1000, (GSourceFunc) childcheck, NULL); |
g_timeout_add (1000, (GSourceFunc) childcheck, NULL); |
479 |
} |
} |
480 |
else |
else |
481 |
{ |
{ |