Ticket #9426: 0001-Changed-Enable-notifications-button-to-checkbox.patch

File 0001-Changed-Enable-notifications-button-to-checkbox.patch, 3.6 KB (added by Secris, 7 years ago)
  • src/preferences/notifications/GeneralView.cpp

    From 7cbe2ea18396e4f1ae5740d2e39ebd34e82d666c Mon Sep 17 00:00:00 2001
    From: Sean Thames <secris1@gmail.com>
    Date: Wed, 5 Mar 2014 01:50:12 -0500
    Subject: [PATCH] Changed "Enable notifications" button to checkbox
    
    ---
     src/preferences/notifications/GeneralView.cpp | 41 ++++++---------------------
     src/preferences/notifications/GeneralView.h   |  4 +--
     2 files changed, 9 insertions(+), 36 deletions(-)
    
    diff --git a/src/preferences/notifications/GeneralView.cpp b/src/preferences/notifications/GeneralView.cpp
    index db6e9ce..350d405 100644
    a b  
    4141#define B_TRANSLATION_CONTEXT "GeneralView"
    4242const int32 kServer = '_TSR';
    4343
    44 const char* kStartServer = B_TRANSLATE("Enable notifications");
    45 const char* kStopServer = B_TRANSLATE("Disable notifications");
    46 const char* kStarted = B_TRANSLATE("Events are notified");
    47 const char* kStopped = B_TRANSLATE("Events are not notified");
    48 
    49 
    5044GeneralView::GeneralView(SettingsHost* host)
    5145    :
    5246    SettingsPane("general", host)
    5347{
    54     BFont statusFont;
    55 
    56     // Set a smaller font for the status label
    57     statusFont.SetSize(be_plain_font->Size() * 0.8);
    58 
    59     // Status button and label
    60     fServerButton = new BButton("server", kStartServer, new BMessage(kServer));
    61     fStatusLabel = new BStringView("status", kStopped);
    62     fStatusLabel->SetFont(&statusFont);
    63 
    64     // Update status label and server button
    65     if (_IsServerRunning()) {
    66         fServerButton->SetLabel(kStopServer);
    67         fStatusLabel->SetText(kStarted);
    68     } else {
    69         fServerButton->SetLabel(kStartServer);
    70         fStatusLabel->SetText(kStopped);
    71     }
     48    // Notifications
     49    fServer = new BCheckBox("server",
     50        B_TRANSLATE("Enable notifications"),
     51        new BMessage(kServer));
    7252
    7353    // Autostart
    7454    fAutoStart = new BCheckBox("autostart",
    GeneralView::GeneralView(SettingsHost* host)  
    9373    SetLayout(new BGroupLayout(B_VERTICAL));
    9474    AddChild(BGroupLayoutBuilder(B_VERTICAL, inset)
    9575        .AddGroup(B_HORIZONTAL, inset)
    96             .Add(fServerButton)
    97             .Add(fStatusLabel)
     76            .Add(fServer)
    9877            .AddGlue()
    9978        .End()
    10079
    GeneralView::GeneralView(SettingsHost* host)  
    11695void
    11796GeneralView::AttachedToWindow()
    11897{
    119     fServerButton->SetTarget(this);
     98    fServer->SetTarget(this);
    12099    fAutoStart->SetTarget(this);
    121100    fTimeout->SetTarget(this);
    122101}
    GeneralView::MessageReceived(BMessage* msg)  
    170149                        (void)alert->Go();
    171150                        return;
    172151                    }
    173 
    174                     fServerButton->SetLabel(kStartServer);
    175                     fStatusLabel->SetText(kStopped);
    176152                } else {
    177153                    // Start server
    178154                    status_t err = be_roster->Launch(kNotificationServerSignature);
    GeneralView::MessageReceived(BMessage* msg)  
    188164                        (void)alert->Go();
    189165                        return;
    190166                    }
    191 
    192                     fServerButton->SetLabel(kStopServer);
    193                     fStatusLabel->SetText(kStarted);
    194167                }
    195168            } break;
    196169        case kSettingChanged:
    GeneralView::Load()  
    230203    settings.Unflatten(&file);
    231204
    232205    char buffer[255];
     206   
     207    fServer->SetValue(_IsServerRunning() ? B_CONTROL_ON : B_CONTROL_OFF);
    233208
    234209    bool autoStart;
    235210    if (settings.FindBool(kAutoStartName, &autoStart) != B_OK)
  • src/preferences/notifications/GeneralView.h

    diff --git a/src/preferences/notifications/GeneralView.h b/src/preferences/notifications/GeneralView.h
    index 12c5f40..85a8b5d 100644
    a b  
    99#include "SettingsPane.h"
    1010
    1111class BCheckBox;
    12 class BButton;
    1312class BStringView;
    1413class BTextControl;
    1514
    public:  
    2625            status_t        Revert();
    2726
    2827private:
    29         BButton*            fServerButton;
    30         BStringView*        fStatusLabel;
     28        BCheckBox*          fServer;
    3129        BCheckBox*          fAutoStart;
    3230        BTextControl*       fTimeout;
    3331        BCheckBox*          fHideAll;