Trivial dialog cleanups.

SVN revision: 8263
This commit is contained in:
Kim Woelders 2004-01-03 12:21:52 +00:00
parent 72466ee352
commit 17c34a3959
19 changed files with 211 additions and 287 deletions

66
src/E.h
View File

@ -224,34 +224,6 @@ if (__xim) XDestroyImage(__xim);}
#define AUDIO_PLAY(sclass) \ #define AUDIO_PLAY(sclass) \
ApplySclass(FindItem((sclass), 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS)); ApplySclass(FindItem((sclass), 0, LIST_FINDBY_NAME, LIST_TYPE_SCLASS));
/************************************************************************/
/* dialog macro convenience funcs */
/************************************************************************/
#define DIALOG_OK(title, text) \
{ \
Dialog *__d; \
__d = CreateDialog("DIALOG"); \
DialogSetTitle(__d, title); \
DialogSetText(__d, text); \
DialogAddButton(__d, _("OK"), NULL, 1); \
ShowDialog(__d); \
}
#define DIALOG_PARAM_OK(title) \
{ \
Dialog *__d; \
__d = CreateDialog("DIALOG"); \
DialogSetTitle(__d, title);
#define DIALOG_PARAM \
DialogSetParamText(__d,
#define DIALOG_PARAM_END \
); \
DialogAddButton(__d, _("OK"), NULL, 1); \
ShowDialog(__d); \
}
/************************************************************************/ /************************************************************************/
@ -2621,29 +2593,24 @@ void Quicksort(void **a, int l, int r,
int (*CompareFunc) (void *d1, void *d2)); int (*CompareFunc) (void *d1, void *d2));
/* dialog.c */ /* dialog.c */
Dialog *CreateDialog(char *name); Dialog *DialogCreate(char *name);
void DialogDestroy(Dialog * d);
void DialogBindKey(Dialog * d, char *key, void DialogBindKey(Dialog * d, char *key,
void (*func) (int val, void *data), int val, void (*func) (int val, void *data), int val,
void *data); void *data);
void FreeDialog(Dialog * d);
void DialogSetText(Dialog * d, char *text); void DialogSetText(Dialog * d, char *text);
void DialogSetTitle(Dialog * d, char *title); void DialogSetTitle(Dialog * d, char *title);
void DialogAddButton(Dialog * d, char *text, void DialogSetExitFunction(Dialog * d,
void (*func) (int val, void *data), void (*func) (int val, void *data),
char close); int val, void *data);
void DialogDrawButton(Dialog * d, int bnum);
void DialogActivateButton(Window win, int inclick);
void DialogDraw(Dialog * d);
void DialogDrawArea(Dialog * d, int x, int y, int w, int h);
void DialogRedraw(Dialog * d); void DialogRedraw(Dialog * d);
void DialogMove(Dialog * d); void DialogMove(Dialog * d);
void ShowDialog(Dialog * d); void ShowDialog(Dialog * d);
void DialogClose(Dialog * d); void DialogClose(Dialog * d);
void DialogSetParamText(Dialog * d, char *fmt, ...);
void DialogAlert(char *fmt, ...); void DialogAddButton(Dialog * d, char *text,
void DialogAlertOK(char *fmt, ...); void (*func) (int val, void *data),
void DialogRestart(int val, void *data); char close);
void DialogQuit(int val, void *data);
DItem *DialogInitItem(Dialog * d); DItem *DialogInitItem(Dialog * d);
DItem *DialogAddItem(DItem * dii, int type); DItem *DialogAddItem(DItem * dii, int type);
DItem *DialogItem(Dialog * d); DItem *DialogItem(Dialog * d);
@ -2657,10 +2624,8 @@ void DialogItemSetPadding(DItem * di, int left, int right,
void DialogItemSetFill(DItem * di, char fill_h, char fill_v); void DialogItemSetFill(DItem * di, char fill_h, char fill_v);
void DialogItemSetAlign(DItem * di, int align_h, int align_v); void DialogItemSetAlign(DItem * di, int align_h, int align_v);
void DialogItemCallCallback(DItem * di); void DialogItemCallCallback(DItem * di);
void DialogRealizeItem(Dialog * d, DItem * di);
void DialogDrawItems(Dialog * d, DItem * di, int x, int y, int w, void DialogDrawItems(Dialog * d, DItem * di, int x, int y, int w,
int h); int h);
void DialogItemsRealize(Dialog * d);
void DialogItemButtonSetText(DItem * di, char *text); void DialogItemButtonSetText(DItem * di, char *text);
void DialogItemCheckButtonSetText(DItem * di, char *text); void DialogItemCheckButtonSetText(DItem * di, char *text);
void DialogItemTextSetText(DItem * di, char *text); void DialogItemTextSetText(DItem * di, char *text);
@ -2677,18 +2642,13 @@ void DialogItemSeparatorSetOrientation(DItem * di,
char horizontal); char horizontal);
void DialogItemImageSetFile(DItem * di, char *image); void DialogItemImageSetFile(DItem * di, char *image);
void DialogFreeItem(DItem * di); void DialogFreeItem(DItem * di);
DItem *DialogItemFindWindow(DItem * di, Window win);
void DialogItemSetRowSpan(DItem * di, int row_span); void DialogItemSetRowSpan(DItem * di, int row_span);
void DialogItemSetColSpan(DItem * di, int col_span); void DialogItemSetColSpan(DItem * di, int col_span);
void DialogSetExitFunction(Dialog * d,
void (*func) (int val, void *data),
int val, void *data);
void DialogItemRadioButtonSetText(DItem * di, char *text); void DialogItemRadioButtonSetText(DItem * di, char *text);
void DialogItemRadioButtonSetFirst(DItem * di, DItem * first); void DialogItemRadioButtonSetFirst(DItem * di, DItem * first);
void DialogItemRadioButtonGroupSetValPtr(DItem * di, void DialogItemRadioButtonGroupSetValPtr(DItem * di,
int *val_ptr); int *val_ptr);
void DialogItemRadioButtonGroupSetVal(DItem * di, int val); void DialogItemRadioButtonGroupSetVal(DItem * di, int val);
void MoveTableBy(Dialog * d, DItem * di, int dx, int dy);
void DialogItemSliderSetVal(DItem * di, int val); void DialogItemSliderSetVal(DItem * di, int val);
void DialogItemSliderSetBounds(DItem * di, int lower, int upper); void DialogItemSliderSetBounds(DItem * di, int lower, int upper);
@ -2707,6 +2667,14 @@ Window DialogItemAreaGetWindow(DItem * di);
void DialogItemAreaSetEventFunc(DItem * di, void DialogItemAreaSetEventFunc(DItem * di,
void (*func) (int val, void (*func) (int val,
void *data)); void *data));
void DialogOK(const char *title, const char *fmt, ...);
void DialogOKstr(const char *title, const char *txt);
void DialogRestart(int val, void *data);
void DialogQuit(int val, void *data);
void DialogAlert(const char *fmt, ...);
void DialogAlertOK(const char *fmt, ...);
int DialogEventKeyPress(XEvent * ev); int DialogEventKeyPress(XEvent * ev);
int DialogEventMotion(XEvent * ev); int DialogEventMotion(XEvent * ev);
int DialogEventExpose(XEvent * ev); int DialogEventExpose(XEvent * ev);

