Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
7cb8cb05
Commit
7cb8cb05
authored
10 years ago
by
Hisham Muhammad
Browse files
Options
Download
Email Patches
Plain Diff
Simplify constructors.
parent
8a11281c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
Action.c
+2
-10
Action.c
AffinityPanel.c
+1
-5
AffinityPanel.c
AvailableMetersPanel.c
+1
-5
AvailableMetersPanel.c
FunctionBar.c
+8
-0
FunctionBar.c
FunctionBar.h
+3
-0
FunctionBar.h
SignalsPanel.c
+1
-5
SignalsPanel.c
linux/IOPriorityPanel.c
+1
-6
linux/IOPriorityPanel.c
with
17 additions
and
31 deletions
+17
-31
Action.c
View file @
7cb8cb05
...
...
@@ -161,13 +161,9 @@ static inline Htop_Reaction setSortKey(Settings* settings, ProcessField sortKey)
return
HTOP_REFRESH
|
HTOP_SAVE_SETTINGS
|
HTOP_UPDATE_PANELHDR
;
}
static
const
char
*
SortFunctions
[]
=
{
"Sort "
,
"Cancel "
,
NULL
};
static
const
char
*
SortKeys
[]
=
{
"Enter"
,
"Esc"
,
NULL
};
static
int
SortEvents
[]
=
{
13
,
27
};
static
Htop_Reaction
sortBy
(
State
*
st
)
{
Htop_Reaction
reaction
=
HTOP_OK
;
Panel
*
sortPanel
=
Panel_new
(
0
,
0
,
0
,
0
,
true
,
Class
(
ListItem
),
FunctionBar_new
(
SortFunctions
,
SortKeys
,
SortEvents
));
Panel
*
sortPanel
=
Panel_new
(
0
,
0
,
0
,
0
,
true
,
Class
(
ListItem
),
FunctionBar_new
EnterEsc
(
"Sort "
,
"Cancel "
));
Panel_setHeader
(
sortPanel
,
"Sort by"
);
ProcessField
*
fields
=
st
->
settings
->
fields
;
for
(
int
i
=
0
;
fields
[
i
];
i
++
)
{
...
...
@@ -307,12 +303,8 @@ static Htop_Reaction actionKill(State* st) {
return
HTOP_REFRESH
|
HTOP_REDRAW_BAR
|
HTOP_UPDATE_PANELHDR
;
}
static
const
char
*
UsersFunctions
[]
=
{
"Show "
,
"Cancel "
,
NULL
};
static
const
char
*
UsersKeys
[]
=
{
"Enter"
,
"Esc"
,
NULL
};
static
int
UsersEvents
[]
=
{
13
,
27
};
static
Htop_Reaction
actionFilterByUser
(
State
*
st
)
{
Panel
*
usersPanel
=
Panel_new
(
0
,
0
,
0
,
0
,
true
,
Class
(
ListItem
),
FunctionBar_new
(
UsersFunctions
,
UsersKeys
,
UsersEvents
));
Panel
*
usersPanel
=
Panel_new
(
0
,
0
,
0
,
0
,
true
,
Class
(
ListItem
),
FunctionBar_new
EnterEsc
(
"Show "
,
"Cancel "
));
Panel_setHeader
(
usersPanel
,
"Show processes of:"
);
UsersTable_foreach
(
st
->
ut
,
addUserToVector
,
usersPanel
);
Vector_insertionSort
(
usersPanel
->
items
);
...
...
This diff is collapsed.
Click to expand it.
AffinityPanel.c
View file @
7cb8cb05
...
...
@@ -42,12 +42,8 @@ PanelClass AffinityPanel_class = {
.
eventHandler
=
AffinityPanel_eventHandler
};
static
const
char
*
AffinityFunctions
[]
=
{
"Set "
,
"Cancel "
,
NULL
};
static
const
char
*
AffinityKeys
[]
=
{
"Enter"
,
"Esc"
,
NULL
};
static
int
AffinityEvents
[]
=
{
13
,
27
};
Panel
*
AffinityPanel_new
(
ProcessList
*
pl
,
Affinity
*
affinity
)
{
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
CheckItem
),
FunctionBar_new
(
AffinityFunctions
,
AffinityKeys
,
AffinityEvents
));
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
CheckItem
),
FunctionBar_new
EnterEsc
(
"Set "
,
"Cancel "
));
Object_setClass
(
this
,
Class
(
AffinityPanel
));
Panel_setHeader
(
this
,
"Use CPUs:"
);
...
...
This diff is collapsed.
Click to expand it.
AvailableMetersPanel.c
View file @
7cb8cb05
...
...
@@ -34,10 +34,6 @@ typedef struct AvailableMetersPanel_ {
}*/
static
const
char
*
AvailableMetersFunctions
[]
=
{
"Add "
,
"Done "
,
NULL
};
static
const
char
*
AvailableMetersKeys
[]
=
{
"Enter"
,
"Esc"
};
static
int
AvailableMetersEvents
[]
=
{
13
,
27
};
static
void
AvailableMetersPanel_delete
(
Object
*
object
)
{
Panel
*
super
=
(
Panel
*
)
object
;
AvailableMetersPanel
*
this
=
(
AvailableMetersPanel
*
)
object
;
...
...
@@ -106,7 +102,7 @@ PanelClass AvailableMetersPanel_class = {
AvailableMetersPanel
*
AvailableMetersPanel_new
(
Settings
*
settings
,
Header
*
header
,
Panel
*
leftMeters
,
Panel
*
rightMeters
,
ScreenManager
*
scr
,
ProcessList
*
pl
)
{
AvailableMetersPanel
*
this
=
AllocThis
(
AvailableMetersPanel
);
Panel
*
super
=
(
Panel
*
)
this
;
FunctionBar
*
fuBar
=
FunctionBar_new
(
AvailableMetersFunctions
,
AvailableMetersKeys
,
AvailableMetersEvents
);
FunctionBar
*
fuBar
=
FunctionBar_new
EnterEsc
(
"Add "
,
"Done "
);
Panel_init
(
super
,
1
,
1
,
1
,
1
,
Class
(
ListItem
),
true
,
fuBar
);
this
->
settings
=
settings
;
...
...
This diff is collapsed.
Click to expand it.
FunctionBar.c
View file @
7cb8cb05
...
...
@@ -33,6 +33,14 @@ static const char* FunctionBar_FLabels[] = {" ", " ", " ", "
static
int
FunctionBar_FEvents
[]
=
{
KEY_F
(
1
),
KEY_F
(
2
),
KEY_F
(
3
),
KEY_F
(
4
),
KEY_F
(
5
),
KEY_F
(
6
),
KEY_F
(
7
),
KEY_F
(
8
),
KEY_F
(
9
),
KEY_F
(
10
)};
static
const
char
*
FunctionBar_EnterEscKeys
[]
=
{
"Enter"
,
"Esc"
,
NULL
};
static
int
FunctionBar_EnterEscEvents
[]
=
{
13
,
27
};
FunctionBar
*
FunctionBar_newEnterEsc
(
const
char
*
enter
,
const
char
*
esc
)
{
const
char
*
functions
[]
=
{
enter
,
esc
,
NULL
};
return
FunctionBar_new
(
functions
,
FunctionBar_EnterEscKeys
,
FunctionBar_EnterEscEvents
);
}
FunctionBar
*
FunctionBar_new
(
const
char
**
functions
,
const
char
**
keys
,
int
*
events
)
{
FunctionBar
*
this
=
calloc
(
1
,
sizeof
(
FunctionBar
));
this
->
functions
=
calloc
(
16
,
sizeof
(
char
*
));
...
...
This diff is collapsed.
Click to expand it.
FunctionBar.h
View file @
7cb8cb05
...
...
@@ -21,6 +21,9 @@ typedef struct FunctionBar_ {
}
FunctionBar
;
FunctionBar
*
FunctionBar_newEnterEsc
(
const
char
*
enter
,
const
char
*
esc
);
FunctionBar
*
FunctionBar_new
(
const
char
**
functions
,
const
char
**
keys
,
int
*
events
);
void
FunctionBar_delete
(
FunctionBar
*
this
);
...
...
This diff is collapsed.
Click to expand it.
SignalsPanel.c
View file @
7cb8cb05
...
...
@@ -62,12 +62,8 @@ static SignalItem signals[] = {
{
.
name
=
"31 SIGSYS"
,
.
number
=
31
},
};
static
const
char
*
SignalsFunctions
[]
=
{
"Send "
,
"Cancel "
,
NULL
};
static
const
char
*
SignalsKeys
[]
=
{
"Enter"
,
"Esc"
,
NULL
};
static
int
SignalsEvents
[]
=
{
13
,
27
};
Panel
*
SignalsPanel_new
()
{
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
ListItem
),
FunctionBar_new
(
SignalsFunctions
,
SignalsKeys
,
SignalsEvents
));
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
ListItem
),
FunctionBar_new
EnterEsc
(
"Send "
,
"Cancel "
));
for
(
unsigned
int
i
=
0
;
i
<
sizeof
(
signals
)
/
sizeof
(
SignalItem
);
i
++
)
Panel_set
(
this
,
i
,
(
Object
*
)
ListItem_new
(
signals
[
i
].
name
,
signals
[
i
].
number
));
Panel_setHeader
(
this
,
"Send signal:"
);
...
...
This diff is collapsed.
Click to expand it.
linux/IOPriorityPanel.c
View file @
7cb8cb05
...
...
@@ -13,13 +13,8 @@ in the source distribution for its full text.
#include "ListItem.h"
}*/
static
const
char
*
IOPriorityFunctions
[]
=
{
"Set "
,
"Cancel "
,
NULL
};
static
const
char
*
IOPriorityKeys
[]
=
{
"Enter"
,
"Esc"
,
NULL
};
static
int
IOPriorityEvents
[]
=
{
13
,
27
};
Panel
*
IOPriorityPanel_new
(
IOPriority
currPrio
)
{
FunctionBar
*
fuBar
=
FunctionBar_new
(
IOPriorityFunctions
,
IOPriorityKeys
,
IOPriorityEvents
);
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
ListItem
),
fuBar
);
Panel
*
this
=
Panel_new
(
1
,
1
,
1
,
1
,
true
,
Class
(
ListItem
),
FunctionBar_newEnterEsc
(
"Set "
,
"Cancel "
));
Panel_setHeader
(
this
,
"IO Priority:"
);
Panel_add
(
this
,
(
Object
*
)
ListItem_new
(
"None (based on nice)"
,
IOPriority_None
));
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment