nemo r91 - in trunk: dbus gtk uicommon



Author: arj
Date: Thu Feb 21 16:55:30 2008
New Revision: 91
URL: http://svn.gnome.org/viewvc/nemo?rev=91&view=rev

Log:
Better string comparison

Thanks to the Smokey tool



Modified:
   trunk/dbus/Protocol.cs
   trunk/gtk/CalendarDrawer.cs
   trunk/gtk/DisplayItem.cs
   trunk/gtk/FixedResizeWidget.cs
   trunk/gtk/Label.cs
   trunk/gtk/MainWindow.cs
   trunk/gtk/OverlayTracker.cs
   trunk/gtk/SearchPopup.cs
   trunk/uicommon/DocumentItem.cs

Modified: trunk/dbus/Protocol.cs
==============================================================================
--- trunk/dbus/Protocol.cs	(original)
+++ trunk/dbus/Protocol.cs	Thu Feb 21 16:55:30 2008
@@ -173,7 +173,7 @@
 					return null;
 
 				string par = Value.Substring (0, Value.LastIndexOf ('/'));
-				if (par == String.Empty)
+				if (String.IsNullOrEmpty(par))
 					par = "/";
 
 				return new ObjectPath (par);

Modified: trunk/gtk/CalendarDrawer.cs
==============================================================================
--- trunk/gtk/CalendarDrawer.cs	(original)
+++ trunk/gtk/CalendarDrawer.cs	Thu Feb 21 16:55:30 2008
@@ -257,7 +257,7 @@
 				b.set_item(file);
 				b.Label += file.name(30);
 				string image = item.image();
-				if (image != "")
+				if (!String.IsNullOrEmpty(image))
 					b.Image = new Gtk.Image(null, image);
 				b.BorderWidth = 0;
 				b.Relief = Gtk.ReliefStyle.None;

Modified: trunk/gtk/DisplayItem.cs
==============================================================================
--- trunk/gtk/DisplayItem.cs	(original)
+++ trunk/gtk/DisplayItem.cs	Thu Feb 21 16:55:30 2008
@@ -115,7 +115,7 @@
 			box.PackStart(picture_alignment, true, true, 3);
 
 			string image = Singleton<Types>.Instance.get_type((int)item.file.type.category).icon;