View File

@ -277,11 +277,8 @@ RemoveActionClass(ActionClass * ActionClassToRemove)
if (ActionClassToRemove->ref_count > 0) if (ActionClassToRemove->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("ActionClass Error!"), _("%u references remain\n"),
ActionClassToRemove->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
ActionClassToRemove->ref_count);
DIALOG_OK(_("ActionClass Error!"), stuff);
EDBUG_RETURN_; EDBUG_RETURN_;
} }
while (RemoveItemByPtr(ActionClassToRemove, LIST_TYPE_ACLASS)); while (RemoveItemByPtr(ActionClassToRemove, LIST_TYPE_ACLASS));
@ -3199,7 +3196,7 @@ doAbout(void *params)
ShowDialog(d); ShowDialog(d);
EDBUG_RETURN(0); EDBUG_RETURN(0);
} }
d = CreateDialog("ABOUT_ENLIGHTENMENT"); d = DialogCreate("ABOUT_ENLIGHTENMENT");
{ {
char stuff[255]; char stuff[255];
@ -3829,17 +3826,17 @@ doZoom(void *params)
("You have been warned about the dangers of Zoom mode\n")); ("You have been warned about the dangers of Zoom mode\n"));
fclose(f); fclose(f);
} }
DIALOG_OK(_("Warning !!!"), DialogOK(_("Warning !!!"),
_("This feature is heavily reliant on a feature of your\n" _("This feature is heavily reliant on a feature of your\n"
"X Server called the Vid Mode Extension. This feature exists\n" "X Server called the Vid Mode Extension. This feature exists\n"
"in XFree86 Servers, but is not a heavily used part of the\n" "in XFree86 Servers, but is not a heavily used part of the\n"
"Server and thus isn't tested much.\n\n" "Server and thus isn't tested much.\n\n"
"It is possible your X Server does not deal well with being\n" "It is possible your X Server does not deal well with being\n"
"asked to switch modes quickly and it may hang, glitch,\n" "asked to switch modes quickly and it may hang, glitch,\n"
"display artefacts or perhaps simply refuse to work.\n\n" "display artefacts or perhaps simply refuse to work.\n\n"
"This is a warning and will only be displayed this one time.\n" "This is a warning and will only be displayed this one time.\n"
"If your Server does not behave well then you will probably\n" "If your Server does not behave well then you will probably\n"
"have to avoid using this feature.\n")); "have to avoid using this feature.\n"));
EDBUG_RETURN(0); EDBUG_RETURN(0);
} }
ewin = GetFocusEwin(); ewin = GetFocusEwin();

View File

@ -2191,13 +2191,10 @@ FreeBorder(Border * b)
if (b->ref_count > 0) if (b->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("Border Error!"), _("%u references remain\n"), b->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
b->ref_count);
DIALOG_OK(_("Border Error!"), stuff);
EDBUG_RETURN_; EDBUG_RETURN_;
} }
while (RemoveItemByPtr(b, LIST_TYPE_BORDER)); while (RemoveItemByPtr(b, LIST_TYPE_BORDER));
for (i = 0; i < b->num_winparts; i++) for (i = 0; i < b->num_winparts; i++)

View File

