Applied patch by Dario Casalinuovo with some changes by myself:
The NetworkStatus applet is now able to launch the Network preferences via its contex menu. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25329 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
fa66c85543
commit
3b41ad8606
@ -5,6 +5,7 @@
|
|||||||
* Authors:
|
* Authors:
|
||||||
* Axel Dörfler, axeld@pinc-software.de
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
* Hugo Santos, hugosantos@gmail.com
|
* Hugo Santos, hugosantos@gmail.com
|
||||||
|
* Dario Casalinuovo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -62,6 +63,8 @@ const uint32 kMsgShowConfiguration = 'shcf';
|
|||||||
const uint32 kMinIconWidth = 16;
|
const uint32 kMinIconWidth = 16;
|
||||||
const uint32 kMinIconHeight = 16;
|
const uint32 kMinIconHeight = 16;
|
||||||
|
|
||||||
|
const uint32 kOpenNetworkPref = 'onwp';
|
||||||
|
|
||||||
const bigtime_t kUpdateInterval = 1000000;
|
const bigtime_t kUpdateInterval = 1000000;
|
||||||
// every second
|
// every second
|
||||||
|
|
||||||
@ -232,6 +235,10 @@ NetworkStatusView::MessageReceived(BMessage* message)
|
|||||||
_ShowConfiguration(message);
|
_ShowConfiguration(message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kOpenNetworkPref:
|
||||||
|
_OpenNetworksPreferences();
|
||||||
|
break;
|
||||||
|
|
||||||
case B_ABOUT_REQUESTED:
|
case B_ABOUT_REQUESTED:
|
||||||
_AboutRequested();
|
_AboutRequested();
|
||||||
break;
|
break;
|
||||||
@ -354,6 +361,9 @@ NetworkStatusView::MouseDown(BPoint point)
|
|||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(new BMenuItem("About NetworkStatus" B_UTF8_ELLIPSIS,
|
menu->AddItem(new BMenuItem("About NetworkStatus" B_UTF8_ELLIPSIS,
|
||||||
new BMessage(B_ABOUT_REQUESTED)));
|
new BMessage(B_ABOUT_REQUESTED)));
|
||||||
|
menu->AddItem(new BMenuItem("Open Networks Preferences" B_UTF8_ELLIPSIS,
|
||||||
|
new BMessage(kOpenNetworkPref)));
|
||||||
|
|
||||||
if (fInDeskbar)
|
if (fInDeskbar)
|
||||||
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED)));
|
menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED)));
|
||||||
menu->SetTargetForItems(this);
|
menu->SetTargetForItems(this);
|
||||||
@ -466,6 +476,23 @@ NetworkStatusView::_Update(bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
NetworkStatusView::_OpenNetworksPreferences()
|
||||||
|
{
|
||||||
|
status_t ret = be_roster->Launch("application/x-vnd.Haiku-Network");
|
||||||
|
if (ret < B_OK) {
|
||||||
|
BString errorMessage("Launching the Network preflet failed.\n\n"
|
||||||
|
"Error: ");
|
||||||
|
errorMessage << strerror(ret);
|
||||||
|
BAlert* alert = new BAlert("launch error", errorMessage.String(),
|
||||||
|
"Ok");
|
||||||
|
// asynchronous alert in order to not block replicant host
|
||||||
|
// application
|
||||||
|
alert->Go(NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Axel Dörfler, axeld@pinc-software.de
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
|
* Dario Casalinuovo
|
||||||
*/
|
*/
|
||||||
#ifndef NETWORK_STATUS_VIEW_H
|
#ifndef NETWORK_STATUS_VIEW_H
|
||||||
#define NETWORK_STATUS_VIEW_H
|
#define NETWORK_STATUS_VIEW_H
|
||||||
@ -53,6 +54,7 @@ class NetworkStatusView : public BView {
|
|||||||
const char* name);
|
const char* name);
|
||||||
int32 _DetermineInterfaceStatus(const char* name);
|
int32 _DetermineInterfaceStatus(const char* name);
|
||||||
void _Update(bool force = false);
|
void _Update(bool force = false);
|
||||||
|
void _OpenNetworksPreferences();
|
||||||
|
|
||||||
BMessageRunner* fMessageRunner;
|
BMessageRunner* fMessageRunner;
|
||||||
BObjectList<BString> fInterfaces;
|
BObjectList<BString> fInterfaces;
|
||||||
|
Loading…
Reference in New Issue
Block a user