summaryrefslogtreecommitdiffstats
path: root/SignalsPanel.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2012-12-05 15:12:20 +0000
committerHisham Muhammad <hisham@gobolinux.org>2012-12-05 15:12:20 +0000
commit00b324bfc162030b575e03795dcfcaac56bd0b4d (patch)
treefbaada243839b0b67351856e2d02a2e8184bf65f /SignalsPanel.c
parent2a73405cd060b543d56987650327b18078a137d7 (diff)
Changes in object model: separate class objects to store vtable. Also, nicer UTF-8 display of big numbers.
Diffstat (limited to 'SignalsPanel.c')
-rw-r--r--SignalsPanel.c33
1 files changed, 6 insertions, 27 deletions
diff --git a/SignalsPanel.c b/SignalsPanel.c
index e1a88b57..a52e5289 100644
--- a/SignalsPanel.c
+++ b/SignalsPanel.c
@@ -5,6 +5,7 @@ Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
+#include "Panel.h"
#include "SignalsPanel.h"
#include "ListItem.h"
@@ -16,26 +17,14 @@ in the source distribution for its full text.
#include <ctype.h>
/*{
-#include "Panel.h"
typedef struct SignalItem_ {
const char* name;
int number;
} SignalItem;
-typedef struct SignalsPanel_ {
- Panel super;
-} SignalsPanel;
-
}*/
-static void SignalsPanel_delete(Object* object) {
- Panel* super = (Panel*) object;
- SignalsPanel* this = (SignalsPanel*) object;
- Panel_done(super);
- free(this);
-}
-
static SignalItem signals[] = {
{ .name = " 0 Cancel", .number = 0 },
{ .name = " 1 SIGHUP", .number = 1 },
@@ -73,21 +62,11 @@ static SignalItem signals[] = {
{ .name = "31 SIGSYS", .number = 31 },
};
-SignalsPanel* SignalsPanel_new(int x, int y, int w, int h) {
- SignalsPanel* this = (SignalsPanel*) malloc(sizeof(SignalsPanel));
- Panel* super = (Panel*) this;
- Panel_init(super, x, y, w, h, LISTITEM_CLASS, true);
- ((Object*)this)->delete = SignalsPanel_delete;
-
+Panel* SignalsPanel_new() {
+ Panel* this = Panel_new(1, 1, 1, 1, true, Class(ListItem));
for(unsigned int i = 0; i < sizeof(signals)/sizeof(SignalItem); i++)
- Panel_set(super, i, (Object*) ListItem_new(signals[i].name, signals[i].number));
- SignalsPanel_reset(this);
+ Panel_set(this, i, (Object*) ListItem_new(signals[i].name, signals[i].number));
+ Panel_setHeader(this, "Send signal:");
+ Panel_setSelected(this, 16); // 16th item is SIGTERM
return this;
}
-
-void SignalsPanel_reset(SignalsPanel* this) {
- Panel* super = (Panel*) this;
-
- Panel_setHeader(super, "Send signal:");
- Panel_setSelected(super, 16); // 16th item is SIGTERM
-}

© 2014-2024 Faster IT GmbH | imprint | privacy policy