Display comment too if possible

This commit is contained in:
Sanel Zukan 2009-05-26 13:35:56 +00:00
parent 5eda865eb4
commit 70f39b6849

View File

@ -74,6 +74,7 @@ static const char* autostart_names[] = {
struct DialogEntry { struct DialogEntry {
String name; String name;
String exec; String exec;
String comment;
}; };
typedef list<String> StringList; typedef list<String> StringList;
@ -183,8 +184,16 @@ static void run_autostart_dialog(DialogEntryList& l) {
cbrowser = new Fl_Check_Browser(10, 75, 350, 185); cbrowser = new Fl_Check_Browser(10, 75, 350, 185);
DialogEntryListIter it = l.begin(), it_end = l.end(); DialogEntryListIter it = l.begin(), it_end = l.end();
for(; it != it_end; ++it) for(; it != it_end; ++it) {
if((*it)->comment.empty())
cbrowser->add((*it)->name.c_str()); cbrowser->add((*it)->name.c_str());
else {
char buf[256];
snprintf(buf, sizeof(buf), "%s (%s)", (*it)->name.c_str(), (*it)->comment.c_str());
cbrowser->add(buf);
}
}
Fl_Button* rsel = new Fl_Button(45, 270, 125, 25, _("Run &selected")); Fl_Button* rsel = new Fl_Button(45, 270, 125, 25, _("Run &selected"));
rsel->callback(dialog_runsel_cb, ptr); rsel->callback(dialog_runsel_cb, ptr);
@ -278,6 +287,10 @@ static void perform_autostart(bool safe) {
else else
en->name = name; en->name = name;
/* get the comment */
if(df.comment(buf, sizeof(buf)))
en->comment = buf;
entry_list.push_back(en); entry_list.push_back(en);
} }