From b7d012007427f3f0cc0881275cf5bcf7b198fb32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 3 Sep 2015 19:23:23 +0200 Subject: [PATCH] Terminal: Added "Save as defaults" back. * It's still convenient to have. * Furthermore, the distinction between when settings are stored is hard to grasp otherwise. * Plus, adopting the current window size is now much more straight forward. --- src/apps/terminal/TermConst.h | 3 ++- src/apps/terminal/TermWindow.cpp | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/apps/terminal/TermConst.h b/src/apps/terminal/TermConst.h index ef7d704fb65..f1d965f431c 100644 --- a/src/apps/terminal/TermConst.h +++ b/src/apps/terminal/TermConst.h @@ -1,5 +1,5 @@ /* - * Copyright 2001-2013, Haiku. + * Copyright 2001-2015, Haiku. * Copyright (c) 2003-4 Kian Duffy * Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. * @@ -71,6 +71,7 @@ static const uint32 ONETHREETWOTWENTYFIVE = 'hunv'; static const uint32 FULLSCREEN = 'fscr'; static const uint32 MSG_FONT_CHANGED = 'fntc'; +static const uint32 MSG_SAVE_AS_DEFAULT = 'sadf'; static const uint32 MSG_CHECK_CHILDREN = 'ckch'; static const uint32 MSG_REMOVE_RESIZE_VIEW_IF_NEEDED = 'rmrv'; static const uint32 MSG_TERMINAL_BUFFER_CHANGED = 'bufc'; diff --git a/src/apps/terminal/TermWindow.cpp b/src/apps/terminal/TermWindow.cpp index 88762c70bb1..8519082097c 100644 --- a/src/apps/terminal/TermWindow.cpp +++ b/src/apps/terminal/TermWindow.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2007-2013, Haiku, Inc. All rights reserved. + * Copyright 2007-2015, Haiku, Inc. All rights reserved. * Copyright (c) 2004 Daniel Furrer * Copyright (c) 2003-2004 Kian Duffy * Copyright (C) 1998,99 Kazuho Okui and Takashi Murai. @@ -523,10 +523,10 @@ TermWindow::_SetupMenu() .AddItem(windowSize) .AddItem(fEncodingMenu) .AddItem(fFontSizeMenu) + .AddItem(B_TRANSLATE("Save as default"), MSG_SAVE_AS_DEFAULT) .AddSeparator() .AddItem(B_TRANSLATE("Settings" B_UTF8_ELLIPSIS), MENU_PREF_OPEN) - .End() - ; + .End(); AddChild(fMenuBar); @@ -935,6 +935,15 @@ TermWindow::MessageReceived(BMessage *message) _ActiveTermView()->Invalidate(); break; } + case MSG_SAVE_AS_DEFAULT: + { + BPath path; + if (PrefHandler::GetDefaultPath(path) == B_OK) { + PrefHandler::Default()->SaveAsText(path.Path(), + PREFFILE_MIMETYPE); + } + break; + } case MENU_PAGE_SETUP: _DoPageSetup();