Index: metacity/ChangeLog
===================================================================
RCS file: /cvs/gnome/metacity/ChangeLog,v
retrieving revision 1.821.2.2
diff -u -r1.821.2.2 ChangeLog
--- metacity/ChangeLog	24 Jun 2004 20:47:53 -0000	1.821.2.2
+++ metacity/ChangeLog	20 Aug 2004 19:34:24 -0000
@@ -1,3 +1,24 @@
+2004-08-20  Federico Mena Quintero  <federico@ximian.com>
+
+	Fix the metacity part of #141472:
+
+	* src/metacity.schemas.in: Added a schema for
+	"/apps/metacity/global_keybindings/logout", with the default being
+	Ctrl-Alt-Delete.
+
+	* src/prefs.h (META_KEYBINDING_LOGOUT): New macro.
+	(MetaKeyBindingAction): Added META_KEYBINDING_ACTION_LOGOUT.
+
+	* src/prefs.c (screen_bindings): Add an item for the
+	META_KEYBINDING_LOGOUT.
+
+	* src/keybindings.c: #include "session.h"
+	(screen_handlers): Add a handler for META_KEYBINDING_LOGOUT.
+	(handle_logout): New handler; just calls meta_session_request_logout().
+
+	* src/session.c (meta_session_request_logout): New public
+	function; requests a log out from the session manager.
+
 2004-06-24  Elijah Newren  <newren@math.utah.edu>
 
 	* src/keybindings.c: (handle_toggle_desktop): Choose correct
Index: metacity/src/keybindings.c
===================================================================
RCS file: /cvs/gnome/metacity/src/keybindings.c,v
retrieving revision 1.97.2.1
diff -u -r1.97.2.1 keybindings.c
--- metacity/src/keybindings.c	24 Jun 2004 20:47:53 -0000	1.97.2.1
+++ metacity/src/keybindings.c	20 Aug 2004 19:34:24 -0000
@@ -30,6 +30,7 @@
 #include "place.h"
 #include "prefs.h"
 #include "effects.h"
+#include "session.h"
 
 #include <X11/keysym.h>
 #include <string.h>
@@ -84,6 +85,11 @@
                                        MetaWindow     *window,
                                        XEvent         *event,
                                        MetaKeyBinding *binding);
+static void handle_logout             (MetaDisplay    *display,
+                                       MetaScreen     *screen,
+                                       MetaWindow     *window,
+                                       XEvent         *event,
+                                       MetaKeyBinding *binding);
 static void handle_panel_keybinding   (MetaDisplay    *display,
                                        MetaScreen     *screen,
                                        MetaWindow     *window,
@@ -285,6 +291,8 @@
     GINT_TO_POINTER (META_TAB_LIST_DOCKS) },  
   { META_KEYBINDING_SHOW_DESKTOP, handle_toggle_desktop,
     NULL },
+  { META_KEYBINDING_LOGOUT, handle_logout,
+    NULL },
   { META_KEYBINDING_PANEL_MAIN_MENU, handle_panel_keybinding,
     GINT_TO_POINTER (META_KEYBINDING_ACTION_PANEL_MAIN_MENU) },
   { META_KEYBINDING_PANEL_RUN_DIALOG, handle_panel_keybinding,
@@ -2760,6 +2768,16 @@
     }
   else
     meta_screen_show_desktop (screen);
+}
+
+static void
+handle_logout (MetaDisplay    *display,
+	       MetaScreen     *screen,
+	       MetaWindow     *window,
+	       XEvent         *event,
+	       MetaKeyBinding *binding)
+{
+  meta_session_request_logout ();
 }
 
 static void
Index: metacity/src/metacity.schemas.in
===================================================================
RCS file: /cvs/gnome/metacity/src/metacity.schemas.in,v
retrieving revision 1.35
diff -u -r1.35 metacity.schemas.in
--- metacity/src/metacity.schemas.in	4 Jun 2004 13:55:10 -0000	1.35
+++ metacity/src/metacity.schemas.in	20 Aug 2004 19:34:25 -0000
@@ -1642,6 +1642,29 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/metacity/global_keybindings/logout</key>
+      <applyto>/apps/metacity/global_keybindings/logout</applyto>
+      <owner>metacity</owner>
+      <type>string</type>
+      <default>&lt;Control&gt;&lt;Alt&gt;Delete</default>
+      <locale name="C">
+         <short>Log out</short>
+         <long>
+          The keybinding that logs you out from the session.
+
+          The format looks like "&lt;Control&gt;&lt;Alt&gt;Delete" or
+          "&lt;Shift&gt;&lt;Alt&gt;F1.
+
+          The parser is fairly liberal and allows lower or upper case,
+          and also abbreviations such as "&lt;Ctl&gt;" and
+          "&lt;Ctrl&gt;". If you set the option to the special string
+          "disabled", then there will be no keybinding for this
+          action.
+         </long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/metacity/global_keybindings/panel_main_menu</key>
       <applyto>/apps/metacity/global_keybindings/panel_main_menu</applyto>
       <owner>metacity</owner>