@ -121,12 +121,7 @@ ButtonDestroy(Button * b)
if (b->ref_count > 0) if (b->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("Button Error!"), _("%u references remain\n"), b->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
b->ref_count);
DIALOG_OK(_("Button Error!"), stuff);
EDBUG_RETURN_; EDBUG_RETURN_;
} }

View File

@ -62,13 +62,11 @@ CreateCurve(ModCurve * c)
} }
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
FreeModCurve(ModCurve * c) FreeModCurve(ModCurve * c)
{ {
EDBUG(6, "FreeModCurve"); EDBUG(6, "FreeModCurve");
if (!c) if (!c)
@ -78,13 +76,11 @@ FreeModCurve(ModCurve * c)
Efree(c->py); Efree(c->py);
EDBUG_RETURN_; EDBUG_RETURN_;
} }
void void
FreeCMClass(ColorModifierClass * cm) FreeCMClass(ColorModifierClass * cm)
{ {
EDBUG(5, "FreeCmClass"); EDBUG(5, "FreeCmClass");
if (!cm) if (!cm)
@ -92,14 +88,9 @@ FreeCMClass(ColorModifierClass * cm)
if (cm->ref_count > 0) if (cm->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("ColorModClass Error!"), _("%u references remain\n"),
cm->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
cm->ref_count);
DIALOG_OK(_("ColorModClass Error!"), stuff);
EDBUG_RETURN_; EDBUG_RETURN_;
} }
while (RemoveItemByPtr(cm, LIST_TYPE_COLORMODIFIER)); while (RemoveItemByPtr(cm, LIST_TYPE_COLORMODIFIER));
@ -110,7 +101,6 @@ FreeCMClass(ColorModifierClass * cm)
FreeModCurve(&(cm->blue)); FreeModCurve(&(cm->blue));
EDBUG_RETURN_; EDBUG_RETURN_;
} }
ColorModifierClass * ColorModifierClass *
@ -180,7 +170,6 @@ CreateCMClass(char *name, int rnum, unsigned char *rpx,
CreateCurve(&(cm->blue)); CreateCurve(&(cm->blue));
EDBUG_RETURN(cm); EDBUG_RETURN(cm);
} }
void void
@ -260,5 +249,4 @@ ModifyCMClass(char *name, int rnum, unsigned char *rpx, unsigned char *rpy,
CreateCurve(&(cm->blue)); CreateCurve(&(cm->blue));
EDBUG_RETURN_; EDBUG_RETURN_;
} }

View File

@ -2057,13 +2057,10 @@ HandleComms(XClientMessageEvent * ev)
if (!s2) if (!s2)
s2 = sunknown; s2 = sunknown;
{ {
char buf[FILEPATH_LEN_MAX]; DialogOK(_("E IPC Error"),
_("Received Unknown Client Message.\n"
Esnprintf(buf, sizeof(buf), "Client Name: %s\n" "Client Version: %s\n"
_("Received Unknown Client Message.\n" "Message Contents:\n\n" "%s\n"), s1, s2, s);
"Client Name: %s\n" "Client Version: %s\n"
"Message Contents:\n\n" "%s\n"), s1, s2, s);
DIALOG_OK(_("E IPC Error"), buf);
AUDIO_PLAY("SOUND_ERROR_IPC"); AUDIO_PLAY("SOUND_ERROR_IPC");
} }
} }

View File

@ -91,25 +91,18 @@ ApplyECursor(Window win, ECursor * ec)
if (!ec) if (!ec)
return; return;
XDefineCursor(disp, win, ec->cursor); XDefineCursor(disp, win, ec->cursor);
return;
} }
void void
FreeECursor(ECursor * ec) FreeECursor(ECursor * ec)
{ {
if (!ec) if (!ec)
return; return;
if (ec->ref_count > 0) if (ec->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("ECursor Error!"), _("%u references remain\n"),
ec->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
ec->ref_count);
DIALOG_OK(_("ECursor Error!"), stuff);
return; return;
} }
@ -120,6 +113,4 @@ FreeECursor(ECursor * ec)
if (ec->file) if (ec->file)
Efree(ec->file); Efree(ec->file);
Efree(ec); Efree(ec);
return;
} }

View File

@ -369,7 +369,6 @@ RemoveImagesFromBG(Background * bg)
void void
FreeDesktopBG(Background * bg) FreeDesktopBG(Background * bg)
{ {
EDBUG(6, "FreeDesktopBG"); EDBUG(6, "FreeDesktopBG");
if (!bg) if (!bg)
@ -377,12 +376,8 @@ FreeDesktopBG(Background * bg)
if (bg->ref_count > 0) if (bg->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("Background Error!"), _("%u references remain\n"),
bg->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
bg->ref_count);
DIALOG_OK(_("Background Error!"), stuff);
EDBUG_RETURN_; EDBUG_RETURN_;
} }

View File

