[haiku-webkit-commits] r566 - webkit/trunk/WebKit/haiku/WebPositive

  • From: noreply@xxxxxxxxxxxx
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Thu, 30 Dec 2010 07:34:45 +0100 (CET)

Author: leavengood
Date: Thu Dec 30 07:34:45 2010
New Revision: 566
URL: http://webpositive.haiku-os.org/changeset/566

Log:
Add a setting to show or hide the Home button. I find it pretty useless myself.

While I was able to add this fairly easily by cutting and pasting, it was still
quite a bit of work. Seems like there should be a less-verbose way of doing
this. But it did work the first time I tested, so I can't complain too much.

Modified:
   webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp
   webkit/trunk/WebKit/haiku/WebPositive/SettingsKeys.cpp
   webkit/trunk/WebKit/haiku/WebPositive/SettingsKeys.h
   webkit/trunk/WebKit/haiku/WebPositive/SettingsWindow.cpp
   webkit/trunk/WebKit/haiku/WebPositive/SettingsWindow.h

Modified: webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp     Thu Dec 30 
03:13:38 2010        (r565)
+++ webkit/trunk/WebKit/haiku/WebPositive/BrowserWindow.cpp     Thu Dec 30 
07:34:45 2010        (r566)
@@ -387,6 +387,8 @@
        fHomeButton = new IconButton("Home", 0, NULL, new BMessage(HOME));
        fHomeButton->SetIcon(206);
        fHomeButton->TrimIcon();
+       if (!fAppSettings->GetValue(kSettingsKeyShowHomeButton, true))
+               fHomeButton->Hide();
 
        // URL input group
        fURLInputGroup = new URLInputGroup(new BMessage(GOTO_URL));
@@ -929,6 +931,12 @@
                        } else if (name == 
kSettingsKeyAutoHideInterfaceInFullscreenMode
                                && message->FindBool("value", &flag) == B_OK) {
                                _SetAutoHideInterfaceInFullscreen(flag);
+                       } else if (name == kSettingsKeyShowHomeButton
+                               && message->FindBool("value", &flag) == B_OK) {
+                               if (flag)
+                                       fHomeButton->Show();
+                               else
+                                       fHomeButton->Hide();
                        }
                        break;
                }

Modified: webkit/trunk/WebKit/haiku/WebPositive/SettingsKeys.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/SettingsKeys.cpp      Thu Dec 30 
03:13:38 2010        (r565)
+++ webkit/trunk/WebKit/haiku/WebPositive/SettingsKeys.cpp      Thu Dec 30 
07:34:45 2010        (r566)
@@ -33,6 +33,7 @@
 const char* kSettingsKeyAutoHideInterfaceInFullscreenMode
        = "auto hide interface in full screen mode";
 const char* kSettingsKeyAutoHidePointer = "auto hide pointer";
+const char* kSettingsKeyShowHomeButton = "show home button";
 
 const char* kSettingsKeyNewWindowPolicy = "new window policy";
 const char* kSettingsKeyNewTabPolicy = "new tab policy";

Modified: webkit/trunk/WebKit/haiku/WebPositive/SettingsKeys.h
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/SettingsKeys.h        Thu Dec 30 
03:13:38 2010        (r565)
+++ webkit/trunk/WebKit/haiku/WebPositive/SettingsKeys.h        Thu Dec 30 
07:34:45 2010        (r566)
@@ -34,6 +34,7 @@
 extern const char* kSettingsKeyShowTabsIfSinglePageOpen;
 extern const char* kSettingsKeyAutoHideInterfaceInFullscreenMode;
 extern const char* kSettingsKeyAutoHidePointer;
+extern const char* kSettingsKeyShowHomeButton;
 
 extern const char* kSettingsKeyNewWindowPolicy;
 extern const char* kSettingsKeyNewTabPolicy;

Modified: webkit/trunk/WebKit/haiku/WebPositive/SettingsWindow.cpp
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/SettingsWindow.cpp    Thu Dec 30 
03:13:38 2010        (r565)
+++ webkit/trunk/WebKit/haiku/WebPositive/SettingsWindow.cpp    Thu Dec 30 
07:34:45 2010        (r566)
@@ -73,6 +73,7 @@
        MSG_TAB_DISPLAY_BEHAVIOR_CHANGED                        = 'tdbc',
        MSG_AUTO_HIDE_INTERFACE_BEHAVIOR_CHANGED        = 'ahic',
        MSG_AUTO_HIDE_POINTER_BEHAVIOR_CHANGED          = 'ahpc',
