示例#1
0
    def delete_selected_sites(self, selection):
        """
        Display delete dialog for each selected site id
        """
        for name, domain in selection:
            conf_name = "%s.%s" % (name, domain)

            # TODO: create a dedicated pac agent
            dialog = gtk.MessageDialog(
                self.get_presentation_agent().get_toplevel(),
                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO,
                "Are you sure you want to delete configuraiton '%s' ?" % conf_name)

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

            if response == gtk.RESPONSE_YES:
                command = DeleteSite(name, domain)
                command.get_event_bus().subscribe(CommandExecEvent,
                                                  self.cb_reload_sites)
                command.get_event_bus().subscribe(
                    CommandExecEvent,
                    self._logs_control_agent.command_evt_callback)
                enqueue_command(command)
                print "deleted site id %s" % conf_name