mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Run those programs...
This commit is contained in:
parent
9a5e7129e2
commit
aced43a39a
@ -12,6 +12,7 @@
|
||||
|
||||
#include "Autostart.h"
|
||||
#include "icons/warning.xpm"
|
||||
#include "EvokeService.h"
|
||||
|
||||
#include <edelib/Nls.h>
|
||||
#include <FL/Fl_Pixmap.h>
|
||||
@ -24,6 +25,16 @@ void closeit_cb(Fl_Widget*, void* w) {
|
||||
win->hide();
|
||||
}
|
||||
|
||||
void run_sel_cb(Fl_Widget*, void* w) {
|
||||
AstartDialog* win = (AstartDialog*)w;
|
||||
win->run_selected();
|
||||
}
|
||||
|
||||
void run_all_cb(Fl_Widget*, void* w) {
|
||||
AstartDialog* win = (AstartDialog*)w;
|
||||
win->run_all();
|
||||
}
|
||||
|
||||
AstartDialog::AstartDialog(unsigned int sz) : Fl_Window(370, 305, _("Autostart warning")),
|
||||
curr(0), lst_sz(sz), lst(0) {
|
||||
|
||||
@ -36,8 +47,10 @@ AstartDialog::AstartDialog(unsigned int sz) : Fl_Window(370, 305, _("Autostart w
|
||||
txt = new Fl_Box(80, 10, 280, 60, _("The following applications are registered for starting. Please choose what to do next"));
|
||||
txt->align(FL_ALIGN_INSIDE | FL_ALIGN_LEFT | FL_ALIGN_WRAP);
|
||||
cbrowser = new Fl_Check_Browser(10, 75, 350, 185);
|
||||
run_sel = new Fl_Button(45, 270, 125, 25, _("Run &selected"));
|
||||
run_all = new Fl_Button(175, 270, 90, 25, _("&Run all"));
|
||||
rsel = new Fl_Button(45, 270, 125, 25, _("Run &selected"));
|
||||
rsel->callback(run_sel_cb, this);
|
||||
rall = new Fl_Button(175, 270, 90, 25, _("&Run all"));
|
||||
rall->callback(run_all_cb, this);
|
||||
cancel = new Fl_Button(270, 270, 90, 25, _("&Cancel"));
|
||||
cancel->callback(closeit_cb, this);
|
||||
cancel->take_focus();
|
||||
@ -52,6 +65,10 @@ AstartDialog::~AstartDialog() {
|
||||
void AstartDialog::add_item(const edelib::String& n, const edelib::String& e) {
|
||||
if(!lst_sz)
|
||||
return;
|
||||
|
||||
if(e.empty())
|
||||
return;
|
||||
|
||||
AstartItem it;
|
||||
it.name = n;
|
||||
it.exec = e;
|
||||
@ -69,3 +86,26 @@ void AstartDialog::run(void) {
|
||||
while(shown())
|
||||
Fl::wait();
|
||||
}
|
||||
|
||||
void AstartDialog::run_selected(void) {
|
||||
int it = cbrowser->nchecked();
|
||||
if(!it)
|
||||
return;
|
||||
|
||||
for(unsigned int i = 0; i < curr; i++) {
|
||||
if(cbrowser->checked(i+1))
|
||||
EvokeService::instance()->run_program(lst[i].exec.c_str());
|
||||
}
|
||||
|
||||
hide();
|
||||
}
|
||||
|
||||
void AstartDialog::run_all(void) {
|
||||
if(!curr)
|
||||
return;
|
||||
|
||||
for(unsigned int i = 0; i < curr; i++)
|
||||
EvokeService::instance()->run_program(lst[i].exec.c_str());
|
||||
|
||||
hide();
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ class AstartDialog : public Fl_Window {
|
||||
Fl_Box* img;
|
||||
Fl_Box* txt;
|
||||
Fl_Check_Browser* cbrowser;
|
||||
Fl_Button* run_sel;
|
||||
Fl_Button* run_all;
|
||||
Fl_Button* rsel;
|
||||
Fl_Button* rall;
|
||||
Fl_Button* cancel;
|
||||
|
||||
public:
|
||||
@ -45,6 +45,9 @@ class AstartDialog : public Fl_Window {
|
||||
unsigned int list_size(void) { return curr; }
|
||||
void add_item(const edelib::String& n, const edelib::String& e);
|
||||
void run(void);
|
||||
|
||||
void run_all(void);
|
||||
void run_selected(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user