@ -22,17 +22,7 @@
*/ */
#include "E.h" #include "E.h"
typedef struct _ditembutton DItemButton; typedef struct
typedef struct _ditemcheckbutton DItemCheckButton;
typedef struct _ditemtext DItemText;
typedef struct _ditemimage DItemImage;
typedef struct _ditemseparator DItemSeparator;
typedef struct _ditemtable DItemTable;
typedef struct _ditemradiobutton DItemRadioButton;
typedef struct _ditemslider DItemSlider;
typedef struct _ditemarea DItemArea;
struct _ditemslider
{ {
char horizontal; char horizontal;
@ -67,45 +57,45 @@ struct _ditemslider
Window base_win; Window base_win;
Window knob_win; Window knob_win;
Window border_win; Window border_win;
}; } DItemSlider;
struct _ditemarea typedef struct
{ {
Window area_win; Window area_win;
int w, h; int w, h;
void (*event_func) (int val, void *data); void (*event_func) (int val, void *data);
}; } DItemArea;
struct _ditembutton typedef struct
{ {
char *text; char *text;
}; } DItemButton;
struct _ditemcheckbutton typedef struct
{ {
char *text; char *text;
Window check_win; Window check_win;
int check_orig_w, check_orig_h; int check_orig_w, check_orig_h;
char onoff; char onoff;
char *onoff_ptr; char *onoff_ptr;
}; } DItemCheckButton;
struct _ditemtext typedef struct
{ {
char *text; char *text;
}; } DItemText;
struct _ditemimage typedef struct
{ {
char *image; char *image;
}; } DItemImage;
struct _ditemseparator typedef struct
{ {
char horizontal; char horizontal;
}; } DItemSeparator;
struct _ditemtable typedef struct
{ {
int num_columns; int num_columns;
char border; char border;
@ -113,9 +103,9 @@ struct _ditemtable
char homogenous_v; char homogenous_v;
int num_items; int num_items;
DItem **items; DItem **items;
}; } DItemTable;
struct _ditemradiobutton typedef struct
{ {
char *text; char *text;
Window radio_win; Window radio_win;
@ -126,7 +116,7 @@ struct _ditemradiobutton
DItem *next; DItem *next;
DItem *first; DItem *first;
void (*event_func) (int val, void *data); void (*event_func) (int val, void *data);
}; } DItemRadioButton;
struct _ditem struct _ditem
{ {
@ -205,6 +195,9 @@ struct _dialog
DKeyBind *keybindings; DKeyBind *keybindings;
}; };
static void MoveTableBy(Dialog * d, DItem * di, int dx, int dy);
static void DialogItemsRealize(Dialog * d);
static ImageClass *d_ic_default = NULL; static ImageClass *d_ic_default = NULL;
static TextClass *d_tc_default = NULL; static TextClass *d_tc_default = NULL;
@ -306,7 +299,7 @@ DialogBindKey(Dialog * d, char *key, void (*func) (int val, void *data),
} }
Dialog * Dialog *
CreateDialog(char *name) DialogCreate(char *name)
{ {
Dialog *d; Dialog *d;
@ -360,7 +353,7 @@ FreeDButton(DButton * db)
} }
void void
FreeDialog(Dialog * d) DialogDestroy(Dialog * d)
{ {
int i; int i;
@ -385,60 +378,6 @@ FreeDialog(Dialog * d)
Efree(d); Efree(d);
} }
void
DialogRestart(int val, void *data)
{
doExit("restart");
val = 0;
data = NULL;
}
void
DialogQuit(int val, void *data)
{
doExit("error");
val = 0;
data = NULL;
}
void
DialogAlert(char *fmt, ...)
{
char text[10240];
va_list ap;
va_start(ap, fmt);
Evsnprintf(text, 10240, fmt, ap);
va_end(ap);
Alert(text);
}
void
DialogAlertOK(char *fmt, ...)
{
char text[10240];
va_list ap;
va_start(ap, fmt);
Evsnprintf(text, 10240, fmt, ap);
va_end(ap);
ASSIGN_ALERT(_("Attention !!!"), _("OK"), " ", " ");
Alert(text);
RESET_ALERT;
}
void
DialogSetParamText(Dialog * d, char *fmt, ...)
{
char text[10240];
va_list ap;
va_start(ap, fmt);
Evsnprintf(text, 10240, fmt, ap);
va_end(ap);
DialogSetText(d, text);
}
void void
DialogSetText(Dialog * d, char *text) DialogSetText(Dialog * d, char *text)
{ {
@ -523,7 +462,7 @@ DialogAddButton(Dialog * d, char *text, void (*func) (int val, void *data),
ButtonReleaseMask | ExposureMask); ButtonReleaseMask | ExposureMask);
} }
void static void
DialogDrawButton(Dialog * d, int bnum) DialogDrawButton(Dialog * d, int bnum)
{ {
int state; int state;
@ -548,7 +487,7 @@ DialogDrawButton(Dialog * d, int bnum)
d->button[bnum]->tclass, d->button[bnum]->text); d->button[bnum]->tclass, d->button[bnum]->text);
} }
void static void
DialogActivateButton(Window win, int inclick) DialogActivateButton(Window win, int inclick)
{ {
Dialog *d; Dialog *d;
@ -576,7 +515,7 @@ DialogActivateButton(Window win, int inclick)
DialogClose(d); DialogClose(d);
} }
void static void
DialogDraw(Dialog * d) DialogDraw(Dialog * d)
{ {
if ((!d->tclass) || (!d->iclass)) if ((!d->tclass) || (!d->iclass))
@ -593,7 +532,7 @@ DialogDraw(Dialog * d)
} }
} }
void static void
DialogDrawArea(Dialog * d, int x, int y, int w, int h) DialogDrawArea(Dialog * d, int x, int y, int w, int h)
{ {
if ((!d->tclass) || (!d->iclass)) if ((!d->tclass) || (!d->iclass))
@ -766,7 +705,7 @@ DialogClose(Dialog * d)
if (d->exit_func) if (d->exit_func)
(d->exit_func) (d->exit_val, d->exit_data); (d->exit_func) (d->exit_val, d->exit_data);
RemoveItem(NULL, d->win, LIST_FINDBY_ID, LIST_TYPE_DIALOG); RemoveItem(NULL, d->win, LIST_FINDBY_ID, LIST_TYPE_DIALOG);
FreeDialog(d); DialogDestroy(d);
} }
DItem * DItem *
@ -1016,7 +955,7 @@ DialogItemCallCallback(DItem * di)
di->func(di->val, di->data); di->func(di->val, di->data);
} }
void static void
DialogRealizeItem(Dialog * d, DItem * di) DialogRealizeItem(Dialog * d, DItem * di)
{ {
char *def = NULL; char *def = NULL;
@ -1596,7 +1535,7 @@ DialogRealizeItem(Dialog * d, DItem * di)
} }
} }
void static void
MoveTableBy(Dialog * d, DItem * di, int dx, int dy) MoveTableBy(Dialog * d, DItem * di, int dx, int dy)
{ {
int i; int i;
@ -1844,7 +1783,7 @@ DialogDrawItems(Dialog * d, DItem * di, int x, int y, int w, int h)
} }
} }
void static void
DialogItemsRealize(Dialog * d) DialogItemsRealize(Dialog * d)
{ {
char pq; char pq;
@ -2124,7 +2063,7 @@ DialogFreeItem(DItem * di)
Efree(di); Efree(di);
} }
DItem * static DItem *
DialogItemFindWindow(DItem * di, Window win) DialogItemFindWindow(DItem * di, Window win)
{ {
DItem *dii = NULL; DItem *dii = NULL;
@ -2156,6 +2095,78 @@ DialogItem(Dialog * d)
return d->item; return d->item;
} }
/*
* Predefined dialogs
*/
void
DialogOK(const char *title, const char *fmt, ...)
{
char text[10240];
va_list ap;
va_start(ap, fmt);
Evsnprintf(text, sizeof(text), fmt, ap);
va_end(ap);
DialogOKstr(title, text);
}
void
DialogOKstr(const char *title, const char *txt)
{
Dialog *d;
d = DialogCreate("DIALOG");
DialogSetTitle(d, title);
DialogSetText(d, txt);
DialogAddButton(d, _("OK"), NULL, 1);
ShowDialog(d);
}
void
DialogRestart(int val, void *data)
{
doExit("restart");
val = 0;
data = NULL;
}
void
DialogQuit(int val, void *data)
{
doExit("error");
val = 0;
data = NULL;
}
void
DialogAlert(const char *fmt, ...)
{
char text[10240];
va_list ap;
va_start(ap, fmt);
Evsnprintf(text, 10240, fmt, ap);
va_end(ap);
Alert(text);
}
void
DialogAlertOK(const char *fmt, ...)
{
char text[10240];
va_list ap;
va_start(ap, fmt);
Evsnprintf(text, 10240, fmt, ap);
va_end(ap);
ASSIGN_ALERT(_("Attention !!!"), _("OK"), " ", " ");
Alert(text);
RESET_ALERT;
}
/* /*
* Dialog event handlers * Dialog event handlers
*/ */

