17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 |
*/ |
*/ |
19 |
|
|
20 |
/* gui_newlogdialog.c - creation and destruction of the newlog dialog |
/* gui_mergelogdialog.c - creation and destruction of the mergelog dialog |
21 |
* |
* |
22 |
* here we create a new log, if an existing logname is chosen, we open it. |
* This dialog shows 2 entries where log names should be filled in, clicking |
23 |
* If the logname is correct we fire up the logeditor, so we can choose |
* on OK will open them in one page. After that, the user can decide to sort |
24 |
* the fields which should be present in the log. |
* the log or not. |
25 |
*/ |
*/ |
26 |
|
|
27 |
#include <gtk/gtk.h> |
#include <gtk/gtk.h> |
30 |
#include "gui_mergedialog.h" |
#include "gui_mergedialog.h" |
31 |
#include "support.h" |
#include "support.h" |
32 |
#include "types.h" |
#include "types.h" |
33 |
|
#include "log.h" |
34 |
|
#include "utils.h" |
35 |
|
#include "gui_utils.h" |
36 |
|
|
37 |
extern GtkWidget *mainwindow; |
extern GtkWidget *mainwindow; |
38 |
extern preferencestype preferences; |
extern preferencestype preferences; |
39 |
|
extern statetype state; |
40 |
|
extern GList *logwindowlist; |
41 |
|
extern GtkWidget *mainnotebook; |
42 |
GtkWidget *mergelogdialog; |
GtkWidget *mergelogdialog; |
43 |
|
|
44 |
static void |
static void |
86 |
*label1, *log1entry, *log1hbox, *log1button, *hsep, |
*label1, *log1entry, *log1hbox, *log1button, *hsep, |
87 |
*label2, *log2entry, *log2hbox, *log2button; |
*label2, *log2entry, *log2hbox, *log2button; |
88 |
gint response; |
gint response; |
89 |
gchar *log1, *log2; |
gchar *log1, *log2, *logn, *logn1, *logn2, *temp; |
90 |
|
LOGDB *lp1, *lp2; |
91 |
|
logtype *logw; |
92 |
|
|
93 |
mergelogdialog = gtk_dialog_new_with_buttons (_("xlog - merge logs"), |
mergelogdialog = gtk_dialog_new_with_buttons (_("xlog - merge logs"), |
94 |
GTK_WINDOW(mainwindow), GTK_DIALOG_DESTROY_WITH_PARENT, |
GTK_WINDOW(mainwindow), GTK_DIALOG_DESTROY_WITH_PARENT, |
139 |
log2 = gtk_editable_get_chars (GTK_EDITABLE (log2entry), 0, -1); |
log2 = gtk_editable_get_chars (GTK_EDITABLE (log2entry), 0, -1); |
140 |
if ( (strlen(log1) > 0) && (strlen(log1) > 0) ) |
if ( (strlen(log1) > 0) && (strlen(log1) > 0) ) |
141 |
{ |
{ |
142 |
|
state.qsos = 0; |
143 |
|
lp1 = log_file_open (log1, TYPE_FLOG); |
144 |
|
lp2 = log_file_open (log2, TYPE_FLOG); |
145 |
|
if (lp1 && lp2) |
146 |
|
{ |
147 |
|
logn1 = logname (g_path_get_basename (log1)); |
148 |
|
logn2 = logname (g_path_get_basename (log2)); |
149 |
|
logn = g_strdup_printf ("%s+%s*", logn1, logn2); |
150 |
|
logw = openlog (lp1, logn, state.logwindows++); |
151 |
|
g_free (logn2); |
152 |
|
g_free (logn1); |
153 |
|
log_file_qso_foreach (lp1, fillin_list, logw); |
154 |
|
log_file_qso_foreach (lp2, fillin_list, logw); |
155 |
|
log_file_close (lp1); |
156 |
|
log_file_close (lp2); |
157 |
|
logw->filename = |
158 |
|
g_strconcat (preferences.savedir, G_DIR_SEPARATOR_S, logn, ".xlog", NULL); |
159 |
|
logw->logchanged = TRUE; |
160 |
|
g_free (logn); |
161 |
|
logwindowlist = g_list_append (logwindowlist, logw); |
162 |
|
gtk_notebook_set_current_page |
163 |
|
(GTK_NOTEBOOK(mainnotebook), state.logwindows - 1); |
164 |
|
set_qsoframe (logw); |
165 |
|
set_tabs_menu (); |
166 |
|
temp = g_strdup_printf |
167 |
|
(_("%d QSO's merged, the log may need sorting"), state.qsos); |
168 |
|
update_statusbar (temp); |
169 |
|
g_free (temp); |
170 |
|
} |
171 |
} |
} |
172 |
g_free (log2); |
g_free (log2); |
173 |
g_free (log1); |
g_free (log1); |