[banshee/youtube] [YouTube] Dispose HttpWebResponse and some streams
- From: Gabriel Burt <gburt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/youtube] [YouTube] Dispose HttpWebResponse and some streams
- Date: Fri, 5 Mar 2010 04:32:17 +0000 (UTC)
commit f054fe93ace31c715ed1ddc657f651cef991ad5c
Author: Gabriel Burt <gabriel burt gmail com>
Date: Thu Mar 4 20:07:51 2010 -0800
[YouTube] Dispose HttpWebResponse and some streams
.../Banshee.YouTube.Data/DataFetch.cs | 11 +++++++----
.../Banshee.YouTube.Gui/VideoStreamTile.cs | 17 ++++-------------
2 files changed, 11 insertions(+), 17 deletions(-)
---
diff --git a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/DataFetch.cs b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/DataFetch.cs
index 04c5f73..c554cfe 100644
--- a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/DataFetch.cs
+++ b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Data/DataFetch.cs
@@ -69,10 +69,13 @@ namespace Banshee.YouTube.Data
HttpWebRequest request = (HttpWebRequest) WebRequest.Create (url);
try {
- HttpWebResponse response = (HttpWebResponse) request.GetResponse ();
- Stream stream = response.GetResponseStream ();
- StreamReader stream_reader = new StreamReader (stream);
- contents = stream_reader.ReadToEnd ();
+ using (var response = (HttpWebResponse) request.GetResponse ()) {
+ using (var stream = response.GetResponseStream ()) {
+ using (var stream_reader = new StreamReader (stream)) {
+ contents = stream_reader.ReadToEnd ();
+ }
+ }
+ }
return contents;
} catch (Exception e) {
diff --git a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/VideoStreamTile.cs b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/VideoStreamTile.cs
old mode 100755
new mode 100644
index 9abc75a..a8a11d9
--- a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/VideoStreamTile.cs
+++ b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/VideoStreamTile.cs
@@ -71,14 +71,12 @@ namespace Banshee.YouTube.Gui
private Label secondary_label = new Label ();
private RatingEntry rating = new RatingEntry ();
- private string banshee_playback_uri;
- private string browser_playback_uri;
private string video_title;
private string video_uploader;
private string primary_text;
private string secondary_text;
- public VideoStreamTile () : base ()
+ public VideoStreamTile ()
{
hbox.BorderWidth = 2;
hbox.Spacing = 6;
@@ -117,15 +115,8 @@ namespace Banshee.YouTube.Gui
ConstructTile ();
}
- public string BansheePlaybackUri {
- get { return banshee_playback_uri; }
- set { banshee_playback_uri = value; }
- }
-
- public string BrowserPlaybackUri {
- get { return browser_playback_uri; }
- set { browser_playback_uri = value; }
- }
+ public string BansheePlaybackUri { get; set; }
+ public string BrowserPlaybackUri { get; set; }
public string Title {
get { return primary_text; }
@@ -150,7 +141,7 @@ namespace Banshee.YouTube.Gui
public Gdk.Pixbuf Pixbuf {
get { return image.Pixbuf; }
set {
- if(value == null) {
+ if (value == null) {
return;
}
diff --git a/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/YouTubeTile.cs b/src/Extensions/Banshee.YouTube/Banshee.YouTube.Gui/YouTubeTile.cs
old mode 100755
new mode 100644
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]