summaryrefslogtreecommitdiffstats
path: root/macos.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2013-01-11 17:07:22 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-11 17:46:00 -0800
commit6a10700ca59e546c7a05688bdf5bffa388286bff (patch)
tree1cef21cc47580f1f64b0f186ebb712bca5b0cc24 /macos.c
parent954290c70ba525cab4fefe83a3e82384ef01ba8c (diff)
downloadsubsurface-6a10700ca59e546c7a05688bdf5bffa388286bff.tar.gz
Add default filename and divelist font to prefs structure
.. and add the usual logic to not save the default values. This also simplifies the initial system-specific setup of both of these: since we have defaults for all the preferences that get set up at startup, we can just initialize those defaults to the system-specific fonts then and there. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'macos.c')
-rw-r--r--macos.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/macos.c b/macos.c
index b2b96cc83..b8451cfd0 100644
--- a/macos.c
+++ b/macos.c
@@ -19,7 +19,8 @@ static GtkOSXApplication *osx_app;
#define SUBSURFACE_PREFERENCES CFSTR("org.hohndel.subsurface")
#define ICON_NAME "Subsurface.icns"
#define UI_FONT "Arial Unicode MS 12"
-#define DIVELIST_MAC_DEFAULT_FONT "Arial Unicode MS 9"
+
+const char system_divelist_default_font[] = "Arial Unicode MS 9";
void subsurface_open_conf(void)
{
@@ -134,22 +135,18 @@ const char *subsurface_icon_name()
return path;
}
-const char *subsurface_default_filename()
+const char *system_default_filename(void)
{
- if (default_filename) {
- return strdup(default_filename);
- } else {
- const char *home, *user;
- char *buffer;
- int len;
+ const char *home, *user;
+ char *buffer;
+ int len;
- home = g_get_home_dir();
- user = g_get_user_name();
- len = strlen(home) + strlen(user) + 45;
- buffer = malloc(len);
- snprintf(buffer, len, "%s/Library/Application Support/Subsurface/%s.xml", home, user);
- return buffer;
- }
+ home = g_get_home_dir();
+ user = g_get_user_name();
+ len = strlen(home) + strlen(user) + 45;
+ buffer = malloc(len);
+ snprintf(buffer, len, "%s/Library/Application Support/Subsurface/%s.xml", home, user);
+ return buffer;
}
const char *subsurface_gettext_domainpath(char *argv0)
@@ -176,8 +173,6 @@ void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
{
GtkWidget *menu_item, *sep;
- if (!divelist_font)
- divelist_font = strdup(DIVELIST_MAC_DEFAULT_FONT);
g_object_set(G_OBJECT(settings), "gtk-font-name", UI_FONT, NULL);
osx_app = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);