give icons to launcher
This commit is contained in:
parent
a999db5657
commit
9796eb2c3c
3 changed files with 64 additions and 18 deletions
|
|
@ -1,3 +1,4 @@
|
|||
#include <MDE/Foundation.h>
|
||||
#include <Mw/Milsko.h>
|
||||
#include <xemil.h>
|
||||
|
||||
|
|
@ -31,9 +32,33 @@ void module(MwWidget box, xl_node_t* node) {
|
|||
int y = (gap + 18) * (c % 2);
|
||||
|
||||
if(n->type == XL_NODE_NODE && strcmp(n->name, "Execute") == 0 && n->text != NULL) {
|
||||
MwWidget btn = MwVaCreateWidget(MwButtonClass, "button", f, x, y, 18, 18,
|
||||
MwNflat, 1,
|
||||
NULL);
|
||||
MwLLPixmap px = NULL;
|
||||
MwWidget btn;
|
||||
const char* icon = NULL;
|
||||
xl_attribute_t* a = n->first_attribute;
|
||||
|
||||
while(a != NULL) {
|
||||
if(strcmp(a->key, "Icon") == 0) {
|
||||
icon = a->value;
|
||||
}
|
||||
a = a->next;
|
||||
}
|
||||
|
||||
if(icon != NULL && icon[0] == '/') {
|
||||
px = MwLoadImage(box, icon);
|
||||
} else if(icon != NULL) {
|
||||
char* p = MDEIconLookUp("apps", icon, 16);
|
||||
|
||||
if(p != NULL) {
|
||||
px = MwLoadImage(box, p);
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
|
||||
btn = MwVaCreateWidget(MwButtonClass, "button", f, x, y, 18, 18,
|
||||
MwNflat, 1,
|
||||
MwNpixmap, px,
|
||||
NULL);
|
||||
|
||||
c++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,27 +10,25 @@
|
|||
<Application Name="Applications" />
|
||||
<Separator />
|
||||
<Execute Name="Terminal">uxterm</Execute>
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Execute Name="" />
|
||||
<Separator />
|
||||
<EndSession Name="End Session" />
|
||||
<ShutDown Name="Shut Down" />
|
||||
<Reboot Name="Reboot" />
|
||||
</Menu>
|
||||
</StartButton>
|
||||
|
||||
<Separator />
|
||||
|
||||
<Launcher>
|
||||
<Execute>uxterm</Execute>
|
||||
<Execute>uxterm</Execute>
|
||||
<Execute>uxterm</Execute>
|
||||
<Execute>uxterm</Execute>
|
||||
<Execute>uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
<Execute Icon="terminal">uxterm</Execute>
|
||||
</Launcher>
|
||||
|
||||
<Separator />
|
||||
|
|
|
|||
|
|
@ -339,6 +339,29 @@ static void menu_scan(opaque_t* opaque, xl_node_t* node) {
|
|||
m->wsub = NULL;
|
||||
m->sub = NULL;
|
||||
m->opaque = MwStringDuplicate(n->text == NULL ? "" : n->text);
|
||||
} else if(n->type == XL_NODE_NODE && strcmp(n->name, "EndSession") == 0 && name != NULL) {
|
||||
m = malloc(sizeof(*m));
|
||||
m->name = MwStringDuplicate(name);
|
||||
m->keep = 0;
|
||||
m->wsub = NULL;
|
||||
m->sub = NULL;
|
||||
m->opaque = malloc(512);
|
||||
|
||||
sprintf(m->opaque, "kill %ld", (long)getppid());
|
||||
} else if(n->type == XL_NODE_NODE && strcmp(n->name, "ShutDown") == 0 && name != NULL) {
|
||||
m = malloc(sizeof(*m));
|
||||
m->name = MwStringDuplicate(name);
|
||||
m->keep = 0;
|
||||
m->wsub = NULL;
|
||||
m->sub = NULL;
|
||||
m->opaque = MwStringDuplicate(""); /* TODO */
|
||||
} else if(n->type == XL_NODE_NODE && strcmp(n->name, "Reboot") == 0 && name != NULL) {
|
||||
m = malloc(sizeof(*m));
|
||||
m->name = MwStringDuplicate(name);
|
||||
m->keep = 0;
|
||||
m->wsub = NULL;
|
||||
m->sub = NULL;
|
||||
m->opaque = MwStringDuplicate(""); /* TODO */
|
||||
}
|
||||
|
||||
if(m != NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue