[postr] Display the flickr username instead of nsid if present



commit 0ee68d594e0efbadde114e28034be4762690633c
Author: David Ignacio <deignacio gmail com>
Date:   Tue Nov 10 00:22:59 2009 -0300

    Display the flickr username instead of nsid if present
    Signed-off-by: Germán Póo-Caamaño <gpoo gnome org>

 src/postr.py |   28 ++++++++++++++++------------
 1 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/postr.py b/src/postr.py
index b3fff6a..e926cef 100644
--- a/src/postr.py
+++ b/src/postr.py
@@ -942,6 +942,9 @@ class Postr(UniqueApp):
 
             if self.is_connected:
                 dest["nsid"] = self.flickr.get_nsid()
+                username = self.flickr.get_username()
+                if username:
+                    dest["username"] = username
 
             iter = self.model.get_iter_root()
             while iter:
@@ -1030,16 +1033,17 @@ class Postr(UniqueApp):
                 if self.is_connected:
                     if source.has_key("nsid"):
                         nsid = source["nsid"]
+                        username = source.get("username")
 
                         if self.flickr.get_nsid() != nsid:
+                            markup_args = (self.flickr.get_username(), username) if self.flickr.get_username() and username else (self.flickr.get_nsid(), nsid)
+                            markup_pattern = _("You are logged in as %s but loading\nan upload set for %s")
                             confirm_dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_YES_NO)
                             confirm_dialog.set_default_response(gtk.RESPONSE_YES)
-                            confirm_dialog.set_markup(
-                                "You are logged in as %s but loading\nan upload set for %s" %
-                                (self.flickr.get_nsid(), nsid))
-                            confirm_dialog.format_secondary_text("Do you want to continue "
-                                                                 "with the load?  You will "
-                                                                 "not import photoset information.")
+                            confirm_dialog.set_markup(markup_pattern % markup_args)
+                            confirm_dialog.format_secondary_text(_("Do you want to continue "
+                                                                   "with the load?  You will "
+                                                                   "not import photoset information."))
                             response = confirm_dialog.run()
                             if response == gtk.RESPONSE_NO:
                                 dialog.destroy()
@@ -1049,14 +1053,14 @@ class Postr(UniqueApp):
                             confirm_dialog.destroy()
                 else:
                     if source.has_key("nsid"):
-                        nsid = source["nsid"]
+                        source_user = source.get("username", source["nsid"])
+                        markup_pattern = _("You are not logged in but loading\nan upload set for %s")
                         confirm_dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_YES_NO)
                         confirm_dialog.set_default_response(gtk.RESPONSE_YES)
-                        confirm_dialog.set_markup(
-                            "You are not logged in but loading\nan upload set for %s" % nsid)
-                        confirm_dialog.format_secondary_text("Do you want to continue "
-                                                             "with the load?  You will "
-                                                             "not import photoset information.")
+                        confirm_dialog.set_markup(markup_pattern % source_user)
+                        confirm_dialog.format_secondary_text(_("Do you want to continue "
+                                                               "with the load?  You will "
+                                                               "not import photoset information."))
                         response = confirm_dialog.run()
                         if response == gtk.RESPONSE_NO:
                             dialog.destroy()



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