[f-spot] Fix Facebook exporting, by bringing the API up-to-date.



commit d55fcfb96ae86f612e373b19de2485c9f35fa580
Author: Ruben Vermeersch <ruben savanne be>
Date:   Sun May 23 01:15:10 2010 +0200

    Fix Facebook exporting, by bringing the API up-to-date.

 .../Exporters/FacebookExport/FacebookExport.cs     |    8 +++---
 .../FacebookExport/FacebookExportDialog.cs         |   24 ++++++++++---------
 extensions/Exporters/FacebookExport/Makefile.am    |   12 +++++++++-
 src/Utils/Log.cs                                   |    2 +-
 4 files changed, 29 insertions(+), 17 deletions(-)
---
diff --git a/extensions/Exporters/FacebookExport/FacebookExport.cs b/extensions/Exporters/FacebookExport/FacebookExport.cs
index 5113a68..b44db9f 100644
--- a/extensions/Exporters/FacebookExport/FacebookExport.cs
+++ b/extensions/Exporters/FacebookExport/FacebookExport.cs
@@ -132,10 +132,10 @@ namespace FSpot.Exporter.Facebook
 
 			Hashtable attribs = new Hashtable();
 			attribs["name"] = keyring_item_name;
-			attribs["uid"] = info.UId.ToString ();
-			attribs["session_key"] = info.SessionKey;
+			attribs["uid"] = info.uid.ToString ();
+			attribs["session_key"] = info.session_key;
 			try {
-				Ring.CreateItem (keyring, ItemType.GenericSecret, keyring_item_name, attribs, info.Secret, true);
+				Ring.CreateItem (keyring, ItemType.GenericSecret, keyring_item_name, attribs, info.secret, true);
 			} catch (KeyringException e) {
 				Log.DebugException (e);
 				return false;
@@ -247,7 +247,7 @@ namespace FSpot.Exporter.Facebook
 						continue;
 					}
 				}
-				AppendValues (String.Format ("{0} {1}", info.FirstName ?? "", info.LastName ?? ""));
+				AppendValues (String.Format ("{0} {1}", info.first_name ?? "", info.last_name ?? ""));
 			}
 		}
 
diff --git a/extensions/Exporters/FacebookExport/FacebookExportDialog.cs b/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
index 5f895bd..faf3b2f 100644
--- a/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
+++ b/extensions/Exporters/FacebookExport/FacebookExportDialog.cs
@@ -262,27 +262,29 @@ namespace FSpot.Exporter.Facebook
 							LoginProgress (0.6, Catalog.GetString ("Session established, fetching friend details..."));
 						});
 
-						User[] infos = account.Facebook.GetUserInfo (uids, new string[] { "first_name", "last_name" });
-						friends = new Dictionary<long, User> ();
-	
-						foreach (User user in infos)
-							friends.Add (user.UId, user);
-	
+						if (uids.Length > 0) {
+							User[] infos = account.Facebook.GetUserInfo (uids, new string[] { "first_name", "last_name" });
+							friends = new Dictionary<long, User> ();
+
+							foreach (User user in infos)
+								friends.Add (user.uid, user);
+						}
+
 						Gtk.Application.Invoke (delegate {
 							LoginProgress (0.8, Catalog.GetString ("Session established, fetching photo albums..."));
 						});
 						Album[] albums = account.Facebook.GetAlbums ();
 						Gtk.Application.Invoke (delegate {
-							existing_album_combobox.Model = new AlbumStore (albums);
-							existing_album_combobox.Active = 0;
-	
 							album_info_vbox.Sensitive = true;
 							picture_info_vbox.Sensitive = true;
 							permissions_hbox.Sensitive = true;
 							login_button.Visible = false;
 							logout_button.Visible = true;
 							// Note for translators: {0} and {1} are respectively firstname and surname of the user
-							LoginProgress (1.0, String.Format (Catalog.GetString ("{0} {1} is logged into Facebook"), me.FirstName, me.LastName));
+							LoginProgress (1.0, String.Format (Catalog.GetString ("{0} {1} is logged into Facebook"), me.first_name, me.last_name));
+
+							existing_album_combobox.Model = new AlbumStore (albums);
+							existing_album_combobox.Active = 0;
 						});
 					} catch (Exception e) {
 						Log.DebugException (e);
@@ -429,7 +431,7 @@ namespace FSpot.Exporter.Facebook
 			_albums = albums;
 
 			foreach (Album album in Albums) {
-				AppendValues (album.Name);
+				AppendValues (album.name);
 			}
 		}
 