View File

@ -114,10 +114,10 @@ BuildWindowGroup(EWin ** ewins, int num)
AddEwinToGroup(ewins[i], g); AddEwinToGroup(ewins[i], g);
else else
{ {
DIALOG_OK(_("Cannot comply"), DialogOK(_("Cannot comply"),
_("Iconboxes and Pagers are disallowed from being\n" _("Iconboxes and Pagers are disallowed from being\n"
"members of a group. You cannot add these windows\n" "members of a group. You cannot add these windows\n"
"to a group.\n")); "to a group.\n"));
} }
} }
} }
@ -146,10 +146,10 @@ AddEwinToGroup(EWin * ewin, Group * g)
} }
else else
{ {
DIALOG_OK(_("Cannot comply"), DialogOK(_("Cannot comply"),
_("Iconboxes and Pagers are disallowed from being\n" _("Iconboxes and Pagers are disallowed from being\n"
"members of a group. You cannot add these windows\n" "members of a group. You cannot add these windows\n"
"to a group.\n")); "to a group.\n"));
} }
} }
} }
@ -592,26 +592,26 @@ ChooseGroupDialog(EWin * ewin, char *message, char group_select, int action)
if ((num_groups == 0) if ((num_groups == 0)
&& (action == ACTION_BREAK_GROUP || action == ACTION_REMOVE_FROM_GROUP)) && (action == ACTION_BREAK_GROUP || action == ACTION_REMOVE_FROM_GROUP))
{ {
DIALOG_OK(_("Window Group Error"), DialogOK(_("Window Group Error"),
_ _
("\n This window currently does not belong to any groups. \n" ("\n This window currently does not belong to any groups. \n"
" You can only destroy groups or remove windows from groups \n" " You can only destroy groups or remove windows from groups \n"
" through a window that actually belongs to at least one group.\n\n")); " through a window that actually belongs to at least one group.\n\n"));
return; return;
} }
if ((num_groups == 0) && (group_select == GROUP_SELECT_ALL_EXCEPT_EWIN)) if ((num_groups == 0) && (group_select == GROUP_SELECT_ALL_EXCEPT_EWIN))
{ {
DIALOG_OK(_("Window Group Error"), DialogOK(_("Window Group Error"),
_("\n Currently, no groups exist or this window \n" _("\n Currently, no groups exist or this window \n"
" already belongs to all existing groups. \n" " already belongs to all existing groups. \n"
" You have to start other groups first. \n\n")); " You have to start other groups first. \n\n"));
return; return;
} }
if (!tmp_groups) if (!tmp_groups)
{ {
DIALOG_OK(_("Window Group Error"), DialogOK(_("Window Group Error"),
_ _
("\n Currently, no groups exist. You have to start a group first.\n\n")); ("\n Currently, no groups exist. You have to start a group first.\n\n"));
return; return;
} }
@ -625,7 +625,7 @@ ChooseGroupDialog(EWin * ewin, char *message, char group_select, int action)
} }
AUDIO_PLAY("SOUND_SETTINGS_GROUP"); AUDIO_PLAY("SOUND_SETTINGS_GROUP");
d = CreateDialog("GROUP_SELECTION"); d = DialogCreate("GROUP_SELECTION");
DialogSetTitle(d, _("Window Group Selection")); DialogSetTitle(d, _("Window Group Selection"));
table = DialogInitItem(d); table = DialogInitItem(d);

