[gnome-control-center] background: Treat empty URI as NULL



commit 5517949b4e23bc7e7686bc5ce29c7e4e06267458
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 14 07:42:58 2011 +0000

    background: Treat empty URI as NULL
    
    So that comparisons are easier.

 panels/background/cc-background-item.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/panels/background/cc-background-item.c b/panels/background/cc-background-item.c
index 535abc7..b110a75 100644
--- a/panels/background/cc-background-item.c
+++ b/panels/background/cc-background-item.c
@@ -322,7 +322,10 @@ _set_uri (CcBackgroundItem *item,
 	  const char       *value)
 {
         g_free (item->priv->uri);
-        item->priv->uri = g_strdup (value);
+        if (value && *value == '\0')
+		item->priv->uri = NULL;
+	else
+		item->priv->uri = g_strdup (value);
 }
 
 const char *
@@ -819,6 +822,10 @@ files_equal (const char *a,
 	GFile *file1, *file2;
 	gboolean retval;
 
+	if (a == NULL ||
+	    b == NULL)
+		return FALSE;
+
 	file1 = g_file_new_for_commandline_arg (a);
 	file2 = g_file_new_for_commandline_arg (b);
 	if (g_file_equal (file1, file2) == FALSE)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]