本文整理汇总了C++中Fl_Config::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Config::get方法的具体用法?C++ Fl_Config::get怎么用?C++ Fl_Config::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Config
的用法示例。
在下文中一共展示了Fl_Config::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateSetup
void updateSetup()
{
//printf("updateSetup()\n");
struct stat s;
// Check if configuration needs to be updated
if(!stat(pGlobalConfig.filename(), &s)) {
static long last_modified = 0;
long now = s.st_mtime;
if(last_modified>0 && last_modified==now) {
// Return if not modified
return;
}
// Store last modified time
last_modified = s.st_mtime;
}
pGlobalConfig.read_file(false);
if(pGlobalConfig.error()) {
fprintf(stderr, "[EWorkPanel Error]: %s\n", pGlobalConfig.strerror());
return;
}
bool auto_hide = false;
static bool hiden = false;
static bool last_state = false;
static bool on_start = true;
bool runbrowser;
pGlobalConfig.get("Panel", "AutoHide", auto_hide, false);
if (on_start) {
last_state = auto_hide;
pGlobalConfig.get("Panel", "RunBrowser", runbrowser, true);
if (runbrowser) { restoreRunBrowser() ; }
}
bool old_hiden = hiden;
if (auto_hide) {
mPanelWindow->setAutoHide(1);
hiden = true;
} else {
mPanelWindow->setAutoHide(0);
hiden = false;
}
if(old_hiden!=hiden || on_start) {
if(!hiden) {
mPanelWindow->position(mPanelWindow->initX, mPanelWindow->initY);
if(mPanelWindow->shown()) Fl_WM::set_window_strut(fl_xid(mPanelWindow), 0, 0, 0, mPanelWindow->h());
} else {
mPanelWindow->position(mPanelWindow->initX, mPanelWindow->initY+mPanelWindow->h()-4);
if(mPanelWindow->shown()) Fl_WM::set_window_strut(fl_xid(mPanelWindow), 0, 0, 0, 4);
}
}
on_start = false;
}
示例2: get_localized_name
Fl_String get_localized_name(Fl_Config &iconConfig)
{
Fl_String localName(get_localized_string());
Fl_String icon_name;
if(iconConfig.get("Desktop Entry", localName, icon_name, "")) {
iconConfig.get("Desktop Entry", "Name", icon_name, "None");
}
return icon_name;
}
示例3: updateWorkspaces
void updateWorkspaces(Fl_Widget*,void*)
{
bool showapplet;
pGlobalConfig.get("Panel", "Workspaces", showapplet, true);
if (!showapplet) { return; }
mWorkspace->clear();
mWorkspace->begin();
char **names=0;
int count = Fl_WM::get_workspace_count();
int names_count = Fl_WM::get_workspace_names(names);
int current = Fl_WM::get_current_workspace();
for(int n=0; n<count; n++) {
Fl_Item *i = new Fl_Item();
i->callback(setWorkspace, (long)n);
i->type(Fl_Item::RADIO);
if(n<names_count && names[n]) {
i->label(names[n]);
free(names[n]);
} else {
Fl_String tmp;
i->label(tmp.printf(tmp, "%s %d", _("Workspace") ,n+1));
}
if(current==n) i->set_value();
}
// add a divider if there are no workspaces
if (count<1) {
new Fl_Menu_Divider();
}
if(names) delete []names;
mWorkspace->end();
}
示例4: clockRefresh
void clockRefresh(void *)
{
// Handle user's format preference
Fl_String timestr = Fl_Date_Time::Now().time_string();
Fl_String timestrsec;
Fl_String format;
pGlobalConfig.get("Clock", "TimeFormat", format, "");
Fl_String seconds = timestr.sub_str(6, 2);
Fl_String minutes = timestr.sub_str(3, 2);
int hours = atoi(timestr.sub_str(0, 2));
if(format == "12") {
if(hours > 12) {
hours -= 12;
}
}
timestr = Fl_String(hours) + ":" + minutes;
timestrsec = timestr + ":" + seconds;
mClockBox->label(timestr);
strncpy(Fl_Date_Time::datePartsOrder, _("MDY"), 3);
Fl_String pClockTooltip = Fl_Date_Time::Now().day_name() + ", ";
pClockTooltip += Fl_Date_Time::Now().date_string() + ", " + timestrsec;
mClockBox->tooltip(pClockTooltip);
mClockBox->redraw();
Fl::add_timeout(1.0, clockRefresh);
}
示例5: getpwuid
MainMenu::MainMenu()
: Fl_Menu_Button(0,0,0,0, "Start")
{
layout_align(FL_ALIGN_LEFT);
label_font(label_font()->bold());
label_size(label_size()+2);
m_modified = 0;
e_image = 0;
m_open = false;
bool showusername;
pGlobalConfig.get("Panel", "ShowUsernameOnMenu", showusername, false);
struct passwd *PWD;
/* Search for an entry with a matching user ID. */
PWD = getpwuid(getuid());
if(showusername && PWD && PWD->pw_name && *PWD->pw_name) {
label(PWD->pw_name);
} else {
label("EDE");
}
tooltip(_("Welcome to the Equinox Desktop Environment."));
}
示例6: restoreRunBrowser
void restoreRunBrowser() {
// Read the history of commands in runBrowser on start
runBrowser->clear();
Fl_String historyString;
pGlobalConfig.get("Panel", "RunHistory", historyString,"");
Fl_String_List history(historyString,"|");
for (unsigned i = 0; i < history.count(); i++) {
runBrowser->add(history[i]);
}
}
示例7: startUtility
// Start utility, like "time/date" or "volume"
void startUtility(Fl_Button *, void *pName)
{
Fl_String value;
pGlobalConfig.get("Panel", (char*)pName, value, "");
if(!pGlobalConfig.error() && !value.empty()) {
value = "ede-launch \""+value;
value += "\"";
fl_start_child_process(value, false);
}
}
示例8: main
int main(int argc, char **argv)
{
signal(SIGCHLD, SIG_IGN);
signal(SIGSEGV, terminationHandler);
fl_init_locale_support("eworkpanel", PREFIX"/share/locale");
fl_init_images_lib();
int X=0,Y=0,W=Fl::w(),H=Fl::h();
int substract;
// Get current workarea
Fl_WM::get_workarea(X,Y,W,H);
//printf("Free area: %d %d %d %d\n", X,Y,W,H);
// We expect that other docks are moving away from panel :)
mPanelWindow = new Fl_Update_Window(X, Y+H-30, W, 30, "Workpanel");
mPanelWindow->layout_spacing(0);
// Panel is type DOCK
mPanelWindow->window_type(Fl_WM::DOCK);
mPanelWindow->setAutoHide(0);
// Read config
bool doShowDesktop;
pGlobalConfig.get("Panel", "ShowDesktop", doShowDesktop, false);
bool doWorkspaces;
pGlobalConfig.get("Panel", "Workspaces", doWorkspaces, true);
bool doQLB;
pGlobalConfig.get("Panel", "QuickLaunchBar", doQLB, true);
bool doRunBrowser;
pGlobalConfig.get("Panel", "RunBrowser", doRunBrowser, true);
bool doSoundMixer;
pGlobalConfig.get("Panel", "SoundMixer", doSoundMixer, true);
bool doCpuMonitor;
pGlobalConfig.get("Panel", "CPUMonitor", doCpuMonitor, true);
bool doBatteryMonitor;
doBatteryMonitor=true; // blah
// Group that holds everything..
Fl_Group *g = new Fl_Group(0,0,0,0);
g->box(FL_DIV_UP_BOX);
g->layout_spacing(2);
g->layout_align(FL_ALIGN_CLIENT);
g->begin();
mSystemMenu = new MainMenu();
Fl_VertDivider *v = new Fl_VertDivider(0, 0, 5, 18, "");
v->layout_align(FL_ALIGN_LEFT);
substract = 5;
//this kind of if-else block is ugly
// - but users demand such features so...
if ((doShowDesktop) || (doWorkspaces) || (doQLB)) {
int size=0;
if ((doShowDesktop) && (doWorkspaces)) { size=48; } else { size=24; }
// Add size for QLB:
if (doQLB && qlb_create_toolbuttons(0)) size += (qlb_numbuttons * 24);
Fl_Group *g2 = new Fl_Group(0,0,size,22);
g2->box(FL_FLAT_BOX);
g2->layout_spacing(0);
g2->layout_align(FL_ALIGN_LEFT);
// Show desktop button
if (doShowDesktop) {
PanelButton *mShowDesktop;
mShowDesktop = new PanelButton(0, 0, 24, 22, FL_NO_BOX, FL_DOWN_BOX, "ShowDesktop");
mShowDesktop->layout_align(FL_ALIGN_LEFT);
mShowDesktop->label_type(FL_NO_LABEL);
mShowDesktop->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
mShowDesktop->image(showdesktop_pix);
mShowDesktop->tooltip(_("Show desktop"));
mShowDesktop->callback( (Fl_Callback*)cb_showdesktop);
mShowDesktop->show();
substract += 26;
}
// Workspaces panel
mWorkspace=0; // so we can detect it later
if (doWorkspaces) {
mWorkspace = new PanelMenu(0, 0, 24, 22, FL_NO_BOX, FL_DOWN_BOX, "WSMenu");
mWorkspace->layout_align(FL_ALIGN_LEFT);
mWorkspace->label_type(FL_NO_LABEL);
mWorkspace->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
mWorkspace->image(desktop_pix);
mWorkspace->tooltip(_("Workspaces"));
mWorkspace->end();
substract += 26;
}
// "Quick Lunch" buttons
for (int count=0; count<qlb_numbuttons; count++) {
qlb_buttons[count] = new PanelButton(0, 0, 24, 22, FL_NO_BOX, FL_DOWN_BOX, qlb_tooltips[count]);
qlb_buttons[count]->layout_align(FL_ALIGN_LEFT);
qlb_buttons[count]->label_type(FL_NO_LABEL);
qlb_buttons[count]->align(FL_ALIGN_INSIDE|FL_ALIGN_CENTER);
//.........这里部分代码省略.........