[Xfce4-commits] <libxfce4ui:new-sm-client> improve warning output

Brian J. Tarricone brian at tarricone.org
Tue Sep 15 12:42:03 CEST 2009


Updating branch refs/heads/kelnos/new-sm-client
         to 91a408b925b1150da008ecf61ee2e2b07dbf3f3a (commit)
       from 42506c6e8f56bc60b10f6c8f785b9b021904603a (commit)

commit 91a408b925b1150da008ecf61ee2e2b07dbf3f3a
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Tue Sep 15 03:41:32 2009 -0700

    improve warning output

 libxfce4ui/xfce-sm-client.c |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/libxfce4ui/xfce-sm-client.c b/libxfce4ui/xfce-sm-client.c
index d0ca320..10a8f69 100644
--- a/libxfce4ui/xfce-sm-client.c
+++ b/libxfce4ui/xfce-sm-client.c
@@ -736,9 +736,6 @@ xfce_sm_client_set_state(XfceSMClient *sm_client,
     if(G_UNLIKELY(old_state == new_state))
         return;
 
-    g_debug("XfceSMClient: %s -> %s", str_from_state(old_state),
-            str_from_state(new_state));
-
     sm_client->state = new_state;
 
     g_signal_emit(G_OBJECT(sm_client), signals[SIG_STATE_CHANGED], 0,
@@ -934,6 +931,14 @@ xsmp_save_phase_2(SmcConn smc_conn,
      * phase 2.  In our SM client's terminolgy, we support save-state
      * but not quit-requested for phase 2. */
 
+    if(sm_client->state == XFCE_SM_CLIENT_STATE_WAITING_FOR_PHASE_2) {
+        g_warning("Got SaveYourselfPhase2 in state %s, ignoring",
+                  str_from_state(sm_client->state));
+        SmcSaveYourselfDone(sm_client->session_connection, True);
+        xfce_sm_client_set_state(sm_client, XFCE_SM_CLIENT_STATE_FROZEN);
+        return;
+    }
+
     xfce_sm_client_set_state(sm_client, XFCE_SM_CLIENT_STATE_SAVING_PHASE_2);
 
     g_signal_emit(G_OBJECT(sm_client), signals[SIG_SAVE_STATE_EXTENDED], 0, NULL);
@@ -995,7 +1000,7 @@ xsmp_save_yourself(SmcConn smc_conn,
     }
 
     if(sm_client->state != XFCE_SM_CLIENT_STATE_IDLE) {
-        g_warning("Got SaveYourself while in phase %s, ignoring",
+        g_warning("Got SaveYourself while in state %s, ignoring",
                   str_from_state(sm_client->state));
         SmcSaveYourselfDone(sm_client->session_connection, True);
         xfce_sm_client_set_state(sm_client, XFCE_SM_CLIENT_STATE_FROZEN);
@@ -1075,8 +1080,10 @@ xsmp_save_complete(SmcConn smc_conn,
 
     TRACE("entering");
 
-    if(sm_client->state != XFCE_SM_CLIENT_STATE_FROZEN)
-        g_warning("Got SaveComplete in unexpected state");
+    if(sm_client->state != XFCE_SM_CLIENT_STATE_FROZEN) {
+        g_warning("Got SaveComplete in state %s, ignoring",
+                  str_from_state(sm_client->state));
+    }
 
     xfce_sm_client_set_state(sm_client, XFCE_SM_CLIENT_STATE_IDLE);
 }
@@ -1122,7 +1129,8 @@ xsmp_shutdown_cancelled(SmcConn smc_conn,
             break;
 
         default:
-            g_warning("got ShutdownCancelled while in unexpected state");
+            g_warning("Got ShutdownCancelled in state %s, ignoring",
+                      str_from_state(sm_client->state));
             xfce_sm_client_set_state(sm_client, XFCE_SM_CLIENT_STATE_IDLE);
             break;
     }
@@ -1142,9 +1150,8 @@ xsmp_interact(SmcConn smc_conn,
      * yourself. */
 
     if(sm_client->state != XFCE_SM_CLIENT_STATE_WAITING_FOR_INTERACT) {
-        g_warning("Got Interact message when not waiting for one");
-        /* FIXME: not sure if this is the best response to this.  we might
-         * want to actually go through with sending quit-requested etc. */
+        g_warning("Got Interact message in state %s, ignoring",
+                  str_from_state(sm_client->state));
         SmcInteractDone(sm_client->session_connection, False);
         SmcSaveYourselfDone(sm_client->session_connection, True);
         xfce_sm_client_set_state(sm_client, XFCE_SM_CLIENT_STATE_FROZEN);



More information about the Xfce4-commits mailing list