diff --git a/extensions/Exporters/FacebookExport/Makefile.am b/extensions/Exporters/FacebookExport/Makefile.am
index 16786b8..3d4afcf 100644
--- a/extensions/Exporters/FacebookExport/Makefile.am
+++ b/extensions/Exporters/FacebookExport/Makefile.am
@@ -10,6 +10,7 @@ PLUGIN_SOURCES =			\
 	$(srcdir)/FacebookExport.cs			\
 	$(srcdir)/FacebookExportDialog.cs		\
 	$(srcdir)/FacebookTagPopup.cs			\
+	$(srcdir)/Mono.Facebook/facebook.cs		\
 	$(srcdir)/Mono.Facebook/Album.cs		\
 	$(srcdir)/Mono.Facebook/AssemblyInfo.cs		\
 	$(srcdir)/Mono.Facebook/Error.cs		\
@@ -25,6 +26,7 @@ PLUGIN_SOURCES =			\
 	$(srcdir)/Mono.Facebook/PeopleList.cs		\
 	$(srcdir)/Mono.Facebook/Photo.cs		\
 	$(srcdir)/Mono.Facebook/Responses.cs		\
+	$(srcdir)/Mono.Facebook/SessionInfo.cs	\
 	$(srcdir)/Mono.Facebook/SessionWrapper.cs	\
 	$(srcdir)/Mono.Facebook/Tag.cs			\
 	$(srcdir)/Mono.Facebook/User.cs			\
@@ -56,8 +58,16 @@ all: $(PLUGIN_ASSEMBLY)
 mpack: $(PLUGIN_ASSEMBLY)
 	mautil p $(PLUGIN_ASSEMBLY)
 
+update-xsd:
+	curl http://api.facebook.com/1.0/facebook.xsd > Mono.Facebook/facebook.xsd
+	xsd Mono.Facebook/facebook.xsd /classes /outputdir:Mono.Facebook/ /namespace:Mono.Facebook.Schemas
+
+validate-xsd: all
+	gmcs -debug $(REFS) $(PKGS) -out:FindNullableClashes.exe FindNullableClashes.cs
+	MONO_PATH=.:$(top_builddir)/src/ mono --debug FindNullableClashes.exe FacebookExport.dll
+
 $(PLUGIN_ASSEMBLY): $(PLUGIN_SOURCES) $(PLUGIN_MANIFEST) $(PLUGIN_NAME).ui
-	$(CSC_LIB) -out:$@ -warnaserror $(PLUGIN_SOURCES) $(REFS) $(PKGS) $(ASSEMBLIES) $(RESOURCES)
+	$(CSC_LIB) -debug -out:$@ -warnaserror $(PLUGIN_SOURCES) $(REFS) $(PKGS) $(ASSEMBLIES) $(RESOURCES)
 
 plugindir = $(pkglibdir)/extensions
 
diff --git a/src/Utils/Log.cs b/src/Utils/Log.cs
index e31ef9b..db93bcd 100644
--- a/src/Utils/Log.cs
+++ b/src/Utils/Log.cs
@@ -388,7 +388,7 @@ namespace FSpot.Utils
             }
         
             // FIXME: We should save these to an actual log file
-            Log.Warning (message ?? "Caught an exception", builder.ToString (), false);
+            Log.Warning (message ?? String.Format ("Caught an exception {0}", e.GetType ().ToString ()), builder.ToString (), false);
         }
 		
 		public static void Exception (Exception e, string format, params object [] args)



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