mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Remove Gtk crud
The DEBUGFILE logic isn't needed anymore. Nor are helpers dealing with model / datastructure updates. Nor conditional compiles to use Gtk instead of Qt. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6d3a4ec9b2
commit
5aa8b52f82
4 changed files with 1 additions and 68 deletions
5
dive.h
5
dive.h
|
@ -743,11 +743,6 @@ struct tank_info {
|
||||||
int cuft, ml, psi, bar;
|
int cuft, ml, psi, bar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef DEBUGFILE
|
|
||||||
extern char *debugfilename;
|
|
||||||
extern FILE *debugfile;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
53
main.c
53
main.c
|
@ -10,15 +10,6 @@
|
||||||
#include "dive.h"
|
#include "dive.h"
|
||||||
#include "divelist.h"
|
#include "divelist.h"
|
||||||
|
|
||||||
#ifdef USE_GTK_UI
|
|
||||||
#include <osm-gps-map.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUGFILE
|
|
||||||
char *debugfilename;
|
|
||||||
FILE *debugfile;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct preferences prefs;
|
struct preferences prefs;
|
||||||
struct preferences default_prefs = {
|
struct preferences default_prefs = {
|
||||||
.units = SI_UNITS,
|
.units = SI_UNITS,
|
||||||
|
@ -100,11 +91,7 @@ static void parse_argument(const char *arg)
|
||||||
if (strcmp(arg,"--import") == 0) {
|
if (strcmp(arg,"--import") == 0) {
|
||||||
/* mark the dives so far as the base,
|
/* mark the dives so far as the base,
|
||||||
* everything after is imported */
|
* everything after is imported */
|
||||||
#if USE_GTK_UI
|
|
||||||
report_dives(FALSE, FALSE);
|
|
||||||
#else
|
|
||||||
process_dives(FALSE, FALSE);
|
process_dives(FALSE, FALSE);
|
||||||
#endif
|
|
||||||
imported = TRUE;
|
imported = TRUE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -122,22 +109,6 @@ static void parse_argument(const char *arg)
|
||||||
} while (*++p);
|
} while (*++p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_dive(struct dive *new_dive)
|
|
||||||
{
|
|
||||||
#if USE_GTK_UI
|
|
||||||
static struct dive *buffered_dive;
|
|
||||||
struct dive *old_dive = buffered_dive;
|
|
||||||
|
|
||||||
if (old_dive) {
|
|
||||||
flush_divelist(old_dive);
|
|
||||||
}
|
|
||||||
show_dive_info(new_dive);
|
|
||||||
show_dive_equipment(new_dive, W_IDX_PRIMARY);
|
|
||||||
show_dive_stats(new_dive);
|
|
||||||
buffered_dive = new_dive;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void renumber_dives(int nr)
|
void renumber_dives(int nr)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -145,9 +116,6 @@ void renumber_dives(int nr)
|
||||||
for (i = 0; i < dive_table.nr; i++) {
|
for (i = 0; i < dive_table.nr; i++) {
|
||||||
struct dive *dive = dive_table.dives[i];
|
struct dive *dive = dive_table.dives[i];
|
||||||
dive->number = nr + i;
|
dive->number = nr + i;
|
||||||
#if USE_GTK_UI
|
|
||||||
flush_divelist(dive);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
mark_divelist_changed(TRUE);
|
mark_divelist_changed(TRUE);
|
||||||
}
|
}
|
||||||
|
@ -204,16 +172,6 @@ int main(int argc, char **argv)
|
||||||
setup_system_prefs();
|
setup_system_prefs();
|
||||||
prefs = default_prefs;
|
prefs = default_prefs;
|
||||||
|
|
||||||
#if DEBUGFILE > 1
|
|
||||||
debugfile = stderr;
|
|
||||||
#elif defined(DEBUGFILE)
|
|
||||||
debugfilename = strdup(prefs.default_filename);
|
|
||||||
strncpy(debugfilename + strlen(debugfilename) - 3, "log", 3);
|
|
||||||
if (g_mkdir_with_parents(g_path_get_dirname(debugfilename), 0664) != 0 ||
|
|
||||||
(debugfile = g_fopen(debugfilename, "w")) == NULL)
|
|
||||||
printf("oh boy, can't create debugfile");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
subsurface_command_line_init(&argc, &argv);
|
subsurface_command_line_init(&argc, &argv);
|
||||||
parse_xml_init();
|
parse_xml_init();
|
||||||
|
|
||||||
|
@ -253,23 +211,12 @@ int main(int argc, char **argv)
|
||||||
sure we remember this as the filename in use */
|
sure we remember this as the filename in use */
|
||||||
set_filename(filename, FALSE);
|
set_filename(filename, FALSE);
|
||||||
}
|
}
|
||||||
#if USE_GTK_UI
|
|
||||||
report_dives(imported, FALSE);
|
|
||||||
if (dive_table.nr == 0)
|
|
||||||
show_dive_info(NULL);
|
|
||||||
#else
|
|
||||||
process_dives(imported, FALSE);
|
process_dives(imported, FALSE);
|
||||||
#endif
|
|
||||||
|
|
||||||
parse_xml_exit();
|
parse_xml_exit();
|
||||||
subsurface_command_line_exit(&argc, &argv);
|
subsurface_command_line_exit(&argc, &argv);
|
||||||
|
|
||||||
init_qt_ui(&argc, &argv); /* qt bit delayed until dives are parsed */
|
init_qt_ui(&argc, &argv); /* qt bit delayed until dives are parsed */
|
||||||
run_ui();
|
run_ui();
|
||||||
exit_ui();
|
exit_ui();
|
||||||
#ifdef DEBUGFILE
|
|
||||||
if (debugfile)
|
|
||||||
fclose(debugfile);
|
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,9 +91,6 @@ void init_ui(int *argcp, char ***argvp)
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
subsurface_open_conf();
|
|
||||||
|
|
||||||
load_preferences();
|
|
||||||
|
|
||||||
/* these still need to be handled in QSettings */
|
/* these still need to be handled in QSettings */
|
||||||
default_dive_computer_vendor = subsurface_get_conf("dive_computer_vendor");
|
default_dive_computer_vendor = subsurface_get_conf("dive_computer_vendor");
|
||||||
|
@ -111,9 +108,6 @@ void run_ui(void)
|
||||||
void exit_ui(void)
|
void exit_ui(void)
|
||||||
{
|
{
|
||||||
delete application;
|
delete application;
|
||||||
#if 0
|
|
||||||
subsurface_close_conf();
|
|
||||||
#endif
|
|
||||||
if (existing_filename)
|
if (existing_filename)
|
||||||
free((void *)existing_filename);
|
free((void *)existing_filename);
|
||||||
// if (default_dive_computer_device)
|
// if (default_dive_computer_device)
|
||||||
|
|
|
@ -467,7 +467,7 @@ void save_dive(FILE *f, struct dive *dive)
|
||||||
fprintf(f, " rating='%d'", dive->rating);
|
fprintf(f, " rating='%d'", dive->rating);
|
||||||
if (dive->visibility)
|
if (dive->visibility)
|
||||||
fprintf(f, " visibility='%d'", dive->visibility);
|
fprintf(f, " visibility='%d'", dive->visibility);
|
||||||
if (dive->dive_tags)
|
if (dive->dive_tags)
|
||||||
save_tags(f, dive->dive_tags);
|
save_tags(f, dive->dive_tags);
|
||||||
|
|
||||||
show_date(f, dive->when);
|
show_date(f, dive->when);
|
||||||
|
@ -575,9 +575,6 @@ void save_dives_logic(const char *filename, const gboolean select_only)
|
||||||
if (!f)
|
if (!f)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Flush any edits of current dives back to the dives! */
|
|
||||||
update_dive(current_dive);
|
|
||||||
|
|
||||||
fprintf(f, "<divelog program='subsurface' version='%d'>\n<settings>\n", VERSION);
|
fprintf(f, "<divelog program='subsurface' version='%d'>\n<settings>\n", VERSION);
|
||||||
|
|
||||||
/* save the dive computer nicknames, if any */
|
/* save the dive computer nicknames, if any */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue