mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-18 01:26:16 +00:00
Merge branch 'cleanup-from-Qt-branch' of github.com:henrik242/subsurface
This commit is contained in:
commit
387dbe510f
10 changed files with 2426 additions and 2311 deletions
2
Makefile
2
Makefile
|
@ -162,7 +162,7 @@ LIBS = $(LIBXML2) $(LIBXSLT) $(LIBSQLITE3) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPU
|
|||
MSGLANGS=$(notdir $(wildcard po/*.po))
|
||||
MSGOBJS=$(addprefix share/locale/,$(MSGLANGS:.po=.UTF-8/LC_MESSAGES/subsurface.mo))
|
||||
|
||||
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o deco.o planner.o \
|
||||
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o divelist-gtk.o deco.o planner.o \
|
||||
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o uemis-downloader.o \
|
||||
gtk-gui.o statistics.o file.o cochran.o device.o download-dialog.o prefs.o \
|
||||
webservice.o sha1.o $(GPSOBJ) $(OSSUPPORT).o $(RESFILE)
|
||||
|
|
|
@ -77,7 +77,7 @@ extern GtkWidget *create_label(const char *fmt, ...);
|
|||
|
||||
extern gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data);
|
||||
|
||||
unsigned int amount_selected;
|
||||
extern unsigned int amount_selected;
|
||||
|
||||
extern void process_selected_dives(void);
|
||||
|
||||
|
|
4
dive.h
4
dive.h
|
@ -410,7 +410,7 @@ static inline int rel_mbar_to_depth(int mbar, struct dive *dive)
|
|||
* be able to edit a dive without unintended side effects */
|
||||
extern struct dive edit_dive;
|
||||
|
||||
extern gboolean autogroup;
|
||||
extern short autogroup;
|
||||
/* random threashold: three days without diving -> new trip
|
||||
* this works very well for people who usually dive as part of a trip and don't
|
||||
* regularly dive at a local facility; this is why trips are an optional feature */
|
||||
|
@ -551,7 +551,7 @@ extern void set_filename(const char *filename, gboolean force);
|
|||
|
||||
extern int parse_dm4_buffer(const char *url, const char *buf, int size, struct dive_table *table, GError **error);
|
||||
|
||||
extern void parse_file(const char *filename, GError **error, gboolean possible_default_filename);
|
||||
extern void parse_file(const char *filename, GError **error);
|
||||
|
||||
extern void show_dive_info(struct dive *);
|
||||
|
||||
|
|
2276
divelist-gtk.c
Normal file
2276
divelist-gtk.c
Normal file
File diff suppressed because it is too large
Load diff
2398
divelist.c
2398
divelist.c
File diff suppressed because it is too large
Load diff
24
divelist.h
24
divelist.h
|
@ -16,4 +16,28 @@ extern void select_prev_dive(void);
|
|||
extern void show_and_select_dive(struct dive *dive);
|
||||
extern double init_decompression(struct dive * dive);
|
||||
extern void export_all_dives_uddf_cb();
|
||||
|
||||
/* divelist core logic functions */
|
||||
extern dive_trip_t *find_trip_by_idx(int idx);
|
||||
extern int dive_nr_sort(int idx_a, int idx_b, timestamp_t when_a, timestamp_t when_b);
|
||||
extern int trip_has_selected_dives(dive_trip_t *trip);
|
||||
extern void get_depth_values(int depth, int *depth_int, int *depth_decimal, int *show_decimal);
|
||||
extern void get_dive_gas(struct dive *dive, int *o2_p, int *he_p, int *o2low_p);
|
||||
extern int get_divenr(struct dive *dive);
|
||||
extern void get_location(struct dive *dive, char **str);
|
||||
extern void get_cylinder(struct dive *dive, char **str);
|
||||
extern void get_suit(struct dive *dive, char **str);
|
||||
extern dive_trip_t *find_matching_trip(timestamp_t when);
|
||||
extern void remove_dive_from_trip(struct dive *dive);
|
||||
extern dive_trip_t *create_and_hookup_trip_from_dive(struct dive *dive);
|
||||
extern void autogroup_dives(void);
|
||||
extern void merge_dive_index(int i, struct dive *a);
|
||||
extern void select_dive(int idx);
|
||||
extern void deselect_dive(int idx);
|
||||
|
||||
#ifdef DEBUG_TRIP
|
||||
extern void dump_selection(void);
|
||||
extern void dump_trip_list(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
12
file.c
12
file.c
|
@ -263,7 +263,7 @@ static void parse_file_buffer(const char *filename, struct memblock *mem, GError
|
|||
parse_xml_buffer(filename, mem->buffer, mem->size, &dive_table, error);
|
||||
}
|
||||
|
||||
void parse_file(const char *filename, GError **error, gboolean possible_default_filename)
|
||||
void parse_file(const char *filename, GError **error)
|
||||
{
|
||||
struct memblock mem;
|
||||
#ifdef SQLITE3
|
||||
|
@ -283,19 +283,9 @@ void parse_file(const char *filename, GError **error, gboolean possible_default_
|
|||
filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* We do *not* want to leave the old default_filename
|
||||
* just because the open failed.
|
||||
*/
|
||||
if (possible_default_filename)
|
||||
set_filename(filename, TRUE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (possible_default_filename)
|
||||
set_filename(filename, TRUE);
|
||||
|
||||
#ifdef SQLITE3
|
||||
fmt = strrchr(filename, '.');
|
||||
if (fmt && (!strcasecmp(fmt + 1, "DB") || !strcasecmp(fmt + 1, "BAK"))) {
|
||||
|
|
|
@ -321,7 +321,8 @@ static void file_open(GtkWidget *w, gpointer data)
|
|||
|
||||
GError *error = NULL;
|
||||
filename = fn_glist->data;
|
||||
parse_file(filename, &error, TRUE);
|
||||
parse_file(filename, &error);
|
||||
set_filename(filename, TRUE);
|
||||
if (error != NULL)
|
||||
{
|
||||
report_error(error);
|
||||
|
@ -2204,7 +2205,7 @@ static GtkWidget *dive_profile_widget(void)
|
|||
static void do_import_file(gpointer data, gpointer user_data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
parse_file(data, &error, FALSE);
|
||||
parse_file((const char *)data, &error);
|
||||
|
||||
if (error != NULL)
|
||||
{
|
||||
|
|
10
main.c
10
main.c
|
@ -348,8 +348,12 @@ int main(int argc, char **argv)
|
|||
/* if we have exactly one filename, parse_file will set
|
||||
* that to be the default. Otherwise there will be no default filename */
|
||||
set_filename(NULL, TRUE);
|
||||
parse_file(a, &error, no_filenames);
|
||||
no_filenames = FALSE;
|
||||
parse_file(a, &error);
|
||||
if (no_filenames)
|
||||
{
|
||||
set_filename(a, TRUE);
|
||||
no_filenames = FALSE;
|
||||
}
|
||||
if (error != NULL)
|
||||
{
|
||||
report_error(error);
|
||||
|
@ -360,7 +364,7 @@ int main(int argc, char **argv)
|
|||
if (no_filenames) {
|
||||
GError *error = NULL;
|
||||
const char *filename = prefs.default_filename;
|
||||
parse_file(filename, &error, TRUE);
|
||||
parse_file(filename, &error);
|
||||
/* don't report errors - this file may not exist, but make
|
||||
sure we remember this as the filename in use */
|
||||
set_filename(filename, FALSE);
|
||||
|
|
|
@ -731,7 +731,7 @@ static void process_raw_buffer(uint32_t deviceid, char *inbuf, char **max_divenr
|
|||
return;
|
||||
}
|
||||
|
||||
static char *get_divenr(char *deviceidstr)
|
||||
static char *uemis_get_divenr(char *deviceidstr)
|
||||
{
|
||||
uint32_t deviceid, maxdiveid = 0;
|
||||
int i;
|
||||
|
@ -789,7 +789,7 @@ static char *do_uemis_download(struct argument_block *args)
|
|||
/* if we have an empty divelist or force it, then we start downloading from the
|
||||
* first dive on the Uemis; otherwise check which was the last dive downloaded */
|
||||
if (!args->force_download && dive_table.nr > 0)
|
||||
newmax = get_divenr(deviceid);
|
||||
newmax = uemis_get_divenr(deviceid);
|
||||
else
|
||||
newmax = strdup("0");
|
||||
start = atoi(newmax);
|
||||
|
|
Loading…
Add table
Reference in a new issue