Add combined configuration dialog.

SVN revision: 24946
This commit is contained in:
Kim Woelders 2006-08-20 19:30:55 +00:00
parent 38cb5937d3
commit e34b526885
7 changed files with 141 additions and 5 deletions

View File

@ -47,6 +47,7 @@ END_MENU
BEGIN_NEW_MENU("CONFIG_SUBMENU", "ROOT")
ADD_MENU_TITLE("Settings")
ADD_MENU_TEXT_ITEM("Enlightenment Settings ...", __A_CMD, "misc cfg")
ADD_MENU_TEXT_ITEM("Focus Settings ...", __A_CMD, "focus cfg")
ADD_MENU_TEXT_ITEM("Move & Resize Settings ...", __A_CMD, "misc cfg moveresize")
ADD_MENU_TEXT_ITEM("Window Placement Settings ...", __A_CMD, "misc cfg placement")

View File

@ -93,6 +93,7 @@ _("Query background selector cache usage"),
_("Query all cache usage"),
_("Regenerate Menus"),
_("Settings"),
_("Enlightenment Settings ..."),
_("Focus Settings ..."),
_("Move & Resize Settings ..."),
_("Window Placement Settings ..."),
@ -131,6 +132,7 @@ _("Absolute Max Width Toggle"),
_("Max Size Toggle"),
_("Available Max Size Toggle"),
_("Absolute Max Size Toggle"),
_("Span Xinerama Screens"),
_("Height"),
_("Width"),
_("Size"),
@ -145,6 +147,7 @@ _("40%"),
_("60%"),
_("80%"),
_("100%"),
_("Opaque when focused"),
_("Toggle Shadows"),
_("Toggle Skip Window Lists"),
_("Toggle Fixed Position"),

View File

@ -249,6 +249,13 @@ DialogBindKey(Dialog * d, const char *key, DialogCallbackFunc * func, int val,
XKeysymToKeycode(disp, XStringToKeysym(key));
}
void
DialogKeybindingsDestroy(Dialog * d)
{
_EFREE(d->keybindings);
d->num_bindings = 0;
}
Dialog *
DialogCreate(const char *name)
{
@ -295,7 +302,7 @@ DialogButtonDestroy(DButton * db, int clean)
}
void
DialogDestroyButtons(Dialog * d, int clean)
DialogButtonsDestroy(Dialog * d, int clean)
{
int i;
@ -318,15 +325,14 @@ DialogDestroy(Dialog * d)
Efree(d->title);
if (d->text)
Efree(d->text);
DialogDestroyButtons(d, 0);
DialogButtonsDestroy(d, 0);
DialogKeybindingsDestroy(d);
if (d->item)
DialogItemDestroy(d->item, 0);
if (d->iclass)
ImageclassDecRefcount(d->iclass);
if (d->tclass)
TextclassDecRefcount(d->tclass);
if (d->keybindings)
Efree(d->keybindings);
FreePmapMask(&(d->pmm_bg));
EFreePixmap(d->pmap);

View File

@ -85,7 +85,8 @@ void DialogRedraw(Dialog * d);
void DialogClose(Dialog * d);
void DialogArrange(Dialog * d, int resize);
void DialogDestroyButtons(Dialog * d, int clean);
void DialogButtonsDestroy(Dialog * d, int clean);
void DialogKeybindingsDestroy(Dialog * d);
void DialogItemTableEmpty(DItem * di);
void DialogShowSimple(const DialogDef * dd, void *data);

View File

@ -211,6 +211,8 @@ MiscIpcConfig(const char *params, Client * c __UNUSED__)
DialogShowSimple(&DlgRemember, NULL);
else if (!strncmp(prm, "session", 2))
DialogShowSimple(&DlgSession, NULL);
else if (prm[0] == '\0')
SettingsConfiguration();
}
else if (!strncmp(cmd, "arrange", 3))
{

View File

@ -616,3 +616,91 @@ SettingsComposite(void)
DialogShowSimple(&DlgComposite, NULL);
}
#endif
/*
* Combined configuration dialog
*/
static const DialogDef *dialogs[] = {
&DlgFocus,
&DlgMoveResize,
&DlgPlacement,
&DlgDesks,
&DlgAreas,
&DlgPagers,
&DlgMenus,
&DlgAutoraise,
&DlgTooltips,
&DlgSound,
&DlgGroupDefaults,
&DlgRemember,
&DlgFx,
&DlgBackground,
&DlgThemeTrans,
#if USE_COMPOSITE
&DlgComposite,
#endif
&DlgSession,
&DlgMisc,
};
#define N_CFG_DLGS (sizeof(dialogs)/sizeof(DialogDef*))
static void
CB_DlgSelect(Dialog * d, int val, void *data)
{
const DialogDef *dd = dialogs[val];
DItem *table = data;
if (!table)
return;
if (!dd->fill)
return;
DialogItemTableEmpty(table);
DialogButtonsDestroy(d, 1);
DialogKeybindingsDestroy(d);
DialogSetTitle(d, _(dd->title));
DialogFill(d, table, dd, NULL);
DialogArrange(d, 1);
}
static void
_DlgFillConfiguration(Dialog * d, DItem * table, void *data __UNUSED__)
{
DItem *di, *buttons, *content;
unsigned int i;
DialogItemTableSetOptions(table, 2, 0, 0, 0);
buttons = DialogAddItem(table, DITEM_TABLE);
content = DialogAddItem(table, DITEM_TABLE);
for (i = 0; i < N_CFG_DLGS; i++)
{
di = DialogAddItem(buttons, DITEM_BUTTON);
DialogItemSetPadding(di, 2, 2, 0, 0);
DialogItemSetText(di, dialogs[i]->label);
DialogItemSetCallback(di, CB_DlgSelect, i, content);
}
DialogFill(d, content, dialogs[0], NULL);
}
static const DialogDef DlgConfiguration = {
"CONFIGURE_ALL",
NULL,
N_("Enlightenment Settings"),
"SOUND_SETTINGS_ALL",
NULL,
NULL,
_DlgFillConfiguration,
0, NULL,
};
void
SettingsConfiguration(void)
{
DialogShowSimple(&DlgConfiguration, NULL);
}

View File

@ -1,16 +1,51 @@
/*
* Copyright (C) 2006 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _SETTINGS_H_
#define _SETTINGS_H_
/* settings.c */
void SettingsConfiguration(void);
void SettingsComposite(void);
#ifdef _DIALOG_H_
extern const DialogDef DlgAreas;
extern const DialogDef DlgAutoraise;
extern const DialogDef DlgBackground;
extern const DialogDef DlgComposite;
extern const DialogDef DlgDesks;
extern const DialogDef DlgFocus;
extern const DialogDef DlgFx;
extern const DialogDef DlgGroupDefaults;
extern const DialogDef DlgMenus;
extern const DialogDef DlgMisc;
extern const DialogDef DlgMoveResize;
extern const DialogDef DlgPagers;
extern const DialogDef DlgPlacement;
extern const DialogDef DlgRemember;
extern const DialogDef DlgSession;
extern const DialogDef DlgSound;
extern const DialogDef DlgThemeTrans;
extern const DialogDef DlgTooltips;
#endif
#endif /* _SETTINGS_H_ */