-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from WasabiFan/ev3dev-jessie
Add IP address to status bar Issue ev3dev/ev3dev#184
- Loading branch information
Showing
6 changed files
with
94 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* brickman -- Brick Manager for LEGO Mindstorms EV3/ev3dev | ||
* | ||
* Copyright (C) 2014 WasabiFan <[email protected]> | ||
* | ||
* based on BatteryStatusBarItem.vala | ||
* Copyright (C) 2014 David Lechner <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* | ||
* NetworkStatusBarItem.vala: | ||
* | ||
* Indicates network IP address in status bar | ||
*/ | ||
|
||
using EV3devKit; | ||
using GRX; | ||
|
||
namespace BrickManager { | ||
public class NetworkStatusBarItem : StatusBarItem { | ||
const ushort TOP = 2; | ||
static Font font; | ||
|
||
static construct { | ||
font = Font.load ("xm6x8"); | ||
} | ||
|
||
string _text = ""; | ||
TextOption text_option; | ||
|
||
public string text { | ||
get { return _text; } | ||
set { | ||
_text = value; | ||
redraw(); | ||
} | ||
} | ||
|
||
public NetworkStatusBarItem () { | ||
text_option = new TextOption () { | ||
font = NetworkStatusBarItem.font, | ||
bg_color = Color.no_color | ||
}; | ||
} | ||
|
||
public override int draw (int x, StatusBar.Align align) { | ||
var color = status_bar.screen.fg_color; | ||
text_option.fg_color = color; | ||
var main_width = text_option.vala_string_width(_text) + 2; | ||
|
||
draw_vala_string (_text, x + 1, TOP, text_option); | ||
return main_width; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters