def display(win, pid = None): global dialog global editing global current_profile_id global account_selector dialog = gtk.Dialog() dialog.set_title("Add new Profile") create_ui(dialog) update_local_data_source(consts.DATASOURCE_BUILTIN) dialog.connect("delete-event", lambda w, d: w.destroy()) # editing profile if pid is not None: dialog.set_title("Edit Profile") fill_form(pid) current_profile_id = pid editing = True else: if google_accounts.get_registered_accounts_count() == 0: ask_for_google_account_creation(dialog) if google_accounts.get_registered_accounts_count() == 1: # Pre-select the only Google account available: account_selector.set_active(0, 0) dialog.show_all() dialog.run()
def update_gaccts_button(): count = google_accounts.get_registered_accounts_count() text = "" if (count == 1): text = "1 account registered" else: text = "%s accounts registered" % (count) google_accts_btn.set_text("Google Accounts", text)