Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        session.c 


Log Message:
Fix answering 'no' to logout dialog.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -3 -r1.68 -r1.69
--- session.c   7 May 2004 15:18:07 -0000       1.68
+++ session.c   31 May 2004 22:54:12 -0000      1.69
@@ -981,9 +981,11 @@
 
    SaveWindowStates();
    if (!params)
-      SaveSession(1);
-   if ((disp) && ((!params) || ((params) && strcmp((char *)params, "logout"))))
-      SetEInfoOnAll();
+     {
+       SaveSession(1);
+       if (disp)
+          SetEInfoOnAll();
+     }
 
    if (disp)
       XSelectInput(disp, VRoot.win, 0);
@@ -992,35 +994,6 @@
      {
        callback_die(sm_conn, NULL);
      }
-   else if (!strcmp(s, "logout"))
-     {
-       Dialog             *d;
-       EWin               *ewin;
-
-       if (!
-           (d =
-            FindItem("LOGOUT_DIALOG", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
-         {
-            SoundPlay("SOUND_LOGOUT");
-            d = DialogCreate("LOGOUT_DIALOG");
-            DialogSetTitle(d, _("Are you sure?"));
-            DialogSetText(d,
-                          _("\n" "\n"
-                            "    Are you sure you wish to log out ?    \n" "\n"
-                            "\n"));
-            DialogAddButton(d, _("  Yes, Log Out  "), LogoutCB, 1);
-            DialogAddButton(d, _("  No  "), NULL, 1);
-            DialogBindKey(d, "Escape", CB_SettingsEscape, 1, d);
-            DialogBindKey(d, "Return", LogoutCB, 0, d);
-         }
-       ShowDialog(d);
-       ewin = FindEwinByDialog(d);
-       if (ewin)
-         {
-            ArrangeEwinCentered(ewin, 1);
-         }
-       return;
-     }
    else if (!strcmp(s, "restart_wm"))
      {
        SoundPlay("SOUND_WAIT");
@@ -1128,9 +1101,11 @@
    Window              w;
 
    if (!params)
-      SaveSession(1);
-   if ((disp) && ((!params) || ((params) && strcmp((char *)params, "logout"))))
-      SetEInfoOnAll();
+     {
+       SaveSession(1);
+       if (disp)
+          SetEInfoOnAll();
+     }
 
    if (params)
      {
@@ -1190,36 +1165,6 @@
             execl(DEFAULT_SH_PATH, DEFAULT_SH_PATH, "-c", "exec", real_exec,
                   NULL);
          }
-       else if (!strcmp(s, "logout"))
-         {
-            Dialog             *d;
-            EWin               *ewin;
-
-            if (!
-                (d =
-                 FindItem("LOGOUT_DIALOG", 0, LIST_FINDBY_NAME,
-                          LIST_TYPE_DIALOG)))
-              {
-                 SoundPlay("SOUND_LOGOUT");
-                 d = DialogCreate("LOGOUT_DIALOG");
-                 DialogSetTitle(d, "Are you sure?");
-                 DialogSetText(d,
-                               "\n" "\n"
-                               "    Are you sure you wish to log out ?    \n"
-                               "\n" "\n");
-                 DialogAddButton(d, "  Yes, Log Out  ", LogoutCB, 1);
-                 DialogAddButton(d, "  No  ", NULL, 1);
-                 DialogBindKey(d, "Escape", CB_SettingsEscape, 0, d);
-                 DialogBindKey(d, "Return", LogoutCB, 0, d);
-              }
-            ShowDialog(d);
-            ewin = FindEwinByDialog(d);
-            if (ewin)
-              {
-                 ArrangeEwinCentered(ewin, 1);
-              }
-            return;
-         }
      }
 
    SoundPlay("SOUND_EXIT");
@@ -1228,9 +1173,44 @@
 
 #endif /* HAVE_X11_SM_SMLIB_H */
 
+static void
+SessionLogoutConfirm(void)
+{
+   Dialog             *d;
+   EWin               *ewin;
+
+   d = FindItem("LOGOUT_DIALOG", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG);
+   if (!d)
+     {
+       SoundPlay("SOUND_LOGOUT");
+       d = DialogCreate("LOGOUT_DIALOG");
+       DialogSetTitle(d, _("Are you sure?"));
+       DialogSetText(d, _("\n\n"
+                          "    Are you sure you wish to log out ?    \n"
+                          "\n\n"));
+       DialogAddButton(d, _("  Yes, Log Out  "), LogoutCB, 1);
+       DialogAddButton(d, _("  No  "), NULL, 1);
+       DialogBindKey(d, "Escape", CB_SettingsEscape, 1, d);
+       DialogBindKey(d, "Return", LogoutCB, 0, d);
+     }
+
+   ShowDialog(d);
+
+   ewin = FindEwinByDialog(d);
+   if (ewin)
+      ArrangeEwinCentered(ewin, 1);
+   return;
+}
+
 int
 SessionExit(const void *param)
 {
+   if (param && !strcmp(param, "logout"))
+     {
+       SessionLogoutConfirm();
+       return 0;
+     }
+
    if (Mode.wm.exiting++)
      {
        /* This may be possible during nested signal handling */




-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. 
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to