[Xfce4-commits] <libxfce4ui:new-sm-client> don't allow NULL current-directory

Brian J. Tarricone brian at tarricone.org
Thu Sep 17 14:28:01 CEST 2009


Updating branch refs/heads/kelnos/new-sm-client
         to 901fb8de6fc98b2c6c9794e9b73e26a6e41259a5 (commit)
       from bebe30bdf8f1bccd66dc0628ca05b73827559d74 (commit)

commit 901fb8de6fc98b2c6c9794e9b73e26a6e41259a5
Author: Brian J. Tarricone <brian at tarricone.org>
Date:   Thu Sep 17 05:28:28 2009 -0700

    don't allow NULL current-directory

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

diff --git a/libxfce4ui/xfce-sm-client.c b/libxfce4ui/xfce-sm-client.c
index 9c8bd9b..4500253 100644
--- a/libxfce4ui/xfce-sm-client.c
+++ b/libxfce4ui/xfce-sm-client.c
@@ -442,8 +442,8 @@ xfce_sm_client_class_init(XfceSMClientClass *klass)
 static void
 xfce_sm_client_init(XfceSMClient *sm_client)
 {
-    sm_client->state = XFCE_SM_CLIENT_STATE_DISCONNECTED;
     sm_client->program = g_get_prgname() ? g_strdup(g_get_prgname()) : g_strdup("<unknown program>");
+    sm_client->current_directory = g_strdup(xfce_get_homedir());
 }
 
 static void
@@ -748,8 +748,8 @@ xfce_sm_client_set_state(XfceSMClient *sm_client,
 
     sm_client->state = new_state;
 
-    g_debug("XfceSMClient: state change: %s -> %s",
-            str_from_state(old_state), str_from_state(new_state));
+    DBG("state change: %s -> %s", str_from_state(old_state),
+        str_from_state(new_state));
 }
 
 static inline char
@@ -1646,10 +1646,7 @@ xfce_sm_client_connect(XfceSMClient *sm_client,
     prop5.type = SmARRAY8;
     prop5.num_vals = 1;
     prop5.vals = &prop5val;
-    if(sm_client->current_directory)
-        prop5val.value = (char *)sm_client->current_directory;
-    else
-        prop5val.value = (char *)xfce_get_homedir();
+    prop5val.value = (char *)sm_client->current_directory;
     prop5val.length = strlen(prop5val.value);
     n_props++;
 
@@ -1977,13 +1974,11 @@ xfce_sm_client_set_current_directory(XfceSMClient *sm_client,
                                      const gchar *current_directory)
 {
     g_return_if_fail(XFCE_IS_SM_CLIENT(sm_client));
+    g_return_if_fail(current_directory && current_directory[0]);
 
     if(!xfce_safe_strcmp(sm_client->current_directory, current_directory))
         return;
 
-    if(!current_directory)
-        current_directory = xfce_get_homedir();
-
     g_free(sm_client->current_directory);
     sm_client->current_directory = g_strdup(current_directory);
 



More information about the Xfce4-commits mailing list