Added ede-bell-conf, a tool to configure system bell (that annoying beep thing)

Rest are changes so can nicely be compiled on freebsd
Also, some changes are in coding style
This commit is contained in:
Sanel Zukan 2009-02-26 11:15:27 +00:00
parent e051472475
commit c7c8fc92ea
13 changed files with 280 additions and 129 deletions

View File

@ -17,14 +17,13 @@ Clean distclean : $(JCACHEFILE) $(HCACHEFILE) ;
# SubInclude goes after local rules
SubInclude TOP ede-about ;
SubInclude TOP ede-bell-conf ;
SubInclude TOP ede-calc ;
SubInclude TOP ede-conf ;
SubInclude TOP ede-crasher ;
SubInclude TOP ede-desktop ;
SubInclude TOP ede-desktop-conf ;
SubInclude TOP ede-screensaver-conf ;
#SubInclude TOP edewm ;
SubInclude TOP efiler ;
SubInclude TOP ede-help ;
SubInclude TOP eimage ;
SubInclude TOP elma ;
@ -37,3 +36,8 @@ SubInclude TOP edewm ;
SubInclude TOP evoke ;
SubInclude TOP doc ;
SubInclude TOP data ;
# efile is not compileable on FreeBSD
if $(OS) != FREEBSD {
SubInclude TOP efiler ;
}

View File

@ -17,7 +17,7 @@ MANUAL_FILES = [ Wildcard manual : *.html : manual ] ;
MANUAL_IMGS = [ FDirName $(SUBDIR) manual images ] ;
# where will be installed
MANUAL_INSTALL_DIR = [ FDirName $(EDEDOCDIR) manual ] ;
MANUAL_INSTALL_DIR = [ FDirName $(EDE_DOC_DIR) manual ] ;
# install generated documents
InstallData $(MANUAL_INSTALL_DIR) : $(MANUAL_FILES) ;

16
ede-bell-conf/Jamfile Normal file
View File

@ -0,0 +1,16 @@
#
# $Id$
#
# Part of Equinox Desktop Environment (EDE).
# Copyright (c) 2009 EDE Authors.
#
# This program is licensed under terms of the
# GNU General Public License version 2 or newer.
# See COPYING for details.
SubDir TOP ede-bell-conf ;
SOURCE = ede-bell-conf.cpp ;
EdeProgram ede-bell-conf : $(SOURCE) ;
TranslationStrings locale : $(SOURCE) ;

View File

@ -0,0 +1,84 @@
/*
* $Id$
*
* ede-bell-conf, a tool to configure system bell
* Part of Equinox Desktop Environment (EDE).
* Copyright (c) 2009 EDE Authors.
*
* This program is licensed under terms of the
* GNU General Public License version 2 or newer.
* See COPYING for details.
*/
#include <FL/x.H>
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Value_Slider.H>
#include <edelib/Window.h>
#include <edelib/Nls.h>
static Fl_Value_Slider* vol_slide;
static Fl_Value_Slider* pitch_slide;
static Fl_Value_Slider* dur_slide;
static edelib::Window* win;
static void set_values(void) {
unsigned long v = KBBellPercent | KBBellPitch | KBBellDuration;
XKeyboardControl kc;
kc.bell_percent = (unsigned int)vol_slide->value();
kc.bell_pitch = (unsigned int)pitch_slide->value();
kc.bell_duration = (unsigned int)dur_slide->value();
XChangeKeyboardControl(fl_display, v, &kc);
}
static void cancel_cb(Fl_Widget*, void*) {
win->hide();
}
static void ok_cb(Fl_Widget*, void*) {
set_values();
win->hide();
}
static void test_cb(Fl_Widget*, void*) {
set_values();
XBell(fl_display, 0);
}
int main(int argc, char **argv) {
win = new edelib::Window(330, 210, _("System bell configuration"));
win->begin();
vol_slide = new Fl_Value_Slider(10, 30, 310, 25, _("Volume"));
vol_slide->type(5);
vol_slide->step(1);
vol_slide->maximum(100);
vol_slide->align(FL_ALIGN_TOP);
pitch_slide = new Fl_Value_Slider(10, 80, 310, 25, _("Pitch"));
pitch_slide->type(5);
pitch_slide->step(1);
pitch_slide->minimum(100);
pitch_slide->maximum(1000);
pitch_slide->align(FL_ALIGN_TOP);
dur_slide = new Fl_Value_Slider(10, 130, 310, 25, _("Duration"));
dur_slide->type(5);
dur_slide->step(1);
dur_slide->minimum(0);
dur_slide->maximum(1000);
dur_slide->align(FL_ALIGN_TOP);
Fl_Button* ok = new Fl_Button(135, 175, 90, 25, _("&OK"));
ok->callback(ok_cb);
Fl_Button* cancel = new Fl_Button(230, 175, 90, 25, _("&Cancel"));
cancel->callback(cancel_cb);
Fl_Button* test = new Fl_Button(10, 175, 90, 25, _("&Test"));
test->callback(test_cb);
win->end();
win->show(argc, argv);
return Fl::run();
}

