summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/app.c14
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/ui/util.c12
4 files changed, 21 insertions, 7 deletions
diff --git a/src/app.c b/src/app.c
index ac93d511..eb48d13f 100644
--- a/src/app.c
+++ b/src/app.c
@@ -168,6 +168,7 @@ static iString *serializePrefs_App_(const iApp *d) {
168 } 168 }
169 appendFormat_String(str, "sidebar.mode arg:%d\n", mode_SidebarWidget(sidebar)); 169 appendFormat_String(str, "sidebar.mode arg:%d\n", mode_SidebarWidget(sidebar));
170 appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(d->window)); 170 appendFormat_String(str, "uiscale arg:%f\n", uiScale_Window(d->window));
171 appendFormat_String(str, "prefs.dialogtab arg:%d\n", d->prefs.dialogTab);
171 appendFormat_String(str, "font.set arg:%d\n", d->prefs.font); 172 appendFormat_String(str, "font.set arg:%d\n", d->prefs.font);
172 appendFormat_String(str, "headingfont.set arg:%d\n", d->prefs.headingFont); 173 appendFormat_String(str, "headingfont.set arg:%d\n", d->prefs.headingFont);
173 appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent); 174 appendFormat_String(str, "zoom.set arg:%d\n", d->prefs.zoomPercent);
@@ -695,6 +696,9 @@ static iBool handlePrefsCommands_(iWidget *d, const char *cmd) {
695 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.http")))); 696 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.http"))));
696 postCommandf_App("proxy.gopher address:%s", 697 postCommandf_App("proxy.gopher address:%s",
697 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.gopher")))); 698 cstr_String(text_InputWidget(findChild_Widget(d, "prefs.proxy.gopher"))));
699 const iWidget *tabs = findChild_Widget(d, "prefs.tabs");
700 postCommandf_App("prefs.dialogtab arg:%u",
701 tabPageIndex_Widget(tabs, currentTabPage_Widget(tabs)));
698 destroy_Widget(d); 702 destroy_Widget(d);
699 return iTrue; 703 return iTrue;
700 } 704 }
@@ -819,7 +823,11 @@ static iBool handleIdentityCreationCommands_(iWidget *dlg, const char *cmd) {
819 823
820iBool handleCommand_App(const char *cmd) { 824iBool handleCommand_App(const char *cmd) {
821 iApp *d = &app_; 825 iApp *d = &app_;
822 if (equal_Command(cmd, "window.retain")) { 826 if (equal_Command(cmd, "prefs.dialogtab")) {
827 d->prefs.dialogTab = arg_Command(cmd);
828 return iTrue;
829 }
830 else if (equal_Command(cmd, "window.retain")) {
823 d->prefs.retainWindowSize = arg_Command(cmd); 831 d->prefs.retainWindowSize = arg_Command(cmd);
824 return iTrue; 832 return iTrue;
825 } 833 }
@@ -842,7 +850,7 @@ iBool handleCommand_App(const char *cmd) {
842 postCommand_App("font.changed"); 850 postCommand_App("font.changed");
843 postCommand_App("window.unfreeze"); 851 postCommand_App("window.unfreeze");
844 return iTrue; 852 return iTrue;
845 } 853 }
846 else if (equal_Command(cmd, "zoom.set")) { 854 else if (equal_Command(cmd, "zoom.set")) {
847 setFreezeDraw_Window(get_Window(), iTrue); /* no intermediate draws before docs updated */ 855 setFreezeDraw_Window(get_Window(), iTrue); /* no intermediate draws before docs updated */
848 d->prefs.zoomPercent = arg_Command(cmd); 856 d->prefs.zoomPercent = arg_Command(cmd);
@@ -1043,6 +1051,8 @@ iBool handleCommand_App(const char *cmd) {
1043 schemeProxy_App(range_CStr("http"))); 1051 schemeProxy_App(range_CStr("http")));
1044 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"), 1052 setText_InputWidget(findChild_Widget(dlg, "prefs.proxy.gopher"),
1045 schemeProxy_App(range_CStr("gopher"))); 1053 schemeProxy_App(range_CStr("gopher")));
1054 iWidget *tabs = findChild_Widget(dlg, "prefs.tabs");
1055 showTabPage_Widget(tabs, tabPage_Widget(tabs, d->prefs.dialogTab));
1046 setCommandHandler_Widget(dlg, handlePrefsCommands_); 1056 setCommandHandler_Widget(dlg, handlePrefsCommands_);
1047 } 1057 }
1048 else if (equal_Command(cmd, "navigate.home")) { 1058 else if (equal_Command(cmd, "navigate.home")) {
diff --git a/src/prefs.c b/src/prefs.c
index a36be6a0..146f3838 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -1,6 +1,7 @@
1#include "prefs.h" 1#include "prefs.h"
2 2
3void init_Prefs(iPrefs *d) { 3void init_Prefs(iPrefs *d) {
4 d->dialogTab = 0;
4 d->theme = dark_ColorTheme; 5 d->theme = dark_ColorTheme;
5 d->useSystemTheme = iTrue; 6 d->useSystemTheme = iTrue;
6 d->retainWindowSize = iTrue; 7 d->retainWindowSize = iTrue;
diff --git a/src/prefs.h b/src/prefs.h
index 53f5dfd7..a19cc0ca 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -10,6 +10,7 @@
10iDeclareType(Prefs) 10iDeclareType(Prefs)
11 11
12struct Impl_Prefs { 12struct Impl_Prefs {
13 int dialogTab;
13 iBool retainWindowSize; 14 iBool retainWindowSize;
14 float uiScale; 15 float uiScale;
15 int zoomPercent; 16 int zoomPercent;
diff --git a/src/ui/util.c b/src/ui/util.c
index 67d34062..c99df1fd 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -904,6 +904,7 @@ iWidget *makePreferences_Widget(void) {
904 iClob(new_LabelWidget(uiHeading_ColorEscape "PREFERENCES", 0, 0, NULL)), 904 iClob(new_LabelWidget(uiHeading_ColorEscape "PREFERENCES", 0, 0, NULL)),
905 frameless_WidgetFlag); 905 frameless_WidgetFlag);
906 iWidget *tabs = makeTabs_Widget(dlg); 906 iWidget *tabs = makeTabs_Widget(dlg);
907 setId_Widget(tabs, "prefs.tabs");
907 iWidget *headings, *values; 908 iWidget *headings, *values;
908 /* General preferences. */ { 909 /* General preferences. */ {
909 appendTwoColumnPage_(tabs, "General", '1', &headings, &values); 910 appendTwoColumnPage_(tabs, "General", '1', &headings, &values);
@@ -933,14 +934,15 @@ iWidget *makePreferences_Widget(void) {
933 /* Layout. */ { 934 /* Layout. */ {
934 appendTwoColumnPage_(tabs, "Style", '2', &headings, &values); 935 appendTwoColumnPage_(tabs, "Style", '2', &headings, &values);
935 /* Fonts. */ { 936 /* Fonts. */ {
936 addChild_Widget(headings, iClob(makeHeading_Widget("Body font:"))); 937 iWidget *fonts;
937 iWidget *fonts = new_Widget();
938 addFontButtons_(fonts, "font");
939 addChildFlags_Widget(values, iClob(fonts), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
940 addChild_Widget(headings, iClob(makeHeading_Widget("Heading font:"))); 938 addChild_Widget(headings, iClob(makeHeading_Widget("Heading font:")));
941 fonts = new_Widget(); 939 fonts = new_Widget();
942 addFontButtons_(fonts, "headingfont"); 940 addFontButtons_(fonts, "headingfont");
943 addChildFlags_Widget(values, iClob(fonts), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag); 941 addChildFlags_Widget(values, iClob(fonts), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
942 addChild_Widget(headings, iClob(makeHeading_Widget("Body font:")));
943 fonts = new_Widget();
944 addFontButtons_(fonts, "font");
945 addChildFlags_Widget(values, iClob(fonts), arrangeHorizontal_WidgetFlag | arrangeSize_WidgetFlag);
944 } 946 }
945 addChild_Widget(headings, iClob(makePadding_Widget(2 * gap_UI))); 947 addChild_Widget(headings, iClob(makePadding_Widget(2 * gap_UI)));
946 addChild_Widget(values, iClob(makePadding_Widget(2 * gap_UI))); 948 addChild_Widget(values, iClob(makePadding_Widget(2 * gap_UI)));
@@ -999,7 +1001,7 @@ iWidget *makePreferences_Widget(void) {
999 addAction_Widget(dlg, prevTab_KeyShortcut, "tabs.prev"); 1001 addAction_Widget(dlg, prevTab_KeyShortcut, "tabs.prev");
1000 addAction_Widget(dlg, nextTab_KeyShortcut, "tabs.next"); 1002 addAction_Widget(dlg, nextTab_KeyShortcut, "tabs.next");
1001 addChild_Widget(get_Window()->root, iClob(dlg)); 1003 addChild_Widget(get_Window()->root, iClob(dlg));
1002 centerSheet_Widget(dlg); 1004 centerSheet_Widget(dlg);
1003 return dlg; 1005 return dlg;
1004} 1006}
1005 1007