public void HandleLoginClicked(object sender, EventArgs args)
        {
            account = new FacebookAccount();

            Uri token = account.CreateToken();

            GnomeUtil.UrlShow(token.ToString());

            HigMessageDialog mbox = new HigMessageDialog(Dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Catalog.GetString("Waiting for authentication"), Catalog.GetString("F-Spot will now launch your browser so that you can log into Facebook.  Turn on the \"Save my login information\" checkbox on Facebook and F-Spot will log into Facebook automatically from now on."));

            mbox.Run();
            mbox.Destroy();

            if (account.Authenticated == false)
            {
                HigMessageDialog error = new HigMessageDialog(Dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString("Error logging into Facebook"), Catalog.GetString("There was a problem logging into Facebook.  Check your credentials and try again."));
                error.Run();
                error.Destroy();
            }
            else
            {
                login_button.Visible  = false;
                logout_button.Visible = true;

                album_info_vbox.Sensitive   = true;
                picture_info_vbox.Sensitive = true;

                User me = account.Facebook.GetLoggedInUser().GetUserInfo();
                // Note for translators: {0} and {1} are respectively firstname and surname of the user
                whoami_label.Text = String.Format(Catalog.GetString("{0} {1} is logged into Facebook"), me.FirstName, me.LastName);

                Friend[] friend_list = account.Facebook.GetFriends();
                long[]   uids        = new long [friend_list.Length];

                for (int i = 0; i < friend_list.Length; i++)
                {
                    uids [i] = friend_list [i].UId;
                }

                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);
                }

                Album[]    albums = account.Facebook.GetAlbums();
                AlbumStore store  = new AlbumStore(albums);
                existing_album_combobox.Model  = store;
                existing_album_combobox.Active = 0;
            }
        }
		public void HandleLoginClicked (object sender, EventArgs args)
		{
			account = new FacebookAccount();

			Uri token = account.CreateToken ();
			GnomeUtil.UrlShow (token.ToString ());

			HigMessageDialog mbox = new HigMessageDialog (Dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Catalog.GetString ("Waiting for authentication"), Catalog.GetString ("F-Spot will now launch your browser so that you can log into Facebook.  Turn on the \"Save my login information\" checkbox on Facebook and F-Spot will log into Facebook automatically from now on."));

			mbox.Run ();
			mbox.Destroy ();

			if (account.Authenticated == false) {
				HigMessageDialog error = new HigMessageDialog (Dialog, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal, Gtk.MessageType.Error, Gtk.ButtonsType.Ok, Catalog.GetString ("Error logging into Facebook"), Catalog.GetString ("There was a problem logging into Facebook.  Check your credentials and try again."));
				error.Run ();
				error.Destroy ();
			}
			else {
				login_button.Visible = false;
				logout_button.Visible = true;

				album_info_vbox.Sensitive = true;
				picture_info_vbox.Sensitive = true;

				User me = account.Facebook.GetLoggedInUser ().GetUserInfo ();
				// Note for translators: {0} and {1} are respectively firstname and surname of the user 
				whoami_label.Text = String.Format (Catalog.GetString ("{0} {1} is logged into Facebook"), me.FirstName, me.LastName);

				Friend[] friend_list = account.Facebook.GetFriends ();
				long[] uids = new long [friend_list.Length];

				for (int i = 0; i < friend_list.Length; i++)
					uids [i] = friend_list [i].UId;

				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);

				Album[] albums = account.Facebook.GetAlbums ();
				AlbumStore store = new AlbumStore (albums);
				existing_album_combobox.Model = store;
				existing_album_combobox.Active = 0;
			}
		}
Example #3
0
        public FacebookExportDialog(IBrowsableCollection selection)
            : base(Assembly.GetExecutingAssembly (), "FacebookExport.ui", "facebook_export_dialog")
        {
            // Sort selection by date ascending
            items = selection.Items;
            Array.Sort (items, new DateComparer ());
            current_item = -1;

            captions = new string [selection.Items.Length];
            tags = new List<Mono.Facebook.Tag> [selection.Items.Length];

            thumbnail_iconview = new FSpot.Widgets.IconView (selection);
            thumbnail_iconview.DisplayDates = false;
            thumbnail_iconview.DisplayTags = false;
            thumbnail_iconview.DisplayRatings = false;
            thumbnail_iconview.ButtonPressEvent += HandleThumbnailIconViewButtonPressEvent;
            thumbnail_iconview.KeyPressEvent += delegate (object sender, KeyPressEventArgs e) {(sender as FSpot.Widgets.IconView).Selection.Clear(); };
            thumbnails_scrolled_window.Add (thumbnail_iconview);
            thumbnail_iconview.Show ();

            login_button.Clicked += HandleLoginClicked;
            logout_button.Clicked += HandleLogoutClicked;
            offline_perm_check.Toggled += HandlePermissionToggled;
            photo_perm_check.Toggled += HandlePermissionToggled;

            create_album_radiobutton.Toggled += HandleCreateAlbumToggled;
            create_album_radiobutton.Active = true;

            existing_album_radiobutton.Toggled += HandleExistingAlbumToggled;

            CellRendererText cell = new CellRendererText ();
            existing_album_combobox.PackStart (cell, true);
            existing_album_combobox.SetAttributes (cell, "text", 0);

            tag_image_eventbox.ButtonPressEvent += HandleTagImageButtonPressEvent;

            tag_treeview.Sensitive = false;
            caption_textview.Sensitive = false;

            DoLogout ();

            account = new FacebookAccount();
            if (account.Authenticated)
                DoLogin ();
        }