+       MSG_SHOW_HOME_BUTTON_CHANGED                            = 'shbc',
 
        MSG_STANDARD_FONT_CHANGED                                       = 
'stfc',
        MSG_SERIF_FONT_CHANGED                                          = 
'sefc',
@@ -203,6 +204,7 @@
                case MSG_TAB_DISPLAY_BEHAVIOR_CHANGED:
                case MSG_AUTO_HIDE_INTERFACE_BEHAVIOR_CHANGED:
                case MSG_AUTO_HIDE_POINTER_BEHAVIOR_CHANGED:
+               case MSG_SHOW_HOME_BUTTON_CHANGED:
                case MSG_STANDARD_FONT_CHANGED:
                case MSG_SERIF_FONT_CHANGED:
                case MSG_SANS_SERIF_FONT_CHANGED:
@@ -338,6 +340,11 @@
                new BMessage(MSG_AUTO_HIDE_POINTER_BEHAVIOR_CHANGED));
        fAutoHidePointer->SetValue(B_CONTROL_OFF);
 
+       fShowHomeButton = new BCheckBox("show home button",
+               B_TRANSLATE("Show Home Button"),
+               new BMessage(MSG_SHOW_HOME_BUTTON_CHANGED));
+       fShowHomeButton->SetValue(B_CONTROL_ON);
+
        BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
                .Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
                        .Add(fStartPageControl->CreateLabelLayoutItem(), 0, 0)
@@ -361,6 +368,7 @@
                .Add(fShowTabsIfOnlyOnePage)
                .Add(fAutoHideInterfaceInFullscreenMode)
                .Add(fAutoHidePointer)
+               .Add(fShowHomeButton)
                .Add(fDaysInHistoryMenuControl)
                .Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing))
 
@@ -547,6 +555,9 @@
                (fAutoHidePointer->Value() == B_CONTROL_ON)
                != fSettings->GetValue(kSettingsKeyAutoHidePointer, false));
 
+       canApply = canApply || ((fShowHomeButton->Value() == B_CONTROL_ON)
+               != fSettings->GetValue(kSettingsKeyShowHomeButton, true));
+
        canApply = canApply || (_MaxHistoryAge()
                != BrowsingHistory::DefaultInstance()->MaxHistoryItemAge());
 
@@ -612,6 +623,8 @@
                fAutoHideInterfaceInFullscreenMode->Value() == B_CONTROL_ON);
        fSettings->SetValue(kSettingsKeyAutoHidePointer,
                fAutoHidePointer->Value() == B_CONTROL_ON);
+       fSettings->SetValue(kSettingsKeyShowHomeButton,
+               fShowHomeButton->Value() == B_CONTROL_ON);
 
        // New page policies
        fSettings->SetValue(kSettingsKeyNewWindowPolicy, _NewWindowPolicy());
@@ -679,6 +692,8 @@
                        false));
        fAutoHidePointer->SetValue(
                fSettings->GetValue(kSettingsKeyAutoHidePointer, false));
+       fShowHomeButton->SetValue(
+               fSettings->GetValue(kSettingsKeyShowHomeButton, true));
 
        BString text;
        text << BrowsingHistory::DefaultInstance()->MaxHistoryItemAge();

Modified: webkit/trunk/WebKit/haiku/WebPositive/SettingsWindow.h
==============================================================================
--- webkit/trunk/WebKit/haiku/WebPositive/SettingsWindow.h      Thu Dec 30 
03:13:38 2010        (r565)
+++ webkit/trunk/WebKit/haiku/WebPositive/SettingsWindow.h      Thu Dec 30 
07:34:45 2010        (r566)
@@ -98,6 +98,7 @@
                        BCheckBox*                      fShowTabsIfOnlyOnePage;
                        BCheckBox*                      
fAutoHideInterfaceInFullscreenMode;
                        BCheckBox*                      fAutoHidePointer;
+                       BCheckBox*                      fShowHomeButton;
 
                        FontSelectionView*      fStandardFontView;
                        FontSelectionView*      fSerifFontView;

Other related posts:

  • » [haiku-webkit-commits] r566 - webkit/trunk/WebKit/haiku/WebPositive - noreply