mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Separate Gtk related code from core logic: divelist
This is simplistic & brute force: any function that touches Gtk related data structures is moved to divelist-gtk.c, everything else stays in divelist.c. Header files have been adjusted so that this still compiles and appears to work. More thought is needed to truly abstract this out, but this seems to be a good point to commit this change. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a412753b0a
commit
1d61955be9
7 changed files with 2401 additions and 2305 deletions
2
Makefile
2
Makefile
|
@ -182,7 +182,7 @@ LIBS = $(LIBQT) $(LIBXML2) $(LIBXSLT) $(LIBSQLITE3) $(LIBGTK) $(LIBGCONF2) $(LIB
|
|||
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 \
|
||||
qt-gui.o statistics.o file.o cochran.o device.o download-dialog.o prefs.o \
|
||||
webservice.o sha1.o $(GPSOBJ) $(OSSUPPORT).o $(RESFILE)
|
||||
|
|
|
@ -81,7 +81,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);
|
||||
|
||||
|
|
2
dive.h
2
dive.h
|
@ -414,7 +414,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 */
|
||||
|
|
2325
divelist-gtk.c
Normal file
2325
divelist-gtk.c
Normal file
File diff suppressed because it is too large
Load diff
2349
divelist.c
2349
divelist.c
File diff suppressed because it is too large
Load diff
22
divelist.h
22
divelist.h
|
@ -4,7 +4,6 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct dive;
|
||||
|
||||
extern void dive_list_update_dives(void);
|
||||
|
@ -21,6 +20,27 @@ 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 trip_has_selected_dives(dive_trip_t *trip);
|
||||
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
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -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