kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=5fc86cc6add02d939bc00790b763d59ee8d11729

commit 5fc86cc6add02d939bc00790b763d59ee8d11729
Author: Kim Woelders <k...@woelders.dk>
Date:   Fri Apr 25 20:20:20 2014 +0200

    Refactor dialog apply/exit handling.
    
    Split into separate functions so we don't have to check on val all over
    to figure out if it is one or the other.
    
    This also avoids that the apply stuff may be done twice on exit a couple
    of places.
---
 src/about.c       |  4 +--
 src/backgrounds.c | 53 ++++++++++++++++----------------
 src/container.c   |  7 ++---
 src/desktops.c    | 14 +++------
 src/dialog.c      | 20 ++++++------
 src/dialog.h      |  9 +++---
 src/focus.c       |  7 ++---
 src/fx.c          |  7 ++---
 src/groups.c      | 91 ++++++++++++++++++++++++++++---------------------------
 src/menus.c       |  7 ++---
 src/mod-trans.c   |  9 ++----
 src/pager.c       |  7 ++---
 src/session.c     | 14 ++++-----
 src/settings.c    | 35 +++++++--------------
 src/snaps.c       | 41 ++++++++++++-------------
 src/sound.c       | 21 ++++++-------
 src/theme.c       |  8 ++---
 src/tooltips.c    | 17 +++++------
 18 files changed, 163 insertions(+), 208 deletions(-)

diff --git a/src/about.c b/src/about.c
index fcad26f..af41f66 100644
--- a/src/about.c
+++ b/src/about.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2009 Kim Woelders
+ * Copyright (C) 2004-2014 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
@@ -64,7 +64,7 @@ static const DialogDef DlgAbout = {
    NULL,
    NULL,
    _DlgFillAbout,
-   DLG_OK | DLG_NO_SEPARATOR, DialogCallbackClose,
+   DLG_OK | DLG_NO_SEPARATOR, DialogCallbackClose, NULL
 };
 
 void
diff --git a/src/backgrounds.c b/src/backgrounds.c
index d52728e..13f04eb 100644
--- a/src/backgrounds.c
+++ b/src/backgrounds.c
@@ -1412,42 +1412,41 @@ static void         BG_RedrawView(Dialog * d);
 static void         BGSettingsGoTo(Dialog * d, Background * bg);
 
 static void
