From 4b12f28ca453b038fdeca8e6ada106e0c157296b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 5 Oct 2013 00:29:09 -0700 Subject: First steps towards removing glib dependencies - remove the build flags and libraries from the Makefile / Configure.mk - remove the glib types (gboolean, gchar, gint64, gint) - comment out / hack around gettext - replace the glib file helper functions - replace g_ascii_strtod - replace g_build_filename - use environment variables instead of g_get_home_dir() & g_get_user_name() - comment out GPS string parsing (uses glib utf8 macros) This needs massive cleanup, but it's a snapshot of what I have right now, in case people want to look at it. Signed-off-by: Dirk Hohndel --- macos.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'macos.c') diff --git a/macos.c b/macos.c index e27a76007..a3709cfb1 100644 --- a/macos.c +++ b/macos.c @@ -169,8 +169,8 @@ const char *system_default_filename(void) char *buffer; int len; - home = g_get_home_dir(); - user = g_get_user_name(); + home = getenv("HOME"); + user = getenv("LOGNAME"); len = strlen(home) + strlen(user) + 45; buffer = malloc(len); snprintf(buffer, len, "%s/Library/Application Support/Subsurface/%s.xml", home, user); @@ -242,22 +242,22 @@ void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar, } #endif /* UES_GTK_UI */ -void subsurface_command_line_init(gint *argc, gchar ***argv) +void subsurface_command_line_init(int *argc, char ***argv) { /* this is a no-op */ } -void subsurface_command_line_exit(gint *argc, gchar ***argv) +void subsurface_command_line_exit(int *argc, char ***argv) { /* this is a no-op */ } -gboolean subsurface_os_feature_available(os_feature_t f) +int subsurface_os_feature_available(os_feature_t f) { return TRUE; } -gboolean subsurface_launch_for_uri(const char* uri) +int subsurface_launch_for_uri(const char* uri) { CFURLRef urlref = CFURLCreateWithBytes(NULL, uri, strlen(uri), kCFStringEncodingMacRoman, NULL); OSStatus status = LSOpenCFURLRef(urlref, NULL); -- cgit v1.2.3-70-g09d2 From 4d0b6e698ae8d9a2f6f625203223e30604c7aaf9 Mon Sep 17 00:00:00 2001 From: Henrik Brautaset Aronsen Date: Sun, 6 Oct 2013 13:43:45 +0200 Subject: Changes to make the glib-removal-hack branch build on MacOSX Tested with the Homebrew packaging system Signed-off-by: Henrik Brautaset Aronsen Signed-off-by: Dirk Hohndel --- Rules.mk | 2 +- download-dialog.c | 2 -- gtk-gui.c | 2 -- macos.c | 6 +++--- main.cpp | 1 - planner-gtk.c | 1 - qthelper.h | 4 ++-- webservice.c | 1 - windows.c | 6 +++--- 9 files changed, 9 insertions(+), 16 deletions(-) (limited to 'macos.c') diff --git a/Rules.mk b/Rules.mk index a62b1bea4..bab6752eb 100644 --- a/Rules.mk +++ b/Rules.mk @@ -48,7 +48,7 @@ CREATOR_FILES = $(NAME).config $(NAME).creator $(NAME).files $(NAME).includes all: $(TARGET) doc -$(TARGET): gen_version_file $(ALL_OBJS) $(MSGOBJS) $(INFOPLIST) +$(TARGET): gen_version_file $(ALL_OBJS) $(INFOPLIST) @$(PRETTYECHO) ' LINK' $(TARGET) $(COMPILE_PREFIX)$(CXX) $(LDFLAGS) -o $(TARGET) $(ALL_OBJS) $(LIBS) diff --git a/download-dialog.c b/download-dialog.c index b98562571..b5632d593 100644 --- a/download-dialog.c +++ b/download-dialog.c @@ -1,5 +1,3 @@ -#include -#include #include "dive.h" #include "divelist.h" #include "display.h" diff --git a/gtk-gui.c b/gtk-gui.c index e873fc622..7ec3d8819 100644 --- a/gtk-gui.c +++ b/gtk-gui.c @@ -8,8 +8,6 @@ * functions. It's renamed back to gtk-ui.c to keep the old Gtk code * around for reference in case we still need it... all that has now been * ripped out of qt-gui.cpp */ -#include -#include #include #include #include diff --git a/macos.c b/macos.c index a3709cfb1..4f41970b6 100644 --- a/macos.c +++ b/macos.c @@ -42,7 +42,7 @@ void subsurface_set_conf(const char *name, const char *value) CFPreferencesSetAppValue(CFSTR_VAR(name), CFSTR_VAR(value), SUBSURFACE_PREFERENCES); } -void subsurface_set_conf_bool(const char *name, int value) +void subsurface_set_conf_bool(const char *name, bool value) { CFPreferencesSetAppValue(CFSTR_VAR(name), value ? kCFBooleanTrue : kCFBooleanFalse, SUBSURFACE_PREFERENCES); @@ -252,12 +252,12 @@ void subsurface_command_line_exit(int *argc, char ***argv) /* this is a no-op */ } -int subsurface_os_feature_available(os_feature_t f) +bool subsurface_os_feature_available(os_feature_t f) { return TRUE; } -int subsurface_launch_for_uri(const char* uri) +bool subsurface_launch_for_uri(const char* uri) { CFURLRef urlref = CFURLCreateWithBytes(NULL, uri, strlen(uri), kCFStringEncodingMacRoman, NULL); OSStatus status = LSOpenCFURLRef(urlref, NULL); diff --git a/main.cpp b/main.cpp index 67f07c881..fddf508ec 100644 --- a/main.cpp +++ b/main.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include "qt-gui.h" #include "version.h" diff --git a/planner-gtk.c b/planner-gtk.c index d5fddec46..b6306bdee 100644 --- a/planner-gtk.c +++ b/planner-gtk.c @@ -4,7 +4,6 @@ * * (c) Dirk Hohndel 2013 */ -#include #include #include #include diff --git a/qthelper.h b/qthelper.h index 0bb7c19f1..0ab184b78 100644 --- a/qthelper.h +++ b/qthelper.h @@ -29,8 +29,8 @@ public: void rmDC(QString m, uint32_t d); DiveComputerNode matchDC(QString m, uint32_t d); DiveComputerNode matchModel(QString m); - QMultiMap dcMap; - QMultiMap dcWorkingMap; + QMultiMap dcMap; + QMultiMap dcWorkingMap; }; QString weight_string(int weight_in_grams); diff --git a/webservice.c b/webservice.c index f4f8baeb4..e713e1282 100644 --- a/webservice.c +++ b/webservice.c @@ -1,4 +1,3 @@ -#include #include #include #include diff --git a/windows.c b/windows.c index 823615c4a..fb2883916 100644 --- a/windows.c +++ b/windows.c @@ -60,7 +60,7 @@ void subsurface_set_conf_int(const char *name, int value) RegSetValueEx(hkey, (LPCTSTR)name, 0, REG_DWORD, (const BYTE *)&value, 4); } -void subsurface_set_conf_bool(const char *name, int value) +void subsurface_set_conf_bool(const char *name, bool value) { subsurface_set_conf_int(name, value); } @@ -305,7 +305,7 @@ void subsurface_command_line_exit(gint *argc, gchar ***argv) g_free(*argv); } -gboolean subsurface_launch_for_uri(const char* uri) +bool subsurface_launch_for_uri(const char* uri) { gboolean ret = FALSE; wchar_t *wuri = (wchar_t *)g_utf8_to_utf16(uri, -1, NULL, NULL, NULL); @@ -320,7 +320,7 @@ gboolean subsurface_launch_for_uri(const char* uri) } /* check if we are running a newer OS version */ -gboolean subsurface_os_feature_available(os_feature_t f) +bool subsurface_os_feature_available(os_feature_t f) { switch (f) { case UTF8_FONT_WITH_STARS: -- cgit v1.2.3-70-g09d2