def on_polkit_action(self, widget, action):
        if action:
            self.sync_button.set_sensitive(True)

            if proxy.get_proxy():
                #                if os.getenv('LANG').startswith('zh_CN'):
                #                    self.sourceview.setup_ubuntu_cn_mirror()
                self.sourceview.set_sensitive(True)
                self.expander.set_sensitive(True)

                if not CONFIG.get_value_from_key(WARNING_KEY):
                    dialog = WarningDialog(
                        _(
                            "It is a possible security risk to "
                            "use packages from Third-Party Sources.\n"
                            "Please be careful and use only sources you trust."
                        ),
                        buttons=gtk.BUTTONS_OK,
                        title=_("Warning"),
                    )
                    checkbutton = GconfCheckButton(_("Never show this dialog"), WARNING_KEY)
                    dialog.add_option(checkbutton)

                    dialog.run()
                    dialog.destroy()
            else:
                ServerErrorDialog().launch()
        else:
            AuthenticateFailDialog().launch()
Beispiel #2
0
    def notify_stable_source(self):
        log.debug("Stable Source Warning is %s", CONFIG.get_value_from_key(WARNING_KEY))
        log.debug("The Stable Source enabling is %s", proxy.get_stable_source_enabled())
        if proxy.get_object() and not CONFIG.get_value_from_key(WARNING_KEY) and not proxy.get_stable_source_enabled():
            dialog = WarningDialog(_('It is highly recommended that you enable the Ubuntu Tweak stable repository to get security and maintenance updates.\n'
                'If you don\'t enable this repository, you will need to update manually.\n\n'
                'Would you like to enable this repository?'),
                                   title=_('Warning'))
            checkbutton = GconfCheckButton(_('Never show this dialog'), WARNING_KEY)
            dialog.add_option(checkbutton)

            response = dialog.run()
            dialog.destroy()

            if response == gtk.RESPONSE_YES:
                log.debug("Start enable the source")
                proxy.enable_stable_source()
                log.debug("Finish enable the source, now it's %s", proxy.get_stable_source_enabled())