-			if (image != "") 
+			if (!String.IsNullOrEmpty(image)) 
 			{
 				Gtk.HBox tmp = new Gtk.HBox();
 

Modified: trunk/gtk/FixedResizeWidget.cs
==============================================================================
--- trunk/gtk/FixedResizeWidget.cs	(original)
+++ trunk/gtk/FixedResizeWidget.cs	Thu Feb 21 16:55:30 2008
@@ -43,7 +43,7 @@
 
 			// FIXME: call it icon, if it's an icon
 			string image = Singleton<Types>.Instance.get_type((int)item.file.type.category).icon;
-			if (image != "") 
+			if (!String.IsNullOrEmpty(image)) 
 			{
 				Gtk.HBox tmp = new Gtk.HBox();
 
@@ -134,8 +134,8 @@
 
 			last_allocation = allocation;
 
-			foreach (Widget i in Children) 
-				i.Destroy();
+			foreach (Widget w in Children)
+				w.Destroy();
 
 			List<FileLayout.Element> percent = new List<FileLayout.Element>();
 		
@@ -305,7 +305,7 @@
 				set_position();
 
 				if (window != null) {
-					window.Destroy();
+					window.Destroy(); 
 					window = null;
 					show();
 				}
@@ -333,7 +333,7 @@
 					Gtk.EventBox image_wrapper = new EventBox();
 					Gtk.Image close_image = new Gtk.Image(null, "close.png");
 					image_wrapper.Add(close_image);
-					if (name == "")
+					if (String.IsNullOrEmpty(name))
 						throw new Exception("name for an overlay cannot be empty");
 					image_wrapper.ButtonPressEvent += delegate { 
 						Singleton<OverlayTracker>.Instance.hide_and_die(name); 

Modified: trunk/gtk/Label.cs
==============================================================================
--- trunk/gtk/Label.cs	(original)
+++ trunk/gtk/Label.cs	Thu Feb 21 16:55:30 2008
@@ -46,7 +46,7 @@
 			b = new ToggleButton(spacing + type.name);
 
 			b.Toggled += delegate(object sender, System.EventArgs e) { label_class.restrict_and_update(type.id); };
-			if (type.icon != "")
+			if (!String.IsNullOrEmpty(type.icon))
 				b.Image = new Gtk.Image(null, type.icon);
 			else
 				b.Image = CairoDrawing.create_empty_image(16, 16);

Modified: trunk/gtk/MainWindow.cs
==============================================================================
--- trunk/gtk/MainWindow.cs	(original)
+++ trunk/gtk/MainWindow.cs	Thu Feb 21 16:55:30 2008
@@ -203,7 +203,7 @@
 
     protected void do_search_text(bool quick_search)
     {
-    	if (search_input.Text == "" || search_input.Text == null)
+    	if (String.IsNullOrEmpty(search_input.Text))
     	{
 			Singleton<OverlayTracker>.Instance.hide_and_die("search_popup");
     		search_result_valid = false;
@@ -371,8 +371,8 @@
 
 	void update_type_labels(List<TypeLabel> labels)
 	{
-		foreach (Widget i in type_labels.Children) 
-			i.Destroy();
+		foreach (Widget w in type_labels.Children) 
+			w.Destroy(); 
 
 		foreach (TypeLabel label in labels) 
 		{

Modified: trunk/gtk/OverlayTracker.cs
==============================================================================
--- trunk/gtk/OverlayTracker.cs	(original)
+++ trunk/gtk/OverlayTracker.cs	Thu Feb 21 16:55:30 2008
@@ -25,7 +25,7 @@
 		// the function used to add make overlaytracker handle the overlay
 		public void add_overlay_and_show(Overlay overlay)
 		{
-			if (overlay.name == "")
+			if (String.IsNullOrEmpty(overlay.name))
 				throw new Exception("name for an overlay cannot be empty");
 		
 			hide_and_die(overlay.name);

Modified: trunk/gtk/SearchPopup.cs
==============================================================================
--- trunk/gtk/SearchPopup.cs	(original)
+++ trunk/gtk/SearchPopup.cs	Thu Feb 21 16:55:30 2008
@@ -168,7 +168,7 @@
 			Gtk.Image close_image = new Gtk.Image(null, "close.png");
 			image_wrapper.Add(close_image);
 
-			if (name == "")
+			if (String.IsNullOrEmpty(name))
 				throw new Exception("name for an overlay cannot be empty");
 
 			image_wrapper.ButtonPressEvent += delegate { 
@@ -273,7 +273,7 @@
 
 				if (doc_item != null) {
 					doc_item.on_snippet_callback = delegate (string snippet) {
-						if (snippet.Length != 0 && snippet != "") {
+						if (!String.IsNullOrEmpty(snippet)) {
 
 							System.Console.WriteLine("got snippet: {0}", snippet);
 
@@ -286,7 +286,7 @@
 							update();
 						}
 					};
-					if (doc_item.snippet != "")
+					if (!String.IsNullOrEmpty(doc_item.snippet))
 						doc_item.on_snippet_callback(doc_item.snippet);
 				}
 			} catch (Exception) { // not document item
@@ -331,7 +331,7 @@
 
 			Gtk.Alignment img_alignment = new Gtk.Alignment(0, (float)0.05, 0,0);
 
-			if (image != "") 
+			if (!String.IsNullOrEmpty(image)) 
 			{
 				Gtk.Image img;
 				

Modified: trunk/uicommon/DocumentItem.cs
==============================================================================
--- trunk/uicommon/DocumentItem.cs	(original)
+++ trunk/uicommon/DocumentItem.cs	Thu Feb 21 16:55:30 2008
@@ -66,7 +66,7 @@
         
 		protected void populate(string search_text)
 		{
-			if (search_text != "") {
+			if (!String.IsNullOrEmpty(search_text)) {
 				this.search_text = search_text;
 				Singleton<SingletonWrapper<Broker>>.Instance.wrapped.search_snippet(path, search_text, 
 														  							Helpers.RunInMainThread<string>(on_snippet_result));
@@ -122,7 +122,7 @@
 				
 			if (on_snippet_callback != null) {
 				string small_formatted_text = format_snippet_text(text_snippet, 60);
-				if (small_formatted_text != null && small_formatted_text != "")
+				if (!String.IsNullOrEmpty(small_formatted_text))
 					on_snippet_callback(small_formatted_text);
 			}
         }



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