1066 |
on_trace_hamlib_activate(GtkMenuItem * menuitem, gpointer user_data) |
on_trace_hamlib_activate(GtkMenuItem * menuitem, gpointer user_data) |
1067 |
{ |
{ |
1068 |
#if WANT_HAMLIB |
#if WANT_HAMLIB |
1069 |
GtkWidget *tracedialog, *tracelabel; |
GtkWidget *tracedialog, *tracelabel, *tracewarningdialog; |
1070 |
gint hamlibresult; |
gint hamlibresult; |
1071 |
gchar *tracestr; |
gchar *tracestr; |
1072 |
|
|
1073 |
|
if (preferences.hamlib == 0) |
1074 |
|
{ |
1075 |
|
tracewarningdialog = create_tracewarningdialog(); |
1076 |
|
gtk_widget_show (tracewarningdialog); |
1077 |
|
} |
1078 |
|
else |
1079 |
|
{ |
1080 |
/* redirect stderr to a file and start the file monitor, |
/* redirect stderr to a file and start the file monitor, |
1081 |
stop and start hamlib with tracing enabled */ |
stop and start hamlib with tracing enabled */ |
1082 |
tracedialog = create_tracedialog(); |
tracedialog = create_tracedialog(); |
1083 |
|
|
1084 |
saved_fd = dup (STDERR_FILENO); |
saved_fd = dup (STDERR_FILENO); |
1085 |
finfo.filename = g_strdup_printf ( "%s/hamlib.out", xlogdir); |
finfo.filename = g_strdup_printf ( "%s/hamlib.out", xlogdir); |
1086 |
stop_hamlib(); |
stop_hamlib(); |
1087 |
finfo.fd = freopen (finfo.filename, "w", stderr); |
finfo.fd = freopen (finfo.filename, "w", stderr); |
1088 |
hamlibresult = start_hamlib (preferences.radio, preferences.device, |
hamlibresult = start_hamlib (preferences.radio, preferences.device, |
1089 |
RIG_DEBUG_TRACE, preferences.polltime); |
RIG_DEBUG_TRACE, preferences.polltime); |
1090 |
tracetimer = gtk_timeout_add (1000, (GtkFunction) updatetrace, tracedialog); |
tracetimer = gtk_timeout_add (1000, (GtkFunction) updatetrace, tracedialog); |
1091 |
|
|
1092 |
tracelabel = lookup_widget(tracedialog, "tracelabel"); |
tracelabel = lookup_widget(tracedialog, "tracelabel"); |
1093 |
tracestr = g_strdup_printf ( _("Saving to %s"), finfo.filename); |
tracestr = g_strdup_printf ( _("Saving to %s"), finfo.filename); |
1094 |
gtk_label_set_text (GTK_LABEL (tracelabel), tracestr); |
gtk_label_set_text (GTK_LABEL (tracelabel), tracestr); |
1095 |
g_free(tracestr); |
g_free(tracestr); |
1096 |
gtk_widget_show (tracedialog); |
gtk_widget_show (tracedialog); |
1097 |
|
} |
1098 |
#endif |
#endif |
1099 |
} |
} |
1100 |
|
|