View File

@ -110,11 +110,8 @@ FreeImageClass(ImageClass * i)
if (i->ref_count > 0) if (i->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("ImageClass Error!"), _("%u references remain\n"),
i->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
i->ref_count);
DIALOG_OK(_("ImageClass Error!"), stuff);
EDBUG_RETURN_; EDBUG_RETURN_;
} }
while (RemoveItemByPtr(i, LIST_TYPE_ICLASS)); while (RemoveItemByPtr(i, LIST_TYPE_ICLASS));

View File

@ -2232,9 +2232,7 @@ IPC_DialogOK(char *params, Client * c)
buf[0] = 0; buf[0] = 0;
if (params) if (params)
{ DialogOKstr(_("Message"), params);
DIALOG_OK(_("Message"), params);
}
else else
Esnprintf(buf, sizeof(buf), "Error: No text for dialog specified"); Esnprintf(buf, sizeof(buf), "Error: No text for dialog specified");

View File

@ -605,7 +605,7 @@ doSMExit(void *params)
LIST_TYPE_DIALOG))) LIST_TYPE_DIALOG)))
{ {
AUDIO_PLAY("SOUND_LOGOUT"); AUDIO_PLAY("SOUND_LOGOUT");
d = CreateDialog("LOGOUT_DIALOG"); d = DialogCreate("LOGOUT_DIALOG");
DialogSetTitle(d, "Are you sure?"); DialogSetTitle(d, "Are you sure?");
DialogSetText(d, DialogSetText(d,
"\n" "\n" "\n" "\n"
@ -1157,7 +1157,7 @@ doSMExit(void *params)
FindItem("LOGOUT_DIALOG", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG))) FindItem("LOGOUT_DIALOG", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
{ {
AUDIO_PLAY("SOUND_LOGOUT"); AUDIO_PLAY("SOUND_LOGOUT");
d = CreateDialog("LOGOUT_DIALOG"); d = DialogCreate("LOGOUT_DIALOG");
DialogSetTitle(d, _("Are you sure?")); DialogSetTitle(d, _("Are you sure?"));
DialogSetText(d, DialogSetText(d,
_("\n" "\n" _("\n" "\n"

View File

@ -123,7 +123,7 @@ SettingsPager(void)
tmp_pager_do_scan = 1; tmp_pager_do_scan = 1;
tmp_pager_scan_speed = mode.pager_scanspeed; tmp_pager_scan_speed = mode.pager_scanspeed;
d = pager_settings_dialog = CreateDialog("CONFIGURE_PAGER"); d = pager_settings_dialog = DialogCreate("CONFIGURE_PAGER");
DialogSetTitle(d, _("Pager Settings")); DialogSetTitle(d, _("Pager Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -413,7 +413,7 @@ SettingsFocus(void)
#endif /* WITH_TARTY_WARP */ #endif /* WITH_TARTY_WARP */
tmp_clickalways = mode.clickalways; tmp_clickalways = mode.clickalways;
d = CreateDialog("CONFIGURE_FOCUS"); d = DialogCreate("CONFIGURE_FOCUS");
DialogSetTitle(d, _("Focus Settings")); DialogSetTitle(d, _("Focus Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -798,7 +798,7 @@ SettingsMoveResize(void)
tmp_resize = mode.resizemode; tmp_resize = mode.resizemode;
tmp_geominfo = mode.geominfomode; tmp_geominfo = mode.geominfomode;
d = CreateDialog("CONFIGURE_MOVERESIZE"); d = DialogCreate("CONFIGURE_MOVERESIZE");
DialogSetTitle(d, _("Move & Resize Settings")); DialogSetTitle(d, _("Move & Resize Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -981,7 +981,7 @@ SettingsMoveResize(void)
ShowDialog(d); ShowDialog(d);
/* /*
* dexp = CreateDialog("CONFIGURE_MOVERESIZE_EXAMPLE"); * dexp = DialogCreate("CONFIGURE_MOVERESIZE_EXAMPLE");
* DialogSetTitle(dexp, _("Move & Resize Settings Example")); * DialogSetTitle(dexp, _("Move & Resize Settings Example"));
*/ */
@ -1118,7 +1118,7 @@ SettingsDesktops(void)
tmp_desktops = mode.numdesktops; tmp_desktops = mode.numdesktops;
tmp_desktop_wraparound = mode.desktop_wraparound; tmp_desktop_wraparound = mode.desktop_wraparound;
d = tmp_desk_dialog = CreateDialog("CONFIGURE_DESKTOPS"); d = tmp_desk_dialog = DialogCreate("CONFIGURE_DESKTOPS");
DialogSetTitle(d, _("Multiple Desktop Settings")); DialogSetTitle(d, _("Multiple Desktop Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -1318,7 +1318,7 @@ SettingsArea(void)
GetAreaSize(&tmp_area_x, &tmp_area_y); GetAreaSize(&tmp_area_x, &tmp_area_y);
tmp_area_y = 9 - tmp_area_y; tmp_area_y = 9 - tmp_area_y;
d = tmp_area_dialog = CreateDialog("CONFIGURE_AREA"); d = tmp_area_dialog = DialogCreate("CONFIGURE_AREA");
DialogSetTitle(d, _("Virtual Desktop Settings")); DialogSetTitle(d, _("Virtual Desktop Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -1496,7 +1496,7 @@ SettingsPlacement(void)
tmp_extra_head = mode.extra_head; tmp_extra_head = mode.extra_head;
#endif #endif
d = CreateDialog("CONFIGURE_PLACEMENT"); d = DialogCreate("CONFIGURE_PLACEMENT");
DialogSetTitle(d, _("Window Placement Settings")); DialogSetTitle(d, _("Window Placement Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -1626,7 +1626,7 @@ SettingsAutoRaise(void)
tmp_autoraise = mode.autoraise; tmp_autoraise = mode.autoraise;
tmp_autoraisetime = (int)(mode.autoraisetime * 100); tmp_autoraisetime = (int)(mode.autoraisetime * 100);
d = CreateDialog("CONFIGURE_AUTORAISE"); d = DialogCreate("CONFIGURE_AUTORAISE");
DialogSetTitle(d, _("Autoraise Settings")); DialogSetTitle(d, _("Autoraise Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -1727,7 +1727,7 @@ SettingsTooltips(void)
tmp_tooltiptime = (int)(mode.tiptime * 100); tmp_tooltiptime = (int)(mode.tiptime * 100);
tmp_roottip = mode.showroottooltip; tmp_roottip = mode.showroottooltip;
d = CreateDialog("CONFIGURE_TOOLTIPS"); d = DialogCreate("CONFIGURE_TOOLTIPS");
DialogSetTitle(d, _("Tooltip Settings")); DialogSetTitle(d, _("Tooltip Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -1829,7 +1829,7 @@ SettingsMiscellaneous(void)
tmp_dialog_headers = mode.dialog_headers; tmp_dialog_headers = mode.dialog_headers;
d = CreateDialog("CONFIGURE_MISCELLANEOUS"); d = DialogCreate("CONFIGURE_MISCELLANEOUS");
DialogSetTitle(d, _("Miscellaneous Settings")); DialogSetTitle(d, _("Miscellaneous Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -1912,7 +1912,7 @@ SettingsAudio(void)
tmp_audio = mode.sound; tmp_audio = mode.sound;
d = CreateDialog("CONFIGURE_AUDIO"); d = DialogCreate("CONFIGURE_AUDIO");
DialogSetTitle(d, _("Audio Settings")); DialogSetTitle(d, _("Audio Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -2072,7 +2072,7 @@ SettingsSpecialFX(void)
tmp_effect_ripples = FX_IsOn("ripples"); tmp_effect_ripples = FX_IsOn("ripples");
tmp_effect_waves = FX_IsOn("waves"); tmp_effect_waves = FX_IsOn("waves");
d = CreateDialog("CONFIGURE_FX"); d = DialogCreate("CONFIGURE_FX");
DialogSetTitle(d, _("Special FX Settings")); DialogSetTitle(d, _("Special FX Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -3301,7 +3301,7 @@ SettingsBackground(Background * bg)
tmp_userbg = mode.user_bg; tmp_userbg = mode.user_bg;
tmp_bg_timeout = mode.desktop_bg_timeout; tmp_bg_timeout = mode.desktop_bg_timeout;
d = bg_sel_dialog = CreateDialog("CONFIGURE_BG"); d = bg_sel_dialog = DialogCreate("CONFIGURE_BG");
DialogSetTitle(d, _("Desktop Background Settings")); DialogSetTitle(d, _("Desktop Background Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -3770,7 +3770,7 @@ SettingsIconbox(char *name)
Efree(tmp_ib_name); Efree(tmp_ib_name);
tmp_ib_name = duplicate(name); tmp_ib_name = duplicate(name);
d = CreateDialog("CONFIGURE_ICONBOX"); d = DialogCreate("CONFIGURE_ICONBOX");
DialogSetTitle(d, _("Iconbox Settings")); DialogSetTitle(d, _("Iconbox Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -4143,9 +4143,9 @@ SettingsGroups(EWin * ewin)
return; return;
if (ewin->num_groups == 0) if (ewin->num_groups == 0)
{ {
DIALOG_OK(_("Window Group Error"), DialogOK(_("Window Group Error"),
_ _
("\n This window currently does not belong to any groups. \n\n")); ("\n This window currently does not belong to any groups. \n\n"));
return; return;
} }
if ((d = FindItem("CONFIGURE_GROUP", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG))) if ((d = FindItem("CONFIGURE_GROUP", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
@ -4167,7 +4167,7 @@ SettingsGroups(EWin * ewin)
for (i = 0; i < ewin->num_groups; i++) for (i = 0; i < ewin->num_groups; i++)
CopyGroupConfig(&(ewin->groups[i]->cfg), &(tmp_cfgs[i])); CopyGroupConfig(&(ewin->groups[i]->cfg), &(tmp_cfgs[i]));
d = CreateDialog("CONFIGURE_GROUP"); d = DialogCreate("CONFIGURE_GROUP");
DialogSetTitle(d, _("Window Group Settings")); DialogSetTitle(d, _("Window Group Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -4371,7 +4371,7 @@ SettingsDefaultGroupControl(void)
CopyGroupConfig(&(mode.group_config), &tmp_group_cfg); CopyGroupConfig(&(mode.group_config), &tmp_group_cfg);
tmp_group_swap = mode.group_swapmove; tmp_group_swap = mode.group_swapmove;
d = CreateDialog("CONFIGURE_DEFAULT_GROUP_CONTROL"); d = DialogCreate("CONFIGURE_DEFAULT_GROUP_CONTROL");
DialogSetTitle(d, _("Default Group Control Settings")); DialogSetTitle(d, _("Default Group Control Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);
@ -4619,7 +4619,7 @@ SettingsRemember()
} }
AUDIO_PLAY("SOUND_SETTINGS_REMEMBER"); AUDIO_PLAY("SOUND_SETTINGS_REMEMBER");
d = CreateDialog("REMEMBER_WINDOW"); d = DialogCreate("REMEMBER_WINDOW");
DialogSetTitle(d, _("Remembered Windows Settings")); DialogSetTitle(d, _("Remembered Windows Settings"));
table = DialogInitItem(d); table = DialogInitItem(d);

View File

@ -280,7 +280,7 @@ SnapshotEwinDialog(EWin * ewin)
ShowDialog(d); ShowDialog(d);
return; return;
} }
d = CreateDialog("SNAPSHOT_WINDOW"); d = DialogCreate("SNAPSHOT_WINDOW");
DialogSetTitle(d, _("Remembered Application Attributes")); DialogSetTitle(d, _("Remembered Application Attributes"));
table = DialogInitItem(d); table = DialogInitItem(d);

View File

@ -50,13 +50,11 @@ LoadWav(char *file)
find = FindFile(file); find = FindFile(file);
if (!find) if (!find)
{ {
DIALOG_PARAM_OK(_("Error finding sound file")); DialogOK(_("Error finding sound file"),
DIALOG_PARAM _("Warning! Enlightenment was unable " _("Warning! Enlightenment was unable to load the\n"
"to load the\nfollowing sound file:\n%s\n" "following sound file:\n%s\n"
"Enlightenment will continue to operate, but you\n" "Enlightenment will continue to operate, but you\n"
"may wish to check your configuration settings.\n"), "may wish to check your configuration settings.\n"), file);
file DIALOG_PARAM_END;
EDBUG_RETURN(NULL); EDBUG_RETURN(NULL);
} }
in_file = afOpenFile(find, "r", NULL); in_file = afOpenFile(find, "r", NULL);

View File

@ -66,11 +66,8 @@ DeleteTclass(TextClass * t)
if (t->ref_count > 0) if (t->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("TextClass Error!"), _("%u references remain\n"),
t->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
t->ref_count);
DIALOG_OK(_("TextClass Error!"), stuff);
EDBUG_RETURN_; EDBUG_RETURN_;
} }
if (t->name) if (t->name)

View File

@ -344,16 +344,13 @@ FindTheme(char *theme)
void void
BadThemeDialog(void) BadThemeDialog(void)
{ {
char s[1024];
if (!badtheme) if (!badtheme)
return; return;
Esnprintf(s, sizeof(s), DialogOK(_("Bad Theme"),
_("The theme:\n" "%s\n" _("The theme:\n" "%s\n"
"Is a badly formed theme package and is thus not being used.\n" "Is a badly formed theme package and is thus not being used.\n"
"Enlightenment has fallen back to using the DEFAULT theme.\n" "Enlightenment has fallen back to using the DEFAULT theme.\n"
"\n" "The reason this theme is bad is:\n" "%s"), badtheme, "\n" "The reason this theme is bad is:\n" "%s"),
badreason); badtheme, badreason);
DIALOG_OK(_("Bad Theme"), s);
} }

View File

@ -858,11 +858,9 @@ FreeToolTip(ToolTip * tt)
if (tt->ref_count > 0) if (tt->ref_count > 0)
{ {
char stuff[255]; DialogOK(_("ToolTip Error!"), _("%u references remain\n"),
tt->ref_count);
Esnprintf(stuff, sizeof(stuff), _("%u references remain\n"),
tt->ref_count);
DIALOG_OK(_("ToolTip Error!"), stuff);
} }
EDBUG_RETURN_; EDBUG_RETURN_;
} }