Index: metacity/src/prefs.c
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.c,v
retrieving revision 1.46
diff -u -r1.46 prefs.c
--- metacity/src/prefs.c	30 Apr 2004 00:26:48 -0000	1.46
+++ metacity/src/prefs.c	20 Aug 2004 19:34:25 -0000
@@ -1421,6 +1421,7 @@
   { META_KEYBINDING_CYCLE_PANELS, 0, 0, TRUE },
   { META_KEYBINDING_CYCLE_PANELS_BACKWARD, 0, 0, TRUE },
   { META_KEYBINDING_SHOW_DESKTOP, 0, 0, FALSE },
+  { META_KEYBINDING_LOGOUT, 0, 0, FALSE },
   { META_KEYBINDING_PANEL_MAIN_MENU, 0, 0, FALSE },
   { META_KEYBINDING_PANEL_RUN_DIALOG, 0, 0, FALSE },
   { META_KEYBINDING_COMMAND_1, 0, 0, FALSE },
Index: metacity/src/prefs.h
===================================================================
RCS file: /cvs/gnome/metacity/src/prefs.h,v
retrieving revision 1.34
diff -u -r1.34 prefs.h
--- metacity/src/prefs.h	19 Feb 2004 18:36:14 -0000	1.34
+++ metacity/src/prefs.h	20 Aug 2004 19:34:25 -0000
@@ -111,6 +111,7 @@
 #define META_KEYBINDING_CYCLE_PANELS             "cycle_panels"
 #define META_KEYBINDING_CYCLE_PANELS_BACKWARD    "cycle_panels_backward"
 #define META_KEYBINDING_SHOW_DESKTOP             "show_desktop"
+#define META_KEYBINDING_LOGOUT                   "logout"
 #define META_KEYBINDING_PANEL_MAIN_MENU          "panel_main_menu"
 #define META_KEYBINDING_PANEL_RUN_DIALOG         "panel_run_dialog"
 #define META_KEYBINDING_COMMAND_1                "run_command_1"
@@ -211,6 +212,7 @@
   META_KEYBINDING_ACTION_CYCLE_PANELS,
   META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD,
   META_KEYBINDING_ACTION_SHOW_DESKTOP,
+  META_KEYBINDING_ACTION_LOGOUT,
   META_KEYBINDING_ACTION_PANEL_MAIN_MENU,
   META_KEYBINDING_ACTION_PANEL_RUN_DIALOG,
   META_KEYBINDING_ACTION_COMMAND_1,
Index: metacity/src/session.c
===================================================================
RCS file: /cvs/gnome/metacity/src/session.c,v
retrieving revision 1.34
diff -u -r1.34 session.c
--- metacity/src/session.c	25 Sep 2003 01:50:30 -0000	1.34
+++ metacity/src/session.c	20 Aug 2004 19:34:26 -0000
@@ -355,6 +355,24 @@
   g_free (saved_client_id);
 }
 
+/**
+ * meta_session_request_logout:
+ *
+ * Requests that a save_yourself be sent to the session manager so that we log
+ * out.
+ **/
+void
+meta_session_request_logout (void)
+{
+  if (!session_connection)
+    {
+      meta_warning (_("Cannot log out because we could not connect to the session manager\n"));
+      return;
+    }
+
+  SmcRequestSaveYourself (session_connection, SmSaveGlobal, TRUE, SmInteractStyleAny, FALSE, TRUE);
+}
+
 void
 meta_session_shutdown (void)
 {
Index: metacity/src/session.h
===================================================================
RCS file: /cvs/gnome/metacity/src/session.h,v
retrieving revision 1.9
diff -u -r1.9 session.h
--- metacity/src/session.h	4 Sep 2002 02:44:52 -0000	1.9
+++ metacity/src/session.h	20 Aug 2004 19:34:26 -0000
@@ -72,6 +72,7 @@
 void meta_session_init (const char *client_id,
                         const char *save_file);
 
+void meta_session_request_logout (void);
 
 void meta_session_shutdown (void);
 