-CB_ConfigureBG(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyBG(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    BgDlgData          *dd = DLG_DATA_GET(d, BgDlgData);
 
-   if (val == 2)
-     {
-       BackgroundImagesKeep(dd->bg, 0);
-       return;
-     }
+   Conf.backgrounds.timeout = dd->bg_timeout;
+   Conf.backgrounds.hiquality = dd->hiq;
+   Conf.backgrounds.user = dd->userbg;
+   Conf.hints.set_xroot_info_on_root_window = dd->root_hint;
 
-   if (val < 2)
-     {
-       Conf.backgrounds.timeout = dd->bg_timeout;
-       Conf.backgrounds.hiquality = dd->hiq;
-       Conf.backgrounds.user = dd->userbg;
-       Conf.hints.set_xroot_info_on_root_window = dd->root_hint;
+   COLOR32_FROM_RGB(dd->bg->bg_solid, dd->bg_r, dd->bg_g, dd->bg_b);
+   dd->bg->bg_tile = dd->bg_tile;
+   dd->bg->bg.keep_aspect = dd->bg_keep_aspect;
+   dd->bg->bg.xjust = dd->bg_xjust;
+   dd->bg->bg.yjust = dd->bg_yjust;
+   dd->bg->bg.xperc = dd->bg_xperc;
+   dd->bg->bg.yperc = dd->bg_yperc;
+   if (!dd->bg_image)
+      BackgroundFilesRemove(dd->bg);
 
-       COLOR32_FROM_RGB(dd->bg->bg_solid, dd->bg_r, dd->bg_g, dd->bg_b);
-       dd->bg->bg_tile = dd->bg_tile;
-       dd->bg->bg.keep_aspect = dd->bg_keep_aspect;
-       dd->bg->bg.xjust = dd->bg_xjust;
-       dd->bg->bg.yjust = dd->bg_yjust;
-       dd->bg->bg.xperc = dd->bg_xperc;
-       dd->bg->bg.yperc = dd->bg_yperc;
-       if (!dd->bg_image)
-          BackgroundFilesRemove(dd->bg);
+   BackgroundInvalidate(dd->bg, 1);
 
-       BackgroundInvalidate(dd->bg, 1);
-
-       BackgroundCacheMini(dd->bg, 0, 1);
-       BG_RedrawView(d);
-     }
+   BackgroundCacheMini(dd->bg, 0, 1);
+   BG_RedrawView(d);
 
    autosave();
 }
 
+static void
+_DlgBGExit(Dialog * d)
+{
+   BgDlgData          *dd = DLG_DATA_GET(d, BgDlgData);
+
+   BackgroundImagesKeep(dd->bg, 0);
+}
+
 /* Draw the background preview image */
 static void
 CB_DesktopMiniDisplayRedraw(Dialog * d,
@@ -2229,7 +2228,7 @@ const DialogDef     DlgBackground = {
    "pix/bg.png",
    N_("Enlightenment Desktop\n" "Background Settings Dialog"),
    _DlgFillBackground,
-   DLG_OAC, CB_ConfigureBG,
+   DLG_OAC, _DlgApplyBG, _DlgBGExit
 };
 
 #endif /* ENABLE_DIALOGS */
diff --git a/src/container.c b/src/container.c
index d39a2bc..8497ed8 100644
--- a/src/container.c
+++ b/src/container.c
@@ -1461,14 +1461,11 @@ typedef struct {
 } ContainerDlgData;
 
 static void
-CB_ConfigureContainer(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyContainer(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    ContainerDlgData   *dd = DLG_DATA_GET(d, ContainerDlgData);
    Container          *ct;
 
-   if (val >= 2)
-      return;
-
    ct = LIST_CHECK(Container, &container_list, dd->ct);
    if (!ct)
       return;
@@ -1738,7 +1735,7 @@ static const DialogDef DlgContainer = {
    "pix/iconbox.png",
    N_("Enlightenment Iconbox\n" "Settings Dialog"),
    _DlgFillContainer,
-   DLG_OAC, CB_ConfigureContainer,
+   DLG_OAC, _DlgApplyContainer, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/desktops.c b/src/desktops.c
index 0337299..e8eb9d4 100644
--- a/src/desktops.c
+++ b/src/desktops.c
@@ -2349,13 +2349,10 @@ typedef struct {
 } DeskDlgData;
 
 static void
-CB_ConfigureDesktops(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyDesktops(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    DeskDlgData        *dd = DLG_DATA_GET(d, DeskDlgData);
 
-   if (val >= 2)
-      return;
-
    ChangeNumberOfDesktops(dd->desktops);
    Conf.desks.slidein = dd->desktop_slide;
    Conf.desks.slidespeed = dd->desktop_slide_speed;
@@ -2583,7 +2580,7 @@ const DialogDef     DlgDesks = {
    "pix/desktops.png",
    N_("Enlightenment Multiple Desktop\n" "Settings Dialog"),
    _DlgFillDesks,
-   DLG_OAC, CB_ConfigureDesktops,
+   DLG_OAC, _DlgApplyDesktops, NULL
 };
 
 typedef struct {
@@ -2598,13 +2595,10 @@ typedef struct {
 } AreaDlgData;
 
 static void
-CB_ConfigureAreas(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyAreas(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    AreaDlgData        *dd = DLG_DATA_GET(d, AreaDlgData);
 
-   if (val >= 2)
-      return;
-
    SetNewAreaSize(dd->area_x, dd->area_y);
    Conf.desks.areas_wraparound = dd->area_wraparound;
    Conf.desks.edge_flip_mode = dd->edge_flip;
@@ -2762,7 +2756,7 @@ const DialogDef     DlgAreas = {
    "pix/areas.png",
    N_("Enlightenment Virtual Desktop\n" "Settings Dialog"),
    _DlgFillAreas,
-   DLG_OAC, CB_ConfigureAreas,
+   DLG_OAC, _DlgApplyAreas, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/dialog.c b/src/dialog.c
index b46b877..dea860e 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -161,8 +161,7 @@ struct _dialog {
    TextClass          *tclass;
    ImageClass         *iclass;
    DItem              *item;
-   DialogCallbackFunc *exit_func;
-   int                 exit_val;
+   DialogExitFunc     *exit_func;
    int                 num_bindings;
    DKeyBind           *keybindings;
    void               *data;
@@ -283,17 +282,16 @@ DialogSetTitle(Dialog * d, const char *title)
 }
 
 void
-DialogSetExitFunction(Dialog * d, DialogCallbackFunc * func, int val)
+DialogSetExitFunction(Dialog * d, DialogExitFunc * func)
 {
    d->exit_func = func;
-   d->exit_val = val;
 }
 
 void
 DialogCallExitFunction(Dialog * d)
 {
    if (d->exit_func)
-      d->exit_func(d, d->exit_val, NULL);
+      d->exit_func(d);
 }
 
 void               *
@@ -514,8 +512,10 @@ DialogFill(Dialog * d, DItem * parent, const DialogDef * 
dd, void *data)
 
    dd->fill(d, content, data);
 
-   if (dd->func)
-      DialogAddFooter(d, parent, dd->flags, dd->func);
+   if (dd->func_apply)
+      DialogAddFooter(d, parent, dd->flags, dd->func_apply);
+
+   DialogSetExitFunction(d, dd->func_exit);
 }
 
 void
@@ -692,8 +692,8 @@ DialogAddFooter(Dialog * d, DItem * parent, int flags, 
DialogCallbackFunc * cb)
      }
    if (flags & 2)
      {
-       DialogItemAddButton(table, _("Apply"), cb, 1, 0, DLG_BUTTON_APPLY);
-       DialogBindKey(d, "Return", cb, 1, NULL);
+       DialogItemAddButton(table, _("Apply"), cb, 0, 0, DLG_BUTTON_APPLY);
+       DialogBindKey(d, "Return", cb, 0, NULL);
        n_buttons++;
      }
    if (flags & 4)
@@ -704,8 +704,6 @@ DialogAddFooter(Dialog * d, DItem * parent, int flags, 
DialogCallbackFunc * cb)
      }
 
    DialogItemTableSetOptions(table, n_buttons, 0, 1, 0);
-
-   DialogSetExitFunction(d, cb, 2);
 }
 
 Dialog             *
diff --git a/src/dialog.h b/src/dialog.h
index 37b87ae..2329680 100644
--- a/src/dialog.h
+++ b/src/dialog.h
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2012 Kim Woelders
+ * Copyright (C) 2004-2014 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
@@ -59,6 +59,7 @@ typedef struct _dialog Dialog;
 typedef struct _ditem DItem;
 
 typedef void        (DialogCallbackFunc) (Dialog * d, int val, void *data);
+typedef void        (DialogExitFunc) (Dialog * d);
 typedef void        (DialogItemCallbackFunc) (DItem * di, int val, void *data);
 
 typedef struct {
@@ -70,7 +71,8 @@ typedef struct {
    const char         *header_text;
    void                (*fill) (Dialog * d, DItem * table, void *data);
    int                 flags;
-   DialogCallbackFunc *func;
+   DialogCallbackFunc *func_apply;
+   DialogExitFunc     *func_exit;
 } DialogDef;
 
 /* dialog.c */
@@ -80,8 +82,7 @@ void                DialogBindKey(Dialog * d, const char *key,
                                  DialogCallbackFunc * func, int val,
                                  void *data);
 void                DialogSetTitle(Dialog * d, const char *title);
-void                DialogSetExitFunction(Dialog * d, DialogCallbackFunc * 
func,
-                                         int val);
+void                DialogSetExitFunction(Dialog * d, DialogExitFunc * func);
 void                DialogCallExitFunction(Dialog * d);
 
 void               *DialogDataSet(Dialog * d, unsigned int size);
diff --git a/src/focus.c b/src/focus.c
index de889a8..a9a744b 100644
--- a/src/focus.c
+++ b/src/focus.c
@@ -749,13 +749,10 @@ typedef struct {
 } FocusDlgData;
 
 static void
-CB_ConfigureFocus(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyFocus(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    FocusDlgData       *dd = DLG_DATA_GET(d, FocusDlgData);
 
-   if (val >= 2)
-      return;
-
    Conf.focus.mode = dd->focus.mode;
    Conf.focus.clickraises = dd->focus.clickalways;
    Conf.focus.all_new_windows_get_focus = dd->focus.new_focus;
@@ -1000,7 +997,7 @@ const DialogDef     DlgFocus = {
    "pix/focus.png",
    N_("Enlightenment Focus\n" "Settings Dialog"),
    _DlgFillFocus,
-   DLG_OAC, CB_ConfigureFocus,
+   DLG_OAC, _DlgApplyFocus, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/fx.c b/src/fx.c
index e1968c8..9a85102 100644
--- a/src/fx.c
+++ b/src/fx.c
@@ -434,11 +434,8 @@ static char         tmp_effect_ripples;
 static char         tmp_effect_waves;
 
 static void
-CB_ConfigureFX(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_DlgApplyFx(Dialog * d __UNUSED__, int val __UNUSED__, void *data __UNUSED__)
 {
-   if (val >= 2)
-      return;
-
    FX_Op(&fx_rip, tmp_effect_ripples ? FX_OP_ENABLE : FX_OP_DISABLE);
    FX_Op(&fx_wav, tmp_effect_waves ? FX_OP_ENABLE : FX_OP_DISABLE);
 
@@ -474,7 +471,7 @@ const DialogDef     DlgFx = {
    "pix/fx.png",
    N_("Enlightenment Special Effects\n" "Settings Dialog"),
    _DlgFillFx,
-   DLG_OAC, CB_ConfigureFX,
+   DLG_OAC, _DlgApplyFx, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/groups.c b/src/groups.c
index db805ef..a63e528 100644
--- a/src/groups.c
+++ b/src/groups.c
@@ -610,47 +610,44 @@ typedef struct {
 } GroupSelDlgData;
 
 static void
-ChooseGroup(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_DlgApplyGroupChoose(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    GroupSelDlgData    *dd = DLG_DATA_GET(d, GroupSelDlgData);
 
-   if (((val == 0) || (val == 2)) && dd->groups)
-     {
-       ShowHideWinGroups(dd->ewin, dd->cur_grp, SET_OFF);
-     }
+   if (!dd->groups)
+      return;
 
-   if (val == 0)
+   switch (dd->action)
      {
-       if (dd->groups)
-         {
-            switch (dd->action)
-              {
-              case GROUP_OP_ADD:
-                 AddEwinToGroup(dd->ewin, dd->groups[dd->cur_grp]);
-                 break;
-              case GROUP_OP_DEL:
-                 RemoveEwinFromGroup(dd->ewin, dd->groups[dd->cur_grp]);
-                 break;
-              case GROUP_OP_BREAK:
-                 BreakWindowGroup(dd->ewin, dd->groups[dd->cur_grp]);
-                 break;
-              default:
-                 break;
-              }
-         }
+     case GROUP_OP_ADD:
+       AddEwinToGroup(dd->ewin, dd->groups[dd->cur_grp]);
+       break;
+     case GROUP_OP_DEL:
+       RemoveEwinFromGroup(dd->ewin, dd->groups[dd->cur_grp]);
+       break;
+     case GROUP_OP_BREAK:
+       BreakWindowGroup(dd->ewin, dd->groups[dd->cur_grp]);
+       break;
+     default:
+       break;
      }
 
-   if (((val == 0) || (val == 2)) && dd->groups)
-     {
-       Efree(dd->groups);
-       dd->groups = NULL;
+   GroupsSave();
+}
 
-       GroupsSave();
-     }
+static void
+_DlgExitGroupChoose(Dialog * d)
+{
+   GroupSelDlgData    *dd = DLG_DATA_GET(d, GroupSelDlgData);
+
+   if (!dd->groups)
+      return;
+   ShowHideWinGroups(dd->ewin, dd->cur_grp, SET_OFF);
+   Efree(dd->groups);
 }
 
 static void
-GroupCallback(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+GroupCallback(Dialog * d, int val, void *data __UNUSED__)
 {
    GroupSelDlgData    *dd = DLG_DATA_GET(d, GroupSelDlgData);
 
@@ -711,7 +708,7 @@ static const DialogDef DlgGroupChoose = {
    "pix/group.png",
    N_("Enlightenment Window Group\n" "Selection Dialog"),
    _DlgFillGroupChoose,
-   DLG_OC, ChooseGroup,
+   DLG_OC, _DlgApplyGroupChoose, _DlgExitGroupChoose
 };
 
 static void
@@ -789,7 +786,7 @@ typedef struct {
 } EwinGroupDlgData;
 
 static void
-CB_ConfigureGroup(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyGroups(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    EwinGroupDlgData   *dd = DLG_DATA_GET(d, EwinGroupDlgData);
    EWin               *ewin;
@@ -800,22 +797,29 @@ CB_ConfigureGroup(Dialog * d, int val, void *data 
__UNUSED__)
    if (ewin && ewin->num_groups != dd->ngrp)
       ewin = NULL;
 
-   if (val < 2 && ewin)
+   if (ewin)
      {
        dd->cfgs[dd->cur_grp] = dd->cfg;
        for (i = 0; i < ewin->num_groups; i++)
           ewin->groups[i]->cfg = dd->cfgs[i];
      }
-   if ((val == 0) || (val == 2))
-     {
-       ShowHideWinGroups(ewin, dd->cur_grp, SET_OFF);
-       Efree(dd->cfgs);
-       dd->cfgs = NULL;
-     }
+
    autosave();
 }
 
 static void
+_DlgExitGroups(Dialog * d)
+{
+   EwinGroupDlgData   *dd = DLG_DATA_GET(d, EwinGroupDlgData);
+   EWin               *ewin;
+
+   ewin = EwinFindByPtr(dd->ewin);
+   ShowHideWinGroups(ewin, dd->cur_grp, SET_OFF);
+
+   Efree(dd->cfgs);
+}
+
+static void
 GroupSelectCallback(Dialog * d, int val, void *data __UNUSED__)
 {
    EwinGroupDlgData   *dd = DLG_DATA_GET(d, EwinGroupDlgData);
@@ -933,7 +937,7 @@ static const DialogDef DlgGroups = {
    "pix/group.png",
    N_("Enlightenment Window Group\n" "Settings Dialog"),
    _DlgFillGroups,
-   DLG_OAC, CB_ConfigureGroup,
+   DLG_OAC, _DlgApplyGroups, _DlgExitGroups
 };
 
 static void
@@ -961,13 +965,10 @@ typedef struct {
 } GroupCfgDlgData;
 
 static void
-CB_ConfigureDefaultGroupSettings(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyGroupDefaults(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    GroupCfgDlgData    *dd = DLG_DATA_GET(d, GroupCfgDlgData);
 
-   if (val >= 2)
-      return;
-
    Conf_groups.dflt = dd->group_cfg;
    Conf_groups.swapmove = dd->group_swap;
 
@@ -1054,7 +1055,7 @@ const DialogDef     DlgGroupDefaults = {
    "pix/group.png",
    N_("Enlightenment Default\n" "Group Control Settings Dialog"),
    _DlgFillGroupDefaults,
-   DLG_OAC, CB_ConfigureDefaultGroupSettings,
+   DLG_OAC, _DlgApplyGroupDefaults, NULL
 };
 
 static void
diff --git a/src/menus.c b/src/menus.c
index e69935e..6537eae 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -1941,13 +1941,10 @@ typedef struct {
 } MenudDlgData;
 
 static void
-CB_ConfigureMenus(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyMenus(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    MenudDlgData       *dd = DLG_DATA_GET(d, MenudDlgData);
 
-   if (val >= 2)
-      return;
-
    Conf.menus.warp = dd->warp;
    Conf.menus.animate = dd->animate;
    Conf.menus.onscreen = dd->onscreen;
@@ -2021,7 +2018,7 @@ const DialogDef     DlgMenus = {
    "pix/place.png",
    N_("Enlightenment Menu\n" "Settings Dialog"),
    _DlgFillMenus,
-   DLG_OAC, CB_ConfigureMenus,
+   DLG_OAC, _DlgApplyMenus, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/mod-trans.c b/src/mod-trans.c
index 2c22026..578680a 100644
--- a/src/mod-trans.c
+++ b/src/mod-trans.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2004-2007 Jaron Omega
- * Copyright (C) 2004-2011 Kim Woelders
+ * Copyright (C) 2004-2014 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
@@ -67,13 +67,10 @@ typedef struct {
 } TransDlgData;
 
 static void
-CB_ConfigureTrans(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyThemeTrans(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    TransDlgData       *dd = DLG_DATA_GET(d, TransDlgData);
 
-   if (val >= 2)
-      return;
-
    Conf.trans.border = dd->st_border;
    Conf.trans.widget = dd->st_widget;
    Conf.trans.dialog = dd->st_dialog;
@@ -266,7 +263,7 @@ const DialogDef     DlgThemeTrans = {
    "pix/tips.png",
    N_("Enlightenment Selective Transparency\n" "Settings Dialog"),
    _DlgFillThemeTrans,
-   DLG_OAC, CB_ConfigureTrans,
+   DLG_OAC, _DlgApplyThemeTrans, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/pager.c b/src/pager.c
index 5b5e738..b043c3e 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -1747,13 +1747,10 @@ typedef struct {
 } PagerDlgData;
 
 static void
-CB_ConfigurePager(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyPagers(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    PagerDlgData       *dd = DLG_DATA_GET(d, PagerDlgData);
 
-   if (val >= 2)
-      return;
-
    PagersShow(dd->show_pagers);
    if (Conf_pagers.hiq != dd->pager_hiq)
       PagerSetHiQ(dd->pager_hiq);
@@ -1974,7 +1971,7 @@ const DialogDef     DlgPagers = {
    "pix/pager.png",
    N_("Enlightenment Desktop & Area\n" "Pager Settings Dialog"),
    _DlgFillPagers,
-   DLG_OAC, CB_ConfigurePager,
+   DLG_OAC, _DlgApplyPagers, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/session.c b/src/session.c
index 0fc0575..2b32fdc 100644
--- a/src/session.c
+++ b/src/session.c
@@ -757,14 +757,12 @@ static char         tmp_logout_dialog;
 static char         tmp_reboot_halt;
 
 static void
-CB_ConfigureSession(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_DlgApplySession(Dialog * d __UNUSED__, int val __UNUSED__,
+                void *data __UNUSED__)
 {
-   if (val < 2)
-     {
-       Conf.session.enable_script = tmp_session_script;
-       Conf.session.enable_logout_dialog = tmp_logout_dialog;
-       Conf.session.enable_reboot_halt = tmp_reboot_halt;
-     }
+   Conf.session.enable_script = tmp_session_script;
+   Conf.session.enable_logout_dialog = tmp_logout_dialog;
+   Conf.session.enable_reboot_halt = tmp_reboot_halt;
    autosave();
 }
 
@@ -803,6 +801,6 @@ const DialogDef     DlgSession = {
    "pix/miscellaneous.png",
    N_("Enlightenment Session\n" "Settings Dialog"),
    _DlgFillSession,
-   DLG_OAC, CB_ConfigureSession,
+   DLG_OAC, _DlgApplySession, NULL
 };
 #endif /* ENABLE_DIALOGS */
diff --git a/src/settings.c b/src/settings.c
index 8693663..7ab20e4 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2012 Kim Woelders
+ * Copyright (C) 2004-2014 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
@@ -41,13 +41,10 @@ typedef struct {
 } MovResDlgData;
 
 static void
-CB_ConfigureMoveResize(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_DlgApplyMoveResize(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    MovResDlgData      *dd = DLG_DATA_GET(d, MovResDlgData);
 
-   if (val >= 2)
-      return;
-
    Conf.movres.mode_move = dd->move;
    Conf.movres.mode_resize = dd->resize;
    Conf.movres.mode_info = dd->geominfo;
@@ -249,7 +246,7 @@ const DialogDef     DlgMoveResize = {
    "pix/moveres.png",
    N_("Enlightenment Move & Resize\n" "Method Settings Dialog"),
    _DlgFillMoveResize,
-   DLG_OAC, CB_ConfigureMoveResize,
+   DLG_OAC, _DlgApplyMoveResize, NULL
 };
 
 typedef struct {
@@ -275,13 +272,10 @@ typedef struct {
 } PlaceDlgData;
 
 static void
-CB_ConfigurePlacement(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_DlgApplyPlacement(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    PlaceDlgData       *dd = DLG_DATA_GET(d, PlaceDlgData);
 
-   if (val >= 2)
-      return;
-
    Conf.focus.transientsfollowleader = dd->with_leader;
    Conf.focus.switchfortransientmap = dd->switch_popup;
 
@@ -494,7 +488,7 @@ const DialogDef     DlgPlacement = {
    "pix/place.png",
    N_("Enlightenment Window Placement\n" "Settings Dialog"),
    _DlgFillPlacement,
-   DLG_OAC, CB_ConfigurePlacement,
+   DLG_OAC, _DlgApplyPlacement, NULL
 };
 
 typedef struct {
@@ -506,13 +500,10 @@ typedef struct {
 } MiscDlgData;
 
 static void
-CB_ConfigureMiscellaneous(Dialog * d __UNUSED__, int val, void *data 
__UNUSED__)
+_DlgApplyMisc(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    MiscDlgData        *dd = DLG_DATA_GET(d, MiscDlgData);
 
-   if (val >= 2)
-      return;
-
    Conf.dialogs.headers = dd->dialog_headers;
    Conf.dialogs.button_image = dd->button_image;
    Conf.startup.animate = dd->animate_startup;
@@ -592,7 +583,7 @@ const DialogDef     DlgMisc = {
    "pix/miscellaneous.png",
    N_("Enlightenment Miscellaneous\n" "Settings Dialog"),
    _DlgFillMisc,
-   DLG_OAC, CB_ConfigureMiscellaneous,
+   DLG_OAC, _DlgApplyMisc, NULL
 };
 
 #if USE_COMPOSITE
@@ -603,15 +594,11 @@ const DialogDef     DlgMisc = {
  */
 
 static void
-CB_ConfigureComposite(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplyComposite(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
-   cfg_composite      *dd;
-
-   if (val >= 2)
-      return;
+   cfg_composite      *dd = DLG_DATA_GET(d, cfg_composite);
 
    /* Configure and read back */
-   dd = DLG_DATA_GET(d, cfg_composite);
    ECompMgrConfigSet(dd);
    ECompMgrConfigGet(dd);
 }
@@ -729,7 +716,7 @@ const DialogDef     DlgComposite = {
    "pix/pager.png",
    N_("Enlightenment Composite\n" "Settings Dialog"),
    _DlgFillComposite,
-   DLG_OAC, CB_ConfigureComposite,
+   DLG_OAC, _DlgApplyComposite, NULL
 };
 #endif
 
@@ -817,7 +804,7 @@ static const DialogDef DlgConfiguration = {
    NULL,
    NULL,
    _DlgFillConfiguration,
-   0, NULL,
+   0, NULL, NULL
 };
 
 void
diff --git a/src/snaps.c b/src/snaps.c
index 1f6a090..bb1fa5c 100644
--- a/src/snaps.c
+++ b/src/snaps.c
@@ -579,15 +579,12 @@ typedef struct {
 } SnapDlgData;
 
 static void
-CB_ApplySnap(Dialog * d, int val, void *data __UNUSED__)
+_DlgApplySnap(Dialog * d, int val __UNUSED__, void *data __UNUSED__)
 {
    EWin               *ewin;
    SnapDlgData        *sd = DLG_DATA_GET(d, SnapDlgData);
    unsigned int        match_flags, use_flags;
 
-   if (val >= 2)
-      goto done;
-
    ewin = EwinFindByClient(sd->client);
    if (!ewin)
       goto done;
@@ -920,7 +917,7 @@ static const DialogDef DlgSnap = {
    N_("Select the attributes of this\n"
       "window you wish to Remember\n" "from now on\n"),
    _DlgFillSnap,
-   DLG_OAC, CB_ApplySnap,
+   DLG_OAC, _DlgApplySnap, NULL
 };
 
 static void
@@ -945,28 +942,30 @@ typedef struct _remwinlist {
 static RememberWinList *rd_ewin_list;
 
 static void
-CB_ApplyRemember(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_DlgApplyRemember(Dialog * d __UNUSED__,
+                 int val __UNUSED__, void *data __UNUSED__)
 {
    int                 i;
 
-   if (val < 2 && rd_ewin_list)
+   if (!rd_ewin_list)
+      return;
+
+   for (i = 0; rd_ewin_list[i].snap; i++)
      {
-       for (i = 0; rd_ewin_list[i].snap; i++)
-         {
-            if (!rd_ewin_list[i].remove)
-               continue;
+       if (!rd_ewin_list[i].remove)
+          continue;
 
-            _SnapDestroy(rd_ewin_list[i].snap);
-         }
-       /* save snapshot info to disk */
-       SnapshotsSave();
+       _SnapDestroy(rd_ewin_list[i].snap);
      }
+   /* save snapshot info to disk */
+   SnapshotsSave();
+}
 
-   if (((val == 0) || (val == 2)) && rd_ewin_list)
-     {
-       Efree(rd_ewin_list);
-       rd_ewin_list = NULL;
-     }
+static void
+_DlgExitRemember(Dialog * d __UNUSED__)
+{
+   Efree(rd_ewin_list);
+   rd_ewin_list = NULL;
 }
 
 static void
@@ -1066,7 +1065,7 @@ const DialogDef     DlgRemember = {
    "pix/snapshots.png",
    N_("Enlightenment Remembered\n" "Windows Settings Dialog"),
    _DlgFillRemember,
-   DLG_OC, CB_ApplyRemember,
+   DLG_OC, _DlgApplyRemember, _DlgExitRemember
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/sound.c b/src/sound.c
index e464e2d..68c9927 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2013 Kim Woelders
+ * Copyright (C) 2004-2014 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
@@ -437,16 +437,15 @@ SoundSighan(int sig, void *prm __UNUSED__)
 static char         tmp_audio;
 
 static void
-CB_ConfigureAudio(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_Dlg_ApplySound(Dialog * d __UNUSED__, int val __UNUSED__,
+               void *data __UNUSED__)
 {
-   if (val < 2)
-     {
-       Conf_sound.enable = tmp_audio;
-       if (Conf_sound.enable)
-          SoundInit();
-       else
-          SoundExit();
-     }
+   Conf_sound.enable = tmp_audio;
+   if (Conf_sound.enable)
+      SoundInit();
+   else
+      SoundExit();
+
    autosave();
 }
 
@@ -473,7 +472,7 @@ const DialogDef     DlgSound = {
    "pix/sound.png",
    N_("Enlightenment Audio\n" "Settings Dialog"),
    _DlgFillSound,
-   DLG_OAC, CB_ConfigureAudio,
+   DLG_OAC, _Dlg_ApplySound, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/theme.c b/src/theme.c
index 52b9be4..2e9ab3f 100644
--- a/src/theme.c
+++ b/src/theme.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2012 Kim Woelders
+ * Copyright (C) 2004-2014 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
@@ -368,10 +368,8 @@ static char         tmp_use_theme_font;
 static char         tmp_use_alt_font;
 
 static void
-_DlgThemeConfigure(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_DlgThemeApply(Dialog * d __UNUSED__, int val __UNUSED__, void *data 
__UNUSED__)
 {
-   if (val >= 2)
-      return;
    if (Conf.theme.use_theme_font_cfg == tmp_use_theme_font &&
        Conf.theme.use_alt_font_cfg == tmp_use_alt_font)
       return;
@@ -415,7 +413,7 @@ const DialogDef     DlgTheme = {
    "pix/miscellaneous.png",
    N_("Enlightenment Theme\n" "Settings Dialog"),
    _DlgThemeFill,
-   DLG_OAC, _DlgThemeConfigure,
+   DLG_OAC, _DlgThemeApply, NULL
 };
 #endif /* ENABLE_DIALOGS */
 
diff --git a/src/tooltips.c b/src/tooltips.c
index 689f410..f8cc81f 100644
--- a/src/tooltips.c
+++ b/src/tooltips.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various 
contributors
- * Copyright (C) 2004-2013 Kim Woelders
+ * Copyright (C) 2004-2014 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
@@ -822,14 +822,13 @@ static int          tmp_tooltiptime;
 static char         tmp_roottip;
 
 static void
-CB_ConfigureTooltips(Dialog * d __UNUSED__, int val, void *data __UNUSED__)
+_DlgApplyTooltips(Dialog * d __UNUSED__, int val __UNUSED__,
+                 void *data __UNUSED__)
 {
-   if (val < 2)
-     {
-       Conf_tooltips.enable = tmp_tooltips;
-       Conf_tooltips.delay = tmp_tooltiptime * 10;
-       Conf_tooltips.showroottooltip = tmp_roottip;
-     }
+   Conf_tooltips.enable = tmp_tooltips;
+   Conf_tooltips.delay = tmp_tooltiptime * 10;
+   Conf_tooltips.showroottooltip = tmp_roottip;
+
    autosave();
 }
 
@@ -873,7 +872,7 @@ const DialogDef     DlgTooltips = {
    "pix/tips.png",
    N_("Enlightenment Tooltip\n" "Settings Dialog"),
    _DlgFillTooltips,
-   DLG_OAC, CB_ConfigureTooltips,
+   DLG_OAC, _DlgApplyTooltips, NULL
 };
 #endif /* ENABLE_DIALOGS */
 

-- 


Reply via email to