View File

@ -0,0 +1,36 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0108
header_name {.h}
code_name {.cxx}
Function {} {open
} {
Fl_Window {} {
label {System bell configuration} open
xywh {428 267 330 210} type Double visible
} {
Fl_Button {} {
label {&OK}
xywh {135 175 90 25}
}
Fl_Button {} {
label {&Cancel} selected
xywh {230 175 90 25}
}
Fl_Button {} {
label {&Test}
xywh {10 175 90 25}
}
Fl_Value_Slider {} {
label Volume
xywh {10 30 310 25} type {Horz Knob} align 1 step 0.01 textsize 12
}
Fl_Value_Slider {} {
label Pitch
xywh {10 80 310 25} type {Horz Knob} align 1 step 0.01 textsize 12
}
Fl_Value_Slider {} {
label Duration
xywh {10 130 310 25} type {Horz Knob} align 1 step 0.01 textsize 12
}
}
}

View File

@ -4,7 +4,7 @@
[EdeConf]
# main items
items = edewmconf,ede-desktop-conf,ede-screensaver-conf,ede-timedate
items = edewmconf,ede-desktop-conf,ede-screensaver-conf,ede-timedate, ede-bell-conf
[edewmconf]
name = Window manager
@ -29,3 +29,9 @@
tip = This item will configure system date and time
exec = ede-timedate
icon = preferences-date-time
[ede-bell-conf]
name = Configure system bell
tip = This item will configure system bell
exec = ede-bell-conf
icon = audio-volume-zero

View File

@ -54,8 +54,6 @@ static void ok_cb(Fl_Widget*, void* w) {
}
static void icon_change_cb(Fl_Button* b, void* d) {
DesktopIconData* data = (DesktopIconData*)d;
edelib::String ret = edelib::icon_chooser(edelib::ICON_SIZE_HUGE);
if(ret.empty())
return;

View File

@ -18,7 +18,7 @@
/*
* Class responsible for displaying images at background
* their scaling (TODO), caching(TODO) and making coffee at the spear time.
* their scaling (TODO), caching(TODO) and making coffee at the spare time.
*/
class Wallpaper : public Fl_Box {
private:

View File

@ -151,7 +151,7 @@ void BatteryMonitor::update_status()
#include <machine/apmioctl.h>
int first = 1;
void battery_check(void)
void BatteryMonitor::battery_check(void)
{
int fd;
struct apmreq ar ;
@ -213,7 +213,7 @@ void battery_check(void)
#define APM_STAT_BATT_CHARGING 3
int first = 1;
void battery_check(void)
void BatteryMonitor::battery_check(void)
{
int fd, r;
bool p;
@ -284,7 +284,7 @@ void battery_check(void)
#define _PATH_APM_NORMAL "/dev/apm"
int first = 1;
void battery_check(void)
void BatteryMonitor::battery_check(void)
{
int fd, r;
bool p;

View File

@ -57,6 +57,8 @@ static int atoms_loaded = 0;
static pid_t xscr_preview_pid = 0;
static const char* xscr_folder_found = 0;
extern char** environ;
static const char* xscr_hacks_dirs[] = {
PREFIX"/lib/xscreensaver/",
"/usr/libexec/xscreensaver/",

View File

@ -10,12 +10,17 @@
* See COPYING for the details.
*/
#include "Fortune.h"
#include <netinet/in.h>
#include <ctype.h>
#include <stdio.h>
#include "Fortune.h"
/* FreeBSD does not have off_t, not sure about others */
#ifndef __GLIBC__
typedef unsigned int off_t;
#endif
struct FortuneFile {
FILE* str_file;
FILE* dat_file;