Use EDE_APPLICATION to init localization code and set default (and much saner) font size.

This commit is contained in:
Sanel Zukan 2010-03-28 12:54:45 +00:00
parent e4ec7c9861
commit 39b5181ad5
18 changed files with 100 additions and 54 deletions

View File

@ -25,7 +25,7 @@
#include <FL/Fl_Text_Buffer.H> #include <FL/Fl_Text_Buffer.H>
#include <FL/Fl_Pixmap.H> #include <FL/Fl_Pixmap.H>
#include <edelib/Nls.h> #include <edelib/Ede.h>
#include "icons/ede.xpm" #include "icons/ede.xpm"
static Fl_Pixmap image_ede((const char**)ede_xpm); static Fl_Pixmap image_ede((const char**)ede_xpm);
@ -123,6 +123,8 @@ char* prepare_style(char* txt, int len) {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
EDE_APPLICATION("ede-about");
win = new Fl_Window(440, 335, _("About EDE")); win = new Fl_Window(440, 335, _("About EDE"));
win->begin(); win->begin();
Fl_Group* title_group = new Fl_Group(0, 0, 440, 65); Fl_Group* title_group = new Fl_Group(0, 0, 440, 65);

View File

@ -30,13 +30,13 @@
#include <edelib/Util.h> #include <edelib/Util.h>
#include <edelib/DesktopFile.h> #include <edelib/DesktopFile.h>
#include <edelib/Directory.h> #include <edelib/Directory.h>
#include <edelib/Nls.h>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include <edelib/Run.h> #include <edelib/Run.h>
#include <edelib/FileTest.h> #include <edelib/FileTest.h>
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/IconLoader.h> #include <edelib/IconLoader.h>
#include <edelib/Ede.h>
EDELIB_NS_USING_AS(Window, AppWindow) EDELIB_NS_USING_AS(Window, AppWindow)
EDELIB_NS_USING(String) EDELIB_NS_USING(String)
@ -346,6 +346,8 @@ static const char* next_param(int curr, char** argv, int argc) {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
EDE_APPLICATION("ede-autostart");
if(argc == 1) { if(argc == 1) {
perform_autostart(false); perform_autostart(false);
return 0; return 0;

View File

@ -10,7 +10,7 @@
* See COPYING for details. * See COPYING for details.
*/ */
#ifndef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@ -23,8 +23,8 @@
#include <FL/Fl_Value_Slider.H> #include <FL/Fl_Value_Slider.H>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/Nls.h>
#include <edelib/XSettingsClient.h> #include <edelib/XSettingsClient.h>
#include <edelib/Ede.h>
EDELIB_NS_USING(XSettingsClient) EDELIB_NS_USING(XSettingsClient)
EDELIB_NS_USING(XSettingsAction) EDELIB_NS_USING(XSettingsAction)
@ -132,6 +132,8 @@ static void test_cb(Fl_Widget*, void*) {
} }
static void window_create(int argc, char** argv) { static void window_create(int argc, char** argv) {
EDE_APPLICATION("ede-bell-conf");
win = new edelib::Window(330, 210, _("System bell configuration"), edelib::WIN_INIT_NONE); win = new edelib::Window(330, 210, _("System bell configuration"), edelib::WIN_INIT_NONE);
win->begin(); win->begin();
vol_slide = new Fl_Value_Slider(10, 30, 310, 25, _("Volume")); vol_slide = new Fl_Value_Slider(10, 30, 310, 25, _("Volume"));

View File

@ -25,11 +25,11 @@
#include <FL/Fl_Button.H> #include <FL/Fl_Button.H>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/Nls.h>
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/String.h> #include <edelib/String.h>
#include <edelib/Regex.h> #include <edelib/Regex.h>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include <edelib/Ede.h>
#ifdef HAVE_CURL #ifdef HAVE_CURL
# include "BugzillaSender.h" # include "BugzillaSender.h"
@ -136,6 +136,8 @@ int main(int argc, char** argv) {
"it from http://curl.haxx.se. After this, you'll have to recompile ede-bug-report again")); "it from http://curl.haxx.se. After this, you'll have to recompile ede-bug-report again"));
return 1; return 1;
#else #else
EDE_APPLICATION("ede-bug-report");
/* in case if debugger output was given */ /* in case if debugger output was given */
const char *gdb_output = NULL; const char *gdb_output = NULL;

View File

@ -10,8 +10,13 @@
* See COPYING for details. * See COPYING for details.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <edelib/Ede.h>
#include "CrashDialog.h" #include "CrashDialog.h"
#define CHECK_ARGV(argv, pshort, plong) ((strcmp(argv, pshort) == 0) || (strcmp(argv, plong) == 0)) #define CHECK_ARGV(argv, pshort, plong) ((strcmp(argv, pshort) == 0) || (strcmp(argv, plong) == 0))
@ -44,6 +49,8 @@ int main(int argc, char** argv) {
return 0; return 0;
} }
EDE_APPLICATION("ede-crasher");
const char* a; const char* a;
ProgramDetails p; ProgramDetails p;

View File

@ -10,6 +10,10 @@
* See COPYING for details. * See COPYING for details.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Button.H> #include <FL/Fl_Button.H>
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
@ -22,10 +26,10 @@
#include <edelib/ExpandableGroup.h> #include <edelib/ExpandableGroup.h>
#include <edelib/String.h> #include <edelib/String.h>
#include <edelib/IconLoader.h> #include <edelib/IconLoader.h>
#include <edelib/Nls.h>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/Run.h> #include <edelib/Run.h>
#include <edelib/Ede.h>
EDELIB_NS_USING(list) EDELIB_NS_USING(list)
EDELIB_NS_USING(Resource) EDELIB_NS_USING(Resource)
@ -146,6 +150,8 @@ static void load_buttons(Fl_Group* g) {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
EDE_APPLICATION("ede-conf");
edelib::Window* win = new edelib::Window(455, 330, _("EDE Configuration Place")); edelib::Window* win = new edelib::Window(455, 330, _("EDE Configuration Place"));
win->begin(); win->begin();

View File

@ -33,7 +33,6 @@
#include <FL/Fl_Menu_Button.H> #include <FL/Fl_Menu_Button.H>
#include <FL/x.H> #include <FL/x.H>
#include <edelib/Nls.h>
#include <edelib/Color.h> #include <edelib/Color.h>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/Resource.h> #include <edelib/Resource.h>
@ -42,6 +41,7 @@
#include <edelib/FontChooser.h> #include <edelib/FontChooser.h>
#include <edelib/Directory.h> #include <edelib/Directory.h>
#include <edelib/ForeignCallback.h> #include <edelib/ForeignCallback.h>
#include <edelib/Ede.h>
#define EDE_DESKTOP_CONFIG "ede-desktop" #define EDE_DESKTOP_CONFIG "ede-desktop"
@ -363,6 +363,8 @@ int main(int argc, char** argv) {
show_group = 3; show_group = 3;
} }
EDE_APPLICATION("ede-desktop-conf");
edelib::Window* win = new edelib::Window(550, 285, _("Desktop options"), edelib::WIN_INIT_IMAGES); edelib::Window* win = new edelib::Window(550, 285, _("Desktop options"), edelib::WIN_INIT_IMAGES);
win->begin(); win->begin();
Fl_Tabs* tabs = new Fl_Tabs(10, 10, 530, 230); Fl_Tabs* tabs = new Fl_Tabs(10, 10, 530, 230);

View File

@ -35,12 +35,12 @@
#include <edelib/IconLoader.h> #include <edelib/IconLoader.h>
#include <edelib/Run.h> #include <edelib/Run.h>
#include <edelib/Util.h> #include <edelib/Util.h>
#include <edelib/Nls.h>
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/MenuButton.h> #include <edelib/MenuButton.h>
#include <edelib/ForeignCallback.h> #include <edelib/ForeignCallback.h>
#include <edelib/Netwm.h> #include <edelib/Netwm.h>
#include <edelib/WindowXid.h> #include <edelib/WindowXid.h>
#include <edelib/Ede.h>
#include "ede-desktop.h" #include "ede-desktop.h"
#include "DesktopIcon.h" #include "DesktopIcon.h"
@ -1137,6 +1137,8 @@ int Desktop::handle(int event) {
} }
int main() { int main() {
EDE_APPLICATION("ede-desktop");
signal(SIGTERM, exit_signal); signal(SIGTERM, exit_signal);
signal(SIGKILL, exit_signal); signal(SIGKILL, exit_signal);
signal(SIGINT, exit_signal); signal(SIGINT, exit_signal);

View File

@ -10,7 +10,7 @@
* See COPYING for details. * See COPYING for details.
*/ */
#ifndef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
#endif #endif
@ -20,7 +20,7 @@
#include <FL/Fl.H> #include <FL/Fl.H>
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/Nls.h> #include <edelib/Ede.h>
EDELIB_NS_USING(MessageBox) EDELIB_NS_USING(MessageBox)
EDELIB_NS_USING(MessageBoxType) EDELIB_NS_USING(MessageBoxType)
@ -159,6 +159,8 @@ int main(int argc, char **argv) {
return EDE_DIALOG_ERROR_RET; return EDE_DIALOG_ERROR_RET;
} }
EDE_APPLICATION("ede-dialog");
/* /*
* Use a trick to load icon theme and colors using xsettings stuff. edelib::Window will load them * Use a trick to load icon theme and colors using xsettings stuff. edelib::Window will load them
* and fill static FLTK values; every further window will use those values, including our will use them * and fill static FLTK values; every further window will use those values, including our will use them

View File

@ -10,5 +10,5 @@
SubDir TOP ede-image-view ; SubDir TOP ede-image-view ;
FltkProgram ede-image-view : ede-image-view.cpp ; EdeProgram ede-image-view : ede-image-view.cpp ;
TranslationStrings locale : ede-image-view.cpp ; TranslationStrings locale : ede-image-view.cpp ;

View File

@ -10,6 +10,16 @@
* See COPYING for details. * See COPYING for details.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#include <Fl/Fl.H> #include <Fl/Fl.H>
#include <Fl/Fl_Double_Window.H> #include <Fl/Fl_Double_Window.H>
#include <Fl/Fl_Button.H> #include <Fl/Fl_Button.H>
@ -18,27 +28,10 @@
#include <Fl/Fl_Widget.H> #include <Fl/Fl_Widget.H>
#include <Fl/Fl_File_Chooser.H> #include <Fl/Fl_File_Chooser.H>
#include <Fl/filename.H> #include <Fl/filename.H>
#include <edelib/Ede.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#define DEBUG 1 #define DEBUG 1
// Can this be moved to Jamfile/configure?
//#define USE_EDELIB
#ifdef USE_EDELIB
#include <edelib/Nls.h>
#else
#define _(stuff) stuff
#endif
// Supported image types // Supported image types
const char* supported[] = {"bm","bmp","gif","jpg","pbm","pgm","png","ppm","xbm","xpm",0}; const char* supported[] = {"bm","bmp","gif","jpg","pbm","pgm","png","ppm","xbm","xpm",0};
@ -371,7 +364,7 @@ int main (int argc, char **argv) {
snprintf(directory, FL_PATH_MAX, "%s", getenv("HOME")); snprintf(directory, FL_PATH_MAX, "%s", getenv("HOME"));
else { else {
if (strcmp(argv[unknown],"--help")==0) { if (strcmp(argv[unknown],"--help")==0) {
printf(_("EImage - EDE Image Viewer\nPart of Equinox Desktop Environment (EDE).\nCopyright (c) 2000-2007 EDE Authors.\n\nThis program is licenced under terms of the\nGNU General Public Licence version 2 or newer.\nSee COPYING for details.\n\n")); printf(_("ede-image-view - EDE Image Viewer\nPart of Equinox Desktop Environment (EDE).\nCopyright (c) 2000-2007 EDE Authors.\n\nThis program is licenced under terms of the\nGNU General Public Licence version 2 or newer.\nSee COPYING for details.\n\n"));
printf(_("Usage: ede-image-view [OPTIONS] [IMAGE_FILE]\n\n")); printf(_("Usage: ede-image-view [OPTIONS] [IMAGE_FILE]\n\n"));
printf(_("Available options:\n%s\n"),Fl::help); printf(_("Available options:\n%s\n"),Fl::help);
return 1; return 1;
@ -395,12 +388,10 @@ int main (int argc, char **argv) {
} }
} }
zoomfactor=1; im=0; // defaults EDE_APPLICATION("ede-image-view");
fl_register_images(); fl_register_images();
zoomfactor=1; im=0; // defaults
FL_NORMAL_SIZE=12;
fl_message_font(FL_HELVETICA, 12);
// Main window // Main window

View File

@ -15,7 +15,7 @@
#endif #endif
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/Nls.h> #include <edelib/Ede.h>
EDELIB_NS_USING(alert) EDELIB_NS_USING(alert)
#ifdef HAVE_XKBRULES #ifdef HAVE_XKBRULES
@ -242,6 +242,8 @@ int main(int argc, char **argv) {
read_config(NULL); read_config(NULL);
} }
EDE_APPLICATION("ede-keyboard-conf");
String cl; String cl;
dialog_canceled = false; dialog_canceled = false;

View File

@ -36,11 +36,11 @@
#include <edelib/Run.h> #include <edelib/Run.h>
#include <edelib/Resource.h> #include <edelib/Resource.h>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/Nls.h>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include <edelib/Missing.h> #include <edelib/Missing.h>
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/String.h> #include <edelib/String.h>
#include <edelib/Ede.h>
#include "icons/run.xpm" #include "icons/run.xpm"
@ -332,6 +332,8 @@ static int start_dialog(int argc, char** argv) {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
EDE_APPLICATION("ede-launch");
if(argc <= 1) if(argc <= 1)
return start_dialog(argc, argv); return start_dialog(argc, argv);

View File

@ -1,7 +1,12 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <signal.h> #include <signal.h>
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Double_Window.H> #include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H> #include <FL/Fl_Button.H>
#include <edelib/Ede.h>
#include "Panel.h" #include "Panel.h"
#include "AppletManager.h" #include "AppletManager.h"
@ -13,6 +18,8 @@ static void exit_signal(int signum) {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
EDE_APPLICATION("ede-panel");
signal(SIGTERM, exit_signal); signal(SIGTERM, exit_signal);
signal(SIGKILL, exit_signal); signal(SIGKILL, exit_signal);
signal(SIGINT, exit_signal); signal(SIGINT, exit_signal);

View File

@ -10,6 +10,10 @@
* See COPYING for the details. * See COPYING for the details.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/Fl_Double_Window.H> #include <FL/Fl_Double_Window.H>
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
@ -21,8 +25,8 @@
#include <FL/Fl_Pixmap.H> #include <FL/Fl_Pixmap.H>
#include <FL/x.H> #include <FL/x.H>
#include <edelib/Nls.h>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include <edelib/Ede.h>
#include "XScreenSaver.h" #include "XScreenSaver.h"
#include "icons/energy.xpm" #include "icons/energy.xpm"
@ -107,6 +111,8 @@ static void ok_cb(Fl_Widget*, void* s) {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
EDE_APPLICATION("ede-screensaver-conf");
fl_open_display(); fl_open_display();
/* start daemon if not started */ /* start daemon if not started */
xscreensaver_run_daemon(fl_display); xscreensaver_run_daemon(fl_display);

View File

@ -10,9 +10,21 @@
* See COPYING for details. * See COPYING for details.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "ede-timedate.h" #include "ede-timedate.h"
#include <edelib/Nls.h> #include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Repeat_Button.H>
#define FL_PATH_MAX 1024
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/Run.h> #include <edelib/Run.h>
#include <edelib/StrUtil.h> #include <edelib/StrUtil.h>
@ -20,16 +32,7 @@
#include <edelib/IconTheme.h> #include <edelib/IconTheme.h>
#include <edelib/Debug.h> #include <edelib/Debug.h>
#include <edelib/Window.h> #include <edelib/Window.h>
#include <edelib/Ede.h>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Repeat_Button.H>
#define FL_PATH_MAX 1024
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#include "icons/world2.xpm" #include "icons/world2.xpm"
@ -430,11 +433,10 @@ static void tick(void *v) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
EDE_APPLICATION("ede-timedate");
FL_NORMAL_SIZE=12;
time_changed = format_changed = tz_changed = date_changed = false; time_changed = format_changed = tz_changed = date_changed = false;
{ timedateWindow = new edelib::Window(415, 320, _("Time and date")); { timedateWindow = new edelib::Window(415, 320, _("Time and date"));
{ Fl_Tabs* o = new Fl_Tabs(5, 5, 405, 270); { Fl_Tabs* o = new Fl_Tabs(5, 5, 405, 270);
{ Fl_Group* o = new Fl_Group(5, 30, 405, 245, _("&Time/date")); { Fl_Group* o = new Fl_Group(5, 30, 405, 245, _("&Time/date"));

View File

@ -10,6 +10,10 @@
* See COPYING for the details. * See COPYING for the details.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h> #include <stdlib.h>
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
@ -22,7 +26,6 @@
#include <FL/Fl_Box.H> #include <FL/Fl_Box.H>
#include <FL/Fl_Pixmap.H> #include <FL/Fl_Pixmap.H>
#include <edelib/Nls.h>
#include <edelib/Resource.h> #include <edelib/Resource.h>
#include <edelib/DesktopFile.h> #include <edelib/DesktopFile.h>
#include <edelib/File.h> #include <edelib/File.h>
@ -30,6 +33,7 @@
#include <edelib/Util.h> #include <edelib/Util.h>
#include <edelib/MessageBox.h> #include <edelib/MessageBox.h>
#include <edelib/Directory.h> #include <edelib/Directory.h>
#include <edelib/Ede.h>
#include "icons/hint.xpm" #include "icons/hint.xpm"
#include "Fortune.h" #include "Fortune.h"
@ -164,6 +168,8 @@ void prev_cb(Fl_Widget*, void*) {
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
EDE_APPLICATION("ede-tip");
ffile = load_fortune_file(); ffile = load_fortune_file();
// initialize random number only if we loaded tips // initialize random number only if we loaded tips

View File

@ -20,6 +20,7 @@
#include <FL/Fl.H> #include <FL/Fl.H>
#include <FL/x.H> #include <FL/x.H>
#include <edelib/Run.h> #include <edelib/Run.h>
#include <edelib/Ede.h>
#include "EvokeService.h" #include "EvokeService.h"
@ -75,6 +76,8 @@ int main(int argc, char** argv) {
} }
} }
EDE_APPLICATION("evoke");
/* make sure X11 is running before rest of code is called */ /* make sure X11 is running before rest of code is called */
fl_open_display(); fl_open_display();