Separate Gtk related code from core logic: info

Surprisingly straight forward, just a couple of places where we really mix
significant logic with UI code (for example setting the window title).

I had to move amount_selected from display-gtk.h to display.h - I guess
the number of dives that are selected is UI independent. But I wonder if
we still will track this as a global variable in a Qt UI (since the Gtk
selection logic is the main reason this existed in the first place).

Added a new info.h files for the necessary declarations.

This should make no difference to functionality.

Cherry-picked from Qt branch; fixed merge issues mostly caused by
dive_tags and Makefile changes.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-04-14 11:31:26 -07:00
parent bfe21343ca
commit 4c775289a7
6 changed files with 1117 additions and 1060 deletions

View file

@ -162,15 +162,15 @@ 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 divelist-gtk.o deco.o \
planner.o planner-gtk.o \
GTKOBJS = info-gtk.o divelist-gtk.o planner-gtk.o gtk-gui.o
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.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)
statistics.o file.o cochran.o device.o download-dialog.o prefs.o \
webservice.o sha1.o $(GPSOBJ) $(OSSUPPORT).o $(RESFILE) $(GTKOBJS)
DEPS = $(wildcard .dep/*.dep)
all: $(NAME)
$(NAME): gen_version_file $(OBJS) $(MSGOBJS) $(INFOPLIST)

View file

@ -77,8 +77,6 @@ extern GtkWidget *create_label(const char *fmt, ...);
extern gboolean icon_click_cb(GtkWidget *w, GdkEventButton *event, gpointer data);
extern unsigned int amount_selected;
extern void process_selected_dives(void);
typedef void (*data_func_t)(GtkTreeViewColumn *col,

View file

@ -63,4 +63,6 @@ struct options {
extern char zoomed_plot, dc_number;
extern unsigned int amount_selected;
#endif

1020
info-gtk.c Normal file

File diff suppressed because it is too large Load diff

1123
info.c

File diff suppressed because it is too large Load diff

20
info.h Normal file
View file

@ -0,0 +1,20 @@
/*
* info.h
*
* logic functions used from info-gtk.c
*/
#ifndef INFO_H
#define INFO_H
extern gboolean gps_changed(struct dive *dive, struct dive *master, const char *gps_text);
extern void print_gps_coordinates(char *buffer, int len, int lat, int lon);
extern void save_equipment_data(struct dive *dive);
extern void update_equipment_data(struct dive *dive, struct dive *master);
extern void update_time_depth(struct dive *dive, struct dive *edited);
extern const char *get_window_title(struct dive *dive);
extern char *evaluate_string_change(const char *newstring, char **textp, const char *master);
extern int text_changed(const char *old, const char *new);
extern gboolean parse_gps_text(const char *gps_text, double *latitude, double *longitude);
extern int divename(char *buf, size_t size, struct dive *dive, char *trailer);
#endif